Point Cloud Library (PCL)  1.14.1-dev
opennurbs_rendering.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_RENDERING_INC_)
18 #define OPENNURBS_RENDERING_INC_
19 
20 
21 class ON_CLASS ON_RenderingAttributes
22 {
23 public:
25  void Default();
26  int Compare( const ON_RenderingAttributes& other ) const;
27  bool Write( ON_BinaryArchive& archive ) const;
28  bool Read( ON_BinaryArchive& archive );
29 
30  bool IsValid( ON_TextLog* text_log ) const;
31 
32 
33  const ON_MaterialRef* MaterialRef( const ON_UUID& plugin_id ) const;
34 
36 };
37 
39 {
40 public:
42  void Default();
43  int Compare( const ON_ObjectRenderingAttributes& other ) const;
44  bool Write( ON_BinaryArchive& archive ) const;
45  bool Read( ON_BinaryArchive& archive );
46 
47  bool IsValid( ON_TextLog* text_log ) const;
48 
49  /*
50  Description:
51  Update mapping channel transformations.
52  Parameters:
53  xform - [in]
54  Transformation applied to parent object.
55  Returns:
56  True is successful. False if there are mapping channels
57  and xform cannot be inverted.
58  */
59  bool Transform( const ON_Xform& xform );
60 
61  /*
62  Parameters:
63  plugin_id - [in]
64  Returns:
65  A pointer to the plug-in's mapping reference, if there
66  is one. Otherwise NULL is returned.
67  */
69  const ON_UUID& plugin_id
70  ) const;
71 
72  /*
73  Parameters:
74  plugin_id - [in]
75  Returns:
76  If a mapping ref exists, it is returned. Otherwise
77  one is added.
78  */
80  const ON_UUID& plugin_id
81  );
82 
83  /*
84  Parameters:
85  plugin_id - [in]
86  Returns:
87  If a mapping ref exists, it is returned. Otherwise
88  one is added.
89  */
91  const ON_UUID& plugin_id
92  );
93 
94 
95  /*
96  Parameters:
97  plugin_id - [in]
98  mapping_channel_id - [in]
99  mapping_id - [in]
100  ON_TextureMapping id
101  Returns:
102  A pointer to the plug-in's mapping channel, if there
103  is one. Otherwise NULL is returned.
104  */
106  const ON_UUID& plugin_id,
107  int mapping_channel_id
108  ) const;
109 
111  const ON_UUID& plugin_id,
112  const ON_UUID& mapping_id
113  ) const;
114 
115 
116  /*
117  Parameters:
118  plugin_id - [in]
119  mapping_channel_id - [in]
120  mapping_id - [in]
121  ON_TextureMapping id
122  Returns:
123  True if the mapping channel was added or a pefect
124  match already existed. False if a mapping channel
125  with a different mapping_id already exists for this
126  plug-in and channel.
127  */
129  const ON_UUID& plugin_id,
130  int mapping_channel_id,
131  const ON_UUID& mapping_id
132  );
133 
134  /*
135  Parameters:
136  plugin_id - [in]
137  mapping_channel_id - [in]
138  mapping_id - [in]
139  ON_TextureMapping id
140  Returns:
141  True if a matching mapping channel was deleted.
142  */
144  const ON_UUID& plugin_id,
145  int mapping_channel_id
146  );
147 
149  const ON_UUID& plugin_id,
150  const ON_UUID& mapping_id
151  );
152 
153  /*
154  Parameters:
155  plugin_id - [in]
156  old_mapping_channel_id - [in]
157  new_mapping_channel_id - [in]
158  Returns:
159  True if a matching mapping channel was found and changed.
160  */
162  const ON_UUID& plugin_id,
163  int old_mapping_channel_id,
164  int new_mapping_channel_id
165  );
166 
167  // Use AddMappingRef() or AddMappingChannel() if you
168  // want to add an element to this array.
169  //
170  // Every mapping ref in this array must have
171  // a distinct value of ON_MappingRef.m_plugin_id.
173 
174  /*
175  Parameters:
176  bEnable - [in]
177  false - (default)
178  Do not generate bitmap textures that
179  approximate procedural textures.
180  true -
181  generate bitmap textures that approximate
182  procedural textures and use these for
183  quick previews.
184  Returns:
185  True if advancded texture preview is enabled.
186  */
188 
189  /*
190  Returns:
191  True if advancded texture preview is enabled.
192  */
194 
195  bool m_bCastsShadows; // default is true
196  bool m_bReceivesShadows; // default is true
197 
198 private:
199  // m_bits encodes 8 true/false settings
200  unsigned char m_bits; // (m_bits & 1) == AdvancedTexturePreview();
201 
202  unsigned char m_reserved1;
203 };
204 
205 #if defined(ON_DLL_TEMPLATE)
206 // This stuff is here because of a limitation in the way Microsoft
207 // handles templates and DLLs. See Microsoft's knowledge base
208 // article ID Q168958 for details.
209 #pragma warning( push )
210 #pragma warning( disable : 4231 )
211 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_RenderingAttributes>;
212 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_ObjectRenderingAttributes>;
213 #pragma warning( pop )
214 #endif
215 
216 
217 #endif
218 
bool Write(ON_BinaryArchive &archive) const
const ON_MappingChannel * MappingChannel(const ON_UUID &plugin_id, int mapping_channel_id) const
bool DeleteMappingChannel(const ON_UUID &plugin_id, const ON_UUID &mapping_id)
bool ChangeMappingChannel(const ON_UUID &plugin_id, int old_mapping_channel_id, int new_mapping_channel_id)
int Compare(const ON_ObjectRenderingAttributes &other) const
bool Transform(const ON_Xform &xform)
bool DeleteMappingRef(const ON_UUID &plugin_id)
bool Read(ON_BinaryArchive &archive)
ON_ClassArray< ON_MappingRef > m_mappings
ON_MappingRef * AddMappingRef(const ON_UUID &plugin_id)
bool AdvancedTexturePreview() const
bool IsValid(ON_TextLog *text_log) const
bool DeleteMappingChannel(const ON_UUID &plugin_id, int mapping_channel_id)
const ON_MappingChannel * MappingChannel(const ON_UUID &plugin_id, const ON_UUID &mapping_id) const
void EnableAdvancedTexturePreview(bool b)
bool AddMappingChannel(const ON_UUID &plugin_id, int mapping_channel_id, const ON_UUID &mapping_id)
const ON_MappingRef * MappingRef(const ON_UUID &plugin_id) const
bool IsValid(ON_TextLog *text_log) const
bool Read(ON_BinaryArchive &archive)
const ON_MaterialRef * MaterialRef(const ON_UUID &plugin_id) const
ON_ClassArray< ON_MaterialRef > m_materials
bool Write(ON_BinaryArchive &archive) const
int Compare(const ON_RenderingAttributes &other) const