]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/DBobView.h
Merge branch 'fix-fast' into 'master'
[xonotic/netradiant.git] / contrib / bobtoolz / DBobView.h
1 /*
2    BobToolz plugin for GtkRadiant
3    Copyright (C) 2001 Gordon Biggans
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 // DBobView.h: interface for the DBobView class.
21 //
22 //////////////////////////////////////////////////////////////////////
23
24 #if !defined( AFX_BOBVIEW_H__6E36062A_EF0B_11D4_ACF7_004095A18133__INCLUDED_ )
25 #define AFX_BOBVIEW_H__6E36062A_EF0B_11D4_ACF7_004095A18133__INCLUDED_
26
27 #include "ientity.h"
28 #include "irender.h"
29 #include "renderable.h"
30 #include "mathlib.h"
31
32 class DListener;
33
34 class Shader;
35
36 const int BOUNDS_ALL = 0;
37 const int BOUNDS_APEX = 1;
38
39 #if _MSC_VER > 1000
40 #pragma once
41 #endif // _MSC_VER > 1000
42
43 class DBobView : public Renderable, public OpenGLRenderable, public Entity::Observer {
44     Shader *m_shader_line;
45     Shader *m_shader_box;
46 public:
47     DBobView();
48
49     virtual ~DBobView();
50
51 protected:
52     vec3_t *path;
53 public:
54     bool m_bShowExtra;
55     int boundingShow;
56     DListener *eyes;
57     float fVarGravity;
58     float fMultiplier;
59     int nPathCount;
60
61     Entity *trigger;
62     Entity *target;
63
64     bool UpdatePath();
65
66     char entTarget[256];
67     char entTrigger[256];
68
69     void Begin(const char *, const char *, float, int, float, bool, bool);
70
71     bool CalculateTrajectory(vec3_t, vec3_t, float, int, float);
72
73     void SetPath(vec3_t *pPath);
74
75     void render(RenderStateFlags state) const;
76
77     void renderSolid(Renderer &renderer, const VolumeTest &volume) const;
78
79     void renderWireframe(Renderer &renderer, const VolumeTest &volume) const;
80
81     void constructShaders();
82
83     void destroyShaders();
84
85     void valueChanged(const char *value)
86     {
87         UpdatePath();
88     }
89
90     typedef MemberCaller<DBobView, void(const char *), &DBobView::valueChanged> ValueChangedCaller;
91
92     void insert(const char *key, EntityKeyValue &value)
93     {
94         value.attach(ValueChangedCaller(*this));
95     }
96
97     void erase(const char *key, EntityKeyValue &value)
98     {
99         value.detach(ValueChangedCaller(*this));
100     }
101
102     void clear()
103     {
104         if (trigger != 0) {
105             trigger->detach(*this);
106             target->detach(*this);
107             trigger = 0;
108             target = 0;
109         }
110     }
111 };
112
113 class Entity;
114
115 void
116 DBobView_setEntity(Entity &entity, float multiplier, int points, float varGravity, bool bNoUpdate, bool bShowExtra);
117
118 #endif // !defined(AFX_BOBVIEW_H__6E36062A_EF0B_11D4_ACF7_004095A18133__INCLUDED_)