Jump to content
  • Advertisement
Sign in to follow this  

Help with my tree class

This topic is 2037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When models are far away, a low poly version of tree should be displayed instead of original tree and I wrote a model class for it. The problem is that the class is not working well.

This tree should be rendered when trees are far away.



but this is what happening.



if trees are far away, the model itself gets vanished and nothing gets rendered, I dunno what actually is wrong.

Here is my code:

tree.h - http://pastebin.com/Wq18hf69

tree.cpp - http://pastebin.com/VC8XELh3

If you need model class code too, then please comment and I'll add it.


Share this post

Link to post
Share on other sites

The problem is solved, thank you for looking at this thread.

the problem was here:

void Tree::DrawFarModel(CXMMATRIX W)
if (farModel_NumVisibleObjects == 0)
UINT stride[2] = {sizeof(Vertex::Basic32), sizeof(Model::InstancedData)};
    UINT offset[2] = {0,0};
ID3D11Buffer* vbs[2] = {*far_mModel_MeshData.VertexBuffer, *mModel_MeshData.InstancedBuffer};

it should be:

3D11Buffer* vbs[2] = {*far_mModel_MeshData.VertexBuffer, *far_mModel_MeshData.InstancedBuffer};
Edited by newtechnology

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!