Oh... this is bitter sweet. I have hardware shadow now in DarkGDK, but only for primitives.
Thanks for your information so far. I will give some code etc here to let you experiment with.
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff();
int iBox = 1;
int iFloor = 2;
dbMakeObjectPlain( iFloor, 100, 100 );
dbRotateObject( iFloor, 270, 0, 0 );
// make primitive object box
dbMakeObjectBox( iBox, 10, 10, 10 );
// make mesh from file
//dbLoadObject( "char.x", iBox, 1 );
//dbRotateObject( iBox, 270, 0, 0 );
dbPositionObject( iBox, 0, 20, 0 );
dbPositionCamera( 0, 100, 100 );
dbPointCamera( 0, 20, 0 );
dbHideLight( 0 );
dbMakeLight( 1 );
dbSetPointLight( 1, 50, 100, 50 );
dbSetLightRange( 1, 500 );
dbSetShadowShadingOn( iBox, -1, 255, 1 );
dbPositionLight( 0, 50, 100, 50 );
// our main loop
while ( LoopGDK ( ) )
{
dbText(0, 0, dbStr( dbScreenFPS() ) );
dbYRotateObject( iBox, dbObjectAngleY( iBox ) + 0.5 );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
This code actually DOES a hardware shadow if you have placed the original "stencilshadow.fx" file inside your project folder. So I did some test with following results:
Works:
DBPRO + PRIMITIVES + ORIGINAL STENCILSHADOW.FX
DBPRO + PRIMITIVES + EXTENDED STENCILSHADOW.FX
DBPRO + BONE ANIMATION MODEL + EXTENDED STENCILSHADOW.FX
DarkGDK + PRIMITIVES + ORIGINAL STENCILSHADOW.FX
Works NOT:
DBPRO + BONE ANIMATION MODEL + ORIGINAL STENCILSHADOW.FX
DarkGDK + PRIMITIVES + EXTENDED STENCILSHADOW.FX
DarkGDK + BONE ANIMATION MODEL + ORIGINAL STENCILSHADOW.FX
DarkGDK + BONE ANIMATION MODEL + EXTENDED STENCILSHADOW.FX
Hm, why does my EXTENDED and the ORIGINAL shader not work for meshfiles? I will take a closer look at the media now, if it depends on the creation/format or whatever from the object.
BTW, I have looked at the definitions in "DBOData.h".
sObjectProperties:
bool bStencilObject; // flagged if object uses the stencil layer
LPVOID pShadowMesh; // holds the pointer to the shadow mesh
I think if you turn on "dbShadowShadingOn()" the bStencilObject is set to true. But what is about that "ShadowMesh"?
This CAN be very interesting, compared to my experience with the shader programming. Actually I tested the shaders with "FX Composer 2" from NVidia and all stencil shaders create a "ShadowMesh". I can give more information about this if anybody think this might be a right way...
EDIT: DOWNLOAD THE .FX FILES FROM THE ATTACHMENT.
Thanks, Tom
Tom Taylor