Re: [Warzone-dev] Texture float coordinates patch [wip] for per

2007-12-05 Thread Dennis Schridde
Am Mittwoch, 5. Dezember 2007 09:05:31 schrieb Dennis Schridde:
 Am Mittwoch, 5. Dezember 2007 00:33:55 schrieb Christian Ohm:
  I'll stop working on it for today. With this patch (not cleaned up, your
  patch is included) everything works except gui elements.
 
  The change in lib/ivis_opengl/piedraw.c is just a quick fix, but I don't
  want to track it down further (I guess the texcoords should be divided
  by 256 directly when loading the pie), and a similar change is needed
  for the gui graphics.

 That's the way I did it, yes. Don't know, but maybe you want to have a look
 at my commit r2258? But it seems everyone is rejecting to do so, so there
 must be a reason. ;)

 --Dennis
PS: It was reverted by Per in r2292 for the therementioned reason.


signature.asc
Description: This is a digitally signed message part.
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Texture float coordinates patch [wip] for per

2007-12-05 Thread Per Inge Mathisen
On 12/5/07, Dennis Schridde [EMAIL PROTECTED] wrote:
 That's the way I did it, yes. Don't know, but maybe you want to have a look at
 my commit r2258? But it seems everyone is rejecting to do so

I did! It was just that a lot of stuff had changed since...

  - Per

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Texture float coordinates patch [wip] for per

2007-12-05 Thread Per Inge Mathisen
On Dec 5, 2007 12:33 AM, Christian Ohm [EMAIL PROTECTED] wrote:
 I'll stop working on it for today. With this patch (not cleaned up, your
 patch is included) everything works except gui elements.

This patch is more limited, but does mostly the same thing. I tried to
reimplement the one-pixel border with it, but I notice texture seams
at close zoom. You do no notice them at normal zoom, though. If this
is worse than it used to be, I do not understand why.

  - Per
Index: src/display3d.c
===
--- src/display3d.c	(revision 2979)
+++ src/display3d.c	(working copy)
@@ -162,7 +162,7 @@
 BOOL	godMode;
 
 static float waterRealValue = 0.0f;
-#define WAVE_SPEED 2.0f
+#define WAVE_SPEED 0.015f
 
 UDWORD	barMode = BAR_FULL; // configured in configuration.c
 
