Add truform to glide wrapper? Will this work...

euan

New member
Some people and myself decided it would be nice to make a glide wrapper that truforms everything for playing N64 games. Well it is low poly stuff isn't it?

I think truform can be added into the D3D XGL200 wrapper by using these two lines:

Code:
DX.D3DD->SetRenderState (D3DRS_PATCHSEGMENTS, *((DWORD*)7.0f));
DX.D3DD->SetRenderState (D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);

I don't know what they do apart from the names sounding like truform. :) 7.0f was a varible from the ATI pntriangle demo, but I've just hardwired it becuase I'm lazy.

The program doesn't compile as it doesn't know the D3DRS_PATCHSEGMENTS constants that I've added. I either need to update the DX8 header files, or add them manually.

Hense the function I changed looks like this: :)

Code:
inline void drawpolygon(uint32 num, uint32 *index, XGLVertex *verts) {
	_exebuffer->Flush();
 
	DX.D3DD->SetRenderState (D3DRS_PATCHSEGMENTS, *((DWORD*)7.0f));
	DX.D3DD->SetRenderState (D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
	DX.D3DD->Begin(D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX, D3DDP_DONOTLIGHT);
	for (uint32 i=0; i<num; i++) {
		vconv(verts[index[i]], vert);
		DX.D3DD->Vertex((LPVOID)&vert);
	}
	DX.D3DD->End(0);
}

Is this actually possible?

I remember reading (although only vaguely as it was 5 minutes ago) that you need both the co-ordinates and the normals for truform to work. Are the normals in here:

struct XGLVertex {
float x, y, z;
float r, g, b;
float ooz;
float a;
float oow;
// XGLTmuVertex tmuvertex[XGLNUM_TMU];
XGLTmuVertex tmuvertex[2];
};

I get lost after the r,g,b;
 
Last edited:
removed that *(DWORD()) crap:

newline:

DX.D3DD->SetRenderState (D3DRS_PATCHSEGMENTS, 7.0f);

MSVC is happy, so it will do until it crashes the PC.
 
So I go looking for the defines for the missing constants:

D3DRS_PATCHSEGMENTS
D3DRS_PATCHEDGESTYLE
D3DPATCHEDGE_DISCRETE

It appears these are DX8 defines. The renderStateType structure in d3d.h has a DX <= 0700 check on it. I found this site that has an updated renderStateType with 2 of the necessary bits.

What do I do to use them? At the start of the file it has a warning saying that it should not be used for DX8. So I changed the include files for the project from d3d.h to d3d8x.h and I just got 1 million compiler errors! Help!
 
Truform needs normals, and I'm not sure that Glide uses normals. Normals are used in lighting (and Truform), but will probably only be set up correctly if DirectX is doing the lighting or if there is T&L support, which I don't think there is.

Are you planning to do this for and N64 emulator like UltraHLE? I'm almost positive it won't work then, because I think the lighting is done by the 'CPU' (i.e. the emulated processor in N64).
 
Glide doesn't use normals, it's almost pure a rasterisation API. I don't think it's possible to add truform in any meaningful way in a glide wrapper.
 
What about Project 64? It uses Direct 3D....
And can use OpenGL with the 1964 OpenGL plugin....


Go for it Euan.....:)
 
<puts on red pointy ears, and swings red cape over shoulder>
Muhuhhuhuhuhahaha!
</puts on red pointy ears, and swings red cape over shoulder>
 
Back
Top