Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
00001 /**************************************************************************************/ 00002 /* */ 00003 /* Visualization Library */ 00004 /* http://visualizationlibrary.org */ 00005 /* */ 00006 /* Copyright (c) 2005-2010, Michele Bosi */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without modification, */ 00010 /* are permitted provided that the following conditions are met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, this */ 00013 /* list of conditions and the following disclaimer. */ 00014 /* */ 00015 /* - Redistributions in binary form must reproduce the above copyright notice, this */ 00016 /* list of conditions and the following disclaimer in the documentation and/or */ 00017 /* other materials provided with the distribution. */ 00018 /* */ 00019 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */ 00020 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */ 00021 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ 00022 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */ 00023 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */ 00024 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ 00025 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */ 00026 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ 00027 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ 00028 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00029 /* */ 00030 /**************************************************************************************/ 00031 00032 #ifndef vlxutils_INCLUDE_ONCE 00033 #define vlxutils_INCLUDE_ONCE 00034 00035 #include <vlCore/VLXValue.hpp> 00036 #include <vlCore/Matrix4.hpp> 00037 #include <vlCore/Vector4.hpp> 00038 #include <vlCore/Log.hpp> 00039 #include <vlCore/Say.hpp> 00040 #include <vlCore/VLXSerializer.hpp> 00041 00042 namespace vl 00043 { 00044 inline std::string vlx_makeTag(const Object* obj) { return std::string("<") + obj->classType().name() + ">"; } 00045 00046 inline VLXValue vlx_Identifier(const std::string& str) { return VLXValue(str.c_str(), VLXValue::Identifier); } 00047 00048 inline VLXValue vlx_ID(const std::string& str) { return VLXValue(str.c_str(), VLXValue::ID); } 00049 00050 inline VLXValue vlx_String(const std::string& str) { return VLXValue(str.c_str(), VLXValue::String); } 00051 00052 inline VLXValue vlx_Rawtext(const std::string& str) { return VLXValue( new VLXRawtextBlock(NULL, str.c_str()) ); } 00053 00054 inline vec2 vlx_vec2(const VLXArrayReal* arr) { VL_CHECK(arr->value().size() == 2); vec2 v; arr->copyTo(v.ptr()); return v; } 00055 00056 inline vec3 vlx_vec3(const VLXArrayReal* arr) { VL_CHECK(arr->value().size() == 3); vec3 v; arr->copyTo(v.ptr()); return v; } 00057 00058 inline vec4 vlx_vec4(const VLXArrayReal* arr) { VL_CHECK(arr->value().size() == 4); vec4 v; arr->copyTo(v.ptr()); return v; } 00059 00060 inline ivec4 vlx_ivec4(const VLXArrayInteger* arr) { VL_CHECK(arr->value().size() == 4); ivec4 v; arr->copyTo(v.ptr()); return v; } 00061 00062 inline uvec4 vlx_uivec4(const VLXArrayInteger* arr) { VL_CHECK(arr->value().size() == 4); uvec4 v; arr->copyTo(v.ptr()); return v; } 00063 00064 inline VLXValue vlx_toValue(const std::vector<int>& vec) 00065 { 00066 VLXValue value; 00067 value.setArray( new VLXArrayInteger ); 00068 value.getArrayInteger()->value().resize( vec.size() ); 00069 if (vec.size()) 00070 value.getArrayInteger()->copyFrom(&vec[0]); 00071 return value; 00072 } 00073 00074 inline VLXValue vlx_toValue(const vec4& vec) 00075 { 00076 VLXValue val( new VLXArrayReal ); 00077 VLXArrayReal* arr = val.getArrayReal(); 00078 arr->value().resize(4); 00079 arr->value()[0] = vec.x(); 00080 arr->value()[1] = vec.y(); 00081 arr->value()[2] = vec.z(); 00082 arr->value()[3] = vec.w(); 00083 return val; 00084 } 00085 00086 inline VLXValue vlx_toValue(const ivec4& vec) 00087 { 00088 VLXValue val( new VLXArrayInteger ); 00089 VLXArrayInteger* arr = val.getArrayInteger(); 00090 arr->value().resize(4); 00091 arr->value()[0] = vec.x(); 00092 arr->value()[1] = vec.y(); 00093 arr->value()[2] = vec.z(); 00094 arr->value()[3] = vec.w(); 00095 return val; 00096 } 00097 00098 inline VLXValue vlx_toValue(const uvec4& vec) 00099 { 00100 VLXValue val( new VLXArrayInteger ); 00101 VLXArrayInteger* arr = val.getArrayInteger(); 00102 arr->value().resize(4); 00103 arr->value()[0] = vec.x(); 00104 arr->value()[1] = vec.y(); 00105 arr->value()[2] = vec.z(); 00106 arr->value()[3] = vec.w(); 00107 return val; 00108 } 00109 00110 inline VLXValue vlx_toValue(const vec3& vec) 00111 { 00112 VLXValue val( new VLXArrayReal ); 00113 VLXArrayReal* arr = val.getArrayReal(); 00114 arr->value().resize(3); 00115 arr->value()[0] = vec.x(); 00116 arr->value()[1] = vec.y(); 00117 arr->value()[2] = vec.z(); 00118 return val; 00119 } 00120 00121 inline VLXValue vlx_toValue(const vec2& vec) 00122 { 00123 VLXValue val( new VLXArrayReal ); 00124 VLXArrayReal* arr = val.getArrayReal(); 00125 arr->value().resize(2); 00126 arr->value()[0] = vec.x(); 00127 arr->value()[1] = vec.y(); 00128 return val; 00129 } 00130 00131 inline bool vlx_isTranslation(const mat4& mat) 00132 { 00133 mat4 tmp = mat; 00134 tmp.setT( vec3(0,0,0) ); 00135 return tmp.isIdentity(); 00136 } 00137 00138 inline bool vlx_isScaling(const mat4& mat) 00139 { 00140 mat4 tmp = mat; 00141 tmp.e(0,0) = 1; 00142 tmp.e(1,1) = 1; 00143 tmp.e(2,2) = 1; 00144 return tmp.isIdentity(); 00145 } 00146 00147 inline VLXValue vlx_toValue(const mat4& mat) 00148 { 00149 VLXValue matrix_list( new VLXList ); 00150 00151 if (vlx_isTranslation(mat)) 00152 { 00153 VLXValue value( new VLXArrayReal("<Translate>") ); 00154 value.getArrayReal()->value().resize(3); 00155 value.getArrayReal()->value()[0] = mat.getT().x(); 00156 value.getArrayReal()->value()[1] = mat.getT().y(); 00157 value.getArrayReal()->value()[2] = mat.getT().z(); 00158 matrix_list.getList()->value().push_back( value ); 00159 } 00160 else 00161 if (vlx_isScaling(mat)) 00162 { 00163 VLXValue value( new VLXArrayReal("<Scale>") ); 00164 value.getArrayReal()->value().resize(3); 00165 value.getArrayReal()->value()[0] = mat.e(0,0); 00166 value.getArrayReal()->value()[1] = mat.e(1,1); 00167 value.getArrayReal()->value()[2] = mat.e(2,2); 00168 matrix_list.getList()->value().push_back( value ); 00169 } 00170 else 00171 { 00172 VLXValue value( new VLXArrayReal("<Matrix>") ); 00173 value.getArrayReal()->value().resize(4*4); 00174 // if we transpose this we have to transpose also the uniform matrices 00175 value.getArrayReal()->copyFrom(mat.ptr()); 00176 matrix_list.getList()->value().push_back( value ); 00177 } 00178 00179 return matrix_list; 00180 } 00181 00182 inline mat4 vlx_mat4( const VLXArrayReal* arr ) 00183 { 00184 mat4 mat; 00185 arr->copyTo(mat.ptr()); 00186 return mat; 00187 } 00188 00189 inline mat4 vlx_mat4( const VLXList* list ) 00190 { 00191 mat4 mat; 00192 00193 for(size_t i=0; i<list->value().size(); ++i) 00194 { 00195 const VLXValue& value = list->value()[i]; 00196 if (value.type() != VLXValue::ArrayReal) 00197 { 00198 Log::error( Say("Line %n : parse error during matrix import.\n") << value.lineNumber() ); 00199 return mat4::getNull(); 00200 } 00201 // composition of subtransforms is made by post multiplication like for COLLADA. 00202 const VLXArrayReal* arr = value.getArrayReal(); 00203 if (arr->tag() == "<Translate>") 00204 { 00205 vec3 tr = vlx_vec3( arr ); 00206 mat = mat * mat4::getTranslation(tr); 00207 } 00208 else 00209 if (arr->tag() == "<Scale>") 00210 { 00211 vec3 sc = vlx_vec3( arr ); 00212 mat = mat * mat4::getScaling(sc); 00213 } 00214 else 00215 if (arr->tag() == "<Matrix>") 00216 { 00217 mat4 m = vlx_mat4( arr ); 00218 mat = mat * m; 00219 } 00220 else 00221 if (arr->tag() == "<LookAt>") 00222 { 00223 // implements the camera's view-matrix look-at as specified by COLLADA 00224 if (arr->value().size() != 9) 00225 { 00226 Log::error( Say("Line %n : <LookAt> must have 9 floats, 3 for 'eye', 3 for 'look' and 3 for 'up'.\n") << arr->lineNumber() << arr->tag() ); 00227 } 00228 else 00229 { 00230 vec3 eye, look, up; 00231 eye.x() = (float)arr->value()[0]; 00232 eye.y() = (float)arr->value()[1]; 00233 eye.z() = (float)arr->value()[2]; 00234 look.x() = (float)arr->value()[3]; 00235 look.y() = (float)arr->value()[4]; 00236 look.z() = (float)arr->value()[5]; 00237 up.x() = (float)arr->value()[6]; 00238 up.y() = (float)arr->value()[7]; 00239 up.z() = (float)arr->value()[8]; 00240 mat = mat * mat4::getLookAt(eye, look, up); 00241 } 00242 } 00243 else 00244 if (arr->tag() == "<Skew>") 00245 { 00246 Log::error("<Skew> tag not yet supported.\n"); 00247 } 00248 else 00249 { 00250 Log::error( Say("Line %n : unknown tag '%s' ignored.\n") << arr->lineNumber() << arr->tag() ); 00251 } 00252 } 00253 00254 return mat; 00255 } 00256 00257 inline const char* vlx_EProjectionMatrixType(EProjectionMatrixType pt) 00258 { 00259 switch(pt) 00260 { 00261 default: 00262 case PMT_UserProjection: return "PMT_UserProjection"; 00263 case PMT_OrthographicProjection: return "PMT_OrthographicProjection"; 00264 case PMT_PerspectiveProjection: return "PMT_PerspectiveProjection"; 00265 case PMT_PerspectiveProjectionFrustum: return "PMT_PerspectiveProjectionFrustum"; 00266 } 00267 } 00268 00269 inline EProjectionMatrixType vlx_EProjectionMatrixType(const VLXValue& value, VLXSerializer& s) 00270 { 00271 if( value.getIdentifier() == "PMT_OrthographicProjection") return PMT_OrthographicProjection; 00272 if( value.getIdentifier() == "PMT_PerspectiveProjection") return PMT_PerspectiveProjection; 00273 if( value.getIdentifier() == "PMT_PerspectiveProjectionFrustum") return PMT_PerspectiveProjectionFrustum; 00274 if( value.getIdentifier() == "PMT_UserProjection") return PMT_UserProjection; 00275 00276 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00277 s.setError(VLXSerializer::ImportError); 00278 return PMT_UserProjection; 00279 } 00280 00281 inline const char* vlx_EClearColorMode(EClearColorMode ccm) 00282 { 00283 switch(ccm) 00284 { 00285 default: 00286 case CCM_Float: return "CCM_Float"; 00287 case CCM_Int: return "CCM_Int"; 00288 case CCM_UInt: return "CCM_UInt"; 00289 } 00290 } 00291 00292 inline EClearColorMode vlx_EClearColorMode(const VLXValue& value, VLXSerializer& s) 00293 { 00294 if( value.getIdentifier() == "CCM_Int") return CCM_Int; 00295 if( value.getIdentifier() == "CCM_UInt") return CCM_UInt; 00296 if( value.getIdentifier() == "CCM_Float") return CCM_Float; 00297 00298 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00299 s.setError(VLXSerializer::ImportError); 00300 return CCM_Float; 00301 } 00302 00303 inline const char* vlx_EClearFlags(EClearFlags cf) 00304 { 00305 switch(cf) 00306 { 00307 default: 00308 case CF_CLEAR_COLOR_DEPTH_STENCIL: return "CF_CLEAR_COLOR_DEPTH_STENCIL"; 00309 case CF_DO_NOT_CLEAR: return "CF_DO_NOT_CLEAR"; 00310 case CF_CLEAR_COLOR: return "CF_CLEAR_COLOR"; 00311 case CF_CLEAR_DEPTH: return "CF_CLEAR_DEPTH"; 00312 case CF_CLEAR_STENCIL: return "CF_CLEAR_STENCIL"; 00313 case CF_CLEAR_COLOR_DEPTH: return "CF_CLEAR_COLOR_DEPTH"; 00314 case CF_CLEAR_COLOR_STENCIL: return "CF_CLEAR_COLOR_STENCIL"; 00315 case CF_CLEAR_DEPTH_STENCIL: return "CF_CLEAR_DEPTH_STENCIL"; 00316 } 00317 } 00318 00319 inline EClearFlags vlx_EClearFlags(const VLXValue& value, VLXSerializer& s) 00320 { 00321 if( value.getIdentifier() == "CF_DO_NOT_CLEAR") return CF_DO_NOT_CLEAR; 00322 if( value.getIdentifier() == "CF_CLEAR_COLOR") return CF_CLEAR_COLOR; 00323 if( value.getIdentifier() == "CF_CLEAR_DEPTH") return CF_CLEAR_DEPTH; 00324 if( value.getIdentifier() == "CF_CLEAR_STENCIL") return CF_CLEAR_STENCIL; 00325 if( value.getIdentifier() == "CF_CLEAR_COLOR_DEPTH") return CF_CLEAR_COLOR_DEPTH; 00326 if( value.getIdentifier() == "CF_CLEAR_COLOR_STENCIL") return CF_CLEAR_COLOR_STENCIL; 00327 if( value.getIdentifier() == "CF_CLEAR_DEPTH_STENCIL") return CF_CLEAR_DEPTH_STENCIL; 00328 if( value.getIdentifier() == "CF_CLEAR_COLOR_DEPTH_STENCIL") return CF_CLEAR_COLOR_DEPTH_STENCIL; 00329 00330 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00331 s.setError(VLXSerializer::ImportError); 00332 return CF_DO_NOT_CLEAR; 00333 } 00334 00335 inline const char* vlx_EPolygonFace(EPolygonFace pf) 00336 { 00337 switch(pf) 00338 { 00339 default: 00340 case PF_FRONT_AND_BACK: return "PF_FRONT_AND_BACK"; 00341 case PF_FRONT: return "PF_FRONT"; 00342 case PF_BACK: return "PF_BACK"; 00343 } 00344 } 00345 00346 inline EPolygonFace vlx_EPolygonFace(const VLXValue& value, VLXSerializer& s) 00347 { 00348 if( value.getIdentifier() == "PF_FRONT") return PF_FRONT; 00349 if( value.getIdentifier() == "PF_BACK") return PF_BACK; 00350 if( value.getIdentifier() == "PF_FRONT_AND_BACK") return PF_FRONT_AND_BACK; 00351 00352 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00353 s.setError(VLXSerializer::ImportError); 00354 return PF_FRONT_AND_BACK; 00355 } 00356 00357 inline const char* vlx_EColorMaterial(EColorMaterial cm) 00358 { 00359 switch(cm) 00360 { 00361 default: 00362 case CM_AMBIENT_AND_DIFFUSE: return "CM_AMBIENT_AND_DIFFUSE"; 00363 case CM_EMISSION: return "CM_EMISSION"; 00364 case CM_AMBIENT: return "CM_AMBIENT"; 00365 case CM_DIFFUSE: return "CM_DIFFUSE"; 00366 case CM_SPECULAR: return "CM_SPECULAR"; 00367 } 00368 } 00369 00370 inline EColorMaterial vlx_EColorMaterial(const VLXValue& value, VLXSerializer& s) 00371 { 00372 if( value.getIdentifier() == "CM_EMISSION") return CM_EMISSION; 00373 if( value.getIdentifier() == "CM_AMBIENT") return CM_AMBIENT; 00374 if( value.getIdentifier() == "CM_DIFFUSE") return CM_DIFFUSE; 00375 if( value.getIdentifier() == "CM_SPECULAR") return CM_SPECULAR; 00376 if( value.getIdentifier() == "CM_AMBIENT_AND_DIFFUSE") return CM_AMBIENT_AND_DIFFUSE; 00377 00378 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00379 s.setError(VLXSerializer::ImportError); 00380 return CM_AMBIENT_AND_DIFFUSE; 00381 } 00382 00383 inline const char* vlx_ETextureFormat(ETextureFormat tf) 00384 { 00385 switch(tf) 00386 { 00387 default: 00388 case TF_UNKNOWN: return "TF_UNKNOWN"; 00389 00390 case TF_ALPHA : return "TF_ALPHA"; 00391 case TF_ALPHA4 : return "TF_ALPHA4"; 00392 case TF_ALPHA8 : return "TF_ALPHA8"; 00393 case TF_ALPHA12: return "TF_ALPHA12"; 00394 case TF_ALPHA16: return "TF_ALPHA16"; 00395 00396 case TF_INTENSITY : return "TF_INTENSITY"; 00397 case TF_INTENSITY4 : return "TF_INTENSITY4"; 00398 case TF_INTENSITY8 : return "TF_INTENSITY8"; 00399 case TF_INTENSITY12: return "TF_INTENSITY12"; 00400 case TF_INTENSITY16: return "TF_INTENSITY16"; 00401 case TF_LUMINANCE : return "TF_LUMINANCE"; 00402 case TF_LUMINANCE4 : return "TF_LUMINANCE4"; 00403 case TF_LUMINANCE8 : return "TF_LUMINANCE8"; 00404 case TF_LUMINANCE12: return "TF_LUMINANCE12"; 00405 case TF_LUMINANCE16: return "TF_LUMINANCE16"; 00406 case TF_LUMINANCE_ALPHA : return "TF_LUMINANCE_ALPHA"; 00407 case TF_LUMINANCE4_ALPHA4 : return "TF_LUMINANCE4_ALPHA4"; 00408 case TF_LUMINANCE6_ALPHA2 : return "TF_LUMINANCE6_ALPHA2"; 00409 case TF_LUMINANCE8_ALPHA8 : return "TF_LUMINANCE8_ALPHA8"; 00410 case TF_LUMINANCE12_ALPHA4 : return "TF_LUMINANCE12_ALPHA4"; 00411 case TF_LUMINANCE12_ALPHA12: return "TF_LUMINANCE12_ALPHA12"; 00412 case TF_LUMINANCE16_ALPHA16: return "TF_LUMINANCE16_ALPHA16"; 00413 case TF_R3_G3_B2: return "TF_R3_G3_B2"; 00414 case TF_RGB : return "TF_RGB"; 00415 case TF_RGB4 : return "TF_RGB4"; 00416 case TF_RGB5 : return "TF_RGB5"; 00417 case TF_RGB8 : return "TF_RGB8"; 00418 case TF_RGB10 : return "TF_RGB10"; 00419 case TF_RGB12 : return "TF_RGB12"; 00420 case TF_RGB16 : return "TF_RGB16"; 00421 case TF_RGBA : return "TF_RGBA"; 00422 case TF_RGBA2 : return "TF_RGBA2"; 00423 case TF_RGBA4 : return "TF_RGBA4"; 00424 case TF_RGB5_A1 : return "TF_RGB5_A1"; 00425 case TF_RGBA8 : return "TF_RGBA8"; 00426 case TF_RGB10_A2: return "TF_RGB10_A2"; 00427 case TF_RGBA12 : return "TF_RGBA12"; 00428 case TF_RGBA16 : return "TF_RGBA16"; 00429 00430 // ARB_texture_float / OpenGL 3 00431 case TF_RGBA32F: return "TF_RGBA32F"; 00432 case TF_RGB32F: return "TF_RGB32F"; 00433 case TF_ALPHA32F: return "TF_ALPHA32F"; 00434 case TF_INTENSITY32F: return "TF_INTENSITY32F"; 00435 case TF_LUMINANCE32F: return "TF_LUMINANCE32F"; 00436 case TF_LUMINANCE_ALPHA32F: return "TF_LUMINANCE_ALPHA32F"; 00437 case TF_RGBA16F: return "TF_RGBA16F"; 00438 case TF_RGB16F: return "TF_RGB16F"; 00439 case TF_ALPHA16F: return "TF_ALPHA16F"; 00440 case TF_INTENSITY16F: return "TF_INTENSITY16F"; 00441 case TF_LUMINANCE16F: return "TF_LUMINANCE16F"; 00442 case TF_LUMINANCE_ALPHA16F: return "TF_LUMINANCE_ALPHA16F"; 00443 00444 // from table 3.12 opengl api specs 4.1 00445 case TF_R8_SNORM: return "TF_R8_SNORM"; 00446 case TF_R16_SNORM: return "TF_R16_SNORM"; 00447 case TF_RG8_SNORM: return "TF_RG8_SNORM"; 00448 case TF_RG16_SNORM: return "TF_RG16_SNORM"; 00449 case TF_RGB8_SNORM: return "TF_RGB8_SNORM"; 00450 case TF_RGBA8_SNORM: return "TF_RGBA8_SNORM"; 00451 case TF_RGB10_A2UI: return "TF_RGB10_A2UI"; 00452 case TF_RGBA16_SNORM: return "TF_RGBA16_SNORM"; 00453 case TF_R11F_G11F_B10F: return "TF_R11F_G11F_B10F"; 00454 case TF_RGB9_E5: return "TF_RGB9_E5"; 00455 case TF_RGB8I: return "TF_RGB8I"; 00456 case TF_RGB8UI: return "TF_RGB8UI"; 00457 case TF_RGB16I: return "TF_RGB16I"; 00458 case TF_RGB16UI: return "TF_RGB16UI"; 00459 case TF_RGB32I: return "TF_RGB32I"; 00460 case TF_RGB32UI: return "TF_RGB32UI"; 00461 case TF_RGBA8I: return "TF_RGBA8I"; 00462 case TF_RGBA8UI: return "TF_RGBA8UI"; 00463 case TF_RGBA16I: return "TF_RGBA16I"; 00464 case TF_RGBA16UI: return "TF_RGBA16UI"; 00465 case TF_RGBA32I: return "TF_RGBA32I"; 00466 case TF_RGBA32UI: return "TF_TF_RGBA32UI"; 00467 00468 // ATI_texture_float (the enums are the same as ARB_texture_float) 00469 //case TF_RGBA_FLOAT32_ATI: return "TF_RGBA_FLOAT32_ATI"; 00470 //case TF_RGB_FLOAT32_ATI: return "TF_RGB_FLOAT32_ATI"; 00471 //case TF_ALPHA_FLOAT32_ATI: return "TF_ALPHA_FLOAT32_ATI"; 00472 //case TF_INTENSITY_FLOAT32_ATI: return "TF_INTENSITY_FLOAT32_ATI"; 00473 //case TF_LUMINANCE_FLOAT32_ATI: return "TF_LUMINANCE_FLOAT32_ATI"; 00474 //case TF_LUMINANCE_ALPHA_FLOAT32_ATI: return "TF_LUMINANCE_ALPHA_FLOAT32_ATI"; 00475 //case TF_RGBA_FLOAT16_ATI: return "TF_RGBA_FLOAT16_ATI"; 00476 //case TF_RGB_FLOAT16_ATI: return "TF_RGB_FLOAT16_ATI"; 00477 //case TF_ALPHA_FLOAT16_ATI: return "TF_ALPHA_FLOAT16_ATI"; 00478 //case TF_INTENSITY_FLOAT16_ATI: return "TF_INTENSITY_FLOAT16_ATI"; 00479 //case TF_LUMINANCE_FLOAT16_ATI: return "TF_LUMINANCE_FLOAT16_ATI"; 00480 //case TF_LUMINANCE_ALPHA_FLOAT16_ATI: return "TF_LUMINANCE_ALPHA_FLOAT16_ATI"; 00481 00482 // EXT_texture_shared_exponent 00483 // case TF_RGB9_E5_EXT: return "TF_RGB9_E5_EXT"; 00484 00485 // EXT_packed_float 00486 // case TF_11F_G11F_B10F_EXT: return "TF_11F_G11F_B10F_EXT"; 00487 00488 // EXT_packed_depth_stencil / GL_ARB_framebuffer_object 00489 case TF_DEPTH_STENCIL : return "TF_DEPTH_STENCIL"; 00490 case TF_DEPTH24_STENCIL8: return "TF_DEPTH24_STENCIL8"; 00491 00492 // ARB_depth_buffer_float 00493 case TF_DEPTH_COMPONENT32F: return "TF_DEPTH_COMPONENT32F"; 00494 case TF_DEPTH32F_STENCIL8 : return "TF_DEPTH32F_STENCIL8"; 00495 00496 // ARB_depth_texture 00497 case TF_DEPTH_COMPONENT : return "TF_DEPTH_COMPONENT"; 00498 case TF_DEPTH_COMPONENT16: return "TF_DEPTH_COMPONENT16"; 00499 case TF_DEPTH_COMPONENT24: return "TF_DEPTH_COMPONENT24"; 00500 case TF_DEPTH_COMPONENT32: return "TF_DEPTH_COMPONENT32"; 00501 00502 // ARB_texture_compression 00503 case TF_COMPRESSED_ALPHA : return "TF_COMPRESSED_ALPHA"; 00504 case TF_COMPRESSED_INTENSITY : return "TF_COMPRESSED_INTENSITY"; 00505 case TF_COMPRESSED_LUMINANCE : return "TF_COMPRESSED_LUMINANCE"; 00506 case TF_COMPRESSED_LUMINANCE_ALPHA: return "TF_COMPRESSED_LUMINANCE_ALPHA"; 00507 case TF_COMPRESSED_RGB : return "TF_COMPRESSED_RGB"; 00508 case TF_COMPRESSED_RGBA : return "TF_COMPRESSED_RGBA"; 00509 00510 // 3DFX_texture_compression_FXT1 00511 case TF_COMPRESSED_RGB_FXT1_3DFX : return "TF_COMPRESSED_RGB_FXT1_3DFX"; 00512 case TF_COMPRESSED_RGBA_FXT1_3DFX: return "TF_COMPRESSED_RGBA_FXT1_3DFX"; 00513 00514 // EXT_texture_compression_s3tc 00515 case TF_COMPRESSED_RGB_S3TC_DXT1_EXT : return "TF_COMPRESSED_RGB_S3TC_DXT1_EXT"; 00516 case TF_COMPRESSED_RGBA_S3TC_DXT1_EXT: return "TF_COMPRESSED_RGBA_S3TC_DXT1_EXT"; 00517 case TF_COMPRESSED_RGBA_S3TC_DXT3_EXT: return "TF_COMPRESSED_RGBA_S3TC_DXT3_EXT"; 00518 case TF_COMPRESSED_RGBA_S3TC_DXT5_EXT: return "TF_COMPRESSED_RGBA_S3TC_DXT5_EXT"; 00519 00520 // EXT_texture_compression_latc 00521 case TF_COMPRESSED_LUMINANCE_LATC1_EXT : return "TF_COMPRESSED_LUMINANCE_LATC1_EXT"; 00522 case TF_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT : return "TF_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT"; 00523 case TF_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT : return "TF_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT"; 00524 case TF_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return "TF_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT"; 00525 00526 // EXT_texture_compression_rgtc 00527 case TF_COMPRESSED_RED_RGTC1_EXT : return "TF_COMPRESSED_RED_RGTC1_EXT"; 00528 case TF_COMPRESSED_SIGNED_RED_RGTC1_EXT : return "TF_COMPRESSED_SIGNED_RED_RGTC1_EXT"; 00529 case TF_COMPRESSED_RED_GREEN_RGTC2_EXT : return "TF_COMPRESSED_RED_GREEN_RGTC2_EXT"; 00530 case TF_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: return "TF_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT"; 00531 00532 // EXT_texture_integer 00533 // case TF_RGBA32UI_EXT: return "TF_RGBA32UI_EXT"; 00534 // case TF_RGB32UI_EXT: return "TF_RGB32UI_EXT"; 00535 case TF_ALPHA32UI_EXT: return "TF_ALPHA32UI_EXT"; 00536 case TF_INTENSITY32UI_EXT: return "TF_INTENSITY32UI_EXT"; 00537 case TF_LUMINANCE32UI_EXT: return "TF_LUMINANCE32UI_EXT"; 00538 case TF_LUMINANCE_ALPHA32UI_EXT: return "TF_LUMINANCE_ALPHA32UI_EXT"; 00539 00540 // case TF_RGBA16UI_EXT: return "TF_RGBA16UI_EXT"; 00541 // case TF_RGB16UI_EXT: return "TF_RGB16UI_EXT"; 00542 case TF_ALPHA16UI_EXT: return "TF_ALPHA16UI_EXT"; 00543 case TF_INTENSITY16UI_EXT: return "TF_INTENSITY16UI_EXT"; 00544 case TF_LUMINANCE16UI_EXT: return "TF_LUMINANCE16UI_EXT"; 00545 case TF_LUMINANCE_ALPHA16UI_EXT: return "TF_LUMINANCE_ALPHA16UI_EXT"; 00546 00547 // case TF_RGBA8UI_EXT: return "TF_RGBA8UI_EXT"; 00548 // case TF_RGB8UI_EXT: return "TF_RGB8UI_EXT"; 00549 case TF_ALPHA8UI_EXT: return "TF_ALPHA8UI_EXT"; 00550 case TF_INTENSITY8UI_EXT: return "TF_INTENSITY8UI_EXT"; 00551 case TF_LUMINANCE8UI_EXT: return "TF_LUMINANCE8UI_EXT"; 00552 case TF_LUMINANCE_ALPHA8UI_EXT: return "TF_LUMINANCE_ALPHA8UI_EXT"; 00553 00554 // case TF_RGBA32I_EXT: return "TF_RGBA32I_EXT"; 00555 // case TF_RGB32I_EXT: return "TF_RGB32I_EXT"; 00556 case TF_ALPHA32I_EXT: return "TF_ALPHA32I_EXT"; 00557 case TF_INTENSITY32I_EXT: return "TF_INTENSITY32I_EXT"; 00558 case TF_LUMINANCE32I_EXT: return "TF_LUMINANCE32I_EXT"; 00559 case TF_LUMINANCE_ALPHA32I_EXT: return "TF_LUMINANCE_ALPHA32I_EXT"; 00560 00561 // case TF_RGBA16I_EXT: return "TF_RGBA16I_EXT"; 00562 // case TF_RGB16I_EXT: return "TF_RGB16I_EXT"; 00563 case TF_ALPHA16I_EXT: return "TF_ALPHA16I_EXT"; 00564 case TF_INTENSITY16I_EXT: return "TF_INTENSITY16I_EXT"; 00565 case TF_LUMINANCE16I_EXT: return "TF_LUMINANCE16I_EXT"; 00566 case TF_LUMINANCE_ALPHA16I_EXT: return "TF_LUMINANCE_ALPHA16I_EXT"; 00567 00568 // case TF_RGBA8I_EXT: return "TF_RGBA8I_EXT"; 00569 // case TF_RGB8I_EXT: return "TF_RGB8I_EXT"; 00570 case TF_ALPHA8I_EXT: return "TF_ALPHA8I_EXT"; 00571 case TF_INTENSITY8I_EXT: return "TF_INTENSITY8I_EXT"; 00572 case TF_LUMINANCE8I_EXT: return "TF_LUMINANCE8I_EXT"; 00573 case TF_LUMINANCE_ALPHA8I_EXT: return "TF_LUMINANCE_ALPHA8I_EXT"; 00574 00575 // GL_ARB_texture_rg 00576 case TF_RED: return "TF_RED"; 00577 case TF_COMPRESSED_RED: return "TF_COMPRESSED_RED"; 00578 case TF_COMPRESSED_RG: return "TF_COMPRESSED_RG"; 00579 case TF_RG: return "TF_RG"; 00580 case TF_R8: return "TF_R8"; 00581 case TF_R16: return "TF_R16"; 00582 case TF_RG8: return "TF_RG8"; 00583 case TF_RG16: return "TF_RG16"; 00584 case TF_R16F: return "TF_R16F"; 00585 case TF_R32F: return "TF_R32F"; 00586 case TF_RG16F: return "TF_RG16F"; 00587 case TF_RG32F: return "TF_RG32F"; 00588 case TF_R8I: return "TF_R8I"; 00589 case TF_R8UI: return "TF_R8UI"; 00590 case TF_R16I: return "TF_R16I"; 00591 case TF_R16UI: return "TF_R16UI"; 00592 case TF_R32I: return "TF_R32I"; 00593 case TF_R32UI: return "TF_R32UI"; 00594 case TF_RG8I: return "TF_RG8I"; 00595 case TF_RG8UI: return "TF_RG8UI"; 00596 case TF_RG16I: return "TF_RG16I"; 00597 case TF_RG16UI: return "TF_RG16UI"; 00598 case TF_RG32I: return "TF_RG32I"; 00599 case TF_RG32UI: return "TF_RG32UI"; 00600 00601 // sRGB OpenGL 2.1 00602 case TF_SLUMINANCE_ALPHA: return "TF_SLUMINANCE_ALPHA"; 00603 case TF_SLUMINANCE8_ALPHA8: return "TF_SLUMINANCE8_ALPHA8"; 00604 case TF_SLUMINANCE: return "TF_SLUMINANCE"; 00605 case TF_SLUMINANCE8: return "TF_SLUMINANCE8"; 00606 case TF_COMPRESSED_SLUMINANCE: return "TF_COMPRESSED_SLUMINANCE"; 00607 case TF_COMPRESSED_SLUMINANCE_ALPHA: return "TF_COMPRESSED_SLUMINANCE_ALPHA"; 00608 00609 // sRGB OpenGL 2.1 / 3.x 00610 case TF_SRGB: return "TF_SRGB"; 00611 case TF_SRGB8: return "TF_SRGB8"; 00612 case TF_SRGB_ALPHA: return "TF_SRGB_ALPHA"; 00613 case TF_SRGB8_ALPHA8: return "TF_SRGB8_ALPHA8"; 00614 case TF_COMPRESSED_SRGB: return "TF_COMPRESSED_SRGB"; 00615 case TF_COMPRESSED_SRGB_ALPHA: return "TF_COMPRESSED_SRGB_ALPHA"; 00616 00617 // GL_EXT_texture_sRGB compressed formats 00618 case TF_COMPRESSED_SRGB_S3TC_DXT1_EXT: return "TF_COMPRESSED_SRGB_S3TC_DXT1_EXT"; 00619 case TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"; 00620 case TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"; 00621 case TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"; 00622 } 00623 } 00624 00625 inline ETextureFormat vlx_ETextureFormat(const VLXValue& value, VLXSerializer& s) 00626 { 00627 if( value.getIdentifier() == "TF_UNKNOWN") return TF_UNKNOWN; 00628 00629 if( value.getIdentifier() == "TF_ALPHA") return TF_ALPHA; 00630 if( value.getIdentifier() == "TF_ALPHA4") return TF_ALPHA4; 00631 if( value.getIdentifier() == "TF_ALPHA8") return TF_ALPHA8; 00632 if( value.getIdentifier() == "TF_ALPHA12") return TF_ALPHA12; 00633 if( value.getIdentifier() == "TF_ALPHA16") return TF_ALPHA16; 00634 00635 if( value.getIdentifier() == "TF_INTENSITY") return TF_INTENSITY; 00636 if( value.getIdentifier() == "TF_INTENSITY4") return TF_INTENSITY4; 00637 if( value.getIdentifier() == "TF_INTENSITY8") return TF_INTENSITY8; 00638 if( value.getIdentifier() == "TF_INTENSITY12") return TF_INTENSITY12; 00639 if( value.getIdentifier() == "TF_INTENSITY16") return TF_INTENSITY16; 00640 if( value.getIdentifier() == "TF_LUMINANCE") return TF_LUMINANCE; 00641 if( value.getIdentifier() == "TF_LUMINANCE4") return TF_LUMINANCE4; 00642 if( value.getIdentifier() == "TF_LUMINANCE8") return TF_LUMINANCE8; 00643 if( value.getIdentifier() == "TF_LUMINANCE12") return TF_LUMINANCE12; 00644 if( value.getIdentifier() == "TF_LUMINANCE16") return TF_LUMINANCE16; 00645 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA") return TF_LUMINANCE_ALPHA; 00646 if( value.getIdentifier() == "TF_LUMINANCE4_ALPHA4") return TF_LUMINANCE4_ALPHA4; 00647 if( value.getIdentifier() == "TF_LUMINANCE6_ALPHA2") return TF_LUMINANCE6_ALPHA2; 00648 if( value.getIdentifier() == "TF_LUMINANCE8_ALPHA8") return TF_LUMINANCE8_ALPHA8; 00649 if( value.getIdentifier() == "TF_LUMINANCE12_ALPHA4") return TF_LUMINANCE12_ALPHA4; 00650 if( value.getIdentifier() == "TF_LUMINANCE12_ALPHA12") return TF_LUMINANCE12_ALPHA12; 00651 if( value.getIdentifier() == "TF_LUMINANCE16_ALPHA16") return TF_LUMINANCE16_ALPHA16; 00652 if( value.getIdentifier() == "TF_R3_G3_B2") return TF_R3_G3_B2; 00653 if( value.getIdentifier() == "TF_RGB") return TF_RGB; 00654 if( value.getIdentifier() == "TF_RGB4") return TF_RGB4; 00655 if( value.getIdentifier() == "TF_RGB5") return TF_RGB5; 00656 if( value.getIdentifier() == "TF_RGB8") return TF_RGB8; 00657 if( value.getIdentifier() == "TF_RGB10") return TF_RGB10; 00658 if( value.getIdentifier() == "TF_RGB12") return TF_RGB12; 00659 if( value.getIdentifier() == "TF_RGB16") return TF_RGB16; 00660 if( value.getIdentifier() == "TF_RGBA") return TF_RGBA; 00661 if( value.getIdentifier() == "TF_RGBA2") return TF_RGBA2; 00662 if( value.getIdentifier() == "TF_RGBA4") return TF_RGBA4; 00663 if( value.getIdentifier() == "TF_RGB5_A1") return TF_RGB5_A1; 00664 if( value.getIdentifier() == "TF_RGBA8") return TF_RGBA8; 00665 if( value.getIdentifier() == "TF_RGB10_A2") return TF_RGB10_A2; 00666 if( value.getIdentifier() == "TF_RGBA12") return TF_RGBA12; 00667 if( value.getIdentifier() == "TF_RGBA16") return TF_RGBA16; 00668 00669 // ARB_texture_float / OpenGL 3 00670 if( value.getIdentifier() == "TF_RGBA32F") return TF_RGBA32F; 00671 if( value.getIdentifier() == "TF_RGB32F") return TF_RGB32F; 00672 if( value.getIdentifier() == "TF_ALPHA32F") return TF_ALPHA32F; 00673 if( value.getIdentifier() == "TF_INTENSITY32F") return TF_INTENSITY32F; 00674 if( value.getIdentifier() == "TF_LUMINANCE32F") return TF_LUMINANCE32F; 00675 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA32F") return TF_LUMINANCE_ALPHA32F; 00676 if( value.getIdentifier() == "TF_RGBA16F") return TF_RGBA16F; 00677 if( value.getIdentifier() == "TF_RGB16F") return TF_RGB16F; 00678 if( value.getIdentifier() == "TF_ALPHA16F") return TF_ALPHA16F; 00679 if( value.getIdentifier() == "TF_INTENSITY16F") return TF_INTENSITY16F; 00680 if( value.getIdentifier() == "TF_LUMINANCE16F") return TF_LUMINANCE16F; 00681 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA16F") return TF_LUMINANCE_ALPHA16F; 00682 00683 // from table 3.12 opengl api specs 4.1 00684 if( value.getIdentifier() == "TF_R8_SNORM") return TF_R8_SNORM; 00685 if( value.getIdentifier() == "TF_R16_SNORM") return TF_R16_SNORM; 00686 if( value.getIdentifier() == "TF_RG8_SNORM") return TF_RG8_SNORM; 00687 if( value.getIdentifier() == "TF_RG16_SNORM") return TF_RG16_SNORM; 00688 if( value.getIdentifier() == "TF_RGB8_SNORM") return TF_RGB8_SNORM; 00689 if( value.getIdentifier() == "TF_RGBA8_SNORM") return TF_RGBA8_SNORM; 00690 if( value.getIdentifier() == "TF_RGB10_A2UI") return TF_RGB10_A2UI; 00691 if( value.getIdentifier() == "TF_RGBA16_SNORM") return TF_RGBA16_SNORM; 00692 if( value.getIdentifier() == "TF_R11F_G11F_B10F") return TF_R11F_G11F_B10F; 00693 if( value.getIdentifier() == "TF_RGB9_E5") return TF_RGB9_E5; 00694 if( value.getIdentifier() == "TF_RGB8I") return TF_RGB8I; 00695 if( value.getIdentifier() == "TF_RGB8UI") return TF_RGB8UI; 00696 if( value.getIdentifier() == "TF_RGB16I") return TF_RGB16I; 00697 if( value.getIdentifier() == "TF_RGB16UI") return TF_RGB16UI; 00698 if( value.getIdentifier() == "TF_RGB32I") return TF_RGB32I; 00699 if( value.getIdentifier() == "TF_RGB32UI") return TF_RGB32UI; 00700 if( value.getIdentifier() == "TF_RGBA8I") return TF_RGBA8I; 00701 if( value.getIdentifier() == "TF_RGBA8UI") return TF_RGBA8UI; 00702 if( value.getIdentifier() == "TF_RGBA16I") return TF_RGBA16I; 00703 if( value.getIdentifier() == "TF_RGBA16UI") return TF_RGBA16UI; 00704 if( value.getIdentifier() == "TF_RGBA32I") return TF_RGBA32I; 00705 if( value.getIdentifier() == "TF_RGBA32UI") return TF_RGBA32UI; 00706 00707 // ATI_texture_float (the enums are the same as ARB_texture_float) 00708 if( value.getIdentifier() == "TF_RGBA_FLOAT32_ATI") return TF_RGBA_FLOAT32_ATI; 00709 if( value.getIdentifier() == "TF_RGB_FLOAT32_ATI") return TF_RGB_FLOAT32_ATI; 00710 if( value.getIdentifier() == "TF_ALPHA_FLOAT32_ATI") return TF_ALPHA_FLOAT32_ATI; 00711 if( value.getIdentifier() == "TF_INTENSITY_FLOAT32_ATI") return TF_INTENSITY_FLOAT32_ATI; 00712 if( value.getIdentifier() == "TF_LUMINANCE_FLOAT32_ATI") return TF_LUMINANCE_FLOAT32_ATI; 00713 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA_FLOAT32_ATI") return TF_LUMINANCE_ALPHA_FLOAT32_ATI; 00714 if( value.getIdentifier() == "TF_RGBA_FLOAT16_ATI") return TF_RGBA_FLOAT16_ATI; 00715 if( value.getIdentifier() == "TF_RGB_FLOAT16_ATI") return TF_RGB_FLOAT16_ATI; 00716 if( value.getIdentifier() == "TF_ALPHA_FLOAT16_ATI") return TF_ALPHA_FLOAT16_ATI; 00717 if( value.getIdentifier() == "TF_INTENSITY_FLOAT16_ATI") return TF_INTENSITY_FLOAT16_ATI; 00718 if( value.getIdentifier() == "TF_LUMINANCE_FLOAT16_ATI") return TF_LUMINANCE_FLOAT16_ATI; 00719 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA_FLOAT16_ATI") return TF_LUMINANCE_ALPHA_FLOAT16_ATI; 00720 00721 // EXT_texture_shared_exponent 00722 if( value.getIdentifier() == "TF_RGB9_E5_EXT") return TF_RGB9_E5_EXT; 00723 00724 // EXT_packed_float 00725 if( value.getIdentifier() == "TF_11F_G11F_B10F_EXT") return TF_11F_G11F_B10F_EXT; 00726 00727 // EXT_packed_depth_stencil / GL_ARB_framebuffer_object 00728 if( value.getIdentifier() == "TF_DEPTH_STENCIL") return TF_DEPTH_STENCIL; 00729 if( value.getIdentifier() == "TF_DEPTH24_STENCIL8") return TF_DEPTH24_STENCIL8; 00730 00731 // ARB_depth_buffer_float 00732 if( value.getIdentifier() == "TF_DEPTH_COMPONENT32F") return TF_DEPTH_COMPONENT32F; 00733 if( value.getIdentifier() == "TF_DEPTH32F_STENCIL8") return TF_DEPTH32F_STENCIL8; 00734 00735 // ARB_depth_texture 00736 if( value.getIdentifier() == "TF_DEPTH_COMPONENT") return TF_DEPTH_COMPONENT; 00737 if( value.getIdentifier() == "TF_DEPTH_COMPONENT16") return TF_DEPTH_COMPONENT16; 00738 if( value.getIdentifier() == "TF_DEPTH_COMPONENT24") return TF_DEPTH_COMPONENT24; 00739 if( value.getIdentifier() == "TF_DEPTH_COMPONENT32") return TF_DEPTH_COMPONENT32; 00740 00741 // ARB_texture_compression 00742 if( value.getIdentifier() == "TF_COMPRESSED_ALPHA") return TF_COMPRESSED_ALPHA; 00743 if( value.getIdentifier() == "TF_COMPRESSED_INTENSITY") return TF_COMPRESSED_INTENSITY; 00744 if( value.getIdentifier() == "TF_COMPRESSED_LUMINANCE") return TF_COMPRESSED_LUMINANCE; 00745 if( value.getIdentifier() == "TF_COMPRESSED_LUMINANCE_ALPHA") return TF_COMPRESSED_LUMINANCE_ALPHA; 00746 if( value.getIdentifier() == "TF_COMPRESSED_RGB") return TF_COMPRESSED_RGB; 00747 if( value.getIdentifier() == "TF_COMPRESSED_RGBA") return TF_COMPRESSED_RGBA; 00748 00749 // 3DFX_texture_compression_FXT1 00750 if( value.getIdentifier() == "TF_COMPRESSED_RGB_FXT1_3DFX") return TF_COMPRESSED_RGB_FXT1_3DFX; 00751 if( value.getIdentifier() == "TF_COMPRESSED_RGBA_FXT1_3DFX") return TF_COMPRESSED_RGBA_FXT1_3DFX; 00752 00753 // EXT_texture_compression_s3tc 00754 if( value.getIdentifier() == "TF_COMPRESSED_RGB_S3TC_DXT1_EXT") return TF_COMPRESSED_RGB_S3TC_DXT1_EXT; 00755 if( value.getIdentifier() == "TF_COMPRESSED_RGBA_S3TC_DXT1_EXT") return TF_COMPRESSED_RGBA_S3TC_DXT1_EXT; 00756 if( value.getIdentifier() == "TF_COMPRESSED_RGBA_S3TC_DXT3_EXT") return TF_COMPRESSED_RGBA_S3TC_DXT3_EXT; 00757 if( value.getIdentifier() == "TF_COMPRESSED_RGBA_S3TC_DXT5_EXT") return TF_COMPRESSED_RGBA_S3TC_DXT5_EXT; 00758 00759 // EXT_texture_compression_latc 00760 if( value.getIdentifier() == "TF_COMPRESSED_LUMINANCE_LATC1_EXT") return TF_COMPRESSED_LUMINANCE_LATC1_EXT; 00761 if( value.getIdentifier() == "TF_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT") return TF_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; 00762 if( value.getIdentifier() == "TF_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT") return TF_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; 00763 if( value.getIdentifier() == "TF_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT") return TF_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; 00764 00765 // EXT_texture_compression_rgtc 00766 if( value.getIdentifier() == "TF_COMPRESSED_RED_RGTC1_EXT") return TF_COMPRESSED_RED_RGTC1_EXT; 00767 if( value.getIdentifier() == "TF_COMPRESSED_SIGNED_RED_RGTC1_EXT") return TF_COMPRESSED_SIGNED_RED_RGTC1_EXT; 00768 if( value.getIdentifier() == "TF_COMPRESSED_RED_GREEN_RGTC2_EXT") return TF_COMPRESSED_RED_GREEN_RGTC2_EXT; 00769 if( value.getIdentifier() == "TF_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT") return TF_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; 00770 00771 // EXT_texture_integer 00772 if( value.getIdentifier() == "TF_RGBA32UI_EXT") return TF_RGBA32UI_EXT; 00773 if( value.getIdentifier() == "TF_RGB32UI_EXT") return TF_RGB32UI_EXT; 00774 if( value.getIdentifier() == "TF_ALPHA32UI_EXT") return TF_ALPHA32UI_EXT; 00775 if( value.getIdentifier() == "TF_INTENSITY32UI_EXT") return TF_INTENSITY32UI_EXT; 00776 if( value.getIdentifier() == "TF_LUMINANCE32UI_EXT") return TF_LUMINANCE32UI_EXT; 00777 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA32UI_EXT") return TF_LUMINANCE_ALPHA32UI_EXT; 00778 00779 if( value.getIdentifier() == "TF_RGBA16UI_EXT") return TF_RGBA16UI_EXT; 00780 if( value.getIdentifier() == "TF_RGB16UI_EXT") return TF_RGB16UI_EXT; 00781 if( value.getIdentifier() == "TF_ALPHA16UI_EXT") return TF_ALPHA16UI_EXT; 00782 if( value.getIdentifier() == "TF_INTENSITY16UI_EXT") return TF_INTENSITY16UI_EXT; 00783 if( value.getIdentifier() == "TF_LUMINANCE16UI_EXT") return TF_LUMINANCE16UI_EXT; 00784 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA16UI_EXT") return TF_LUMINANCE_ALPHA16UI_EXT; 00785 00786 if( value.getIdentifier() == "TF_RGBA8UI_EXT") return TF_RGBA8UI_EXT; 00787 if( value.getIdentifier() == "TF_RGB8UI_EXT") return TF_RGB8UI_EXT; 00788 if( value.getIdentifier() == "TF_ALPHA8UI_EXT") return TF_ALPHA8UI_EXT; 00789 if( value.getIdentifier() == "TF_INTENSITY8UI_EXT") return TF_INTENSITY8UI_EXT; 00790 if( value.getIdentifier() == "TF_LUMINANCE8UI_EXT") return TF_LUMINANCE8UI_EXT; 00791 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA8UI_EXT") return TF_LUMINANCE_ALPHA8UI_EXT; 00792 00793 if( value.getIdentifier() == "TF_RGBA32I_EXT") return TF_RGBA32I_EXT; 00794 if( value.getIdentifier() == "TF_RGB32I_EXT") return TF_RGB32I_EXT; 00795 if( value.getIdentifier() == "TF_ALPHA32I_EXT") return TF_ALPHA32I_EXT; 00796 if( value.getIdentifier() == "TF_INTENSITY32I_EXT") return TF_INTENSITY32I_EXT; 00797 if( value.getIdentifier() == "TF_LUMINANCE32I_EXT") return TF_LUMINANCE32I_EXT; 00798 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA32I_EXT") return TF_LUMINANCE_ALPHA32I_EXT; 00799 00800 if( value.getIdentifier() == "TF_RGBA16I_EXT") return TF_RGBA16I_EXT; 00801 if( value.getIdentifier() == "TF_RGB16I_EXT") return TF_RGB16I_EXT; 00802 if( value.getIdentifier() == "TF_ALPHA16I_EXT") return TF_ALPHA16I_EXT; 00803 if( value.getIdentifier() == "TF_INTENSITY16I_EXT") return TF_INTENSITY16I_EXT; 00804 if( value.getIdentifier() == "TF_LUMINANCE16I_EXT") return TF_LUMINANCE16I_EXT; 00805 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA16I_EXT") return TF_LUMINANCE_ALPHA16I_EXT; 00806 00807 if( value.getIdentifier() == "TF_RGBA8I_EXT") return TF_RGBA8I_EXT; 00808 if( value.getIdentifier() == "TF_RGB8I_EXT") return TF_RGB8I_EXT; 00809 if( value.getIdentifier() == "TF_ALPHA8I_EXT") return TF_ALPHA8I_EXT; 00810 if( value.getIdentifier() == "TF_INTENSITY8I_EXT") return TF_INTENSITY8I_EXT; 00811 if( value.getIdentifier() == "TF_LUMINANCE8I_EXT") return TF_LUMINANCE8I_EXT; 00812 if( value.getIdentifier() == "TF_LUMINANCE_ALPHA8I_EXT") return TF_LUMINANCE_ALPHA8I_EXT; 00813 00814 // GL_ARB_texture_rg 00815 if( value.getIdentifier() == "TF_RED") return TF_RED; 00816 if( value.getIdentifier() == "TF_COMPRESSED_RED") return TF_COMPRESSED_RED; 00817 if( value.getIdentifier() == "TF_COMPRESSED_RG") return TF_COMPRESSED_RG; 00818 if( value.getIdentifier() == "TF_RG") return TF_RG; 00819 if( value.getIdentifier() == "TF_R8") return TF_R8; 00820 if( value.getIdentifier() == "TF_R16") return TF_R16; 00821 if( value.getIdentifier() == "TF_RG8") return TF_RG8; 00822 if( value.getIdentifier() == "TF_RG16") return TF_RG16; 00823 if( value.getIdentifier() == "TF_R16F") return TF_R16F; 00824 if( value.getIdentifier() == "TF_R32F") return TF_R32F; 00825 if( value.getIdentifier() == "TF_RG16F") return TF_RG16F; 00826 if( value.getIdentifier() == "TF_RG32F") return TF_RG32F; 00827 if( value.getIdentifier() == "TF_R8I") return TF_R8I; 00828 if( value.getIdentifier() == "TF_R8UI") return TF_R8UI; 00829 if( value.getIdentifier() == "TF_R16I") return TF_R16I; 00830 if( value.getIdentifier() == "TF_R16UI") return TF_R16UI; 00831 if( value.getIdentifier() == "TF_R32I") return TF_R32I; 00832 if( value.getIdentifier() == "TF_R32UI") return TF_R32UI; 00833 if( value.getIdentifier() == "TF_RG8I") return TF_RG8I; 00834 if( value.getIdentifier() == "TF_RG8UI") return TF_RG8UI; 00835 if( value.getIdentifier() == "TF_RG16I") return TF_RG16I; 00836 if( value.getIdentifier() == "TF_RG16UI") return TF_RG16UI; 00837 if( value.getIdentifier() == "TF_RG32I") return TF_RG32I; 00838 if( value.getIdentifier() == "TF_RG32UI") return TF_RG32UI; 00839 00840 // sRGB OpenGL 2.1 00841 if( value.getIdentifier() == "TF_SLUMINANCE_ALPHA") return TF_SLUMINANCE_ALPHA; 00842 if( value.getIdentifier() == "TF_SLUMINANCE8_ALPHA8") return TF_SLUMINANCE8_ALPHA8; 00843 if( value.getIdentifier() == "TF_SLUMINANCE") return TF_SLUMINANCE; 00844 if( value.getIdentifier() == "TF_SLUMINANCE8") return TF_SLUMINANCE8; 00845 if( value.getIdentifier() == "TF_COMPRESSED_SLUMINANCE") return TF_COMPRESSED_SLUMINANCE; 00846 if( value.getIdentifier() == "TF_COMPRESSED_SLUMINANCE_ALPHA") return TF_COMPRESSED_SLUMINANCE_ALPHA; 00847 00848 // sRGB OpenGL 2.1 / 3.x 00849 if( value.getIdentifier() == "TF_SRGB") return TF_SRGB; 00850 if( value.getIdentifier() == "TF_SRGB8") return TF_SRGB8; 00851 if( value.getIdentifier() == "TF_SRGB_ALPHA") return TF_SRGB_ALPHA; 00852 if( value.getIdentifier() == "TF_SRGB8_ALPHA8") return TF_SRGB8_ALPHA8; 00853 if( value.getIdentifier() == "TF_COMPRESSED_SRGB") return TF_COMPRESSED_SRGB; 00854 if( value.getIdentifier() == "TF_COMPRESSED_SRGB_ALPHA") return TF_COMPRESSED_SRGB_ALPHA; 00855 00856 // GL_EXT_texture_sRGB compressed formats 00857 if( value.getIdentifier() == "TF_COMPRESSED_SRGB_S3TC_DXT1_EXT") return TF_COMPRESSED_SRGB_S3TC_DXT1_EXT; 00858 if( value.getIdentifier() == "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT") return TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; 00859 if( value.getIdentifier() == "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT") return TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; 00860 if( value.getIdentifier() == "TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT") return TF_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; 00861 00862 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00863 s.setError(VLXSerializer::ImportError); 00864 return TF_UNKNOWN; 00865 } 00866 00867 inline const char* vlx_EUniformType(EUniformType type) 00868 { 00869 switch(type) 00870 { 00871 default: 00872 return "UT_NONE"; 00873 00874 case UT_INT: return "UT_INT"; 00875 case UT_INT_VEC2: return "UT_INT_VEC2"; 00876 case UT_INT_VEC3: return "UT_INT_VEC3"; 00877 case UT_INT_VEC4: return "UT_INT_VEC4"; 00878 00879 case UT_UNSIGNED_INT: return "UT_UNSIGNED_INT"; 00880 case UT_UNSIGNED_INT_VEC2: return "UT_UNSIGNED_INT_VEC2"; 00881 case UT_UNSIGNED_INT_VEC3: return "UT_UNSIGNED_INT_VEC3"; 00882 case UT_UNSIGNED_INT_VEC4: return "UT_UNSIGNED_INT_VEC4"; 00883 00884 case UT_FLOAT: return "UT_FLOAT"; 00885 case UT_FLOAT_VEC2: return "UT_FLOAT_VEC2"; 00886 case UT_FLOAT_VEC3: return "UT_FLOAT_VEC3"; 00887 case UT_FLOAT_VEC4: return "UT_FLOAT_VEC4"; 00888 00889 case UT_FLOAT_MAT2: return "UT_FLOAT_MAT2"; 00890 case UT_FLOAT_MAT3: return "UT_FLOAT_MAT3"; 00891 case UT_FLOAT_MAT4: return "UT_FLOAT_MAT4"; 00892 00893 case UT_FLOAT_MAT2x3: return "UT_FLOAT_MAT2x3"; 00894 case UT_FLOAT_MAT3x2: return "UT_FLOAT_MAT3x2"; 00895 case UT_FLOAT_MAT2x4: return "UT_FLOAT_MAT2x4"; 00896 case UT_FLOAT_MAT4x2: return "UT_FLOAT_MAT4x2"; 00897 case UT_FLOAT_MAT3x4: return "UT_FLOAT_MAT3x4"; 00898 case UT_FLOAT_MAT4x3: return "UT_FLOAT_MAT4x3"; 00899 00900 case UT_DOUBLE: return "UT_DOUBLE"; 00901 case UT_DOUBLE_VEC2: return "UT_DOUBLE_VEC2"; 00902 case UT_DOUBLE_VEC3: return "UT_DOUBLE_VEC3"; 00903 case UT_DOUBLE_VEC4: return "UT_DOUBLE_VEC4"; 00904 00905 case UT_DOUBLE_MAT2: return "UT_DOUBLE_MAT2"; 00906 case UT_DOUBLE_MAT3: return "UT_DOUBLE_MAT3"; 00907 case UT_DOUBLE_MAT4: return "UT_DOUBLE_MAT4"; 00908 00909 case UT_DOUBLE_MAT2x3: return "UT_DOUBLE_MAT2x3"; 00910 case UT_DOUBLE_MAT3x2: return "UT_DOUBLE_MAT3x2"; 00911 case UT_DOUBLE_MAT2x4: return "UT_DOUBLE_MAT2x4"; 00912 case UT_DOUBLE_MAT4x2: return "UT_DOUBLE_MAT4x2"; 00913 case UT_DOUBLE_MAT3x4: return "UT_DOUBLE_MAT3x4"; 00914 case UT_DOUBLE_MAT4x3: return "UT_DOUBLE_MAT4x3"; 00915 } 00916 } 00917 00918 inline EUniformType vlx_EUniformType(const VLXValue& value, VLXSerializer& s) 00919 { 00920 if( value.getIdentifier() == "UT_INT") return UT_INT; 00921 if( value.getIdentifier() == "UT_INT_VEC2") return UT_INT_VEC2; 00922 if( value.getIdentifier() == "UT_INT_VEC3") return UT_INT_VEC3; 00923 if( value.getIdentifier() == "UT_INT_VEC4") return UT_INT_VEC4; 00924 00925 if( value.getIdentifier() == "UT_UNSIGNED_INT") return UT_UNSIGNED_INT; 00926 if( value.getIdentifier() == "UT_UNSIGNED_INT_VEC2") return UT_UNSIGNED_INT_VEC2; 00927 if( value.getIdentifier() == "UT_UNSIGNED_INT_VEC3") return UT_UNSIGNED_INT_VEC3; 00928 if( value.getIdentifier() == "UT_UNSIGNED_INT_VEC4") return UT_UNSIGNED_INT_VEC4; 00929 00930 if( value.getIdentifier() == "UT_FLOAT") return UT_FLOAT; 00931 if( value.getIdentifier() == "UT_FLOAT_VEC2") return UT_FLOAT_VEC2; 00932 if( value.getIdentifier() == "UT_FLOAT_VEC3") return UT_FLOAT_VEC3; 00933 if( value.getIdentifier() == "UT_FLOAT_VEC4") return UT_FLOAT_VEC4; 00934 00935 if( value.getIdentifier() == "UT_FLOAT_MAT2") return UT_FLOAT_MAT2; 00936 if( value.getIdentifier() == "UT_FLOAT_MAT3") return UT_FLOAT_MAT3; 00937 if( value.getIdentifier() == "UT_FLOAT_MAT4") return UT_FLOAT_MAT4; 00938 00939 if( value.getIdentifier() == "UT_FLOAT_MAT2x3") return UT_FLOAT_MAT2x3; 00940 if( value.getIdentifier() == "UT_FLOAT_MAT3x2") return UT_FLOAT_MAT3x2; 00941 if( value.getIdentifier() == "UT_FLOAT_MAT2x4") return UT_FLOAT_MAT2x4; 00942 if( value.getIdentifier() == "UT_FLOAT_MAT4x2") return UT_FLOAT_MAT4x2; 00943 if( value.getIdentifier() == "UT_FLOAT_MAT3x4") return UT_FLOAT_MAT3x4; 00944 if( value.getIdentifier() == "UT_FLOAT_MAT4x3") return UT_FLOAT_MAT4x3; 00945 00946 if( value.getIdentifier() == "UT_DOUBLE") return UT_DOUBLE; 00947 if( value.getIdentifier() == "UT_DOUBLE_VEC2") return UT_DOUBLE_VEC2; 00948 if( value.getIdentifier() == "UT_DOUBLE_VEC3") return UT_DOUBLE_VEC3; 00949 if( value.getIdentifier() == "UT_DOUBLE_VEC4") return UT_DOUBLE_VEC4; 00950 00951 if( value.getIdentifier() == "UT_DOUBLE_MAT2") return UT_DOUBLE_MAT2; 00952 if( value.getIdentifier() == "UT_DOUBLE_MAT3") return UT_DOUBLE_MAT3; 00953 if( value.getIdentifier() == "UT_DOUBLE_MAT4") return UT_DOUBLE_MAT4; 00954 00955 if( value.getIdentifier() == "UT_DOUBLE_MAT2x3") return UT_DOUBLE_MAT2x3; 00956 if( value.getIdentifier() == "UT_DOUBLE_MAT3x2") return UT_DOUBLE_MAT3x2; 00957 if( value.getIdentifier() == "UT_DOUBLE_MAT2x4") return UT_DOUBLE_MAT2x4; 00958 if( value.getIdentifier() == "UT_DOUBLE_MAT4x2") return UT_DOUBLE_MAT4x2; 00959 if( value.getIdentifier() == "UT_DOUBLE_MAT3x4") return UT_DOUBLE_MAT3x4; 00960 if( value.getIdentifier() == "UT_DOUBLE_MAT4x3") return UT_DOUBLE_MAT4x3; 00961 00962 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00963 s.setError(VLXSerializer::ImportError); 00964 return UT_NONE; 00965 } 00966 00967 inline const char* vlx_EDepthTextureMode(EDepthTextureMode dtm) 00968 { 00969 switch(dtm) 00970 { 00971 default: 00972 case DTM_RED: return "DTM_RED"; 00973 case DTM_LUMINANCE: return "DTM_LUMINANCE"; 00974 case DTM_INTENSITY: return "DTM_INTENSITY"; 00975 case DTM_ALPHA: return "DTM_ALPHA"; 00976 } 00977 } 00978 00979 inline EDepthTextureMode vlx_EDepthTextureMode(const VLXValue& value, VLXSerializer& s) 00980 { 00981 if( value.getIdentifier() == "DTM_LUMINANCE") return DTM_LUMINANCE; 00982 if( value.getIdentifier() == "DTM_INTENSITY") return DTM_INTENSITY; 00983 if( value.getIdentifier() == "DTM_ALPHA") return DTM_ALPHA; 00984 if( value.getIdentifier() == "DTM_RED") return DTM_RED; 00985 00986 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 00987 s.setError(VLXSerializer::ImportError); 00988 return DTM_RED; 00989 } 00990 00991 inline const char* vlx_ETexCompareMode(ETexCompareMode tcm) 00992 { 00993 switch(tcm) 00994 { 00995 default: 00996 case TCM_NONE: return "TCM_NONE"; 00997 // case TCM_COMPARE_R_TO_TEXTURE: return "TCM_COMPARE_R_TO_TEXTURE"; 00998 case TCM_COMPARE_REF_DEPTH_TO_TEXTURE: return "TCM_COMPARE_REF_DEPTH_TO_TEXTURE"; 00999 } 01000 } 01001 01002 inline ETexCompareMode vlx_ETexCompareMode(const VLXValue& value, VLXSerializer& s) 01003 { 01004 if( value.getIdentifier() == "TCM_COMPARE_R_TO_TEXTURE") return TCM_COMPARE_R_TO_TEXTURE; 01005 if( value.getIdentifier() == "TCM_COMPARE_REF_DEPTH_TO_TEXTURE") return TCM_COMPARE_REF_DEPTH_TO_TEXTURE; 01006 if( value.getIdentifier() == "TCM_NONE") return TCM_NONE; 01007 01008 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01009 s.setError(VLXSerializer::ImportError); 01010 return TCM_NONE; 01011 } 01012 01013 inline const char* vlx_ETexCompareFunc(ETexCompareFunc tcf) 01014 { 01015 switch(tcf) 01016 { 01017 default: 01018 case TCF_LEQUAL: return "TCF_LEQUAL"; 01019 case TCF_GEQUAL: return "TCF_GEQUAL"; 01020 case TCF_LESS: return "TCF_LESS"; 01021 case TCF_GREATER: return "TCF_GREATER"; 01022 case TCF_EQUAL: return "TCF_EQUAL"; 01023 case TCF_NOTEQUAL: return "TCF_NOTEQUAL"; 01024 case TCF_ALWAYS: return "TCF_ALWAYS"; 01025 case TCF_NEVER: return "TCF_NEVER"; 01026 } 01027 } 01028 01029 inline ETexCompareFunc vlx_ETexCompareFunc(const VLXValue& value, VLXSerializer& s) 01030 { 01031 if( value.getIdentifier() == "TCF_GEQUAL") return TCF_GEQUAL; 01032 if( value.getIdentifier() == "TCF_LESS") return TCF_LESS; 01033 if( value.getIdentifier() == "TCF_GREATER") return TCF_GREATER; 01034 if( value.getIdentifier() == "TCF_EQUAL") return TCF_EQUAL; 01035 if( value.getIdentifier() == "TCF_NOTEQUAL") return TCF_NOTEQUAL; 01036 if( value.getIdentifier() == "TCF_ALWAYS") return TCF_ALWAYS; 01037 if( value.getIdentifier() == "TCF_NEVER") return TCF_NEVER; 01038 if( value.getIdentifier() == "TCF_LEQUAL") return TCF_LEQUAL; 01039 01040 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01041 s.setError(VLXSerializer::ImportError); 01042 return TCF_LEQUAL; 01043 } 01044 01045 inline const char* vlx_ETexParamFilter(ETexParamFilter tpf) 01046 { 01047 switch(tpf) 01048 { 01049 default: 01050 case TPF_NEAREST: return "TPF_NEAREST"; 01051 case TPF_LINEAR: return "TPF_LINEAR"; 01052 case TPF_NEAREST_MIPMAP_NEAREST: return "TPF_NEAREST_MIPMAP_NEAREST"; 01053 case TPF_LINEAR_MIPMAP_NEAREST: return "TPF_LINEAR_MIPMAP_NEAREST"; 01054 case TPF_NEAREST_MIPMAP_LINEAR: return "TPF_NEAREST_MIPMAP_LINEAR"; 01055 case TPF_LINEAR_MIPMAP_LINEAR: return "TPF_LINEAR_MIPMAP_LINEAR"; 01056 } 01057 } 01058 01059 inline ETexParamFilter vlx_ETexParamFilter(const VLXValue& value, VLXSerializer& s) 01060 { 01061 if( value.getIdentifier() == "TPF_LINEAR") return TPF_LINEAR; 01062 if( value.getIdentifier() == "TPF_NEAREST_MIPMAP_NEAREST") return TPF_NEAREST_MIPMAP_NEAREST; 01063 if( value.getIdentifier() == "TPF_LINEAR_MIPMAP_NEAREST") return TPF_LINEAR_MIPMAP_NEAREST; 01064 if( value.getIdentifier() == "TPF_NEAREST_MIPMAP_LINEAR") return TPF_NEAREST_MIPMAP_LINEAR; 01065 if( value.getIdentifier() == "TPF_LINEAR_MIPMAP_LINEAR") return TPF_LINEAR_MIPMAP_LINEAR; 01066 if( value.getIdentifier() == "TPF_NEAREST") return TPF_NEAREST; 01067 01068 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01069 s.setError(VLXSerializer::ImportError); 01070 return TPF_NEAREST; 01071 } 01072 01073 inline const char* vlx_ETexParamWrap(ETexParamWrap tpw) 01074 { 01075 switch(tpw) 01076 { 01077 default: 01078 case TPW_REPEAT: return "TPW_REPEAT"; 01079 case TPW_CLAMP: return "TPW_CLAMP"; 01080 case TPW_CLAMP_TO_BORDER: return "TPW_CLAMP_TO_BORDER"; 01081 case TPW_CLAMP_TO_EDGE: return "TPW_CLAMP_TO_EDGE"; 01082 case TPW_MIRRORED_REPEAT: return "TPW_MIRRORED_REPEAT"; 01083 } 01084 } 01085 01086 inline ETexParamWrap vlx_ETexParamWrap(const VLXValue& value, VLXSerializer& s) 01087 { 01088 if( value.getIdentifier() == "TPW_CLAMP") return TPW_CLAMP; 01089 if( value.getIdentifier() == "TPW_CLAMP_TO_BORDER") return TPW_CLAMP_TO_BORDER; 01090 if( value.getIdentifier() == "TPW_CLAMP_TO_EDGE") return TPW_CLAMP_TO_EDGE; 01091 if( value.getIdentifier() == "TPW_MIRRORED_REPEAT") return TPW_MIRRORED_REPEAT; 01092 if( value.getIdentifier() == "TPW_REPEAT") return TPW_REPEAT; 01093 01094 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01095 s.setError(VLXSerializer::ImportError); 01096 return TPW_REPEAT; 01097 } 01098 01099 inline const char* vlx_EEnable(EEnable en) 01100 { 01101 switch(en) 01102 { 01103 default: 01104 return "EN_UnknownEnable"; 01105 case EN_BLEND: return "EN_BLEND"; 01106 case EN_CULL_FACE: return "EN_CULL_FACE"; 01107 case EN_DEPTH_TEST: return "EN_DEPTH_TEST"; 01108 case EN_STENCIL_TEST: return "EN_STENCIL_TEST"; 01109 case EN_DITHER: return "EN_DITHER"; 01110 case EN_POLYGON_OFFSET_FILL: return "EN_POLYGON_OFFSET_FILL"; 01111 case EN_POLYGON_OFFSET_LINE: return "EN_POLYGON_OFFSET_LINE"; 01112 case EN_POLYGON_OFFSET_POINT: return "EN_POLYGON_OFFSET_POINT"; 01113 case EN_COLOR_LOGIC_OP: return "EN_COLOR_LOGIC_OP"; 01114 case EN_MULTISAMPLE: return "EN_MULTISAMPLE"; 01115 case EN_POINT_SMOOTH: return "EN_POINT_SMOOTH"; 01116 case EN_LINE_SMOOTH: return "EN_LINE_SMOOTH"; 01117 case EN_POLYGON_SMOOTH: return "EN_POLYGON_SMOOTH"; 01118 case EN_LINE_STIPPLE: return "EN_LINE_STIPPLE"; 01119 case EN_POLYGON_STIPPLE: return "EN_POLYGON_STIPPLE"; 01120 case EN_POINT_SPRITE: return "EN_POINT_SPRITE"; 01121 case EN_PROGRAM_POINT_SIZE: return "EN_PROGRAM_POINT_SIZE"; 01122 case EN_ALPHA_TEST: return "EN_ALPHA_TEST"; 01123 case EN_LIGHTING: return "EN_LIGHTING"; 01124 case EN_COLOR_SUM: return "EN_COLOR_SUM"; 01125 case EN_FOG: return "EN_FOG"; 01126 case EN_NORMALIZE: return "EN_NORMALIZE"; 01127 case EN_RESCALE_NORMAL: return "EN_RESCALE_NORMAL"; 01128 case EN_VERTEX_PROGRAM_TWO_SIDE: return "EN_VERTEX_PROGRAM_TWO_SIDE"; 01129 case EN_TEXTURE_CUBE_MAP_SEAMLESS: return "EN_TEXTURE_CUBE_MAP_SEAMLESS"; 01130 case EN_CLIP_DISTANCE0: return "EN_CLIP_DISTANCE0"; 01131 case EN_CLIP_DISTANCE1: return "EN_CLIP_DISTANCE1"; 01132 case EN_CLIP_DISTANCE2: return "EN_CLIP_DISTANCE2"; 01133 case EN_CLIP_DISTANCE3: return "EN_CLIP_DISTANCE3"; 01134 case EN_CLIP_DISTANCE4: return "EN_CLIP_DISTANCE4"; 01135 case EN_CLIP_DISTANCE5: return "EN_CLIP_DISTANCE5"; 01136 case EN_CLIP_DISTANCE6: return "EN_CLIP_DISTANCE6"; 01137 case EN_CLIP_DISTANCE7: return "EN_CLIP_DISTANCE7"; 01138 case EN_SAMPLE_ALPHA_TO_COVERAGE: return "EN_SAMPLE_ALPHA_TO_COVERAGE"; 01139 case EN_SAMPLE_ALPHA_TO_ONE: return "EN_SAMPLE_ALPHA_TO_ONE"; 01140 case EN_SAMPLE_COVERAGE: return "EN_SAMPLE_COVERAGE"; 01141 } 01142 } 01143 01144 inline EEnable vlx_EEnable(const VLXValue& value, VLXSerializer& s) 01145 { 01146 if( value.getIdentifier() == "EN_BLEND") return EN_BLEND; 01147 if( value.getIdentifier() == "EN_CULL_FACE") return EN_CULL_FACE; 01148 if( value.getIdentifier() == "EN_DEPTH_TEST") return EN_DEPTH_TEST; 01149 if( value.getIdentifier() == "EN_STENCIL_TEST") return EN_STENCIL_TEST; 01150 if( value.getIdentifier() == "EN_DITHER") return EN_DITHER; 01151 if( value.getIdentifier() == "EN_POLYGON_OFFSET_FILL") return EN_POLYGON_OFFSET_FILL; 01152 if( value.getIdentifier() == "EN_POLYGON_OFFSET_LINE") return EN_POLYGON_OFFSET_LINE; 01153 if( value.getIdentifier() == "EN_POLYGON_OFFSET_POINT") return EN_POLYGON_OFFSET_POINT; 01154 if( value.getIdentifier() == "EN_COLOR_LOGIC_OP") return EN_COLOR_LOGIC_OP; 01155 if( value.getIdentifier() == "EN_MULTISAMPLE") return EN_MULTISAMPLE; 01156 if( value.getIdentifier() == "EN_POINT_SMOOTH") return EN_POINT_SMOOTH; 01157 if( value.getIdentifier() == "EN_LINE_SMOOTH") return EN_LINE_SMOOTH; 01158 if( value.getIdentifier() == "EN_POLYGON_SMOOTH") return EN_POLYGON_SMOOTH; 01159 if( value.getIdentifier() == "EN_LINE_STIPPLE") return EN_LINE_STIPPLE; 01160 if( value.getIdentifier() == "EN_POLYGON_STIPPLE") return EN_POLYGON_STIPPLE; 01161 if( value.getIdentifier() == "EN_POINT_SPRITE") return EN_POINT_SPRITE; 01162 if( value.getIdentifier() == "EN_PROGRAM_POINT_SIZE") return EN_PROGRAM_POINT_SIZE; 01163 if( value.getIdentifier() == "EN_ALPHA_TEST") return EN_ALPHA_TEST; 01164 if( value.getIdentifier() == "EN_LIGHTING") return EN_LIGHTING; 01165 if( value.getIdentifier() == "EN_COLOR_SUM") return EN_COLOR_SUM; 01166 if( value.getIdentifier() == "EN_FOG") return EN_FOG; 01167 if( value.getIdentifier() == "EN_NORMALIZE") return EN_NORMALIZE; 01168 if( value.getIdentifier() == "EN_RESCALE_NORMAL") return EN_RESCALE_NORMAL; 01169 if( value.getIdentifier() == "EN_VERTEX_PROGRAM_TWO_SIDE") return EN_VERTEX_PROGRAM_TWO_SIDE; 01170 if( value.getIdentifier() == "EN_TEXTURE_CUBE_MAP_SEAMLESS") return EN_TEXTURE_CUBE_MAP_SEAMLESS; 01171 if( value.getIdentifier() == "EN_CLIP_DISTANCE0") return EN_CLIP_DISTANCE0; 01172 if( value.getIdentifier() == "EN_CLIP_DISTANCE1") return EN_CLIP_DISTANCE1; 01173 if( value.getIdentifier() == "EN_CLIP_DISTANCE2") return EN_CLIP_DISTANCE2; 01174 if( value.getIdentifier() == "EN_CLIP_DISTANCE3") return EN_CLIP_DISTANCE3; 01175 if( value.getIdentifier() == "EN_CLIP_DISTANCE4") return EN_CLIP_DISTANCE4; 01176 if( value.getIdentifier() == "EN_CLIP_DISTANCE5") return EN_CLIP_DISTANCE5; 01177 if( value.getIdentifier() == "EN_CLIP_DISTANCE6") return EN_CLIP_DISTANCE6; 01178 if( value.getIdentifier() == "EN_CLIP_DISTANCE7") return EN_CLIP_DISTANCE7; 01179 if( value.getIdentifier() == "EN_SAMPLE_ALPHA_TO_COVERAGE") return EN_SAMPLE_ALPHA_TO_COVERAGE; 01180 if( value.getIdentifier() == "EN_SAMPLE_ALPHA_TO_ONE") return EN_SAMPLE_ALPHA_TO_ONE; 01181 if( value.getIdentifier() == "EN_SAMPLE_COVERAGE") return EN_SAMPLE_COVERAGE; 01182 01183 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01184 s.setError(VLXSerializer::ImportError); 01185 return EN_UnknownEnable; 01186 } 01187 01188 inline EPrimitiveType vlx_EPrimitiveType(const VLXValue& value, VLXSerializer& s) 01189 { 01190 if( value.getIdentifier() == "PT_POINTS") return PT_POINTS; 01191 if( value.getIdentifier() == "PT_LINES") return PT_LINES; 01192 if( value.getIdentifier() == "PT_LINE_LOOP") return PT_LINE_LOOP; 01193 if( value.getIdentifier() == "PT_LINE_STRIP") return PT_LINE_STRIP; 01194 if( value.getIdentifier() == "PT_TRIANGLES") return PT_TRIANGLES; 01195 if( value.getIdentifier() == "PT_TRIANGLE_STRIP") return PT_TRIANGLE_STRIP; 01196 if( value.getIdentifier() == "PT_TRIANGLE_FAN") return PT_TRIANGLE_FAN; 01197 if( value.getIdentifier() == "PT_QUADS") return PT_QUADS; 01198 if( value.getIdentifier() == "PT_QUAD_STRIP") return PT_QUAD_STRIP; 01199 if( value.getIdentifier() == "PT_POLYGON") return PT_POLYGON; 01200 if( value.getIdentifier() == "PT_LINES_ADJACENCY") return PT_LINES_ADJACENCY; 01201 if( value.getIdentifier() == "PT_LINE_STRIP_ADJACENCY") return PT_LINE_STRIP_ADJACENCY; 01202 if( value.getIdentifier() == "PT_TRIANGLES_ADJACENCY") return PT_TRIANGLES_ADJACENCY; 01203 if( value.getIdentifier() == "PT_TRIANGLE_STRIP_ADJACENCY") return PT_TRIANGLES_ADJACENCY; 01204 if( value.getIdentifier() == "PT_PATCHES") return PT_PATCHES; 01205 if( value.getIdentifier() == "PT_UNKNOWN") return PT_UNKNOWN; 01206 01207 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01208 s.setError(VLXSerializer::ImportError); 01209 return PT_UNKNOWN; 01210 } 01211 01212 inline const char* vlx_EPrimitiveType(EPrimitiveType type) 01213 { 01214 switch(type) 01215 { 01216 case PT_POINTS: return "PT_POINTS"; break; 01217 case PT_LINES: return "PT_LINES"; break; 01218 case PT_LINE_LOOP: return "PT_LINE_LOOP"; break; 01219 case PT_LINE_STRIP: return "PT_LINE_STRIP"; break; 01220 case PT_TRIANGLES: return "PT_TRIANGLES"; break; 01221 case PT_TRIANGLE_STRIP: return "PT_TRIANGLE_STRIP"; break; 01222 case PT_TRIANGLE_FAN: return "PT_TRIANGLE_FAN"; break; 01223 case PT_QUADS: return "PT_QUADS"; break; 01224 case PT_QUAD_STRIP: return "PT_QUAD_STRIP"; break; 01225 case PT_POLYGON: return "PT_POLYGON"; break; 01226 case PT_LINES_ADJACENCY: return "PT_LINES_ADJACENCY"; break; 01227 case PT_LINE_STRIP_ADJACENCY: return "PT_LINE_STRIP_ADJACENCY"; break; 01228 case PT_TRIANGLES_ADJACENCY: return "PT_TRIANGLES_ADJACENCY"; break; 01229 case PT_TRIANGLE_STRIP_ADJACENCY: return "PT_TRIANGLE_STRIP_ADJACENCY"; break; 01230 case PT_PATCHES: return "PT_PATCHES"; break; 01231 default: 01232 case PT_UNKNOWN: return "PT_UNKNOWN"; break; 01233 } 01234 } 01235 01236 inline EVertexAttribInterpretation vlx_EVertexAttribInterpretation(const VLXValue& value, VLXSerializer& s) 01237 { 01238 if( value.getIdentifier() == "VAI_NORMAL") return VAI_NORMAL; 01239 if( value.getIdentifier() == "VAI_INTEGER") return VAI_INTEGER; 01240 if( value.getIdentifier() == "VAI_DOUBLE") return VAI_DOUBLE; 01241 01242 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01243 s.setError(VLXSerializer::ImportError); 01244 return VAI_NORMAL; 01245 } 01246 01247 inline const char* vlx_EVertexAttribInterpretation(EVertexAttribInterpretation type) 01248 { 01249 switch(type) 01250 { 01251 default: 01252 case VAI_NORMAL: return "VAI_NORMAL"; break; 01253 case VAI_INTEGER: return "VAI_INTEGER"; break; 01254 case VAI_DOUBLE: return "VAI_DOUBLE"; break; 01255 } 01256 } 01257 01258 inline ETextureDimension vlx_ETextureDimension(const VLXValue& value, VLXSerializer& s) 01259 { 01260 if( value.getIdentifier() == "TD_TEXTURE_1D") return TD_TEXTURE_1D; 01261 if( value.getIdentifier() == "TD_TEXTURE_2D") return TD_TEXTURE_2D; 01262 if( value.getIdentifier() == "TD_TEXTURE_3D") return TD_TEXTURE_3D; 01263 if( value.getIdentifier() == "TD_TEXTURE_CUBE_MAP") return TD_TEXTURE_CUBE_MAP; 01264 if( value.getIdentifier() == "TD_TEXTURE_RECTANGLE") return TD_TEXTURE_RECTANGLE; 01265 if( value.getIdentifier() == "TD_TEXTURE_1D_ARRAY") return TD_TEXTURE_1D_ARRAY; 01266 if( value.getIdentifier() == "TD_TEXTURE_2D_ARRAY") return TD_TEXTURE_2D_ARRAY; 01267 if( value.getIdentifier() == "TD_TEXTURE_BUFFER") return TD_TEXTURE_BUFFER; 01268 if( value.getIdentifier() == "TD_TEXTURE_2D_MULTISAMPLE") return TD_TEXTURE_2D_MULTISAMPLE; 01269 if( value.getIdentifier() == "TD_TEXTURE_2D_MULTISAMPLE_ARRAY") return TD_TEXTURE_2D_MULTISAMPLE_ARRAY; 01270 if( value.getIdentifier() == "TD_TEXTURE_UNKNOWN") return TD_TEXTURE_UNKNOWN; 01271 01272 Log::error( Say("Line %n : unknown token '%s'.\n") << value.lineNumber() << value.getIdentifier() ); 01273 s.setError(VLXSerializer::ImportError); 01274 return TD_TEXTURE_UNKNOWN; 01275 } 01276 01277 inline const char* vlx_ETextureDimension(ETextureDimension td) 01278 { 01279 switch(td) 01280 { 01281 case TD_TEXTURE_1D: return "TD_TEXTURE_1D"; 01282 case TD_TEXTURE_2D: return "TD_TEXTURE_2D"; 01283 case TD_TEXTURE_3D: return "TD_TEXTURE_3D"; 01284 case TD_TEXTURE_CUBE_MAP: return "TD_TEXTURE_CUBE_MAP"; 01285 case TD_TEXTURE_RECTANGLE: return "TD_TEXTURE_RECTANGLE"; 01286 case TD_TEXTURE_1D_ARRAY: return "TD_TEXTURE_1D_ARRAY"; 01287 case TD_TEXTURE_2D_ARRAY: return "TD_TEXTURE_2D_ARRAY"; 01288 case TD_TEXTURE_BUFFER: return "TD_TEXTURE_BUFFER"; 01289 case TD_TEXTURE_2D_MULTISAMPLE: return "TD_TEXTURE_2D_MULTISAMPLE"; 01290 case TD_TEXTURE_2D_MULTISAMPLE_ARRAY: return "TD_TEXTURE_2D_MULTISAMPLE_ARRAY"; 01291 case TD_TEXTURE_UNKNOWN: return "TD_TEXTURE_UNKNOWN"; 01292 default: 01293 Log::error( Say("Invalid texture dimension %n\n") << td ); 01294 VL_TRAP() 01295 return "TD_TEXTURE_UNKNOWN"; 01296 } 01297 } 01298 01299 } 01300 01301 #endif