Jump to content

[SOLVED] Draw static lines


photo

Recommended Posts

Hello,

 

I want to draw many static lines in unigine, I found two methods: one to use fpf class, but it seems need to re-submit lines every frame, it cost too much. Two is use ObjectMesh, but it seems only can draw triangles. Is there is any other approchs to draw static lines effienctly? Please give some suggestions, thanks!

Link to comment

I check the ObjectDynamic class, it can render lines, but only in script, in c++API I have not found such class, I also check the ObjectmeshDynamic class, but it hasn`t lines rendering interface. May be I could create new object class and re-Implement the render()  with help of Ffp class.

Link to comment

I tried the ObjectDynamic but did not archived to show it, below is my code:

 

ObjectDynamciPtr obj = ObjectDynamic::create();

ObjectDynmaic::Attribute attrib;

attrib.offset = 0;

attrib.size = 3;

attrib.type = ObjectDynamic::TYPE_FLOAT;

obj->setVertexFormat(attrib,1);

obj->addVertexFloat(0, vec3(0.0,0.0,0.0).get(), 3);

obj->addVertexFloat(0, vec3(0.0,5.0,5.0).get(), 3);

obj->addVertexFloat(0, vec3(0.0,5.0,0.0).get(), 3);

obj->addIndex(0);

obj->addIndex(1);

obj->addIndex(2);

obj->setSurfaceMode(ObjectDynamic::MODE_TRIANGLES, 0);

obj->setMaterial("mesh_base", "*");

obj->setBoundBox(vec3(-10.0,-10.0,-10.0),vec3(10.0,10.0,10.0));

obj->flush();

 

No triangle was shown, where is the problem?

Link to comment
×
×
  • Create New...