lin.xianming Posted January 19, 2017 Share Posted January 19, 2017 1> I'm trying to figure out how to get the vertices from objects. It seems that only ObjectMeshDynamic has the related API. virtual const ObjectMeshDynamic::Vertex * ObjectMeshDynamic::getVertexArray() const = 0; But if I intend to get vertices from ObjectMeshStatic, is it possible? 2> Console::get()->run("world_load core/Unigine"); means the whole related textures have uploaded into CPU or GPU memory? My purpose is just to draw the scene in wireframe. Is it too costly? Thanks! David Link to comment
silent Posted January 20, 2017 Share Posted January 20, 2017 Hi David, 2> Console::get()->run("world_load core/Unigine"); means the whole related textures have uploaded into CPU or GPU memory? My purpose is just to draw the scene in wireframe. Is it too costly? Yes. To avoid uploading textures you need to assign material with blank texture to all the materials and surfaces. Regarding the first question, maybe that article will be helpful: https://developer.unigine.com/en/docs/2.3.1/code/uniginescript/usage/mesh_class/(also, there is a getVertex method in Unigine::Mesh class). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
lin.xianming Posted January 21, 2017 Author Share Posted January 21, 2017 I put the codes into Players.cpp (a sample located in "starter_windows_2.3.1\source\samples\Api\Nodes\Players" ), but It dosen't work (m.pointer = 0). virtual int init() { ... // create meshes ObjectMeshStaticPtr mesh_0 = ObjectMeshStatic::create("../../data/cbox.mesh"); mesh_0->release(); mesh_0->setTransform(translate(Vec3(-2.0f, 0.0f, 0.0f))); mesh_0->setMaterial("mesh_base", "*"); // Get mesh from ObjectMeshStatic MeshPtr m; mesh_0->getMesh(m); } Thanks Link to comment
ded Posted January 23, 2017 Share Posted January 23, 2017 Hi David, Maybe a name "getMesh" for this method is a somewhat misleading. It actually copies geometry into the mesh instance that you've passed as a parameter. So it should work if you create mesh instance first, something like: MeshPtr m = Mesh::create(); if (mesh_0->getMesh(m)) { ... } else { Log::error("failed to load a mesh\n"); } Link to comment
Recommended Posts