Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

James Trotter

What's wrong??

This topic is 5661 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

What''s wrong with this?
  

for (x = xpos; x <= size + xpos; x += trisize) {
	for (y = ypos; y <= size + ypos; y += trisize) {
		currentcolor = parent->parent->map[parent->mapID]->LightMapData[x * parent->size / trisize + y / trisize].x;
		vertex[currentvertex] = Vector3D((float)x, parent->parent->map[parent->mapID]->Height(x, y), (float)y);
		color[currentvertex] = Vector3D(currentcolor, currentcolor, currentcolor);
		if (vertex[currentvertex].y > topvert.y)
			topvert.y = vertex[currentvertex].y;
		if (vertex[currentvertex].y < bottomvert.y)
			bottomvert.y = vertex[currentvertex].y;

		texcoord[currentvertex].u = (float)x / (float)parent->size;
		texcoord[currentvertex].v = (float)y / (float)parent->size;
		currentvertex++;
	}
}

currentvertex = 0;
for (x = 0; x <= size; x += trisize) {
	if(switchsides) {	// Check if we need to render the opposite way for this column

		for (y = size; y >= 0; y -= trisize) {
			currentvertex = x / trisize * size / trisize + y / trisize;
			vertindex[index++] = currentvertex;
			currentvertex = (x + trisize) / trisize * size / trisize + y / trisize;
			vertindex[index++] = currentvertex;
		}
	} else {
		for (y = 0; y <= size; y += trisize) {
			currentvertex = (x + trisize) / trisize * size / trisize + y / trisize;
			vertindex[index++] = currentvertex;
			currentvertex = x / trisize * size / trisize + y / trisize;
			vertindex[index++] = currentvertex;
		}
	}
	switchsides = !switchsides;
}


  
It seems to be rendering som triangles that aren''t supposed to be there...

Share this post


Link to post
Share on other sites
Advertisement
Screenshot? Explanation of what its supposed to be doing? It''s been said before: it''s not much fun trying to debug a piece of code with absolutely no information.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!