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() == vl::ArrayUInt1::Type())
416 vlx = export_ArrayT<vl::ArrayUInt1, VLXArrayInteger>(s, obj);
418 if(obj->classType() == vl::ArrayUInt2::Type())
419 vlx = export_ArrayT<vl::ArrayUInt2, VLXArrayInteger>(s, obj);
421 if(obj->classType() == vl::ArrayUInt3::Type())
422 vlx = export_ArrayT<vl::ArrayUInt3, VLXArrayInteger>(s, obj);
424 if(obj->classType() == vl::ArrayUInt4::Type())
425 vlx = export_ArrayT<vl::ArrayUInt4, VLXArrayInteger>(s, obj);
428 if(obj->classType() == vl::ArrayInt1::Type())
429 vlx = export_ArrayT<vl::ArrayInt1, VLXArrayInteger>(s, obj);
431 if(obj->classType() == vl::ArrayInt2::Type())
432 vlx = export_ArrayT<vl::ArrayInt2, VLXArrayInteger>(s, obj);
434 if(obj->classType() == vl::ArrayInt3::Type())
435 vlx = export_ArrayT<vl::ArrayInt3, VLXArrayInteger>(s, obj);
437 if(obj->classType() == vl::ArrayInt4::Type())
438 vlx = export_ArrayT<vl::ArrayInt4, VLXArrayInteger>(s, obj);
441 if(obj->classType() == vl::ArrayUShort1::Type())
442 vlx = export_ArrayT<vl::ArrayUShort1, VLXArrayInteger>(s, obj);
444 if(obj->classType() == vl::ArrayUShort2::Type())
445 vlx = export_ArrayT<vl::ArrayUShort2, VLXArrayInteger>(s, obj);
447 if(obj->classType() == vl::ArrayUShort3::Type())
448 vlx = export_ArrayT<vl::ArrayUShort3, VLXArrayInteger>(s, obj);
450 if(obj->classType() == vl::ArrayUShort4::Type())
451 vlx = export_ArrayT<vl::ArrayUShort4, VLXArrayInteger>(s, obj);
454 if(obj->classType() == vl::ArrayUShort1::Type())
455 vlx = export_ArrayT<vl::ArrayUShort1, VLXArrayInteger>(s, obj);
457 if(obj->classType() == vl::ArrayUShort2::Type())
458 vlx = export_ArrayT<vl::ArrayUShort2, VLXArrayInteger>(s, obj);
460 if(obj->classType() == vl::ArrayUShort3::Type())
461 vlx = export_ArrayT<vl::ArrayUShort3, VLXArrayInteger>(s, obj);
463 if(obj->classType() == vl::ArrayUShort4::Type())
464 vlx = export_ArrayT<vl::ArrayUShort4, VLXArrayInteger>(s, obj);
467 if(obj->classType() == vl::ArrayShort1::Type())
468 vlx = export_ArrayT<vl::ArrayShort1, VLXArrayInteger>(s, obj);
470 if(obj->classType() == vl::ArrayShort2::Type())
471 vlx = export_ArrayT<vl::ArrayShort2, VLXArrayInteger>(s, obj);
473 if(obj->classType() == vl::ArrayShort3::Type())
474 vlx = export_ArrayT<vl::ArrayShort3, VLXArrayInteger>(s, obj);
476 if(obj->classType() == vl::ArrayShort4::Type())
477 vlx = export_ArrayT<vl::ArrayShort4, VLXArrayInteger>(s, obj);
480 if(obj->classType() == vl::ArrayUByte1::Type())
481 vlx = export_ArrayT<vl::ArrayUByte1, VLXArrayInteger>(s, obj);
483 if(obj->classType() == vl::ArrayUByte2::Type())
484 vlx = export_ArrayT<vl::ArrayUByte2, VLXArrayInteger>(s, obj);
486 if(obj->classType() == vl::ArrayUByte3::Type())
487 vlx = export_ArrayT<vl::ArrayUByte3, VLXArrayInteger>(s, obj);
489 if(obj->classType() == vl::ArrayUByte4::Type())
490 vlx = export_ArrayT<vl::ArrayUByte4, VLXArrayInteger>(s, obj);
493 if(obj->classType() == vl::ArrayByte1::Type())
494 vlx = export_ArrayT<vl::ArrayByte1, VLXArrayInteger>(s, obj);
496 if(obj->classType() == vl::ArrayByte2::Type())
497 vlx = export_ArrayT<vl::ArrayByte2, VLXArrayInteger>(s, obj);
499 if(obj->classType() == vl::ArrayByte3::Type())
500 vlx = export_ArrayT<vl::ArrayByte3, VLXArrayInteger>(s, obj);
502 if(obj->classType() == vl::ArrayByte4::Type())
503 vlx = export_ArrayT<vl::ArrayByte4, VLXArrayInteger>(s, obj);
506 if(obj->classType() == vl::ArrayFloat1::Type())
507 vlx = export_ArrayT<vl::ArrayFloat1, VLXArrayReal>(s, obj);
509 if(obj->classType() == vl::ArrayFloat2::Type())
510 vlx = export_ArrayT<vl::ArrayFloat2, VLXArrayReal>(s, obj);
512 if(obj->classType() == vl::ArrayFloat3::Type())
513 vlx = export_ArrayT<vl::ArrayFloat3, VLXArrayReal>(s, obj);
515 if(obj->classType() == vl::ArrayFloat4::Type())
516 vlx = export_ArrayT<vl::ArrayFloat4, VLXArrayReal>(s, obj);
519 if(obj->classType() == vl::ArrayDouble1::Type())
520 vlx = export_ArrayT<vl::ArrayDouble1, VLXArrayReal>(s, obj);
522 if(obj->classType() == vl::ArrayDouble2::Type())
523 vlx = export_ArrayT<vl::ArrayDouble2, VLXArrayReal>(s, obj);
525 if(obj->classType() == vl::ArrayDouble3::Type())
526 vlx = export_ArrayT<vl::ArrayDouble3, VLXArrayReal>(s, obj);
528 if(obj->classType() == vl::ArrayDouble4::Type())
529 vlx = export_ArrayT<vl::ArrayDouble4, VLXArrayReal>(s, obj);
558 vl::Log::debug(
"VLXClassWrapper_Renderable : skipping dirty bounds.\n");
567 const std::vector<VLXStructure::KeyValue>& 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');
682 if (strstr(key.c_str(),
"VertexAttribArray") == key.c_str())
711 if (key ==
"DrawCall")
728 importGeometry(s, vlx, geom.
get());
772 for(
size_t i=0; i<geom->
drawCalls().size(); ++i) {
783 exportGeometry(s, cast_obj, vlx.get());
795 if(draw_call->isOfType(vl::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(vl::DrawElementsUInt::Type()) )
851 if ( de->isOfType(vl::DrawElementsUShort::Type()) )
857 if ( de->isOfType(vl::DrawElementsUByte::Type()) )
866 if(draw_call->isOfType(vl::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(vl::MultiDrawElementsUInt::Type()) )
931 if ( de->isOfType(vl::MultiDrawElementsUShort::Type()) )
937 if ( de->isOfType(vl::MultiDrawElementsUByte::Type()) )
952 if( draw_call->isOfType(vl::DrawArrays::Type()) )
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" )
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(vl::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(vl::DrawElementsUInt::Type()))
1055 *vlx <<
"Instances" << (
long long)de->
instances();
1057 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1061 if (dcall->isOfType(vl::DrawElementsUShort::Type()))
1064 *vlx <<
"Instances" << (
long long)de->
instances();
1066 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1070 if (dcall->isOfType(vl::DrawElementsUByte::Type()))
1073 *vlx <<
"Instances" << (
long long)de->
instances();
1075 *vlx <<
"BaseVertex" << (
long long)de->
baseVertex();
1079 if (dcall->isOfType(vl::MultiDrawElementsUInt::Type()))
1088 if (dcall->isOfType(vl::MultiDrawElementsUShort::Type()))
1097 if (dcall->isOfType(vl::MultiDrawElementsUByte::Type()))
1117 exportDrawCall(s, cast_obj, vlx.get());
1129 std::vector<VLXStructure::KeyValue> 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)
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();
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 vl::UT_INT_VEC2: arr_int->value().resize(count*2); arr_int->copyFrom( (
int*)uniform->
rawData() );
break;
1501 case vl::UT_INT_VEC3: arr_int->value().resize(count*3); arr_int->copyFrom( (
int*)uniform->
rawData() );
break;
1502 case vl::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 vl::UT_FLOAT_VEC2: arr_real->value().resize(count*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1523 case vl::UT_FLOAT_VEC3: arr_real->value().resize(count*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1524 case vl::UT_FLOAT_VEC4: arr_real->value().resize(count*4); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1526 case vl::UT_FLOAT_MAT2: arr_real->value().resize(count*2*2); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1527 case vl::UT_FLOAT_MAT3: arr_real->value().resize(count*3*3); arr_real->copyFrom( (
float*)uniform->
rawData() );
break;
1528 case vl::UT_FLOAT_MAT4: arr_real->value().resize(count*4*4); 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; }
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(vl::RenderStateIndexed::Type())) || (index >= 0 && renderstate->isOfType(vl::RenderStateIndexed::Type())), list->value()[i] )
1645 for(
size_t i=0; i<list->value().size(); ++i)
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();
1703 *renderstates.
getList() << (
long long)index;
1707 *vlx <<
"RenderStates" << renderstates;
1716 exportShader(s, cast_obj, vlx.get());
1728 if (obj->isOfType(vl::DistanceLODEvaluator::Type()))
1734 const VLXArrayReal* arr = vlx_distances->getArrayReal();
1735 if (arr->value().size())
1742 if (obj->isOfType(vl::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() == vl::DistanceLODEvaluator::Type())
1788 distances.getArrayReal()->value().resize( lod->
distanceRangeSet().size() );
1791 *vlx <<
"DistanceRageSet" << distances;
1794 if (obj->classType() == vl::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::KeyValue>& 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((
int)ilod)->push_back( shader );
1889 importEffect(s, vlx, obj.
get());
1896 for(
size_t 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::KeyValue>& 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)
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)
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(vl::DepthSortCallback::Type()))
3174 if (vlx->
tag() ==
"<vl::DepthSortCallback>")
3184 importActorEventCallback(s, vlx, obj.
get());
3190 if (cb->classType() == vl::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());
3522 importTextureSampler(s, vlx, obj.
get());
3538 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.
EProjectionMatrixType projectionMatrixType() const
The Camera's projection matrix type.
VLX wrapper of vl::Array.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
The ArrayAbstract class defines an abstract interface to conveniently manipulate data stored in a Buf...
Associates a Renderable object to an Effect and Transform.
void setNearPlane(real nearplane)
The near clipping plane.
void setFrontSpecular(const fvec4 &color)
int baseVertex() const
Returns the currently used base vertex.
vl::EPrimitiveType vlx_EPrimitiveType(const VLXValue &value, VLXSerializer &s)
void exportTextureSampler(VLXSerializer &s, const vl::TextureImageUnit *tex_sampler, 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 exportVertexAttrib(const vl::VertexAttrib *obj, VLXStructure *vlx)
void setEffect(Effect *effect)
Binds an Effect to an Actor.
TexParameter * getTexParameter()
The TexParameter object associated to a Texture.
void exportLODEvaluator(VLXSerializer &s, const vl::LODEvaluator *obj, VLXStructure *vlx)
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...
VLXRawtextBlock * getRawtextBlock()
void exportViewport(const vl::Viewport *obj, VLXStructure *vlx)
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.
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 exportNormal(const vl::Normal *obj, VLXStructure *vlx)
void exportGLSLShader(const vl::GLSLShader *glslsh, VLXStructure *vlx)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setPrimitiveType(EPrimitiveType type)
Sets the draw call's primitive type.
Transform * transform()
Returns the Transform bound tho an Actor.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void exportPatchParameter(const vl::PatchParameter *pp, VLXStructure *vlx)
const Transform * boundTransform() const
Returns the Transform bound to a camera.
void importTexParameter(VLXSerializer &s, const VLXStructure *vlx, vl::TexParameter *obj)
Wrapper for all VLX value types.
Wraps the OpenGL function glTexParameter(), see also http://www.opengl.org/sdk/docs/man/xhtml/glTexPa...
ETexCompareFunc compareFunc() const
VLX wrapper of vl::Texture.
const fvec4 & value() const
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
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
void exportClipPlane(VLXSerializer &s, const vl::ClipPlane *clip, VLXStructure *vlx)
void setBackDiffuse(const fvec4 &color)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void exportActor(VLXSerializer &s, const vl::Actor *obj, VLXStructure *vlx)
vlX::VLXValue * getValue(const char *key)
vl::vec4 vlx_vec4(const VLXArrayReal *arr)
const char * vlx_ETextureFormat(vl::ETextureFormat tf)
VLX wrapper of vl::DistanceLODEvaluator and vl::PixelLODEvaluator.
A simple String formatting class.
float frontShininess() const
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.
std::string vlx_makeTag(const vl::Object *obj)
static void warning(const String &message)
Use this function to provide information about situations that might lead to errors or loss of data...
VLX_EXPORT VLXList * setList(VLXList *)
void setSetupParams(SetupParams *setup_params)
See SetupParams.
void bindTransform(Transform *transform)
Attach the light to a vl::Transform.
vl::ref< VLXStructure > export_ArrayT(VLXSerializer &s, const vl::Object *arr_abstract)
const fvec4 & backDiffuse() const
VLX wrapper of vl::Material.
const std::vector< float > & pixelRangeSet() const
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
EColorMaterial colorMaterial() const
RenderState wrapping the OpenGL function glNormal(), see also http://www.opengl.org/sdk/docs/man/xhtm...
void importTextureSampler(VLXSerializer &s, const VLXStructure *vlx, vl::TextureImageUnit *obj)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
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...
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void exportActorEventCallback(VLXSerializer &s, const vl::ActorEventCallback *cb, VLXStructure *vlx)
Key/value pair used by VLXStructure.
const std::vector< GLsizei > & countVector() const
The count vector used as 'count' parameter of glMultiDrawElements.
void setFrontAmbient(const fvec4 &color)
void importGeometry(VLXSerializer &s, const VLXStructure *vlx, vl::Geometry *geom)
void exportEffect(VLXSerializer &s, const vl::Effect *obj, VLXStructure *vlx)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
const String & imagePath() const
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
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.
VLXStructure * exportVLX(const vl::Object *obj)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setClearColor(float r, float g, float b, float a)
void importGLSLShader(VLXSerializer &s, const VLXStructure *vlx, vl::GLSLShader *obj)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setClearColorInt(int r, int g, int b, int a)
const SetupParams * setupParams() const
See SetupParams.
std::string generateID(const char *prefix)
VLXValue vlx_String(const std::string &str)
const char * vlx_EPolygonFace(vl::EPolygonFace pf)
void copyTo(T2 *ptr) const
Base interface for all MultiDrawElements* sub classes.
void importVertexAttrib(VLXSerializer &s, const VLXStructure *vlx, vl::VertexAttrib *obj)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
bool isEnabled() const
True if the draw call is enabled.
void importDrawCall(VLXSerializer &s, const VLXStructure *vlx, vl::DrawCall *draw_call)
bool boundsDirty() const
Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed...
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void exportMaterial(const vl::Material *obj, VLXStructure *vlx)
void setFarPlane(real farplane)
The far clipping plane.
void setWrapT(ETexParamWrap texturewrap)
void setFrontShininess(float shininess)
void setVertexArray(ArrayAbstract *data)
Conventional vertex array.
const char * vlx_EClearColorMode(vl::EClearColorMode ccm)
An array of 64 bits floating point numbers, can also have a tag.
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(...)
float linearAttenuation() const
void setPosition(const fvec4 &position)
The position or direction of a light.
VLX wrapper of vl::Viewport.
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. ...
VLXValue export_Sphere(const vl::Sphere &sphere)
float constantAttenuation() const
Base cass for all class wrappers implementing the translation to/from its VLX representation.
VLX wrapper of vl::GLSLProgram.
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)...
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*() ...
void setBoundingSphere(const Sphere &sphere)
Sets the bounding sphere of a Renderable.
void setNormalArray(ArrayAbstract *data)
Conventional normal array.
void exportGLSLProgram(VLXSerializer &s, const vl::GLSLProgram *obj, VLXStructure *vlx)
vl::vec3 vlx_vec3(const VLXArrayReal *arr)
real nearPlane() const
The near clipping plane.
void setSecondaryColorArray(ArrayAbstract *data)
Conventional secondary color array.
const char * vlx_ETexCompareMode(vl::ETexCompareMode tcm)
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)
void signalExportError(const vl::String &str)
void setColorArray(const fvec4 &color)
Fills the color array with the given color.
const UniformSet * getUniformSet() const
Returns the installed UniformSet.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const char * vlx_EProjectionMatrixType(vl::EProjectionMatrixType pt)
VLXStructure * getStructure()
const std::string & source() const
Returns the sources for this shader.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setBackSpecular(const fvec4 &color)
void importResourceDatabase(VLXSerializer &s, const VLXStructure *vlx, vl::ResourceDatabase *resdb)
void setBackEmission(const fvec4 &color)
void setFormat(ETextureFormat format)
void importClipPlane(VLXSerializer &s, const VLXStructure *vlx, vl::ClipPlane *obj)
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...
void exportDrawCallBase(VLXSerializer &s, const vl::DrawCall *obj, VLXStructure *vlx)
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...
void importPatchParameter(const VLXStructure *vlx, vl::PatchParameter *pp)
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
const T * at(size_t i) const
bool isDisplayListEnabled() const
Returns true if display lists are enabled for a Renderable (disabled by default). ...
void setPatchVertices(int vertices)
Specifies the number of vertices that will be used to make up a single patch primitive.
RenderState wrapping the OpenGL function glColor(), see also http://www.opengl.org/sdk/docs/man/xhtml...
const fvec3 & spotDirection() const
void exportResourceDatabase(VLXSerializer &s, const vl::ResourceDatabase *obj, VLXStructure *vlx)
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.
void importMaterial(VLXSerializer &s, const VLXStructure *vlx, vl::Material *obj)
const ArrayAbstract * colorArray() const
Conventional color array.
int activeLod() const
Returns the lod to be used for rendering.
void importGLSLProgram(VLXSerializer &s, const VLXStructure *vlx, vl::GLSLProgram *obj)
void setPatchDefaultInnerLevel(const fvec2 &level)
The two floating-point values corresponding to the tow inner tessellation levels for each subsequent ...
vl::Object * importVLX(const VLXStructure *st)
Viewport * viewport()
The viewport bound to a camera.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
const fvec4 & backSpecular() const
std::vector< VLXValue > & value()
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, 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 importLight(VLXSerializer &s, const VLXStructure *vlx, vl::Light *obj)
VLX wrapper of vl::SecondaryColor.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
const fvec4 & frontAmbient() const
Wraps a GLSL fragment shader to be bound to a GLSLProgram: the shader this shader will run on the pro...
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setGenerateMipmap(bool generate_mipmap)
virtual bool primitiveRestartEnabled() const
Returns whether the primitive-restart functionality is enabled or not.
The TextureImageUnit class associates a Texture object to an OpenGL texture unit. ...
void setClearColorUInt(unsigned int r, unsigned int g, unsigned int b, unsigned int a)
bool generateMipmap() const
const char * vlx_EClearFlags(vl::EClearFlags cf)
const char * vlx_EEnable(vl::EEnable en)
long long getInteger() const
Base interface for all DrawElements* sub classes.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
DepthSortCallback sorts the primitives of the Geometry bound to the Actor in which the callback is in...
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.
A list of key/VLXValue pairs, can also have a tag.
virtual void exportRenderable(const vl::Renderable *obj, VLXStructure *vlx)
const char * vlx_ETexParamFilter(vl::ETexParamFilter tpf)
float quadraticAttenuation() const
Texture * texture()
The texture sampler by a texture unit.
const fvec4 & frontDiffuse() const
EClearColorMode clearColorMode() const
void exportSecondaryColor(const vl::SecondaryColor *obj, VLXStructure *vlx)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setFixedSamplesLocations(bool fixed)
Base class for most of the OpenGL render state wrapper classes.
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.
void exportColor(const vl::Color *obj, VLXStructure *vlx)
void setDepthTextureMode(EDepthTextureMode mode)
void setStart(int start)
sets the starting vertex for the rendering.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setImagePath(const String &path)
void setCount(int count)
sets the number of vertices to be rendered.
VLX wrapper of vl::Light.
void setFrontEmission(const fvec4 &color)
vl::Sphere import_Sphere(const VLXStructure *vlx)
bool isOccludee() const
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
void setBackShininess(float shininess)
void exportDrawCall(VLXSerializer &s, const vl::DrawCall *dcall, VLXStructure *vlx)
VLX wrapper of vl::Color.
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().
const char * vlx_EDepthTextureMode(vl::EDepthTextureMode dtm)
const char * vlx_ETexCompareFunc(vl::ETexCompareFunc tcf)
void setValue(const fvec3 &color)
const std::map< std::string, int > & fragDataLocations() const
real top() const
'top' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
void setSamples(int samples)
VLX wrapper of vl::Geometry.
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
void importActor(VLXSerializer &s, const VLXStructure *vlx, vl::Actor *obj)
RenderState wrapping the OpenGL function glVertexAttrib(), see also http://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttrib.xml for more information.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
A simple sequence of VLXValue objects, can also have a tag.
UniformSet * getUniformSet()
Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant...
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void exportShader(VLXSerializer &s, const vl::Shader *obj, VLXStructure *vlx)
The base class for all the reference counted objects.
void setRenderRank(int rank)
Modifies the rendering rank of an Actor.
void signalImportError(const vl::String &str)
const Plane & plane() const
Returns the actual plane used to perform the clipping.
void setBorderColor(fvec4 bordercolor)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void exportGeometry(VLXSerializer &s, const vl::Geometry *geom, VLXStructure *vlx)
vl::uvec4 vlx_uivec4(const VLXArrayInteger *arr)
void get(std::vector< ref< T > > &resources, bool clear_vector=true)
Returns all the objects of the specified type in the given vector.
const std::string & tag() const
An abstract class that represents all the objects that can be rendered.
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 vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
vl::ivec4 vlx_ivec4(const VLXArrayInteger *arr)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
ETexParamWrap wrapR() const
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setValue(const fvec4 &value)
int count() const
returns the number of vertices to be rendered.
bool canExport(const vl::Object *obj) const
const std::vector< double > & distanceRangeSet() const
int renderRank() const
Returns the rendering rank of an Actor.
VLX wrapper of vl::Actor.
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.
ETexParamWrap wrapS() const
real farPlane() const
The far clipping plane.
VLXValue vlx_Identifier(const std::string &str)
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 setBackAmbient(const fvec4 &color)
void exportTexParameter(const vl::TexParameter *texparam, 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 ...
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void registerExportedObject(const vl::Object *obj, VLXStructure *st)
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 setPatchDefaultOuterLevel(const fvec4 &level)
The four floating-point values corresponding to the four outer tessellation levels for each subsequen...
void setQuadraticAttenuation(float quadraticattenuation)
If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of...
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
#define VLX_IMPORT_CHECK_RETURN_NULL(Condition, Obj)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
T * as()
Casts an Object to the specified class.
void setDimension(ETextureDimension dimension)
void setLODEvaluator(LODEvaluator *lod_evaluator)
Installs the LODEvaluator used to compute the current LOD at rendering time.
void importShader(VLXSerializer &s, const VLXStructure *vlx, vl::Shader *sh)
std::vector< KeyValue > & value()
ETextureDimension dimension() const
void setEnabled(bool enabled)
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
int patchVertices() const
Returns the number of vertices that will be used to make up a single patch primitive.
VLX wrapper of vl::ClipPlane.
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.
int renderRank() const
Returns the rendering rank of an Effect.
void importNormal(VLXSerializer &s, const VLXStructure *vlx, vl::Normal *obj)
void setViewMatrix(const mat4 &mat)
Sets the Camera's view matrix (inverse of the modeling matrix).
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
VLX wrapper of vl::DepthSortCallback.
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...
void setPrimitiveRestartEnabled(bool enabled)
Enables the primitive-restart functionality.
VLX wrapper of vl::Camera.
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
An array of 64 bits integers, can also have a tag.
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...
RenderState wrapping the OpenGL function glMaterial() and glColorMaterial(), see also http://www...
Defines the sequence of Shader objects used to render an Actor.
const fvec4 & frontSpecular() const
void importColor(VLXSerializer &s, const VLXStructure *vlx, vl::Color *obj)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
#define VLX_IMPORT_CHECK_RETURN(Condition, Obj)
void setDisplayListEnabled(bool enabled)
Enable/disable display lists (disabled by default).
Effect * effect()
Returns the Effect bound to an Actor.
std::vector< T > & value()
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
int instances() const
Returns the number of instances for this set of primitives.
VLX wrapper of vl::GLSLVertexShader, vl::GLSLFragmentShader, vl::GLSLGeometryShader, vl::GLSLTessControlShader, vl::GLSLTessEvaluationShader.
ETexParamFilter magFilter() const
vl::vec2 vlx_vec2(const VLXArrayReal *arr)
const vec3 & normal() const
const fvec4 & specular() const
const std::string & objectName() const
The name of the object, by default set to the object's class name.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setColorMaterial(EPolygonFace face, EColorMaterial color)
void exportTexture(VLXSerializer &s, const vl::Texture *obj, VLXStructure *vlx)
VLXValue vlx_Rawtext(const std::string &str)
The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements.
UniformSet * getUniformSet()
Returns the UniformSet installed.
SetupParams wraps all the parameters needed to crate a Texture.
VLX wrapper of vl::VertexAttrib.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setFrontDiffuse(const fvec4 &color)
Unknown or other projection type.
void setLODEvaluator(LODEvaluator *lod_evaluator)
Installs the LODEvaluator used to compute the current LOD at rendering time.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setColorMaterialEnabled(bool enabled)
Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format.
void bindTransform(Transform *transform)
Bind the camera to a Transform.
RenderStateSet * getRenderStateSet()
void bindTransform(Transform *transform)
If NULL follows the camera otherwise the given transformation node.
void importSecondaryColor(VLXSerializer &s, const VLXStructure *vlx, vl::SecondaryColor *obj)
VLX wrapper of vl::ResourceDatabase.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const fvec4 & position() const
The position or direction of a light.
const fvec4 & clearColor() const
void setValue(const fvec4 &color)
void exportCamera(VLXSerializer &s, const vl::Camera *obj, VLXStructure *vlx)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::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 ...
void importCamera(VLXSerializer &s, const VLXStructure *vlx, vl::Camera *obj)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
const String & path() const
The path from which the shader was loaded.
VLX wrapper of vl::Normal.
VLX wrapper of vl::TexParameter.
void setWrapR(ETexParamWrap texturewrap)
void bindFragDataLocation(int color_number, const char *name)
void registerImportedStructure(const VLXStructure *st, Object *obj)
const fvec4 & value() const
const mat4 & projectionMatrix() const
The Camera's projection matrix.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
Wraps the OpenGL function glLight().
const ArrayAbstract * secondaryColorArray() const
Conventional secondary color array.
const char * vlx_EColorMaterial(vl::EColorMaterial cm)
vl::mat4 vlx_mat4(const VLXArrayReal *arr)
void importRenderable(const VLXStructure *vlx, vl::Renderable *ren)
void setTexture(Texture *texture)
The texture sampler by a texture unit.
ETexParamWrap wrapT() const
void setEnabled(bool enable)
Enables/disables the draw call.
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.
void setInstances(int instances)
Sets the number of instances for this set of primitives.
std::string getShaderSource() const
Retrieves the shader source using glGetShaderSource()
vl::ETextureDimension vlx_ETextureDimension(const VLXValue &value, VLXSerializer &s)
void importTexture(VLXSerializer &s, const VLXStructure *vlx, vl::Texture *obj)
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void setAnisotropy(float anisotropy)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
void setFOV(real fov)
The field of view of the camera.
void setFogCoordArray(ArrayAbstract *data)
Conventional fog array.
const char * vlx_EUniformType(vl::EUniformType type)
VLX wrapper of vl::Renderable.
VLXArrayInteger * getArrayInteger()
void importViewport(VLXSerializer &s, const VLXStructure *vlx, vl::Viewport *obj)
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. ...
VLX wrapper of vl::TextureImageUnit.
static String printf(const char *fmt,...)
Returns a formatted string using the legacy printf syntax. The resulting string can be maximum 1024 +...
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
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.
EDepthTextureMode depthTextureMode() const
bool attachShader(GLSLShader *shader)
Attaches the GLSLShader to this GLSLProgram.
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
virtual vl::ref< vl::Object > importVLX(VLXSerializer &s, const VLXStructure *vlx)
EPrimitiveType primitiveType() const
Returns the draw call's primitive type.
VLX wrapper of vl::Shader.
VLX wrapper of vl::DrawCall and subclasses.
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)
const std::string & getString() const
VLXValue vlx_toValue(const std::vector< int > &vec)
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.
void setBufferObject(BufferObject *bo)
bool fixedSamplesLocations() const
const fvec3 & value() const
const Image * image() const
VLXArrayReal * getArrayReal()
void importLODEvaluator(VLXSerializer &s, const VLXStructure *vlx, vl::LODEvaluator *obj)
void enable(EEnable capability)
void setRenderBlock(int block)
Modifies the rendering block of an Actor.
const GLSLShader * shader(int i) const
Returns the i-th GLSLShader objects bound to this GLSLProgram.
void setHeight(int height)
const char * vlx_ETexParamWrap(vl::ETexParamWrap tpw)
A LODEvaluator that computes the appropriate LOD based on the approximate 2d area that an Actor cover...
void importActorEventCallback(VLXSerializer &s, const VLXStructure *vlx, vl::ActorEventCallback *obj)
void setCompareMode(ETexCompareMode mode)
void setNormal(const vec3 &normal)
const ArrayAbstract * normalArray() const
Conventional normal array.
virtual vl::ref< VLXStructure > exportVLX(VLXSerializer &s, const vl::Object *obj)
void exportLight(VLXSerializer &s, const vl::Light *obj, VLXStructure *vlx)
bool canImport(const VLXStructure *st) const
VLX wrapper of vl::Effect.
float backShininess() const
const std::string & getIdentifier() const
void resolvePath(std::string &path)
If the given path starts with "this:" then the "this:" prefix is replaced with the documentURL()...
void setOrigin(real origin)
const fvec4 & ambient() const
The ResourceDatabase class contains and manipulates a set of resources.
void setAmbient(const fvec4 &ambientcolor)
Collection< DrawCall > & drawCalls()
Returns the list of DrawCall objects bound to a Geometry.
const fvec3 & value() const
vl::AABB import_AABB(const VLXStructure *vlx)
const ref< ShaderPasses > & lod(int lod_level) const
Returns the ShaderPasses representing the specified LOD level.
void importEffect(VLXSerializer &s, const VLXStructure *vlx, vl::Effect *obj)
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::PatchParameter.
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...
VLXValue export_ShaderPasses(VLXSerializer &s, const vl::ShaderPasses *sh_seq)
VLXValue export_AABB(const vl::AABB &aabb)