D3DRM Frames and Textures
Hello all,
I`ve got a simple (or perhaps impossible) question to answer regarding Direct3DRM and c++. Okay, so in the code below I`m loading a mesh and texturing it -
.
.
.
LPDIRECT3DRMFRAME3 frame = NULL;
LPDIRECT3DRMMESHBUILDER3 testb = NULL;
LPDIRECT3DRMMESH mesh = NULL;
LPDIRECT3DRMTEXTURE3 tex;
LPDIRECT3DRMWRAP wrap = NULL;
//load bridge
lpD3DRM->CreateFrame(myglobs.scene, &frame);
lpD3DRM->CreateMeshBuilder( &testb);
testb->Load("bridge.x", NULL, D3DRMLOAD_FROMFILE,NULL, NULL );
lpD3DRM->LoadTexture("bridge.bmp", &tex);
testb->SetTexture(tex);
testb->CreateMesh( &mesh);
lpD3DRM->CreateWrap(D3DRMWRAP_FLAT, NULL,D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0),D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0),D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0),D3DVAL(0.0), D3DVAL(0.0),D3DVAL(0.05), D3DVAL(0.05),&wrap);
wrap->Apply((LPDIRECT3DRMOBJECT) mesh);
frame->AddVisual((LPDIRECT3DRMVISUAL)mesh);
.
.
.
And the code works! Now say I want to load a frame using the function Load:
LPDIRECT3DRMFRAME3 frame = NULL;
frame->Load((LPVOID)"baldercave1.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL);
Now how would I apply a texture to the frame?
Thanks,
Moses Marx
briandra2@aol.com
As i can see in msdn the Frame class has SetTexture member. So you can try to use it. Or if you want to assign a wrap to the object''s geometry or do anything else you want with it''s meshes you can procede:
1) call Frame->GetVisuals() and get VisualArray
2) call VisualArray->GetElement() for all indexes
3) for each returned Visual object do:
1) QueryInterface for Mesh
2) QueryInterface for Frame
3) QueryInterface for something else
4) Once you discovered object to be the Mesh or ??? apply textures, wraps, do whatever.
I''m not sure that i''m right. Good luck
------------------------------
DISCLAIMER: Im not responsible for any harm that my english can cause to your eyes, brains or programming skills.
1) call Frame->GetVisuals() and get VisualArray
2) call VisualArray->GetElement() for all indexes
3) for each returned Visual object do:
1) QueryInterface for Mesh
2) QueryInterface for Frame
3) QueryInterface for something else
4) Once you discovered object to be the Mesh or ??? apply textures, wraps, do whatever.
I''m not sure that i''m right. Good luck
------------------------------
DISCLAIMER: Im not responsible for any harm that my english can cause to your eyes, brains or programming skills.
Thank you for your answer. I am having a problem with the function GetVisuals, though. My problem lies here:
LPDIRECT3DRMVISUALARRAY visuals;
LPDIRECT3DRMFRAME3 frame;
DWORD w;
frame->GetVisuals (&w, &visuals);
When I compile the code, I get the error
Cannot convert struct IDIRECT3DRMVISUALARRAY to struct IUNKNOWN
(not exactly like that, but close).
Do you know how I can get this line to work?
Thanks,
Moses Marx
briandra2@aol.com
LPDIRECT3DRMVISUALARRAY visuals;
LPDIRECT3DRMFRAME3 frame;
DWORD w;
frame->GetVisuals (&w, &visuals);
When I compile the code, I get the error
Cannot convert struct IDIRECT3DRMVISUALARRAY to struct IUNKNOWN
(not exactly like that, but close).
Do you know how I can get this line to work?
Thanks,
Moses Marx
briandra2@aol.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement