Quake 3 lightmaps - PVR Multi-Texture

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
User avatar
Anthony817
Insane DCEmu
Insane DCEmu
Posts: 129
Joined: Wed Mar 10, 2010 1:29 am
Location: Fort Worth, Texas
Has liked: 10 times
Been liked: 3 times

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by Anthony817 » Fri Aug 28, 2015 1:59 pm

Looking nice!
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by PH3NOM » Mon Aug 31, 2015 7:42 pm

Thanks man!
That vid is an old build by now.
Here is a more current build, I posted on another thread here...
viewtopic.php?f=29&t=102506&p=1047897#p1047897
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by PH3NOM » Wed Sep 02, 2015 8:20 pm

bogglez wrote:BTW I didn't check your vertex transformation assembly code in detail, but I think you didn't implement texture matrices. Maybe they would allow you to apply a cool effect.
It is a hit on performance, but I am working on adding texture matrices into OpenGL.
But yes, in fact, this is a nice solution to creating the portal effect I was previously using :lol:
Spoiler!

Code: Select all

//== Immediate Mode Texture Coordinate Submission ==//

#define mat_trans_texture(s, t, r, q) { \
        register float __s __asm__("fr4") = (s); \
        register float __t __asm__("fr5") = (t); \
        register float __r __asm__("fr6") = (r); \
        register float __q __asm__("fr7") = (q); \
        __asm__ __volatile__( \
                              "fldi1	fr7\n" \
                              "ftrv	xmtrx,fv4\n" \
                              "fldi1	fr6\n" \
                              "fdiv	fr7,fr6\n" \
                              "fmul	fr6,fr4\n" \
                              "fmul	fr6,fr5\n" \
                              : "=f" (__s), "=f" (__t), "=f" (__r) \
                              : "0" (__s), "1" (__t), "2" (__r) \
                              : "fr3" ); \
        s = __s; t = __t; r = __r; \
    }

void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) {
    _glKosMatrixLoadTexture();
         
    GL_KOS_VERTEX_TEX_COORD.s = u;
    GL_KOS_VERTEX_TEX_COORD.t = v;
    GL_KOS_VERTEX_TEX_COORD.r = 0.0f;
    GL_KOS_VERTEX_TEX_COORD.q = 1.0f;
    
    mat_trans_texture(GL_KOS_VERTEX_TEX_COORD.s, GL_KOS_VERTEX_TEX_COORD.t,
                      GL_KOS_VERTEX_TEX_COORD.r, GL_KOS_VERTEX_TEX_COORD.q);
                      
    GL_KOS_VERTEX_UV[0] = GL_KOS_VERTEX_TEX_COORD.s;
    GL_KOS_VERTEX_UV[1] = GL_KOS_VERTEX_TEX_COORD.t;
    
    _glKosMatrixLoadRender();    
}
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by bogglez » Fri Sep 04, 2015 5:00 pm

PH3NOM wrote:
bogglez wrote:BTW I didn't check your vertex transformation assembly code in detail, but I think you didn't implement texture matrices. Maybe they would allow you to apply a cool effect.
It is a hit on performance, but I am working on adding texture matrices into OpenGL.
But yes, in fact, this is a nice solution to creating the portal effect I was previously using :lol:
If the texture matrix is identity you can just skip the transformation.
2 UV coordinates can be trasnformed with a single 4x4 matrix.
You can also add a define to remove this feature..
And you'll probably transform very few UVs this way.
So I think it's definitely worth adding.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
Anthony817
Insane DCEmu
Insane DCEmu
Posts: 129
Joined: Wed Mar 10, 2010 1:29 am
Location: Fort Worth, Texas
Has liked: 10 times
Been liked: 3 times

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by Anthony817 » Thu Sep 10, 2015 5:07 pm

Wow that zombie stuff looks awesome on the other thread.
User avatar
bbmario
DCEmu Freak
DCEmu Freak
Posts: 69
Joined: Wed Feb 05, 2014 5:58 am
Has liked: 1 time
Been liked: 0

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by bbmario » Tue May 31, 2016 10:09 am

I have a quick question about the Q3BSP_RenderArraysMultiTex() method. You seem to be using GL_TEXTURE0_ARB and GL_TEXTURE1_ARB, but you use renderNode.data[0].uv.x and renderNode.data[0].uv.z for each. Why is that?
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: Quake 3 lightmaps - PVR Multi-Texture

Post by PH3NOM » Tue Jun 07, 2016 4:51 pm

Hey man sorry for the confusion!
There are 2 uv sets per vertex. I simply used a generic 4 float vector type for storing both uv sets.
So here you can consider x, y components of the uv as u and v for texture0 and z, w are u and v for texture1
Post Reply