DI-Guy SDK Documentation  13.5
diguyGraphicsState.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2020 MAK Technologies, Inc.
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;
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) const;
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() const;
123 
124  /*l
125  *b Description:
126  ** return Decal array
127  */
128  diguyGraphicsTextureArray* get_texture_array();
129 
130  /*l
131  *b Description:
132  **
133  ** This function returns whether either the material or texture of
134  ** this state contains an alpha component. States that have an alpha
135  ** component can make objects semi-transparent, which can affect when
136  ** said objects should be drawn.
137  **
138  *b Returns:
139  **
140  ** 1 if state contains an alpha component, 0 if not; -1 on failure
141  */
142  int get_contains_alpha_component() const;
143 
144  /*l
145  *b Description:
146  **
147  ** This function returns whether faces drawn with this state should
148  ** be lit or unlit.
149  **
150  *b Returns:
151  **
152  ** 1 if faces unlit, 0 if lit, -1 on failure
153  */
154  int get_is_unlit() const;
155 
156  /*l
157  *b Description:
158  **
159  ** This function frees most memory allocated by the DI-Guy geometry
160  ** loader for this object.
161  **
162  ** This function should only be called during or after the object's
163  ** build() function has been called. After it has been called, calls
164  ** to many accessor functions will fail.
165  */
166  void free_loader_memory();
167 
168 
169 
170 /*****************************************************************************/
182 #ifdef CPLUSPLUS_ONLY
183 
184  /*l
185  *b Description:
186  **
187  ** This function will be called by DI-Guy when it is time for a
188  ** renderer-specific state object to be created. A subclass of
189  ** this class isn't always necessary, particularly for immediate
190  ** mode renderers in which everything might be done in a subclass
191  ** of diguyGraphicsMaterial and a subclass of diguyGraphicsTexture.
192  **
193  *i Immediate Mode:
194  **
195  ** Immediate mode renderers usually do not override this function.
196  **
197  *i Scene Graph:
198  **
199  ** Scene graph renderers may override this function, to
200  ** create a state object that will be associated with
201  ** diguyGraphicsMesh objects.
202  **
203  ** The subclass version of this function may need to refer to
204  ** material and texture objects created by the build() calls
205  ** of subclasses of diguyGraphicsMaterial and
206  ** diguyGraphicsTexture objects.
207  **
208  *b Callable From:
209  **
210  *- - N/A (automatically called by DI-Guy Graphics API during
211  *- the Build Stage)
212  */
213  virtual void build();
214 
215  /*l
216  *b Description:
217  **
218  ** This function will be called by DI-Guy when it is time for a
219  ** renderer-specific state object to be destroyed.
220  **
221  *i Immediate Mode:
222  **
223  ** Immediate mode renderers may override this function, to
224  ** destroy any object that may have been created by build().
225  **
226  *i Scene Graph:
227  **
228  ** Scene graph renderers may override this function, to
229  ** destroy any object that may have been created by build().
230  **
231  *b Callable From:
232  **
233  *- - N/A (automatically called by DI-Guy Graphics API during
234  *- the Unbuild Stage)
235  */
236  virtual void unbuild();
237 
238  /*l
239  *b Description:
240  **
241  ** This function will be called by DI-Guy when the state should
242  ** be made active, or bound.
243  **
244  *i Immediate Mode:
245  **
246  ** Immediate mode renderers can override this function, but
247  ** may not need to. The material and texture of the state
248  ** will receive their own bind_now() calls.
249  **
250  *i Scene Graph:
251  **
252  ** Scene graph renderers usually do not override this function.
253  **
254  *b Callable From:
255  **
256  *- - N/A (automatically called by DI-Guy Graphics API during
257  *- Draw Stage)
258  */
259  virtual void bind_now();
260 
262  void bind(int texture_mask);
263 
264 #endif
265 
266 
267 /****************************************************************************/
268 /****************************************************************************/
269 
274 #ifdef CPLUSPLUS_ONLY
275 
276  bdiGeometryGeosetState* get_scripted_object() {return m_scripted_object;}
277 
278 protected:
279 
280  /*l
281  ** A protected constructor. Constructors are called automatically
282  ** by DI-Guy.
283  */
284  diguyGraphicsState(void* internal_data);
286  /*l
287  ** A protected destructor. Destructors are called automatically
288  ** by DI-Guy.
289  */
290  virtual ~diguyGraphicsState();
291 
292 private:
293 
294  /*l
295  ** A pointer to internal data.
296  */
297  bdiGeometryGeosetState* m_scripted_object;
298 
299  friend class bdiGeometryGeosetState;
300  friend class bdiGeometryFactory;
301 
302 #endif
303 };
304 
305 
306 #endif /* __diguyGraphicsState_H */
307 
A class that represents a shared material/textures combination.
Definition: diguyGraphicsState.h:45
A class that represents a shared texture.
Definition: diguyGraphicsTexture.h:135
A class that represents a shared material.
Definition: diguyGraphicsMaterial.h:42
A class that represents a shared 2D texture array.
Definition: diguyGraphicsTextureArray.h:40
diguyTextureMapType
This enumeration lists the type of texture map a given image file is being used as.
Definition: diguyGraphicsTexture.h:56