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