Jump to content

Can I get Vertices from ObjectMeshStatic


photo

Recommended Posts

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

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:

Link to comment

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

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
×
×
  • Create New...