32 #ifndef VLXWrapper_Graphics_INCLUDE_ONCE 33 #define VLXWrapper_Graphics_INCLUDE_ONCE 72 if (vlx->
tag() ==
"<vl::ArrayFloat1>")
77 arr_float1->resize( vlx_arr_float->value().size() );
78 vlx_arr_float->copyTo((
float*)arr_float1->ptr());
81 if (vlx->
tag() ==
"<vl::ArrayFloat2>")
87 arr_float2->resize( vlx_arr_float->value().size() / 2 );
88 vlx_arr_float->copyTo((
float*)arr_float2->ptr());
91 if (vlx->
tag() ==
"<vl::ArrayFloat3>")
97 arr_float3->resize( vlx_arr_float->value().size() / 3 );
98 vlx_arr_float->copyTo((
float*)arr_float3->ptr());
101 if (vlx->
tag() ==
"<vl::ArrayFloat4>")
107 arr_float4->resize( vlx_arr_float->value().size() / 4 );
108 vlx_arr_float->copyTo((
float*)arr_float4->ptr());
111 if (vlx->
tag() ==
"<vl::ArrayDouble1>")
116 arr_floating1->resize( vlx_arr_floating->value().size() );
117 vlx_arr_floating->copyTo((
double*)arr_floating1->ptr());
120 if (vlx->
tag() ==
"<vl::ArrayDouble2>")
126 arr_floating2->resize( vlx_arr_floating->value().size() / 2 );
127 vlx_arr_floating->copyTo((
double*)arr_floating2->ptr());
130 if (vlx->
tag() ==
"<vl::ArrayDouble3>")
136 arr_floating3->resize( vlx_arr_floating->value().size() / 3 );
137 vlx_arr_floating->copyTo((
double*)arr_floating3->ptr());
140 if (vlx->
tag() ==
"<vl::ArrayDouble4>")
146 arr_floating4->resize( vlx_arr_floating->value().size() / 4 );
147 vlx_arr_floating->copyTo((
double*)arr_floating4->ptr());
150 if (vlx->
tag() ==
"<vl::ArrayInt1>")
155 arr_int1->resize( vlx_arr_int->value().size() );
156 vlx_arr_int->copyTo((
int*)arr_int1->ptr());
159 if (vlx->
tag() ==
"<vl::ArrayInt2>")
165 arr_int2->resize( vlx_arr_int->value().size() / 2 );
166 vlx_arr_int->copyTo((
int*)arr_int2->ptr());
169 if (vlx->
tag() ==
"<vl::ArrayInt3>")
175 arr_int3->resize( vlx_arr_int->value().size() / 3 );
176 vlx_arr_int->copyTo((
int*)arr_int3->ptr());
179 if (vlx->
tag() ==
"<vl::ArrayInt4>")
185 arr_int4->resize( vlx_arr_int->value().size() / 4 );
186 vlx_arr_int->copyTo((
int*)arr_int4->ptr());
189 if (vlx->
tag() ==
"<vl::ArrayUInt1>")
194 arr_int1->
resize( vlx_arr_int->value().size() );
195 vlx_arr_int->copyTo((
unsigned int*)arr_int1->
ptr());
198 if (vlx->
tag() ==
"<vl::ArrayUInt2>")
204 arr_int2->resize( vlx_arr_int->value().size() / 2 );
205 vlx_arr_int->copyTo((
unsigned int*)arr_int2->ptr());
208 if (vlx->
tag() ==
"<vl::ArrayUInt3>")
214 arr_int3->resize( vlx_arr_int->value().size() / 3 );
215 vlx_arr_int->copyTo((
unsigned int*)arr_int3->ptr());
218 if (vlx->
tag() ==
"<vl::ArrayUInt4>")
224 arr_int4->resize( vlx_arr_int->value().size() / 4 );
225 vlx_arr_int->copyTo((
unsigned int*)arr_int4->ptr());
228 if (vlx->
tag() ==
"<vl::ArrayShort1>")
233 arr_short1->resize( vlx_arr_int->value().size() );
234 vlx_arr_int->copyTo((
short*)arr_short1->ptr());
237 if (vlx->
tag() ==
"<vl::ArrayShort2>")
243 arr_short2->resize( vlx_arr_int->value().size() / 2 );
244 vlx_arr_int->copyTo((
short*)arr_short2->ptr());
247 if (vlx->
tag() ==
"<vl::ArrayShort3>")
253 arr_short3->resize( vlx_arr_int->value().size() / 3 );
254 vlx_arr_int->copyTo((
short*)arr_short3->ptr());
257 if (vlx->
tag() ==
"<vl::ArrayShort4>")
263 arr_short4->resize( vlx_arr_int->value().size() / 4 );
264 vlx_arr_int->copyTo((
short*)arr_short4->ptr());
267 if (vlx->
tag() ==
"<vl::ArrayUShort1>")
272 arr_short1->
resize( vlx_arr_int->value().size() );
273 vlx_arr_int->copyTo((
unsigned short*)arr_short1->
ptr());
276 if (vlx->
tag() ==
"<vl::ArrayUShort2>")
282 arr_short2->resize( vlx_arr_int->value().size() / 2 );
283 vlx_arr_int->copyTo((
unsigned short*)arr_short2->ptr());
286 if (vlx->
tag() ==
"<vl::ArrayUShort3>")
292 arr_short3->resize( vlx_arr_int->value().size() / 3 );
293 vlx_arr_int->copyTo((
unsigned short*)arr_short3->ptr());
296 if (vlx->
tag() ==
"<vl::ArrayUShort4>")
302 arr_short4->resize( vlx_arr_int->value().size() / 4 );
303 vlx_arr_int->copyTo((
unsigned short*)arr_short4->ptr());
306 if (vlx->
tag() ==
"<vl::ArrayByte1>")
311 arr_byte1->resize( vlx_arr_int->value().size() );
312 vlx_arr_int->copyTo((
char*)arr_byte1->ptr());
315 if (vlx->
tag() ==
"<vl::ArrayByte2>")
321 arr_byte2->resize( vlx_arr_int->value().size() / 2 );
322 vlx_arr_int->copyTo((
char*)arr_byte2->ptr());
325 if (vlx->
tag() ==
"<vl::ArrayByte3>")
331 arr_byte3->resize( vlx_arr_int->value().size() / 3 );
332 vlx_arr_int->copyTo((
char*)arr_byte3->ptr());
335 if (vlx->
tag() ==
"<vl::ArrayByte4>")
341 arr_byte4->resize( vlx_arr_int->value().size() / 4 );
342 vlx_arr_int->copyTo((
char*)arr_byte4->ptr());
345 if (vlx->
tag() ==
"<vl::ArrayUByte1>")
350 arr_byte1->
resize( vlx_arr_int->value().size() );
351 vlx_arr_int->copyTo((
unsigned char*)arr_byte1->
ptr());
354 if (vlx->
tag() ==
"<vl::ArrayUByte2>")
360 arr_byte2->resize( vlx_arr_int->value().size() / 2 );
361 vlx_arr_int->copyTo((
unsigned char*)arr_byte2->ptr());
364 if (vlx->
tag() ==
"<vl::ArrayUByte3>")
370 arr_byte3->resize( vlx_arr_int->value().size() / 3 );
371 vlx_arr_int->copyTo((
unsigned char*)arr_byte3->ptr());
374 if (vlx->
tag() ==
"<vl::ArrayUByte4>")
380 arr_byte4->resize( vlx_arr_int->value().size() / 4 );
381 vlx_arr_int->copyTo((
unsigned char*)arr_byte4->ptr());
390 return arr_abstract.
get();
393 template<
typename T_Array,
typename T_VLXArray>
396 const T_Array* arr = arr_abstract->
as<T_Array>();
401 vlx_array->value().resize( arr->size() * arr->glSize() );
402 typename T_VLXArray::scalar_type* dst = &vlx_array->value()[0];
403 const typename T_Array::scalar_type* src = (
const typename T_Array::scalar_type*)arr->begin();
404 const typename T_Array::scalar_type* end = (
const typename T_Array::scalar_type*)arr->end();
405 for(; src<end; ++src, ++dst)
406 *dst = (
typename T_VLXArray::scalar_type)*src;
415 if(obj->classType() == ArrayUInt1::Type())
416 vlx = export_ArrayT<ArrayUInt1, VLXArrayInteger>(s, obj);
418 if(obj->classType() == ArrayUInt2::Type())
419 vlx = export_ArrayT<ArrayUInt2, VLXArrayInteger>(s, obj);
421 if(obj->classType() == ArrayUInt3::Type())
422 vlx = export_ArrayT<ArrayUInt3, VLXArrayInteger>(s, obj);
424 if(obj->classType() == ArrayUInt4::Type())
425 vlx = export_ArrayT<ArrayUInt4, VLXArrayInteger>(s, obj);
428 if(obj->classType() == ArrayInt1::Type())
429 vlx = export_ArrayT<ArrayInt1, VLXArrayInteger>(s, obj);
431 if(obj->classType() == ArrayInt2::Type())
432 vlx = export_ArrayT<ArrayInt2, VLXArrayInteger>(s, obj);
434 if(obj->classType() == ArrayInt3::Type())
435 vlx = export_ArrayT<ArrayInt3, VLXArrayInteger>(s, obj);
437 if(obj->classType() == ArrayInt4::Type())
438 vlx = export_ArrayT<ArrayInt4, VLXArrayInteger>(s, obj);
441 if(obj->classType() == ArrayUShort1::Type())
442 vlx = export_ArrayT<ArrayUShort1, VLXArrayInteger>(s, obj);
444 if(obj->classType() == ArrayUShort2::Type())
445 vlx = export_ArrayT<ArrayUShort2, VLXArrayInteger>(s, obj);
447 if(obj->classType() == ArrayUShort3::Type())
448 vlx = export_ArrayT<ArrayUShort3, VLXArrayInteger>(s, obj);
450 if(obj->classType() == ArrayUShort4::Type())
451 vlx = export_ArrayT<ArrayUShort4, VLXArrayInteger>(s, obj);
454 if(obj->classType() == ArrayUShort1::Type())
455 vlx = export_ArrayT<ArrayUShort1, VLXArrayInteger>(s, obj);
457 if(obj->classType() == ArrayUShort2::Type())
458 vlx = export_ArrayT<ArrayUShort2, VLXArrayInteger>(s, obj);
460 if(obj->classType() == ArrayUShort3::Type())
461 vlx = export_ArrayT<ArrayUShort3, VLXArrayInteger>(s, obj);
463 if(obj->classType() == ArrayUShort4::Type())
464 vlx = export_ArrayT<ArrayUShort4, VLXArrayInteger>(s, obj);
467 if(obj->classType() == ArrayShort1::Type())
468 vlx = export_ArrayT<ArrayShort1, VLXArrayInteger>(s, obj);
470 if(obj->classType() == ArrayShort2::Type())
471 vlx = export_ArrayT<ArrayShort2, VLXArrayInteger>(s, obj);
473 if(obj->classType() == ArrayShort3::Type())
474 vlx = export_ArrayT<ArrayShort3, VLXArrayInteger>(s, obj);
476 if(obj->classType() == ArrayShort4::Type())
477 vlx = export_ArrayT<ArrayShort4, VLXArrayInteger>(s, obj);
480 if(obj->classType() == ArrayUByte1::Type())
481 vlx = export_ArrayT<ArrayUByte1, VLXArrayInteger>(s, obj);
483 if(obj->classType() == ArrayUByte2::Type())
484 vlx = export_ArrayT<ArrayUByte2, VLXArrayInteger>(s, obj);
486 if(obj->classType() == ArrayUByte3::Type())
487 vlx = export_ArrayT<ArrayUByte3, VLXArrayInteger>(s, obj);
489 if(obj->classType() == ArrayUByte4::Type())
490 vlx = export_ArrayT<ArrayUByte4, VLXArrayInteger>(s, obj);
493 if(obj->classType() == ArrayByte1::Type())
494 vlx = export_ArrayT<ArrayByte1, VLXArrayInteger>(s, obj);
496 if(obj->classType() == ArrayByte2::Type())
497 vlx = export_ArrayT<ArrayByte2, VLXArrayInteger>(s, obj);
499 if(obj->classType() == ArrayByte3::Type())
500 vlx = export_ArrayT<ArrayByte3, VLXArrayInteger>(s, obj);
502 if(obj->classType() == ArrayByte4::Type())
503 vlx = export_ArrayT<ArrayByte4, VLXArrayInteger>(s, obj);
506 if(obj->classType() == ArrayFloat1::Type())
507 vlx = export_ArrayT<ArrayFloat1, VLXArrayReal>(s, obj);
509 if(obj->classType() == ArrayFloat2::Type())
510 vlx = export_ArrayT<ArrayFloat2, VLXArrayReal>(s, obj);
512 if(obj->classType() == ArrayFloat3::Type())
513 vlx = export_ArrayT<ArrayFloat3, VLXArrayReal>(s, obj);
515 if(obj->classType() == ArrayFloat4::Type())
516 vlx = export_ArrayT<ArrayFloat4, VLXArrayReal>(s, obj);
519 if(obj->classType() == ArrayDouble1::Type())
520 vlx = export_ArrayT<ArrayDouble1, VLXArrayReal>(s, obj);
522 if(obj->classType() == ArrayDouble2::Type())
523 vlx = export_ArrayT<ArrayDouble2, VLXArrayReal>(s, obj);
525 if(obj->classType() == ArrayDouble3::Type())
526 vlx = export_ArrayT<ArrayDouble3, VLXArrayReal>(s, obj);
528 if(obj->classType() == ArrayDouble4::Type())
529 vlx = export_ArrayT<ArrayDouble4, VLXArrayReal>(s, obj);
558 Log::debug(
"VLXClassWrapper_Renderable : skipping dirty bounds.\n");
567 const std::vector<VLXStructure::Value>& values = vlx->
value();
568 for(
size_t i=0; i<values.size(); ++i)
570 const std::string& key = values[i].key();
571 if (key ==
"BufferObjectEnabled")
576 if (key ==
"DisplayListEnabled")
603 for(
size_t i=0; i<vlx->
value().size(); ++i)
605 const std::string& key = vlx->
value()[i].key();
608 if (key ==
"VertexArray")
618 if (key ==
"NormalArray")
628 if (key ==
"ColorArray")
638 if (key ==
"SecondaryColorArray")
648 if (key ==
"FogCoordArray")
658 if (strstr(key.c_str(),
"TexCoordArray") == key.c_str())
660 const char* ch = key.c_str() + 13;
664 if (*ch>=
'0' && *ch<=
'9')
665 tex_unit = tex_unit*10 + (*ch -
'0');
669 Log::error(
"TexCoordArray must end with a number!\n" );
682 if (strstr(key.c_str(),
"VertexAttribArray") == key.c_str())
711 if (key ==
"DrawCall")
728 importGeometry(s, vlx, geom.
get());
772 for(
int i=0; i<geom->
drawCalls().size(); ++i) {
783 exportGeometry(s, cast_obj, vlx.get());
795 if(draw_call->isOfType(DrawElementsBase::Type()))
803 for(
size_t i=0; i<vlx->
value().size(); ++i)
805 const std::string& key = vlx->
value()[i].key();
807 if( key ==
"PrimitiveType" )
814 if( key ==
"Enabled" )
820 if( key ==
"Instances" )
826 if( key ==
"PrimitiveRestartEnabled" )
832 if( key ==
"BaseVertex" )
838 if( key ==
"IndexBuffer" )
845 if ( de->isOfType(DrawElementsUInt::Type()) )
851 if ( de->isOfType(DrawElementsUShort::Type()) )
857 if ( de->isOfType(DrawElementsUByte::Type()) )
866 if(draw_call->isOfType( MultiDrawElementsBase::Type() ))
877 for(
size_t i=0; i<vlx->
value().size(); ++i)
879 const std::string& key = vlx->
value()[i].key();
881 if( key ==
"PrimitiveType" )
888 if( key ==
"Enabled" )
894 if( key ==
"PrimitiveRestartEnabled" )
900 if( key ==
"BaseVertices" )
909 if( key ==
"CountVector" )
918 if( key ==
"IndexBuffer" )
925 if ( de->isOfType(MultiDrawElementsUInt::Type()) )
931 if ( de->isOfType(MultiDrawElementsUShort::Type()) )
937 if ( de->isOfType(MultiDrawElementsUByte::Type()) )
952 if( draw_call->isOfType( DrawArrays::Type() ) )
958 da->setObjectName( name->getString() );
960 for(
size_t i=0; i<vlx->
value().size(); ++i)
962 const std::string& key = vlx->
value()[i].key();
965 if( key ==
"PrimitiveType" )
972 if( key ==
"Enabled" )
975 da->setEnabled( value.
getBool() );
978 if( key ==
"Instances" )
1002 if (vlx->
tag() ==
"<vl::DrawElementsUInt>")
1005 if (vlx->
tag() ==
"<vl::DrawElementsUShort>")
1008 if (vlx->
tag() ==
"<vl::DrawElementsUByte>")
1011 if (vlx->
tag() ==
"<vl::MultiDrawElementsUInt>")
1014 if (vlx->
tag() ==
"<vl::MultiDrawElementsUShort>")
1017 if (vlx->
tag() ==
"<vl::MultiDrawElementsUByte>")
1020 if (vlx->
tag() ==
"<vl::DrawArrays>")
1026 importDrawCall(s, vlx, dc.
get());
1042 exportDrawCallBase(s, dcall, vlx);
1044 if (dcall->isOfType(DrawArrays::Type()))
1047 *vlx <<
"Instances" << (
long long)da->
instances();
1048 *vlx <<
"Start" << (
long long)da->
start();
1049 *vlx <<
"Count" << (
long long)da->
count();
1052 if (dcall->isOfType(DrawElementsUInt::Type()))
1055 *vlx <<
"Instances" << (
long long)de->
instances();
1057 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1061 if (dcall->isOfType(DrawElementsUShort::Type()))
1064 *vlx <<
"Instances" << (
long long)de->
instances();
1066 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1070 if (dcall->isOfType(DrawElementsUByte::Type()))
1073 *vlx <<
"Instances" << (
long long)de->
instances();
1075 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1079 if (dcall->isOfType(MultiDrawElementsUInt::Type()))
1088 if (dcall->isOfType(MultiDrawElementsUShort::Type()))
1097 if (dcall->isOfType(MultiDrawElementsUByte::Type()))
1107 Log::error(
"DrawCall type not supported for export.\n");
1117 exportDrawCall(s, cast_obj, vlx.get());
1129 std::vector<VLXStructure::Value> values = vlx->
value();
1130 for(
size_t i=0; i<values.size(); ++i)
1132 const std::string& key = values[i].key();
1133 if (key ==
"PatchVertices")
1138 if (key ==
"PatchDefaultOuterLevel")
1143 if (key ==
"PatchDefaultInnerLevel")
1155 importPatchParameter(vlx, pp.
get());
1172 exportPatchParameter(cast_obj, vlx.get());
1194 for(
size_t i=0; i<list->value().size(); ++i)
1196 const VLXValue& value = list->value()[i];
1216 importResourceDatabase(s, vlx, resdb.
get());
1225 *vlx <<
"Resources" << list.
get();
1227 for(
size_t i=0; i<obj->
resources().size(); ++i)
1231 Log::debug(
Say(
"VLXClassWrapper_ResourceDatabase : skipping '%s'.\n") << obj->
resources().at(i).get()->className() );
1247 exportResourceDatabase(s, cast_obj, vlx.
get());
1310 std::vector<int> int_vec;
1311 std::vector<unsigned int> uint_vec;
1312 std::vector<float> float_vec;
1313 std::vector<double> double_vec;
1318 int_vec.resize(count*1);
if (arr_int) arr_int->
copyTo(&int_vec[0]);
else int_vec[0] = (int)val->
getInteger();
1335 uint_vec.resize(count*1);
if (arr_int) arr_int->
copyTo(&uint_vec[0]);
else uint_vec[0] = (
unsigned int)val->
getInteger();
1352 float_vec.resize(count*1);
if (arr_real) arr_real->
copyTo(&float_vec[0]);
else float_vec[0] = (float)val->
getReal();
1407 double_vec.resize(count*1);
if (arr_real) arr_real->
copyTo(&double_vec[0]);
else double_vec[0] = (double)val->
getReal();
1462 Log::error(
Say(
"Error importing uniform : uninitialized uniform (%s).\n") << uniform->
name() );
1466 Log::error(
Say(
"Error importing uniform : illegal uniform type (%s).\n") << uniform->
name() );
1477 importUniform(s, vlx, obj.
get());
1485 *vlx <<
"Count" << (
long long)uniform->
count();
1487 const int count = uniform->
count();
1491 switch(uniform->
type())
1496 {
int val = 0; uniform->
getUniform(&val); *vlx <<
"Data" << (
long long)val;
break; }
1498 { arr_int->value().resize(count*1); arr_int->copyFrom( (
int*)uniform->
rawData() );
break; }
1500 case UT_INT_VEC2: arr_int->value().resize(count*2); arr_int->copyFrom( (
int*)uniform->
rawData() );
break;
1501 case UT_INT_VEC3: arr_int->value().resize(count*3); arr_int->copyFrom( (
int*)uniform->
rawData() );
break;
1502 case UT_INT_VEC4: arr_int->value().resize(count*4); arr_int->copyFrom( (
int*)uniform->
rawData() );
break;
1507 {
unsigned int val = 0; uniform->
getUniform(&val); *vlx <<
"Data" << (
long long)val;
break; }
1509 { arr_int->value().resize(count*1); arr_int->copyFrom( (
int*)uniform->
rawData() );
break; }
1518 {
float val = 0; uniform->
getUniform(&val); *vlx <<
"Data" << (double)val;
break; }
1520 { arr_real->value().resize(count*1); arr_real->copyFrom( (
float*)uniform->
rawData() );
break; }
1522 case UT_FLOAT_VEC2: arr_real->value().resize(count*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1523 case UT_FLOAT_VEC3: arr_real->value().resize(count*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1524 case UT_FLOAT_VEC4: arr_real->value().resize(count*4); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1526 case UT_FLOAT_MAT2: arr_real->value().resize(count*2*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1527 case UT_FLOAT_MAT3: arr_real->value().resize(count*3*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1528 case UT_FLOAT_MAT4: arr_real->value().resize(count*4*4); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1530 case UT_FLOAT_MAT2x3: arr_real->value().resize(count*2*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1531 case UT_FLOAT_MAT3x2: arr_real->value().resize(count*3*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1532 case UT_FLOAT_MAT2x4: arr_real->value().resize(count*2*4); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1533 case UT_FLOAT_MAT4x2: arr_real->value().resize(count*4*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1534 case UT_FLOAT_MAT3x4: arr_real->value().resize(count*3*4); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1535 case UT_FLOAT_MAT4x3: arr_real->value().resize(count*4*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1540 {
double val = 0; uniform->
getUniform(&val); *vlx <<
"Data" << (double)val;
break; }
1542 { arr_real->value().resize(count*1); arr_real->copyFrom( (
double*)uniform->
rawData() );
break; }
1544 case UT_DOUBLE_VEC2: arr_real->value().resize(count*2); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1545 case UT_DOUBLE_VEC3: arr_real->value().resize(count*3); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1546 case UT_DOUBLE_VEC4: arr_real->value().resize(count*4); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1548 case UT_DOUBLE_MAT2: arr_real->value().resize(count*2*2); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1549 case UT_DOUBLE_MAT3: arr_real->value().resize(count*3*3); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1550 case UT_DOUBLE_MAT4: arr_real->value().resize(count*4*4); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1552 case UT_DOUBLE_MAT2x3: arr_real->value().resize(count*2*3); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1553 case UT_DOUBLE_MAT3x2: arr_real->value().resize(count*3*2); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1554 case UT_DOUBLE_MAT2x4: arr_real->value().resize(count*2*4); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1555 case UT_DOUBLE_MAT4x2: arr_real->value().resize(count*4*2); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1556 case UT_DOUBLE_MAT3x4: arr_real->value().resize(count*3*4); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1557 case UT_DOUBLE_MAT4x3: arr_real->value().resize(count*4*3); arr_real->copyFrom( (
double*)uniform->
rawData() );
break;
1560 Log::error(
Say(
"Error exporting uniform : uninitialized uniform (%s).\n") << uniform->
name() );
1564 Log::error(
Say(
"Error exporting uniform : illegal uniform type (%s).\n") << uniform->
name() );
1568 if (!arr_int->value().empty())
1569 *vlx <<
"Data" << arr_int.
get();
1571 if (!arr_real->value().empty())
1572 *vlx <<
"Data" << arr_real.
get();
1581 exportUniform(cast_obj, vlx.get());
1603 for(
size_t i=0; i<list->value().size(); ++i)
1619 for(
size_t i=0; i<list->value().size(); ++i)
1625 index = (int)list->value()[i].getInteger();
1631 VLX_IMPORT_CHECK_RETURN( (index == -1 && !renderstate->isOfType(RenderStateIndexed::Type())) || (index >= 0 && renderstate->isOfType(RenderStateIndexed::Type())), list->value()[i] )
1645 for(
size_t i=0; i<list->value().size(); ++i)
1648 Uniform* uniform = s.
importVLX( list->value()[i].getStructure() )->as<Uniform>();
1660 importShader(s, vlx, obj.
get());
1674 for(
size_t i=0; i<obj->
uniforms().size(); ++i)
1677 *vlx <<
"Uniforms" << uniforms;
1686 *vlx <<
"Enables" << enables.
get();
1698 Log::debug(
Say(
"VLXClassWrapper_Shader : skipping '%s'.\n") << rs->className() );
1703 *renderstates.
getList() << (
long long)index;
1707 *vlx <<
"RenderStates" << renderstates;
1716 exportShader(s, cast_obj, vlx.get());
1728 if (obj->isOfType(DistanceLODEvaluator::Type()))
1734 const VLXArrayReal* arr = vlx_distances->getArrayReal();
1735 if (arr->value().size())
1742 if (obj->isOfType(PixelLODEvaluator::Type()))
1749 if (arr->value().size())
1759 if (vlx->
tag() ==
"<vl::DistanceLODEvaluator>")
1764 importLODEvaluator(s, vlx, obj.
get());
1768 if (vlx->
tag() ==
"<vl::PixelLODEvaluator>")
1773 importLODEvaluator(s, vlx, obj.
get());
1784 if (obj->classType() == DistanceLODEvaluator::Type())
1788 distances.getArrayReal()->value().resize( lod->
distanceRangeSet().size() );
1791 *vlx <<
"DistanceRageSet" << distances;
1794 if (obj->classType() == PixelLODEvaluator::Type())
1798 pixels.getArrayReal()->value().resize( lod->
pixelRangeSet().size() );
1800 pixels.getArrayReal()->copyFrom( &lod->
pixelRangeSet()[0] );
1801 *vlx <<
"PixelRageSet" << pixels;
1815 exportLODEvaluator(s, cast_obj, vlx.get());
1831 const std::vector<VLXStructure::Value>& values = vlx->
value();
1832 for(
size_t i=0; i<values.size(); ++i)
1834 const std::string& key = values[i].key();
1835 const VLXValue& value = values[i].value();
1836 if (key ==
"RenderRank")
1842 if (key ==
"EnableMask")
1848 if (key ==
"ActiveLod")
1854 if (key ==
"LODEvaluator")
1866 for(
size_t ilod=0; ilod< lod_list->value().size(); ++ilod)
1868 const VLXValue& lod_shaders = lod_list->value()[ilod];
1871 for(
size_t ish=0; ish<lod_shaders.
getList()->
value().size(); ++ish)
1877 obj->
lod(ilod)->push_back( shader );
1889 importEffect(s, vlx, obj.
get());
1896 for(
int i=0; i<sh_seq->
size(); ++i)
1905 *vlx <<
"RenderRank" << (
long long)obj->
renderRank();
1906 *vlx <<
"EnableMask" << (
long long)obj->
enableMask();
1907 *vlx <<
"ActiveLod" << (
long long)obj->
activeLod();
1914 for(
int i=0; obj->
lod(i) && i<VL_MAX_EFFECT_LOD; ++i)
1915 *lod_list << export_ShaderPasses(s, obj->
lod(i).get());
1916 *vlx <<
"Lods" << lod_list.
get();
1925 exportEffect(s, cast_obj, vlx.get());
1941 const std::vector<VLXStructure::Value>& values = vlx->
value();
1942 for(
size_t i=0; i<values.size(); ++i)
1944 const std::string& key = values[i].key();
1945 const VLXValue& value = values[i].value();
1946 if (key ==
"RenderRank")
1952 if (key ==
"RenderBlock")
1958 if (key ==
"EnableMask")
1964 if (key ==
"IsOccludee")
1970 if (key ==
"Enabled")
1980 for(
size_t i=0; i<list->value().size(); ++i)
1982 const VLXValue& lod = list->value()[i];
1990 if (key ==
"Effect")
1998 if (key ==
"Transform")
2006 if (key ==
"Uniforms")
2010 for(
size_t i=0; i<list->value().size(); ++i)
2013 Uniform* uniform = s.
importVLX( list->value()[i].getStructure() )->as<Uniform>();
2022 if (key ==
"LODEvaluator")
2033 if (key ==
"ActorEventCallbacks")
2037 for(
size_t i=0; i<list->value().size(); ++i)
2039 const VLXValue& elem = list->value()[i];
2057 importActor(s, vlx, obj.
get());
2065 *vlx <<
"EnableMask" << (
long long)obj->
enableMask();
2066 *vlx <<
"RenderBlock" << (
long long)obj->
renderBlock();
2067 *vlx <<
"RenderRank" << (
long long)obj->
renderRank();
2073 for(
size_t i=0; i<VL_MAX_ACTOR_LOD && obj->
lod(i); ++i)
2075 *vlx <<
"Lods" << renderables;
2090 *vlx <<
"Uniforms" << uniforms;
2102 *vlx <<
"ActorEventCallbacks" << callbacks;
2111 exportActor(s, cast_obj, vlx.get());
2127 for(
size_t i=0; i<vlx->
value().size(); ++i)
2129 const std::string& key = vlx->
value()[i].key();
2131 if (key ==
"ViewMatrix")
2138 if (key ==
"ProjectionMatrix")
2153 if (key ==
"Viewport")
2167 if (key ==
"NearPlane")
2173 if (key ==
"FarPlane")
2191 if (key ==
"Bottom")
2203 if (key ==
"BoundTransform")
2218 importCamera(s, vlx, obj.
get());
2230 *vlx <<
"NearPlane" << (double)obj->
nearPlane();
2231 *vlx <<
"FarPlane" << (double)obj->
farPlane();
2232 *vlx <<
"FOV" << (double)obj->
fov();
2233 *vlx <<
"Left" << (double)obj->
left();
2234 *vlx <<
"Right" << (double)obj->
right();
2235 *vlx <<
"Bottom" << (double)obj->
bottom();
2236 *vlx <<
"Top" << (double)obj->
top();
2247 exportCamera(s, cast_obj, vlx.get());
2264 for(
size_t i=0; i<vlx->
value().size(); ++i)
2266 const std::string& key = vlx->
value()[i].key();
2268 if (key ==
"ClearColor")
2274 if (key ==
"ClearColorInt")
2280 if (key ==
"ClearColorUInt")
2286 if (key ==
"ClearDepth")
2292 if (key ==
"ClearStecil")
2298 if (key ==
"ClearColorMode")
2304 if (key ==
"ClearFlags")
2328 if (key ==
"Height")
2341 importViewport(s, vlx, obj.
get());
2352 *vlx <<
"ClearDepth" << (double)obj->
clearDepth();
2353 *vlx <<
"ClearStecil" << (
long long)obj->
clearStencil();
2356 *vlx <<
"X" << (
long long)obj->
x();
2357 *vlx <<
"Y" << (
long long)obj->
y();
2358 *vlx <<
"Width" << (
long long)obj->
width();
2359 *vlx <<
"Height" << (
long long)obj->
height();
2368 exportViewport(cast_obj, vlx.get());
2384 for(
size_t i=0; i<vlx->
value().size(); ++i)
2386 const std::string& key = vlx->
value()[i].key();
2388 if (key ==
"LocalMatrix")
2405 if (key ==
"Children")
2409 for(
size_t ich=0; ich<list->value().size(); ++ich)
2426 importTransform(s, vlx, obj.
get());
2444 *vlx <<
"Children" << childs;
2453 exportTransform(s, cast_obj, vlx.get());
2469 for(
size_t i=0; i<vlx->
value().size(); ++i)
2471 const std::string& key = vlx->
value()[i].key();
2473 if (key ==
"Ambient")
2480 if (key ==
"Diffuse")
2486 if (key ==
"Specular")
2492 if (key ==
"Position")
2498 if (key ==
"SpotDirection")
2504 if (key ==
"SpotExponent")
2510 if (key ==
"SpotCutoff")
2516 if (key ==
"ConstantAttenuation")
2522 if (key ==
"LinearAttenuation")
2528 if (key ==
"QuadraticAttenuation")
2534 if (key ==
"BoundTransform")
2549 importLight(s, vlx, obj.
get());
2577 exportLight(s, cast_obj, vlx.get());
2589 for(
size_t i=0; i<vlx->
value().size(); ++i)
2591 const std::string& key = vlx->
value()[i].key();
2593 if (key ==
"PlaneNormal")
2599 if (key ==
"PlaneOrigin")
2605 if (key ==
"BoundTransform")
2620 importClipPlane(s, vlx, obj.
get());
2638 exportClipPlane(s, cast_obj, vlx.get());
2654 for(
size_t i=0; i<vlx->
value().size(); ++i)
2656 const std::string& key = vlx->
value()[i].key();
2658 if (key ==
"AttachShader")
2667 if (key ==
"FragDataLocation")
2674 const char* name = list->value()[0].
getIdentifier().c_str();
2675 int index = (int)list->value()[1].getInteger();
2692 if (key ==
"Uniforms")
2696 for(
size_t i=0; i<list->value().size(); ++i)
2699 Uniform* uniform = s.
importVLX( list->value()[i].getStructure() )->as<Uniform>();
2712 importGLSLProgram(s, vlx, obj.
get());
2730 *vlx <<
"Uniforms" << uniforms;
2737 *location << (
long long)it->second;
2738 *vlx <<
"FragDataLocation" << location;
2758 exportGLSLProgram(s, cast_obj, vlx.get());
2776 std::string resolved_path = path->
getString();
2795 if (vlx->
tag() ==
"<vl::GLSLVertexShader>")
2798 if (vlx->
tag() ==
"<vl::GLSLFragmentShader>")
2801 if (vlx->
tag() ==
"<vl::GLSLGeometryShader>")
2804 if (vlx->
tag() ==
"<vl::GLSLTessControlShader>")
2807 if (vlx->
tag() ==
"<vl::GLSLTessEvaluationShader>")
2817 importGLSLShader(s, vlx, obj.
get());
2826 if (!glslsh->
source().empty())
2841 exportGLSLShader(cast_obj, vlx.get());
2867 importVertexAttrib(s, vlx, obj.
get());
2884 exportVertexAttrib(cast_obj, vlx.get());
2906 importColor(s, vlx, obj.
get());
2921 exportColor(cast_obj, vlx.get());
2943 importSecondaryColor(s, vlx, obj.
get());
2958 exportSecondaryColor(cast_obj, vlx.get());
2980 importNormal(s, vlx, obj.
get());
2995 exportNormal(cast_obj, vlx.get());
3011 for(
size_t i=0; i<vlx->
value().size(); ++i)
3013 const std::string& key = vlx->
value()[i].key();
3015 if (key ==
"FrontAmbient")
3021 if (key ==
"FrontDiffuse")
3027 if (key ==
"FrontEmission")
3033 if (key ==
"FrontSpecular")
3039 if (key ==
"FrontShininess")
3045 if (key ==
"BackAmbient")
3051 if (key ==
"BackDiffuse")
3057 if (key ==
"BackEmission")
3063 if (key ==
"BackSpecular")
3069 if (key ==
"BackShininess")
3075 if (key ==
"ColorMaterialEnabled")
3106 importMaterial(s, vlx, obj.
get());
3139 exportMaterial(cast_obj, vlx.get());
3151 if (obj->isOfType(DepthSortCallback::Type()))
3174 if (vlx->
tag() ==
"<vl::DepthSortCallback>")
3184 importActorEventCallback(s, vlx, obj.
get());
3190 if (cb->classType() == DepthSortCallback::Type())
3211 exportActorEventCallback(s, cast_obj, vlx.get());
3229 for(
size_t i=0; i<vlx->
value().size(); ++i)
3231 const std::string& key = vlx->
value()[i].key();
3234 if (key ==
"Dimension")
3240 if (key ==
"TexParameter")
3249 if (key ==
"ImagePath")
3252 std::string resolved_path = value.
getString();
3257 if (key ==
"Format")
3269 if (key ==
"Height")
3281 if (key ==
"GenMipmaps")
3287 if (key ==
"BufferObject")
3295 if (key ==
"Samples")
3301 if (key ==
"FixedSamplesLocations")
3314 importTexture(s, vlx, obj.
get());
3347 *vlx <<
"Width" << (
long long)par->
width();
3350 *vlx <<
"Height" << (
long long)par->
height();
3353 *vlx <<
"Depth" << (
long long)par->
depth();
3367 *vlx <<
"Samples" << (
long long)par->
samples();
3380 exportTexture(s, cast_obj, vlx.get());
3392 for(
size_t i=0; i<vlx->
value().size(); ++i)
3394 const std::string& key = vlx->
value()[i].key();
3397 if (key ==
"MinFilter")
3403 if (key ==
"MagFilter")
3427 if (key ==
"CompareMode")
3433 if (key ==
"CompareFunc")
3439 if (key ==
"DepthTextureMode")
3445 if (key ==
"BorderColor")
3451 if (key ==
"Anisotropy")
3457 if (key ==
"GenerateMipmap")
3470 importTexParameter(s, vlx, obj.
get());
3485 *vlx <<
"Anisotropy" << texparam->
anisotropy();
3495 exportTexParameter(cast_obj, vlx.get());
3531 importTextureSampler(s, vlx, obj.
get());
3549 exportTextureSampler(s, cast_obj, vlx.get());
static void debug(const String &message)
Use this function to provide extra information useful to investigate and solve problems.
const char * vlx_ETextureFormat(ETextureFormat tf)
EProjectionMatrixType projectionMatrixType() const
The Camera's projection matrix type.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
The ArrayAbstract class defines an abstract interface to conveniently manipulate data stored in a Buf...
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
Associates a Renderable object to an Effect and Transform.
VLXRawtextBlock * getRawtextBlock()
void setNearPlane(real nearplane)
The near clipping plane.
void setFrontSpecular(const fvec4 &color)
int baseVertex() const
Returns the currently used base vertex.
VLX wrapper of vl::Shader.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void registerImportedStructure(const VLXStructure *st, Object *obj)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setBaseVertex(int base_vertex)
If base_vertx is != 0 glDrawElementsBaseVertex/glDrawElementsInstancedBaseVertex will be used instead...
const Renderable * lod(int lod_index) const
Returns the Renderable object representing the LOD level specifed by lod_index.
ETextureFormat format() const
void exportGeometry(VLXSerializer &s, const Geometry *geom, VLXStructure *vlx)
void setEffect(Effect *effect)
Binds an Effect to an Actor.
const char * vlx_ETexParamWrap(ETexParamWrap tpw)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const T * at(int i) const
TexParameter * getTexParameter()
The TexParameter object associated to a Texture.
void setTexture(Texture *texture)
The texture sampler by a texture unit.
void setClearStencil(int stencil)
void setEnableMask(unsigned int mask)
The enable mask of an Actor's Effect defines whether the actor should be rendered or not depending on...
const mat4 & viewMatrix() const
Returns the Camera's view matrix (inverse of the modeling matrix).
void setViewport(Viewport *viewport)
The viewport bound to a camera.
VLX wrapper of vl::Viewport.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
VLX wrapper of vl::Geometry.
bool isEnabled() const
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
const std::vector< ref< Uniform > > & uniforms() const
Equivalent to getUniformSet()->uniforms()
void copyTo(T2 *ptr) const
vec3 vlx_vec3(const VLXArrayReal *arr)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
bool canExport(const Object *obj) const
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setPrimitiveType(EPrimitiveType type)
Sets the draw call's primitive type.
Transform * transform()
Returns the Transform bound tho an Actor.
const Transform * boundTransform() const
Returns the Transform bound to a camera.
VLX wrapper of vl::TextureSampler.
Wraps the OpenGL function glTexParameter(), see also http://www.opengl.org/sdk/docs/man/xhtml/glTexPa...
ETexCompareFunc compareFunc() const
const fvec4 & value() const
void exportSecondaryColor(const SecondaryColor *obj, VLXStructure *vlx)
float spotCutoff() const
Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot l...
size_t renderStatesCount() const
VLXValue export_AABB(const AABB &aabb)
void setBackDiffuse(const fvec4 &color)
VLX wrapper of vl::DrawCall and subclasses.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void exportResourceDatabase(VLXSerializer &s, const ResourceDatabase *obj, VLXStructure *vlx)
A simple String formatting class.
float frontShininess() const
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
const std::vector< GLint > & baseVertices() const
Returns the list of base vertices, one for each primitive.
void setObjectName(const char *name)
The name of the object, by default set to the object's class name in debug builds.
static void warning(const String &message)
Use this function to provide information about situations that might lead to errors or loss of data...
void setSetupParams(SetupParams *setup_params)
See SetupParams.
VLX wrapper of vl::Array.
void exportTexture(VLXSerializer &s, const Texture *obj, VLXStructure *vlx)
VLXArrayInteger * getArrayInteger()
void bindTransform(Transform *transform)
Attach the light to a vl::Transform.
const fvec4 & backDiffuse() const
const std::vector< float > & pixelRangeSet() const
void importShader(VLXSerializer &s, const VLXStructure *vlx, Shader *sh)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void importTexParameter(VLXSerializer &s, const VLXStructure *vlx, TexParameter *obj)
EColorMaterial colorMaterial() const
const std::string & getString() const
RenderState wrapping the OpenGL function glNormal(), see also http://www.opengl.org/sdk/docs/man/xhtm...
VLX wrapper of vl::Light.
VLXValue vlx_Rawtext(const std::string &str)
unsigned int handle() const
The handle of this OpenGL shader object as returned by glCreateShader()
Wraps a GLSL geometry shader to be bound to a GLSLProgram: the shader this shader will run on the pro...
const std::vector< GLsizei > & countVector() const
The count vector used as 'count' parameter of glMultiDrawElements.
bool canImport(const VLXStructure *st) const
void setFrontAmbient(const fvec4 &color)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
const String & imagePath() const
const String & filePath() const
The file from which the image was loaded.
EnableSet * getEnableSet()
Wraps a GLSL vertex shader to be bound to a GLSLProgram: the shader this shader will run on the progr...
const ArrayAbstract * vertexArray() const
Conventional vertex array.
void setClearColor(float r, float g, float b, float a)
void importGeometry(VLXSerializer &s, const VLXStructure *vlx, Geometry *geom)
void setClearColorInt(int r, int g, int b, int a)
VLX wrapper of vl::ClipPlane.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
const SetupParams * setupParams() const
See SetupParams.
VLX wrapper of vl::TexParameter.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
Base interface for all MultiDrawElements* sub classes.
VLX wrapper of vl::DepthSortCallback.
const char * vlx_ETexCompareFunc(ETexCompareFunc tcf)
const std::string & getIdentifier() const
bool isEnabled() const
True if the draw call is enabled.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
bool boundsDirty() const
Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed...
void exportGLSLProgram(VLXSerializer &s, const GLSLProgram *obj, VLXStructure *vlx)
VLXValue vlx_String(const std::string &str)
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void setFarPlane(real farplane)
The far clipping plane.
void setWrapT(ETexParamWrap texturewrap)
void setFrontShininess(float shininess)
VLXStructure * exportVLX(const Object *obj)
void setVertexArray(ArrayAbstract *data)
Conventional vertex array.
TexParameter * getTexParameter()
The TexParameter used by the sampler used to override the one specified by the bound Texture...
const char * vlx_ETexParamFilter(ETexParamFilter tpf)
void registerExportedObject(const Object *obj, VLXStructure *st)
void setInstances(int instances)
Sets the number of instances for this set of primitives.
const std::vector< ref< Uniform > > & uniforms() const
Equivalent to gocUniformSet()->uniforms(...)
void importPatchParameter(const VLXStructure *vlx, PatchParameter *pp)
void signalExportError(const String &str)
float linearAttenuation() const
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setPosition(const fvec4 &position)
The position or direction of a light.
void importMaterial(VLXSerializer &s, const VLXStructure *vlx, Material *obj)
void exportLODEvaluator(VLXSerializer &s, const LODEvaluator *obj, VLXStructure *vlx)
Wraps a GLSL tessellation evaluation shader to be bound to a GLSLProgram: this shader will run on the...
int renderBlock() const
Returns the rendering block of an Actor.
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
VLCORE_EXPORT VLXList * setList(VLXList *)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
std::string generateID(const char *prefix)
float constantAttenuation() const
VLX wrapper of vl::PatchParameter.
Wraps an OpenGL texture object representing and managing all the supported texture types...
const Collection< ActorEventCallback > * actorEventCallbacks() const
Returns the list of ActorEventCallback bound to an Actor.
bool isBufferObjectEnabled() const
Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default)...
An array of 64 bits floating point numbers, can also have a tag.
void setWrapS(ETexParamWrap texturewrap)
void setValue(const fvec3 &color)
void setSpecular(const fvec4 &specularcolor)
real left() const
'left' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void setBoundingSphere(const Sphere &sphere)
Sets the bounding sphere of a Renderable.
void setNormalArray(ArrayAbstract *data)
Conventional normal array.
real nearPlane() const
The near clipping plane.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void setSecondaryColorArray(ArrayAbstract *data)
Conventional secondary color array.
void setLinearAttenuation(float linearattenuation)
If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of...
void setDiffuse(const fvec4 &diffusecolor)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void importViewport(VLXSerializer &s, const VLXStructure *vlx, Viewport *obj)
void setColorArray(const fvec4 &color)
Fills the color array with the given color.
const UniformSet * getUniformSet() const
Returns the installed UniformSet.
const char * vlx_ETexCompareMode(ETexCompareMode tcm)
const std::string & source() const
Returns the sources for this shader.
void setBackSpecular(const fvec4 &color)
void setBackEmission(const fvec4 &color)
void setFormat(ETextureFormat format)
Texture * texture()
The texture sampler by a texture unit.
VLX wrapper of vl::GLSLProgram.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
VLX wrapper of vl::DistanceLODEvaluator and vl::PixelLODEvaluator.
void setEnableMask(unsigned int mask)
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
const char * vlx_EUniformType(EUniformType type)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
VLXValue * getValue(const char *key)
void setSpotCutoff(float spotcutoff)
Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot l...
vec2 vlx_vec2(const VLXArrayReal *arr)
void setBoundingBox(const AABB &aabb)
Sets the bounding box of a Renderable.
unsigned int enableMask() const
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
const fvec4 & backAmbient() const
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void exportMaterial(const Material *obj, VLXStructure *vlx)
bool isDisplayListEnabled() const
Returns true if display lists are enabled for a Renderable (disabled by default). ...
void exportLight(VLXSerializer &s, const Light *obj, VLXStructure *vlx)
void setPatchVertices(int vertices)
Specifies the number of vertices that will be used to make up a single patch primitive.
ref< VLXStructure > export_ArrayT(VLXSerializer &s, const Object *arr_abstract)
RenderState wrapping the OpenGL function glColor(), see also http://www.opengl.org/sdk/docs/man/xhtml...
const fvec3 & spotDirection() const
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
EUniformType
Uniform types, see also vl::UniformInfo, vl::GLSLProgram, vl::Uniform, http://www.opengl.org/sdk/docs/man4/xhtml/glGetActiveUniform.xml.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
const ArrayAbstract * colorArray() const
Conventional color array.
int activeLod() const
Returns the lod to be used for rendering.
void importActor(VLXSerializer &s, const VLXStructure *vlx, Actor *obj)
void setPatchDefaultInnerLevel(const fvec2 &level)
The two floating-point values corresponding to the tow inner tessellation levels for each subsequent ...
void importLODEvaluator(VLXSerializer &s, const VLXStructure *vlx, LODEvaluator *obj)
Viewport * viewport()
The viewport bound to a camera.
VLXValue export_Sphere(const Sphere &sphere)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const fvec4 & backSpecular() const
std::string vlx_makeTag(const Object *obj)
Visualization Library main namespace.
void setTexParameter(TexParameter *tex_param)
The TexParameter used by the sampler used to override the one specified by the bound Texture...
Sphere import_Sphere(const VLXStructure *vlx)
const fvec4 & diffuse() const
ETexParamFilter minFilter() const
void setCompareFunc(ETexCompareFunc func)
Wraps a GLSL tessellation control shader to be bound to a GLSLProgram: the shader this shader will ru...
void importCamera(VLXSerializer &s, const VLXStructure *vlx, Camera *obj)
void exportNormal(const Normal *obj, VLXStructure *vlx)
const fvec4 & frontAmbient() const
Wraps a GLSL fragment shader to be bound to a GLSLProgram: the shader this shader will run on the pro...
VLX wrapper of vl::GLSLVertexShader, vl::GLSLFragmentShader, vl::GLSLGeometryShader, vl::GLSLTessControlShader, vl::GLSLTessEvaluationShader.
void setGenerateMipmap(bool generate_mipmap)
virtual bool primitiveRestartEnabled() const
Returns whether the primitive-restart functionality is enabled or not.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
ivec4 vlx_ivec4(const VLXArrayInteger *arr)
void setClearColorUInt(unsigned int r, unsigned int g, unsigned int b, unsigned int a)
bool generateMipmap() const
void exportColor(const Color *obj, VLXStructure *vlx)
Base interface for all DrawElements* sub classes.
DepthSortCallback sorts the primitives of the Geometry bound to the Actor in which the callback is in...
Key/value pair used by VLXStructure.
const unsigned char * ptr() const
Returns the pointer to the first element of the local buffer. Equivalent to bufferObject()->ptr() ...
Transform * boundTransform()
Returns the vl::Transform to which the Light is attached.
vec4 vlx_vec4(const VLXArrayReal *arr)
void exportActor(VLXSerializer &s, const Actor *obj, VLXStructure *vlx)
float quadraticAttenuation() const
const fvec4 & frontDiffuse() const
EClearColorMode clearColorMode() const
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setFixedSamplesLocations(bool fixed)
Base class for most of the OpenGL render state wrapper classes.
void importLight(VLXSerializer &s, const VLXStructure *vlx, Light *obj)
VLXStructure * getStructure()
void setMinFilter(ETexParamFilter minfilter)
void setRenderState(RenderStateNonIndexed *renderstate)
PatchParameter * patchParameter()
The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES.
uvec4 vlx_uivec4(const VLXArrayInteger *arr)
void importActorEventCallback(VLXSerializer &s, const VLXStructure *vlx, ActorEventCallback *obj)
VLXValue export_ShaderPasses(VLXSerializer &s, const ShaderPasses *sh_seq)
void setDepthTextureMode(EDepthTextureMode mode)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void setImagePath(const String &path)
#define VLX_IMPORT_CHECK_RETURN(Condition, Obj)
void setFrontEmission(const fvec4 &color)
bool isOccludee() const
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setBackShininess(float shininess)
virtual void computePointerVector()=0
Computes the pointer vector to be used when BufferObjects are DISABLED.
real fov() const
The field of view of the camera.
Wraps the OpenGL function glClipPlane().
VLX wrapper of vl::Renderable.
const std::string & tag() const
void setValue(const fvec3 &color)
const char * vlx_EPolygonFace(EPolygonFace pf)
mat4 vlx_mat4(const VLXArrayReal *arr)
std::vector< T > & value()
const std::map< std::string, int > & fragDataLocations() const
real top() const
'top' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
std::vector< Value > & value()
void setSamples(int samples)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void exportEffect(VLXSerializer &s, const Effect *obj, VLXStructure *vlx)
void setConstantAttenuation(float constantattenuation)
If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of...
const std::vector< ref< Object > > & resources() const
RenderState wrapping the OpenGL function glVertexAttrib(), see also http://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttrib.xml for more information.
void exportPatchParameter(const PatchParameter *pp, VLXStructure *vlx)
UniformSet * getUniformSet()
Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant...
VLX wrapper of vl::Actor.
The base class for all the reference counted objects.
void setRenderRank(int rank)
Modifies the rendering rank of an Actor.
void exportClipPlane(VLXSerializer &s, const ClipPlane *clip, VLXStructure *vlx)
const Plane & plane() const
Returns the actual plane used to perform the clipping.
void setBorderColor(fvec4 bordercolor)
void exportDrawCall(VLXSerializer &s, const DrawCall *dcall, VLXStructure *vlx)
void get(std::vector< ref< T > > &resources, bool clear_vector=true)
Returns all the objects of the specified type in the given vector.
An abstract class that represents all the objects that can be rendered.
The TextureSampler class associates a Texture object to an OpenGL texture unit.
const uvec4 & clearColorUInt() const
void setSource(const String &source_or_path)
Sets the sources for this shader and schedules a recompilation for it. If the string passed is a file...
virtual void exportRenderable(const Renderable *obj, VLXStructure *vlx)
ETexParamWrap wrapR() const
VLXValue vlx_Identifier(const std::string &str)
Object * importVLX(const VLXStructure *st)
void exportGLSLShader(const GLSLShader *glslsh, VLXStructure *vlx)
void setValue(const fvec4 &value)
int count() const
returns the number of vertices to be rendered.
const std::vector< double > & distanceRangeSet() const
int renderRank() const
Returns the rendering rank of an Actor.
void importColor(VLXSerializer &s, const VLXStructure *vlx, Color *obj)
LODEvaluator * lodEvaluator()
Returns the installed LODEvaluator (if any) or NULL.
virtual void computeBufferObjectPointerVector()=0
Computes the pointer vector to be used when BufferObjects are ENABLED.
Transform * boundTransform()
bool empty() const
Returns true if length() == 0.
Implements the viewport and clearing settings associated to a Camera.
Wrapper for all VLX value types.
ETexParamWrap wrapS() const
real farPlane() const
The far clipping plane.
LODEvaluator * lodEvaluator()
Returns the installed LODEvaluator (if any) or NULL.
void setTransform(Transform *transform)
Binds a Transform to an Actor.
void setClearDepth(real depth)
fvec4 borderColor() const
real bottom() const
'bottom' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
void setUniform(Uniform *uniform)
Utility function using getUniformSet(). Adds a Uniform to this program's static uniform set...
void exportVertexAttrib(const VertexAttrib *obj, VLXStructure *vlx)
void setBackAmbient(const fvec4 &color)
AABB import_AABB(const VLXStructure *vlx)
const BufferObject * bufferObject() const
void setRenderRank(int rank)
Modifies the rendering rank of an Actor.
void setOccludee(bool is_occludee)
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
void importDrawCall(VLXSerializer &s, const VLXStructure *vlx, DrawCall *draw_call)
void importGLSLProgram(VLXSerializer &s, const VLXStructure *vlx, GLSLProgram *obj)
const char * vlx_EEnable(EEnable en)
void setTexCoordArray(int tex_unit, ArrayAbstract *data)
Conventional texture coords arrays.
void setProjectionMatrix(const mat4 &mat, EProjectionMatrixType proj_type)
The Camera's projection matrix.
A sequence of Shader objects each of which represent a rendering pass.
void exportDrawCallBase(VLXSerializer &s, const DrawCall *obj, VLXStructure *vlx)
void setPatchDefaultOuterLevel(const fvec4 &level)
The four floating-point values corresponding to the four outer tessellation levels for each subsequen...
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setQuadraticAttenuation(float quadraticattenuation)
If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of...
An array of 64 bits integers, can also have a tag.
T * as()
Casts an Object to the specified class.
void setDimension(ETextureDimension dimension)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void setLODEvaluator(LODEvaluator *lod_evaluator)
Installs the LODEvaluator used to compute the current LOD at rendering time.
ETextureDimension dimension() const
VLXArrayReal * getArrayReal()
VLX wrapper of vl::Camera.
void setEnabled(bool enabled)
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
void importGLSLShader(VLXSerializer &s, const VLXStructure *vlx, GLSLShader *obj)
int patchVertices() const
Returns the number of vertices that will be used to make up a single patch primitive.
void setUniform(Uniform *uniform)
Equivalent to getUniformSet()->setUniform(uniform)
void setActiveLod(int lod)
Sets the lod to be used for rendering.
The ActorEventCallback class defines a callback object to react to Actor-related events.
void exportActorEventCallback(VLXSerializer &s, const ActorEventCallback *cb, VLXStructure *vlx)
int renderRank() const
Returns the rendering rank of an Effect.
void setViewMatrix(const mat4 &mat)
Sets the Camera's view matrix (inverse of the modeling matrix).
void exportCamera(VLXSerializer &s, const Camera *obj, VLXStructure *vlx)
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
void setSpotExponent(float spotexponent)
unsigned int enableMask() const
The enable mask of an Actor's Effect defines whether the actor should be rendered or not depending on...
VLX wrapper of vl::VertexAttrib.
VLX wrapper of vl::SecondaryColor.
void setPrimitiveRestartEnabled(bool enabled)
Enables the primitive-restart functionality.
void exportViewport(const Viewport *obj, VLXStructure *vlx)
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
void setClearColorMode(EClearColorMode mode)
Abstract class to compute the appropriate LOD of an Actor or Effect.
void setSpotDirection(const fvec3 &spotdirection)
A LODEvaluator that computes the appropriate LOD based on the distance of an Actor from the Camera...
void importResourceDatabase(VLXSerializer &s, const VLXStructure *vlx, ResourceDatabase *resdb)
RenderState wrapping the OpenGL function glMaterial() and glColorMaterial(), see also http://www...
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
Defines the sequence of Shader objects used to render an Actor.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const fvec4 & frontSpecular() const
void signalImportError(const String &str)
void setDisplayListEnabled(bool enabled)
Enable/disable display lists (disabled by default).
Effect * effect()
Returns the Effect bound to an Actor.
void importRenderable(const VLXStructure *vlx, Renderable *ren)
void importSecondaryColor(VLXSerializer &s, const VLXStructure *vlx, SecondaryColor *obj)
EEnable
Constant that enable/disable a specific OpenGL feature, see also Shader, Shader::enable(), Shader::disable(), Shader::isEnabled()
The BufferObject class is a Buffer that can upload its data on the GPU memory.
const ivec4 & clearColorInt() const
A simple sequence of VLXValue objects, can also have a tag.
void importTexture(VLXSerializer &s, const VLXStructure *vlx, Texture *obj)
int instances() const
Returns the number of instances for this set of primitives.
Base cass for all class wrappers implementing the translation to/from its VLX representation.
ETexParamFilter magFilter() const
ETextureDimension vlx_ETextureDimension(const VLXValue &value, VLXSerializer &s)
const vec3 & normal() const
const fvec4 & specular() const
VLX wrapper of vl::Effect.
const std::string & objectName() const
The name of the object, by default set to the object's class name.
void setColorMaterial(EPolygonFace face, EColorMaterial color)
void importTextureSampler(VLXSerializer &s, const VLXStructure *vlx, TextureSampler *obj)
The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements.
UniformSet * getUniformSet()
Returns the UniformSet installed.
void importClipPlane(VLXSerializer &s, const VLXStructure *vlx, ClipPlane *obj)
SetupParams wraps all the parameters needed to crate a Texture.
void setFrontDiffuse(const fvec4 &color)
Unknown or other projection type.
VLX wrapper of vl::Color.
void setLODEvaluator(LODEvaluator *lod_evaluator)
Installs the LODEvaluator used to compute the current LOD at rendering time.
#define VLX_IMPORT_CHECK_RETURN_NULL(Condition, Obj)
void setColorMaterialEnabled(bool enabled)
void bindTransform(Transform *transform)
Bind the camera to a Transform.
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
VLX wrapper of vl::Texture.
RenderStateSet * getRenderStateSet()
void bindTransform(Transform *transform)
If NULL follows the camera otherwise the given transformation node.
const fvec4 & position() const
The position or direction of a light.
const fvec4 & clearColor() const
void setValue(const fvec4 &color)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
void setLod(int lod_index, Renderable *renderable)
Sets the Renderable object representing the LOD level specifed by lod_index.
virtual bool primitiveRestartEnabled() const
Returns whether the primitive-restart functionality is enabled or not (requires OpenGL 3...
const fvec2 & patchDefaultInnerLevel() const
The two floating-point values corresponding to the tow inner tessellation levels for each subsequent ...
const String & path() const
The path from which the shader was loaded.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
EPrimitiveType vlx_EPrimitiveType(const VLXValue &value, VLXSerializer &s)
void exportShader(VLXSerializer &s, const Shader *obj, VLXStructure *vlx)
void setWrapR(ETexParamWrap texturewrap)
void exportTextureSampler(VLXSerializer &s, const TextureSampler *tex_sampler, VLXStructure *vlx)
void bindFragDataLocation(int color_number, const char *name)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const fvec4 & value() const
const char * vlx_EProjectionMatrixType(EProjectionMatrixType pt)
const mat4 & projectionMatrix() const
The Camera's projection matrix.
Wraps the OpenGL function glLight().
void resolvePath(std::string &path)
If the given path starts with "this:" then the "this:" prefix is replaced with the documentURL()...
const ArrayAbstract * secondaryColorArray() const
Conventional secondary color array.
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
ETexParamWrap wrapT() const
const char * vlx_EColorMaterial(EColorMaterial cm)
VLX wrapper of vl::Normal.
void setEnabled(bool enable)
Enables/disables the draw call.
The ref<> class is used to reference-count an Object.
const ArrayAbstract * texCoordArray(int tex_unit) const
Conventional texture coords arrays.
ETexCompareMode compareMode() const
real right() const
'right' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
float spotExponent() const
int start() const
returns the starting vertex for the rendering.
std::string getShaderSource() const
Retrieves the shader source using glGetShaderSource()
void setAnisotropy(float anisotropy)
const char * vlx_EClearColorMode(EClearColorMode ccm)
void setFOV(real fov)
The field of view of the camera.
void setFogCoordArray(ArrayAbstract *data)
Conventional fog array.
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
ESortMode sortMode() const
const AABB & boundingBox() const
Returns the bounding box of a Renderable without recomputing the bounds if dirty. ...
static String printf(const char *fmt,...)
Returns a formatted string using the legacy printf syntax. The resulting string can be maximum 1024 +...
std::vector< VLXValue > & value()
int instances() const
Returns the number of instances for this set of primitives.
std::string toStdString() const
Returns a UTF8 encoded std::string.
const ArrayAbstract * fogCoordArray() const
Conventional fog array.
void importEffect(VLXSerializer &s, const VLXStructure *vlx, Effect *obj)
EDepthTextureMode depthTextureMode() const
bool attachShader(GLSLShader *shader)
Attaches the GLSLShader to this GLSLProgram.
long long getInteger() const
EPrimitiveType primitiveType() const
Returns the draw call's primitive type.
A list of key/VLXValue pairs, can also have a tag.
const fvec4 & backEmission() const
const Sphere & boundingSphere() const
Returns the bounding sphere of a Renderable without recomputing the bounds if dirty.
void setGenMipmaps(bool on)
const fvec4 & frontEmission() const
const RenderStateSlot * renderStates() const
Wraps the OpenGL function glDrawArrays().
void setUniform(Uniform *uniform)
Equivalent to gocUniformSet()->setUniform(...)
void setMagFilter(ETexParamFilter magfilter)
void setBufferObjectEnabled(bool enabled)
Enable/disable BufferObject (vertex buffer object) (enabled by default).
int shaderCount() const
Returns the number of GLSLShader objects bound to this GLSLProgram.
Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format.
void setBufferObject(BufferObject *bo)
bool fixedSamplesLocations() const
void importVertexAttrib(VLXSerializer &s, const VLXStructure *vlx, VertexAttrib *obj)
const fvec3 & value() const
const char * vlx_EDepthTextureMode(EDepthTextureMode dtm)
const Image * image() const
void enable(EEnable capability)
void setRenderBlock(int block)
Modifies the rendering block of an Actor.
void importNormal(VLXSerializer &s, const VLXStructure *vlx, Normal *obj)
virtual ref< VLXStructure > exportVLX(VLXSerializer &s, const Object *obj)
virtual ref< Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
VLX wrapper of vl::ResourceDatabase.
const GLSLShader * shader(int i) const
Returns the i-th GLSLShader objects bound to this GLSLProgram.
void exportTexParameter(const TexParameter *texparam, VLXStructure *vlx)
void setHeight(int height)
A LODEvaluator that computes the appropriate LOD based on the approximate 2d area that an Actor cover...
void setCompareMode(ETexCompareMode mode)
void setNormal(const vec3 &normal)
const ArrayAbstract * normalArray() const
Conventional normal array.
float backShininess() const
void setOrigin(real origin)
const fvec4 & ambient() const
VLXValue vlx_toValue(const std::vector< int > &vec)
The ResourceDatabase class contains and manipulates a set of resources.
void setAmbient(const fvec4 &ambientcolor)
const char * vlx_EClearFlags(EClearFlags cf)
Collection< DrawCall > & drawCalls()
Returns the list of DrawCall objects bound to a Geometry.
const fvec3 & value() const
const ref< ShaderPasses > & lod(int lod_level) const
Returns the ShaderPasses representing the specified LOD level.
bool colorMaterialEnabled() const
RenderState wrapping the OpenGL function glSecondaryColor(), see also http://www.opengl.org/sdk/docs/man/xhtml/glSecondaryColor.xml for more information.
void setPrimitiveRestartEnabled(bool enabled)
Enables the primitive-restart functionality (requires OpenGL 3.1).
VLX wrapper of vl::Material.
EClearFlags clearFlags() const
void setClearFlags(EClearFlags clear_flags)
Usually you want to use rather RendererAbstract::setClearFlags()
EPolygonFace colorMaterialFace() const
const fvec4 & patchDefaultOuterLevel() const
The four floating-point values corresponding to the four outer tessellation levels for each subsequen...
const std::vector< EEnable > & enables() const
Wrapper of glPatchParameter(), specifies the parameters for patch primitives, used by vl::DrawCall::s...