00001 /* $NoKeywords: $ */ 00002 /* 00003 // 00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. 00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert 00006 // McNeel & Associates. 00007 // 00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF 00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED. 00011 // 00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>. 00013 // 00015 */ 00016 00017 #if !defined(OPENNURBS_RENDERING_INC_) 00018 #define OPENNURBS_RENDERING_INC_ 00019 00020 00021 class ON_CLASS ON_RenderingAttributes 00022 { 00023 public: 00024 ON_RenderingAttributes(); 00025 void Default(); 00026 int Compare( const ON_RenderingAttributes& other ) const; 00027 bool Write( ON_BinaryArchive& archive ) const; 00028 bool Read( ON_BinaryArchive& archive ); 00029 00030 bool IsValid( ON_TextLog* text_log ) const; 00031 00032 00033 const ON_MaterialRef* MaterialRef( const ON_UUID& plugin_id ) const; 00034 00035 ON_ClassArray<ON_MaterialRef> m_materials; 00036 }; 00037 00038 class ON_CLASS ON_ObjectRenderingAttributes : public ON_RenderingAttributes 00039 { 00040 public: 00041 ON_ObjectRenderingAttributes(); 00042 void Default(); 00043 int Compare( const ON_ObjectRenderingAttributes& other ) const; 00044 bool Write( ON_BinaryArchive& archive ) const; 00045 bool Read( ON_BinaryArchive& archive ); 00046 00047 bool IsValid( ON_TextLog* text_log ) const; 00048 00049 /* 00050 Description: 00051 Update mapping channel transformations. 00052 Parameters: 00053 xform - [in] 00054 Transformation applied to parent object. 00055 Returns: 00056 True is successful. False if there are mapping channels 00057 and xform cannot be inverted. 00058 */ 00059 bool Transform( const ON_Xform& xform ); 00060 00061 /* 00062 Parameters: 00063 plugin_id - [in] 00064 Returns: 00065 A pointer to the plug-in's mapping reference, if there 00066 is one. Otherwise NULL is returned. 00067 */ 00068 const ON_MappingRef* MappingRef( 00069 const ON_UUID& plugin_id 00070 ) const; 00071 00072 /* 00073 Parameters: 00074 plugin_id - [in] 00075 Returns: 00076 If a mapping ref exists, it is returned. Otherwise 00077 one is added. 00078 */ 00079 ON_MappingRef* AddMappingRef( 00080 const ON_UUID& plugin_id 00081 ); 00082 00083 /* 00084 Parameters: 00085 plugin_id - [in] 00086 Returns: 00087 If a mapping ref exists, it is returned. Otherwise 00088 one is added. 00089 */ 00090 bool DeleteMappingRef( 00091 const ON_UUID& plugin_id 00092 ); 00093 00094 00095 /* 00096 Parameters: 00097 plugin_id - [in] 00098 mapping_channel_id - [in] 00099 mapping_id - [in] 00100 ON_TextureMapping id 00101 Returns: 00102 A pointer to the plug-in's mapping channel, if there 00103 is one. Otherwise NULL is returned. 00104 */ 00105 const ON_MappingChannel* MappingChannel( 00106 const ON_UUID& plugin_id, 00107 int mapping_channel_id 00108 ) const; 00109 00110 const ON_MappingChannel* MappingChannel( 00111 const ON_UUID& plugin_id, 00112 const ON_UUID& mapping_id 00113 ) const; 00114 00115 00116 /* 00117 Parameters: 00118 plugin_id - [in] 00119 mapping_channel_id - [in] 00120 mapping_id - [in] 00121 ON_TextureMapping id 00122 Returns: 00123 True if the mapping channel was added or a pefect 00124 match already existed. False if a mapping channel 00125 with a different mapping_id already exists for this 00126 plug-in and channel. 00127 */ 00128 bool AddMappingChannel( 00129 const ON_UUID& plugin_id, 00130 int mapping_channel_id, 00131 const ON_UUID& mapping_id 00132 ); 00133 00134 /* 00135 Parameters: 00136 plugin_id - [in] 00137 mapping_channel_id - [in] 00138 mapping_id - [in] 00139 ON_TextureMapping id 00140 Returns: 00141 True if a matching mapping channel was deleted. 00142 */ 00143 bool DeleteMappingChannel( 00144 const ON_UUID& plugin_id, 00145 int mapping_channel_id 00146 ); 00147 00148 bool DeleteMappingChannel( 00149 const ON_UUID& plugin_id, 00150 const ON_UUID& mapping_id 00151 ); 00152 00153 /* 00154 Parameters: 00155 plugin_id - [in] 00156 old_mapping_channel_id - [in] 00157 new_mapping_channel_id - [in] 00158 Returns: 00159 True if a matching mapping channel was found and changed. 00160 */ 00161 bool ChangeMappingChannel( 00162 const ON_UUID& plugin_id, 00163 int old_mapping_channel_id, 00164 int new_mapping_channel_id 00165 ); 00166 00167 // Use AddMappingRef() or AddMappingChannel() if you 00168 // want to add an element to this array. 00169 // 00170 // Every mapping ref in this array must have 00171 // a distinct value of ON_MappingRef.m_plugin_id. 00172 ON_ClassArray<ON_MappingRef> m_mappings; 00173 00174 /* 00175 Parameters: 00176 bEnable - [in] 00177 false - (default) 00178 Do not generate bitmap textures that 00179 approximate procedural textures. 00180 true - 00181 generate bitmap textures that approximate 00182 procedural textures and use these for 00183 quick previews. 00184 Returns: 00185 True if advancded texture preview is enabled. 00186 */ 00187 void EnableAdvancedTexturePreview(bool b); 00188 00189 /* 00190 Returns: 00191 True if advancded texture preview is enabled. 00192 */ 00193 bool AdvancedTexturePreview() const; 00194 00195 bool m_bCastsShadows; // default is true 00196 bool m_bReceivesShadows; // default is true 00197 00198 private: 00199 // m_bits encodes 8 true/false settings 00200 unsigned char m_bits; // (m_bits & 1) == AdvancedTexturePreview(); 00201 00202 unsigned char m_reserved1; 00203 }; 00204 00205 #if defined(ON_DLL_TEMPLATE) 00206 // This stuff is here because of a limitation in the way Microsoft 00207 // handles templates and DLLs. See Microsoft's knowledge base 00208 // article ID Q168958 for details. 00209 #pragma warning( push ) 00210 #pragma warning( disable : 4231 ) 00211 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_RenderingAttributes>; 00212 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_ObjectRenderingAttributes>; 00213 #pragma warning( pop ) 00214 #endif 00215 00216 00217 #endif 00218