DI-Guy SDK Documentation  13.1
diguyGraphicsState.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************/
14 #ifndef __diguyGraphicsState_H
15 #define __diguyGraphicsState_H
16 
17 #ifdef SWIG
18 %module diguyGraphicsState
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 #include <diguy_constants.h>
25 #include <declspec_diguy.h>
26 
27 // needed for diguyTextureMapType
28 #include <diguyGraphicsTexture.h>
29 
30 class bdiGeometryGeosetState;
31 class diguyGraphicsState;
34 
35 
36 #endif
37 
38 /****************************************************************************/
39 class BDI_DECLSPEC_diguy diguyGraphicsState
40 {
41 
42 public:
43 
44 /*****************************************************************************/
57  /*l
58  *b Description:
59  **
60  ** This function returns the material of this state. Specific
61  ** information about the material can then be accessed from
62  ** the returned object.
63  **
64  *b Returns:
65  **
66  ** object of type diguyGraphicsMaterial; NULL on failure
67  */
68  diguyGraphicsMaterial* get_material();
69 
70  /*l
71  *b Description:
72  **
73  ** This function returns the number of textures this state has.
74  **
75  *b Returns:
76  **
77  ** number of textures associated with this state
78  */
79  int get_num_textures();
80 
81  /*l
82  *b Description:
83  **
84  ** This function returns the nth texture of this state. Specific
85  ** information about the texture can then be accessed from
86  ** the returned object.
87  **
88  *b Returns:
89  **
90  ** object of type diguyGraphicsTexture; NULL on failure
91  */
92  diguyGraphicsTexture* get_texture(int texture_index = 0);
93 
94  /*l
95  *b Description:
96  **
97  ** This function returns the way that a texture is used in the state.
98  ** Possibilities include diffuse, specular, normal.
99  **
100  *b Returns:
101  **
102  ** diguyTextureMapType enum
103  */
104  diguyTextureMapType get_texture_type(int index);
105 
106  /*l
107  *b Description:
108  **
109  ** This function returns a bit-wise or'ed mask of available textures
110  ** in this state. Possibilities include DIGUY_TEXTURE_MAP_MASK_DIFFUSE,
111  ** DIGUY_TEXTURE_MAP_MASK_SPECULAR, DIGUY_TEXTURE_MAP_MASK_BUMP,
112  ** etc. See diguyTextureMapMasks enum for a complete list.
113  **
114  */
115  int get_textures_available();
116 
117  /*l
118  *b Description:
119  **
120  ** This function returns whether either the material or texture of
121  ** this state contains an alpha component. States that have an alpha
122  ** component can make objects semi-transparent, which can affect when
123  ** said objects should be drawn.
124  **
125  *b Returns:
126  **
127  ** 1 if state contains an alpha component, 0 if not; -1 on failure
128  */
129  int get_contains_alpha_component();
130 
131  /*l
132  *b Description:
133  **
134  ** This function returns whether faces drawn with this state should
135  ** be lit or unlit.
136  **
137  *b Returns:
138  **
139  ** 1 if faces unlit, 0 if lit, -1 on failure
140  */
141  int get_is_unlit();
142 
143  /*l
144  *b Description:
145  **
146  ** This function frees most memory allocated by the DI-Guy geometry
147  ** loader for this object.
148  **
149  ** This function should only be called during or after the object's
150  ** build() function has been called. After it has been called, calls
151  ** to many accessor functions will fail.
152  */
153  void free_loader_memory();
154 
155 
156 
157 /*****************************************************************************/
169 #ifdef CPLUSPLUS_ONLY
170 
171  /*l
172  *b Description:
173  **
174  ** This function will be called by DI-Guy when it is time for a
175  ** renderer-specific state object to be created. A subclass of
176  ** this class isn't always necessary, particularly for immediate
177  ** mode renderers in which everything might be done in a subclass
178  ** of diguyGraphicsMaterial and a subclass of diguyGraphicsTexture.
179  **
180  *i Immediate Mode:
181  **
182  ** Immediate mode renderers usually do not override this function.
183  **
184  *i Scene Graph:
185  **
186  ** Scene graph renderers may override this function, to
187  ** create a state object that will be associated with
188  ** diguyGraphicsMesh objects.
189  **
190  ** The subclass version of this function may need to refer to
191  ** material and texture objects created by the build() calls
192  ** of subclasses of diguyGraphicsMaterial and
193  ** diguyGraphicsTexture objects.
194  **
195  *b Callable From:
196  **
197  *- - N/A (automatically called by DI-Guy Graphics API during
198  *- the Build Stage)
199  */
200  virtual void build();
201 
202  /*l
203  *b Description:
204  **
205  ** This function will be called by DI-Guy when it is time for a
206  ** renderer-specific state object to be destroyed.
207  **
208  *i Immediate Mode:
209  **
210  ** Immediate mode renderers may override this function, to
211  ** destroy any object that may have been created by build().
212  **
213  *i Scene Graph:
214  **
215  ** Scene graph renderers may override this function, to
216  ** destroy any object that may have been created by build().
217  **
218  *b Callable From:
219  **
220  *- - N/A (automatically called by DI-Guy Graphics API during
221  *- the Unbuild Stage)
222  */
223  virtual void unbuild();
224 
225  /*l
226  *b Description:
227  **
228  ** This function will be called by DI-Guy when the state should
229  ** be made active, or bound.
230  **
231  *i Immediate Mode:
232  **
233  ** Immediate mode renderers can override this function, but
234  ** may not need to. The material and texture of the state
235  ** will receive their own bind_now() calls.
236  **
237  *i Scene Graph:
238  **
239  ** Scene graph renderers usually do not override this function.
240  **
241  *b Callable From:
242  **
243  *- - N/A (automatically called by DI-Guy Graphics API during
244  *- Draw Stage)
245  */
246  virtual void bind_now();
247 
248 #endif
249 
250 
251 /****************************************************************************/
252 /****************************************************************************/
253 
258 #ifdef CPLUSPLUS_ONLY
259 
260  bdiGeometryGeosetState* get_scripted_object() {return m_scripted_object;}
261 
262 protected:
263 
264  /*l
265  ** A protected constructor. Constructors are called automatically
266  ** by DI-Guy.
267  */
268  diguyGraphicsState(void* internal_data);
269 
270  /*l
271  ** A protected destructor. Destructors are called automatically
272  ** by DI-Guy.
273  */
274  virtual ~diguyGraphicsState();
276 private:
278  /*l
279  ** A pointer to internal data.
280  */
281  bdiGeometryGeosetState* m_scripted_object;
282 
283  friend class bdiGeometryGeosetState;
284  friend class bdiGeometryFactory;
285 
286 #endif
287 };
288 
289 
290 #endif /* __diguyGraphicsState_H */
291 
A class that represents a shared material/textures combination.
Definition: diguyGraphicsState.h:37
A class that represents a shared texture. Can be subclassed by filling out the diguy_graphics_set_tex...
Definition: diguyGraphicsTexture.h:124
A class that represents a shared material.
Definition: diguyGraphicsMaterial.h:34
diguyTextureMapType
This enumeration lists the type of texture map a given image file is being used as.
Definition: diguyGraphicsTexture.h:56