@@ -503,7 +503,7 @@
 	if(!gamePaused())
 	{
 		waterRealValue += (WAVE_SPEED * frameTime2) / GAME_TICKS_PER_SEC;
-		if (waterRealValue = (256 / TILES_IN_PAGE_ROW) / 2)
+		if (waterRealValue = (1.0f / TILES_IN_PAGE_ROW) / 2)
 		{
 			waterRealValue = 0.0f;
 		}
@@ -809,7 +809,6 @@
 	pie_SetColourKeyedBlack(TRUE);
 	pie_TranslateTextureEnd();
 
-
 	targetOpenList((BASE_OBJECT*)driveGetDriven());
 
 	/*  */
@@ -939,18 +938,19 @@
 	const unsigned short tile = TileNumber_tile(tileNumber);
 
 	/* Used to calculate texture coordinates, which are 0-255 in value */
-	const unsigned int xMult = (256 / (PAGE_WIDTH / TILE_WIDTH));
-	const unsigned int yMult = (256 / (PAGE_HEIGHT / TILE_HEIGHT));
+	const float xMult = (1.0f / (PAGE_WIDTH / TILE_WIDTH));
+	const float yMult = (1.0f / (PAGE_HEIGHT / TILE_HEIGHT));
+	const float one = 1.0f / PAGE_WIDTH;
 
 	/*
 	 * Points for flipping the texture around if the tile is flipped or rotated
 	 * Store the source rect as four points
 	 */
-	Vector2i
-		sP1 = {1, 1},
-		sP2 = {xMult - 1, 1},
-		sP3 = {xMult - 1, yMult - 1},
-		sP4 = {1, yMult - 1},
+	Vector2f
+		sP1 = { one, one },
+		sP2 = { xMult - one, one },
+		sP3 = { xMult - one, yMult - one },
+		sP4 = { one, yMult - one },
 		sPTemp;
 
 	if (texture  TILE_XFLIP)
@@ -4049,23 +4049,23 @@
 	if (terrainType( mapTile(actualX, actualY) ) == TER_WATER)
 	{
 		/* Used to calculate texture coordinates, which are 0-255 in value */
-		const unsigned int
-xMult = 256 / TILES_IN_PAGE_COLUMN,
-yMult = 256 / (2 * TILES_IN_PAGE_ROW);
+		const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
+		const float yMult = 1.0f / (2.0f * TILES_IN_PAGE_ROW);
+		const float one = 1.0f / PAGE_WIDTH;
 		const unsigned int tileNumber = getWaterTileNum();
 		TERRAIN_VERTEX vertices[3];
 
-		tileScreenInfo[i+0][j+0].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + 1;
+		tileScreenInfo[i+0][j+0].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + one;
 		tileScreenInfo[i+0][j+0].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset;
 
-		tileScreenInfo[i+0][j+1].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + (xMult - 1);
+		tileScreenInfo[i+0][j+1].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + (xMult - one);
 		tileScreenInfo[i+0][j+1].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset;
 
-		tileScreenInfo[i+1][j+1].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + (xMult - 1);
-		tileScreenInfo[i+1][j+1].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset + (yMult - 1);
+		tileScreenInfo[i+1][j+1].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + (xMult - one);
+		tileScreenInfo[i+1][j+1].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset + (yMult - one);
 
-		tileScreenInfo[i+1][j+0].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + 1;
-		tileScreenInfo[i+1][j+0].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset + (yMult - 1);
+		tileScreenInfo[i+1][j+0].u = tileTexInfo[TileNumber_tile(tileNumber)].uOffset + one;
+		tileScreenInfo[i+1][j+0].v = tileTexInfo[TileNumber_tile(tileNumber)].vOffset + (yMult - one);
 
 		vertices[0] = tileScreenInfo[i + 0][j + 0];
 		vertices[0].pos.y = tileScreenInfo[i + 0][j + 0].water_height;
Index: src/texture.c
===
--- src/texture.c	(revision 2979)
+++ src/texture.c	(working copy)
@@ -173,9 +173,8 @@
 			free(tile.bmp);
 			if (i == TILE_WIDTH) // dealing with main texture page; so register coordinates
 			{
-// 256 is an integer hack for GLfloat texture coordinates
-tileTexInfo[k].uOffset = xOffset / (xSize / 256);
-tileTexInfo[k].vOffset = yOffset / (ySize / 256);
+tileTexInfo[k].uOffset = (float)xOffset / (float)xSize;
+tileTexInfo[k].vOffset = (float)yOffset / (float)ySize;
 tileTexInfo[k].texPage = texPage;
 debug(LOG_TEXTURE,   texLoad: Registering k=%d i=%d u=%f v=%f xoff=%d yoff=%d xsize=%d ysize=%d tex=%d (%s),
  k, i, tileTexInfo[k].uOffset, tileTexInfo[k].vOffset, xOffset, yOffset, xSize, ySize, texPage, fullPath);
Index: lib/ivis_common/piedef.h

[Warzone-dev] [bug #10456] Texture seams are back again

2007-12-05 Thread Per I. Mathisen

URL:
  http://gna.org/bugs/?10456

 Summary: Texture seams are back again
 Project: Warzone Resurrection Project
Submitted by: per
Submitted on: Wednesday 12/05/2007 at 22:19
Category: Engine: Graphics
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Release: svn/trunk
Operating System: GNU/Linux
 Planned Release: None

___

Details:

Commit 2983 made texture seams a lot worse again here than it was before that
commit. Not sure why.




___

Reply to this item at:

  http://gna.org/bugs/?10456

___
  Message sent via/by Gna!
  http://gna.org/


___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev