Horde3D

Next-Generation Graphics Engine
It is currently 20.06.2019, 10:07

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 09.06.2019, 16:32 
Offline

Joined: 08.03.2018, 12:00
Posts: 19
I've made a model programmatically using this:
Code:
H3DRes bbRes = h3dAddResource(H3DResTypes::Material, ("billboards/" + img + ".xml").c_str(), 0);
h3dutLoadResourcesFromDisk("assets");

H3DRes geo = h3dFindResource(H3DResTypes::Geometry, "models/button.geo");
H3DNode n = h3dAddModelNode(scene, (name + "MODEL").c_str(), geo);
h3dAddMeshNode(n, (std::string{name} + "MESH").c_str(), bbRes, 0, h3dGetResParamI(geo, H3DGeoRes::GeometryElem, 0, H3DGeoRes::GeoIndexCountI), 0, h3dGetResParamI(geo, H3DGeoRes::GeometryElem, 0, H3DGeoRes::GeoVertexCountI));

Before I used the above, I also tried generating the geometry myself, but in both cases, h3dutPickNode never returned the node, but what was behind it. It only seems to pick scenegraphs that were loaded with h3dAddResource.

I have checked, and no, the flags for the node were 0, so there was no NoRayQuery flag.


Top
 Profile  
Reply with quote  
PostPosted: 10.06.2019, 11:03 
Offline

Joined: 17.11.2009, 17:00
Posts: 184
Location: Russia, Moscow
Hello. At a quick glance, it seems that AABB was not correctly generated for the model. I'll look into it today, when I have time.


Top
 Profile  
Reply with quote  
PostPosted: 10.06.2019, 16:06 
Offline

Joined: 17.11.2009, 17:00
Posts: 184
Location: Russia, Moscow
Yep, it seems that the problem is in AABB not correctly updated when mesh is added. It is only updated during scene graph update, which happens during h3dRender. So, you have the following choices:
1) Postpone ray casting till next frame
2) Add SceneManager::updateNodes() in h3dAddMeshNode(). The problem with this approach is that whole scene graph would be updated on mesh adding.
3) Add SceneNode::updateTree() in ModelNode::update() in if( flags & ModelUpdateFlags::Geometry ) section. The problem with this approach is that model node and it children would be updated on each morphing animation. Don't know if it matters for you and how it will affect performance, but this is probably the way to go, if the first approach is not feasible for you.

UPDATE: probably the way to go is to add another parameter to ModelUpdateFlags, something like ModelUpdateFlags::ChildNodes, that calls update tree. That way you can control the number of updates that should be done. For example, you can add several meshes and then update only once via h3dUpdateModel().


Top
 Profile  
Reply with quote  
PostPosted: 12.06.2019, 20:56 
Offline

Joined: 17.11.2009, 17:00
Posts: 184
Location: Russia, Moscow
I've added the functionality and pull requested it to develop branch. Please tell if it suits your needs or not.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group