Well that only occurs if I shift the code around (Rem stuff "here" to unrem stuff "there"). I think the Internal D3D Texture that TV is using, is being accurately exposed. Here's the code that I'm using to grab that texture:
TextureIndex := Form1.Mesh[obj].GetTexture(i);
if TextureIndex > 0 then
begin
D3DTexture := iDirect3DTexture9(Form1.TVInternals.GetTexture(TextureIndex));
g_pEffect.SetTexture('g_txScene', D3DTexture);
end
else
g_pEffect.SetTexture('g_txScene', g_pTexDef);
The alphanumber problem I don't think is the main issue, as it occurs if I jumble the code around a bit (And for all I know jumbling the code around to that extent could be the incorrect order things need to be done in. So I think the alphanumeric thing can be disregarded for the time being). I think the bigger issue is the matrix values being passed to the shader params
EDIT: Well I solved a VERY large part of it, I was using custom made procedures to convert from a TV_3DMatrix to a D3DMatrix and the problem was instead of using the parameter (containing the passed Matrix values) on the procedure's prototype, I was using a locally declared variable that really didn't equal anything, and so I was getting matrix values raised to the -38 and -39 power! Now my textures are showing up properly, just one last thing, it's more of a glitch than anything. My camera is now rolling'ing when it should be Pitching'ing. See
http://www.nasm.si.edu/exhibitions/gal109/NEWHTF/HTF541B.HTM for the definitions I used. I'm guessing something in the matrix calculations but again not sure. I think it would be significantly easier though as now I think it's more of a logic issue and less of a matter of finding some awry abstract rudimentary value.
EDIT 2:
Well it appears my code decieved me slightly. The parameter thing was in fact a big problem, and without fixing that nothing would've likely worked. But after fixing that I put all the code into yet another sandbox project to clean it up (Sort of like a final cleanup phase) that's when I noticed something disappointing. It appears everything started working (Excluding the parameter thing) because I had a mesh.render in the shader loop. So before I go any further, lemme pose this question.
Is this snippet of code ok to be doing?:
for obj := 1 to MaxMeshes do
begin
If MainRenderWindow.MeshObjIndexesUsed[obj] = 1 Then
begin
MeshAddr := MainRenderWindow.TVInternals.GetD3DMesh(MainRenderWindow.Mesh[obj].GetIndex);
D3DMesh := ID3DXMesh(MeshAddr);
//mWorldView := TVMatrixToD3DMatrix(MainRenderWindow.Mesh[obj].GetMatrix);
TmpTVMatrix := MainRenderWindow.Mesh[Obj].GetMatrix();
mWorldView := PD3DXMatrixA16(@TmpTVMatrix)^;
//This MatrixMultiply line causes artifacts for some reason
D3DXMatrixMultiply(mWorldView, mWorldView, pmViewTemp);
g_pEffect.SetMatrix('g_mWorldView', mWorldView);
g_pEffect._Begin(@cPass, 0);
for p := 0 to cPass - 1 do
begin
g_pEffect.BeginPass(p);
for i := 0 to MainRenderWindow.Mesh[obj].GetGroupCount() - 1 do
begin
//Basically we're just getting the material for
//each group of the mesh and the diffuse colors
//for that material then sending that info to
//the effect object.
MaterialIndex := MainRenderWindow.Mesh[obj].GetMaterial(i);
//vDif stands for vector Diffuse
vDifTmp.x := MainRenderWindow.TVMaterial.GetDiffuse(MaterialIndex).r;
vDifTmp.y := MainRenderWindow.TVMaterial.GetDiffuse(MaterialIndex).g;
vDifTmp.z := MainRenderWindow.TVMaterial.GetDiffuse(MaterialIndex).b;
vDifTmp.w := MainRenderWindow.TVMaterial.GetDiffuse(MaterialIndex).a;
g_pEffect.SetVector('g_vMaterial', vDifTmp);
Application.ProcessMessages();
//Now we do the same for the textures
TextureIndex := MainRenderWindow.Mesh[obj].GetTexture(i);
if TextureIndex > 0 then
begin
D3DTexture := iDirect3DTexture9(MainRenderWindow.TVInternals.GetTexture(TextureIndex));
g_pEffect.SetTexture('g_txScene', D3DTexture);
end
else
g_pEffect.SetTexture('g_txScene', g_pTexDef);
g_pEffect.CommitChanges();
Form1.TVInternals.UpdateD3DMesh(MeshIndex);
D3DMesh.DrawSubset(i);
end;
g_pEffect.EndPass;
end; //for p := 0 to cPass - 1 do
g_pEffect._End;
end;
end;
More specifically, the line (Almost all the way at the bottom) that states:
Form1.TVInternals.UpdateD3DMesh(MeshIndex);
Here's why I'm asking, the ID3DXMesh does not provide a render method. I'm not even sure BaseMesh does either (Probably not if BaseMesh is the parent of Mesh and Mesh doesn't have one). The reason I'm using ID3DXMesh is because I need to get access to Passes and Subsets (Which I'm guessing is a mesh'es group by TV Terminology and Popular Rendering Util Terminology). I'm kind of forced into using ID3DXMesh because inside of the group loop (Which is inside the pass loop) the textures and materials are applied to mesh's subsets; Normally not a big deal except the shader uses values passed to it inside of these loops which also means the g_pEffect object is heavily dependant on this design as well, and before I go reinventing the wheel I need to get a handle on this first.
So what I'm looking to do, is grab a pointer to the internal DX mesh loaded and created by TV, set some stuff on it, update it via UpdateD3DMesh, and then render it via Mesh.Render. I mean is that perfectly legit? Right now it seems to just make my mesh totally black.
EDIT 3: It turns out they weren't totally black just very very dark and without differentiating brightness meaning either no shadows or completely shadowed. A problem to figure out after I figure out why anything beyond my first mesh loaded results in those meshes not having it's gimbal locked when the camera is rotated.