Jump to content

  • Log In with Google      Sign In   
  • Create Account

Help with my tree class


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 newtechnology   Members   -  Reputation: 734

Like
0Likes
Like

Posted 26 March 2014 - 03:39 AM

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.

eOw3yNa.png

 

but this is what happening.

kF1gEuf.png

 

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.

 



Sponsor:

#2 newtechnology   Members   -  Reputation: 734

Like
1Likes
Like

Posted 26 March 2014 - 03:54 AM

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


the problem was here:

void Tree::DrawFarModel(CXMMATRIX W)
{
if (farModel_NumVisibleObjects == 0)
return;
 
pDeviceContext->IASetInputLayout(InputLayouts::InstancedBasic32);
    pDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
 
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, 26 March 2014 - 03:54 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS