Oh where oh where has my D3DXColorLerp and D3DXVec3LengthSq gone?
m$ tells me they are in d3dx8.lib, but my linker tells me otherwise.
I enabled them in the includefile by specifying the protos.
Has anyone else found this to be an issue?
Do I have a redundant lib?
Help !!
Posted on 2002-12-31 23:31:38 by Homer
iirc, d3dx8.lib references functions in libc.lib(?). You need the lib file that comes with VC++, but they get optimized out in most cases. I have the file from the WinXP DDK, but I don't know where it is freely availible.
Posted on 2002-12-31 23:43:53 by bitRAKE
Reckon u could whack it up someplace for me?
I'd surely appreciate it !!!

Alternatively, if anyone can provide a macro version of these functions...
It's driving me crazy !!

I have the libci.lib from Scronty's site... is that the file to which you refer?
Is the XP version any different? I do develop for XP.
Posted on 2002-12-31 23:59:37 by Homer
Yeah, that is the file I was talking about - I am assuming this is the same bridge Scronty crossed.
Maybe, I am wrong. :confused:
Posted on 2003-01-01 01:04:32 by bitRAKE
Afternoon, EvilHomer2k.

From DXSDK:

Requirements
Header: Declared in D3dx8math.h.
Import Library: Use D3dx8.lib.


It's an inline macro inside d3dx8math.inl


D3DXINLINE D3DXCOLOR* D3DXColorLerp
(D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s)
{
#ifdef D3DX_DEBUG
if(!pOut || !pC1 || !pC2)
return NULL;
#endif

pOut->r = pC1->r + s * (pC2->r - pC1->r);
pOut->g = pC1->g + s * (pC2->g - pC1->g);
pOut->b = pC1->b + s * (pC2->b - pC1->b);
pOut->a = pC1->a + s * (pC2->a - pC1->a);
return pOut;
}

Inside Calebs' d3dx8math_fkt.def file, it's defined as:


D3DXVec4Lerp macro pV1 : REQ, pV2 : REQ, F : REQ

local temp

temp SUBSTR <F>, 1, 1

IFDIFI pV2, <FPUStack>

IFDIFI pV1, <FPUStack>
__LoadFloat4 pV1
ENDIF


IFIDNI temp, <#>
temp SUBSTR <F>, 2
db 068h
dd temp
__LerpFloat4 pV2, esp
add esp, 4
ELSE
__LerpFloat4 pV2, F
ENDIF
ELSE

IFDIFI pV1, <FPUStack>

IFIDNI temp, <#>
temp SUBSTR <F>, 2
db 068h
dd temp
__LerpRevFloat4 pV1, esp
add esp, 4
ELSE
__LerpRevFloat4 pV1, F
ENDIF
ENDIF


ENDIF

endm
...
D3DXColorLerp equ D3DXVec4Lerp


Cheers,
Scronty
Posted on 2003-01-01 03:22:37 by Scronty
Scronty, you are a Godsend ... I am extremely grateful.
I was just about to try fetching the function pointers myself using the handy dandy LoadProcAddress macro...
Looking inside the d3dx8.lib, I can see that the functions are referenced within the lib.
I expect that means that these functions are functions !!
Does this mean that I can put those macros away?
Thanks again man.
Posted on 2003-01-01 07:40:39 by Homer
Afternoon, EvilHomer2k.

Dunno if you can just throw those macros away.
I thought 'inline' stuff was the equivalent of us using macros, however maybe MS VC++ does it differently?
There're about three uses of D3DXColorLerp inside the d3dx8.lib file, but are these actually imports?
probably just references to the macro, maybe?

Since I know bugger-all about macro syntax (and do not plan on spending a few hours looking line-by-line through AoA to find what each piece of syntax means), I'd just make a D3DXColorLerp function.

Cheers,
Scronty
Posted on 2003-01-01 14:47:10 by Scronty
D3DXColorLerp looks like a blend function between two colors - reduces to a couple SSE2 instructions.
Posted on 2003-01-01 16:35:51 by bitRAKE
; // Calculate particle color
lea eax, pParticle.Particle.clrFade ;pV1=pointer to D3DXCOLOR
lea ebx, pParticle.Particle.clrDiffuse ;pV2=pointer to D3DXCOLOR
mov ecx, pParticle.Particle.fFade ; F = FLOAT
D3DXColorLerp eax, ebx, ecx

Assembling: C:\masm32\Particles\ParticleEngine.asm
C:\masm32\Particles\RenderParticles.inc(125) : error A2051: text item required
D3DXVec4Lerp(3): Macro Called From
C:\masm32\Particles\RenderParticles.inc(125): Include File
C:\masm32\Particles\RenderParticles.inc(125) : error A2051: text item required
D3DXVec4Lerp(4): Macro Called From
C:\masm32\Particles\RenderParticles.inc(125): Include File
C:\masm32\Particles\RenderParticles.inc(125) : error A2008: syntax error : eax
D3DXVec4Lerp(5): Macro Called From
C:\masm32\Particles\RenderParticles.inc(125): Include File
C:\masm32\Particles\RenderParticles.inc(125) : error A2008: syntax error : ebx
D3DXVec4Lerp(14): Macro Called From
C:\masm32\Particles\RenderParticles.inc(125): Include File
_
Assembly Error


I don't understand why Caleb is referring to the FLOAT value as a string...
What the heck calling convention should I be using?

In his 3DStars example, he didn't use his own macro.
I am not even sure it works !!
Some days I feel SO stupid :(
Posted on 2003-01-01 22:33:36 by Homer
Within Caleb's macro, my desired code boils down to two other macros...
__LoadFloat4 pV1
__LerpFloat4 pV2, F

Caleb's includefiles are down @ his site :(

Anyone have them perchance?
Posted on 2003-01-05 03:22:39 by Homer