kai.xia Posted December 4, 2014 Share Posted December 4, 2014 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
frustum Posted December 4, 2014 Share Posted December 4, 2014 ObjectDynamic can be used for lines rendering. The simple shader for rendering is required. Check the objects/dynamic_05 sample. Link to comment
kai.xia Posted December 5, 2014 Author Share Posted December 5, 2014 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
frustum Posted December 5, 2014 Share Posted December 5, 2014 ObjectDynamic has absolutely same functionality inside c++ api. Link to comment
kai.xia Posted December 8, 2014 Author Share Posted December 8, 2014 Ok, I missed it, I only check the chm document and did not find, and found it in the includes folder, thanks. Link to comment
kai.xia Posted December 10, 2014 Author Share Posted December 10, 2014 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
kai.xia Posted December 11, 2014 Author Share Posted December 11, 2014 Solved, the material shader need to be bind to "dynamic" type. Link to comment
Recommended Posts