View previous topic :: View next topic |
Author |
Message |
banshee777 Member
Joined: 10 Feb 2005 Posts: 37
|
Posted: Thu Aug 25, 2005 1:56 pm Post subject: DMF engine and lightmaping |
|
|
I can't seem to get lightmapping going.
Isn't the UV values 6 to 11 after lightmapped the second layer, second texture coords?
int brushrender()
{
char crap;
int i = 0;
int j = 0;
int uv0 = 0;
int uv1 = 1;
int uv2 = 6;
int uv3 = 7;
char test;
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mtexture[0]);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mtexture[1]);
while (i < mapcore[0].boxes) // MAX OBJECTS etc box, pyramid, etc
{
for (int j = 0; j < box[i].polygons; j++) // render all faces
{
uv0 = 0;
uv1 = 1;
uv2 = 6;
uv3 = 7;
glBegin(GL_TRIANGLES);
//for (int z = 0; z < box[i].vertices[j] && box[i].visible == -1; z++)
for (int z = 0; z < box[i].vertices[j]; z++) //render face
{
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, box[i].uv_values0[j][uv0], box[i].uv_values0[j][uv1]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, box[i].uv_values0[j][uv2], box[i].uv_values0[j][uv3]);
glVertex3d(box[i].x[box[i].vertice_index_values0[j][z]],box[i].y[box[i].vertice_index_values0[j][z]],box[i].z[box[i].vertice_index_values0[j][z]]);
uv0 = uv0 + 2;
uv1 = uv1 + 2;
uv2 = uv2 + 2;
uv3 = uv3 + 2;
}
glEnd();
}
i++;
}
} |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Thu Aug 25, 2005 3:20 pm Post subject: |
|
|
The UV set is the last. In the UV for the triangle you will have 6 for each layer. (Assuming you work with triangles) It's always layer 4 |
|
Back to top |
|
|
banshee777 Member
Joined: 10 Feb 2005 Posts: 37
|
Posted: Thu Aug 25, 2005 9:20 pm Post subject: ... |
|
|
I ignored the 4th layer, i'm justing doing 2 layers. Still it should work. Unless the finally UV values are incorrect
1 1 1 1 1 1 last uv values 1 1 1 1 1 1
First texture second texture?
or it's differenent other? |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Thu Aug 25, 2005 9:30 pm Post subject: Re: ... |
|
|
banshee777 wrote: |
I ignored the 4th layer, i'm justing doing 2 layers. Still it should work. Unless the finally UV values are incorrect
1 1 1 1 1 1 last uv values 1 1 1 1 1 1
First texture second texture?
or it's differenent other? |
The foruth layer is ALWAYS the lightmap layer. Regardless if you used layers 2 or 3 |
|
Back to top |
|
|
banshee777 Member
Joined: 10 Feb 2005 Posts: 37
|
Posted: Fri Aug 26, 2005 5:16 am Post subject: ... |
|
|
The texture is back to front. It needs to be flipped. Thats why i had these problems. |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Fri Aug 26, 2005 5:27 am Post subject: Re: ... |
|
|
banshee777 wrote: |
The texture is back to front. It needs to be flipped. Thats why i had these problems. |
That's because Deled uses CW triangles instead of CCW. |
|
Back to top |
|
|
|