Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Concatenating indices for meshes

4: Adsense

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
No replies to this topic

#1 noatom   Members   

925
Like
1Likes
Like

Posted 10 February 2014 - 02:19 PM

I'm basically trying to get all the data from all the meshes and put them into a single buffer(a buffer for vertices,one for indices). The models are of TriangleList type.

 

Here's how I'm currently doing it:

vector<unsigned long> finall_indices;
	unsigned long indices_before_adding = 0;
	for (long long i = 0; i < meshes.size(); i++){
		for (long long s = 0; s < meshes.at(i)->index_queue.size(); s++){
			finall_indices.push_back(meshes.at(i)->index_queue.at(s)+ indices_before_adding);
		}
		indices_before_adding += meshes.at(i)->index_queue.size();
	}

However,there are some problems,like missing quads. The indices are fine,because I tested them when I did not put all the mesh data together.

 

What am I doing wrong?

 

 

 

Answer:

 

To indices_before_adding should be added the nr of vertices in the last mesh,every time a new mesh's indices are added to the finall_indices mesh.


Edited by noatom, 10 February 2014 - 03:54 PM.





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.