Some more info on the ENABLE_VIEW event thing:
The bug (if it really is one) only appears when using mtl.skillx. If i manually set values by pEffect->SetFloat there are no problems.
Which leads me to my next problem:
I would use pEffect->Set... instead of mtl.skillx but i can't get mtl->d3deffect to work in A7 (tried updating the MATERIAL struct in atypes.h (copy paste from A8), but that didn't work). How can i access mtl->d3deffect in A7 or a dll?
Also there seems to be a problem with ev->render_map[x] or i'm doing something wrong.
This is my dll function (called in ENABLE_RENDER event as shown in the manual):
DLLFUNC HRESULT sc_dll_renderGBuffer(void)
{
// open the scene and get the active D3D device
LPDIRECT3DDEVICE9 pd3dDev = (LPDIRECT3DDEVICE9)draw_begin();
if (!pd3dDev) return error("pd3dDev not available!");
//pd3dDev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0, 128, 0, 0), 1.0, 0);
ENTITY* pEntity = (ENTITY*)(ev->me);
BMAP* entSkin1 = (BMAP*)(ev->render_map[0]);
BMAP* entSkin2 = (BMAP*)(ev->render_map[1]);
BMAP* entSkin3 = (BMAP*)(ev->render_map[2]);
BMAP* entSkin4 = (BMAP*)(ev->render_map[3]);
LPD3DXMESH pMesh = (LPD3DXMESH)(ev->render_mesh);
D3DMATERIAL9* pMaterial = (D3DMATERIAL9*)(ev->render_d3dmaterial);
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)(ev->render_d3dxeffect);
//pass texture to shader
//pEffect->SetTexture("texBRDFLut", brdfLUT);
//pEffect->SetTexture("mySkin2",(LPDIRECT3DBASETEXTURE9)(inTexture->d3dtex));
//get first valid technique from effect file
D3DXHANDLE hTech;
pEffect->FindNextValidTechnique(NULL,&hTech);
if (SUCCEEDED(pEffect->SetTechnique(hTech)))
{
//set matrices
pEffect->SetMatrix("matWorld", (D3DXMATRIX*)(ev->matWorld));
pEffect->SetMatrix("matView", (D3DXMATRIX*)(ev->matView));
pEffect->SetMatrix("matProj", (D3DXMATRIX*)(ev->matProj));
//set textures
if(entSkin1) pEffect->SetTexture("entSkin1", (LPDIRECT3DBASETEXTURE9)(entSkin1->d3dtex));
if(entSkin2) pEffect->SetTexture("entSkin2", (LPDIRECT3DBASETEXTURE9)(entSkin2->d3dtex));
if(entSkin3) pEffect->SetTexture("entSkin3", (LPDIRECT3DBASETEXTURE9)(entSkin3->d3dtex));
if(entSkin4) pEffect->SetTexture("entSkin4", (LPDIRECT3DBASETEXTURE9)(entSkin4->d3dtex));
//render the scene using the hlsl effect
UINT cPasses, iPass;
pEffect->Begin(&cPasses, 0);
for (iPass = 0; iPass < cPasses; iPass++)
{
pEffect->BeginPass(iPass);
// Only call CommitChanges if any state changes have happened
// after BeginPass is called
//pEffect->CommitChanges();
// Render the mesh with the applied technique
pMesh->DrawSubset(0);
pEffect->EndPass();
}
pEffect->End();
}
return 0;
}
I can only get entSkin1 to show up in the shader. 2,3 and 4 aren't working. Now if i open up the .mdl in MED and apply the exact same texture from skin1 to skin2, i can access both in the shader. What am i doing wrong here?
I do understand that you can't/won't fix bugs in A7 anymore. But maybe there are workarounds for the mentioned points.
