C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyGraphicsState.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************/
34 #ifndef __diguyGraphicsState_H
35 #define __diguyGraphicsState_H
36 
37 #ifdef SWIG
38 %module diguyGraphicsState
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #ifdef CPLUSPLUS_ONLY
44 #include <diguy_constants.h>
45 #include <declspec_diguy.h>
46 
47 // needed for diguyTextureMapType
48 #include <diguyGraphicsTexture.h>
49 
50 class bdiGeometryGeosetState;
51 class diguyGraphicsState;
54 
55 
56 #endif
57 
58 /****************************************************************************/
59 class BDI_DECLSPEC_diguy diguyGraphicsState
60 {
61 
62 public:
63 
64 /*****************************************************************************/
73  /*l
74  *b Description:
75  **
76  ** This function returns the material of this state. Specific
77  ** information about the material can then be accessed from
78  ** the returned object.
79  **
80  *b Returns:
81  **
82  ** object of type diguyGraphicsMaterial; NULL on failure
83  **
84  *b Callable From:
85  **
86  *- - C++
87  */
88  diguyGraphicsMaterial* get_material();
89 
90  /*l
91  *b Description:
92  **
93  ** This function returns the number of textures this state has.
94  **
95  *b Returns:
96  **
97  ** number of textures associated with this state
98  **
99  *b Callable From:
100  **
101  *- - C++
102  */
103  int get_num_textures();
104 
105  /*l
106  *b Description:
107  **
108  ** This function returns the nth texture of this state. Specific
109  ** information about the texture can then be accessed from
110  ** the returned object.
111  **
112  *b Returns:
113  **
114  ** object of type diguyGraphicsTexture; NULL on failure
115  **
116  *b Callable From:
117  **
118  *- - C++
119  */
120  diguyGraphicsTexture* get_texture(int texture_index = 0);
121 
122  /*l
123  *b Description:
124  **
125  ** This function returns the way that a texture is used in the state.
126  ** Possibilities include diffuse, specular, normal.
127  **
128  *b Returns:
129  **
130  ** diguyTextureMapType enum
131  **
132  *b Callable From:
133  **
134  *- - C++
135  */
136  diguyTextureMapType get_texture_type(int index);
137 
138  /*l
139  *b Description:
140  **
141  ** This function returns a bit-wise or'ed mask of available textures
142  ** in this state. Possibilities include DIGUY_TEXTURE_MAP_MASK_DIFFUSE,
143  ** DIGUY_TEXTURE_MAP_MASK_SPECULAR, DIGUY_TEXTURE_MAP_MASK_BUMP,
144  ** etc. See diguyTextureMapMasks enum for a complete list.
145  **
146  */
147  int get_textures_available();
148 
149  /*l
150  *b Description:
151  **
152  ** This function returns whether either the material or texture of
153  ** this state contains an alpha component. States that have an alpha
154  ** component can make objects semi-transparent, which can affect when
155  ** said objects should be drawn.
156  **
157  *b Returns:
158  **
159  ** 1 if state contains an alpha component, 0 if not; -1 on failure
160  **
161  *b Callable From:
162  **
163  *- - C++
164  */
165  int get_contains_alpha_component();
166 
167  /*l
168  *b Description:
169  **
170  ** This function returns whether faces drawn with this state should
171  ** be lit or unlit.
172  **
173  *b Returns:
174  **
175  ** 1 if faces unlit, 0 if lit, -1 on failure
176  **
177  *b Callable From:
178  **
179  *- - C++
180  */
181  int get_is_unlit();
182 
183  /*l
184  *b Description:
185  **
186  ** This function frees most memory allocated by the DI-Guy geometry
187  ** loader for this object.
188  **
189  ** This function should only be called during or after the object's
190  ** build() function has been called. After it has been called, calls
191  ** to many accessor functions will fail.
192  **
193  *b Callable From:
194  **
195  *- - C++
196  */
197  void free_loader_memory();
198 
199 
200 
201 /*****************************************************************************/
213 #ifdef CPLUSPLUS_ONLY
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 created. A subclass of
220  ** this class isn't always necessary, particularly for immediate
221  ** mode renderers in which everything might be done in a subclass
222  ** of diguyGraphicsMaterial and a subclass of diguyGraphicsTexture.
223  **
224  *i Immediate Mode:
225  **
226  ** Immediate mode renderers usually do not override this function.
227  **
228  *i Scene Graph:
229  **
230  ** Scene graph renderers may override this function, to
231  ** create a state object that will be associated with
232  ** diguyGraphicsMesh objects.
233  **
234  ** The subclass version of this function may need to refer to
235  ** material and texture objects created by the build() calls
236  ** of subclasses of diguyGraphicsMaterial and
237  ** diguyGraphicsTexture objects.
238  **
239  *b Callable From:
240  **
241  *- - N/A (automatically called by DI-Guy Graphics API during
242  *- the Build Stage)
243  */
244  virtual void build();
245 
246  /*l
247  *b Description:
248  **
249  ** This function will be called by DI-Guy when it is time for a
250  ** renderer-specific state object to be destroyed.
251  **
252  *i Immediate Mode:
253  **
254  ** Immediate mode renderers may override this function, to
255  ** destroy any object that may have been created by build().
256  **
257  *i Scene Graph:
258  **
259  ** Scene graph renderers may override this function, to
260  ** destroy any object that may have been created by build().
261  **
262  *b Callable From:
263  **
264  *- - N/A (automatically called by DI-Guy Graphics API during
265  *- the Unbuild Stage)
266  */
267  virtual void unbuild();
268 
269  /*l
270  *b Description:
271  **
272  ** This function will be called by DI-Guy when the state should
273  ** be made active, or bound.
274  **
275  *i Immediate Mode:
276  **
277  ** Immediate mode renderers can override this function, but
278  ** may not need to. The material and texture of the state
279  ** will receive their own bind_now() calls.
280  **
281  *i Scene Graph:
282  **
283  ** Scene graph renderers usually do not override this function.
284  **
285  *b Callable From:
286  **
287  *- - N/A (automatically called by DI-Guy Graphics API during
288  *- Draw Stage)
289  */
290  virtual void bind_now();
291 
292 #endif
293 
294 
295 /****************************************************************************/
296 /****************************************************************************/
297 
302 #ifdef CPLUSPLUS_ONLY
303 
304  bdiGeometryGeosetState* get_scripted_object() {return m_scripted_object;}
305 
306 protected:
307 
308  /*l
309  ** A protected constructor. Constructors are called automatically
310  ** by DI-Guy.
311  */
312  diguyGraphicsState(void* internal_data);
313 
314  /*l
315  ** A protected destructor. Destructors are called automatically
316  ** by DI-Guy.
317  */
318  virtual ~diguyGraphicsState();
320 private:
322  /*l
323  ** A pointer to internal data.
324  */
325  bdiGeometryGeosetState* m_scripted_object;
326 
327  friend class bdiGeometryGeosetState;
328  friend class bdiGeometryFactory;
329 
330 #endif
331 };
332 
333 
334 #endif /* __diguyGraphicsState_H */
335