Skip to main content
gamedev.net
🔒 Locked

What's wrong??

Started by James Trotter Mar 24, 2003 at 9:54 AM 1 replies 400+ views
Original Post
James Trotter
James Trotter
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...
JuNC
JuNC
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.
James Trotter
James Trotter
Sorry, must have forgotten... Anyway, here's the screenshot...



[edited by - James Trotter on March 24, 2003 12:29:51 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.