more work on CPhysical

This commit is contained in:
aap 2019-05-18 12:39:39 +02:00
parent 58ebd6c6d4
commit 9e496100b7
106 changed files with 57865 additions and 103 deletions

View File

@ -7,11 +7,16 @@ workspace "re3"
files { "src/modelinfo/*.*" }
files { "src/entities/*.*" }
files { "src/render/*.*" }
files { "src/control/*.*" }
files { "src/audio/*.*" }
includedirs { "src", "src/modelinfo" }
includedirs { "src", "src/entities" }
includedirs { "src", "src/render" }
includedirs { os.getenv("RWSDK33") }
includedirs { "src" }
includedirs { "src/modelinfo" }
includedirs { "src/entities" }
includedirs { "src/render" }
includedirs { "src/control" }
includedirs { "src/audio" }
includedirs { "rwsdk/include/d3d8" }
project "re3"
kind "SharedLib"

View File

@ -0,0 +1,793 @@
/* If this file is used outside of the core RW SDK,
* the following things need to be defined
*/
#if (!defined(RWASSERT))
#define RWASSERT(_assertval) /* No op */
#endif
#if (!defined(RWFUNCTION))
#define RWFUNCTION(_rwfunctionstring) /* No op */
#endif
#if (!defined(RWRETURN))
#define RWRETURN(_rwreturnval) return(_rwreturnval)
#endif
#if (!defined(RWRETURNVOID))
#define RWRETURNVOID() return
#endif
/* These are used by specular lighting,
* sorry I have to leave them in here... IDBS
* I'll make it neater when I have time.
*/
#if (!defined(FALLOFFAMBIENT))
#define FALLOFFAMBIENT() /* No op */
#endif
#if (!defined(FALLOFFDIRECTIONAL))
#define FALLOFFDIRECTIONAL() /* No op */
#endif
#if (!defined(FALLOFFPOINT))
#define FALLOFFPOINT() /* No op */
#endif
#if (!defined(FALLOFFSPOT))
#define FALLOFFSPOT() /* No op */
#endif
#if (!defined(FALLOFFSOFTSPOT))
#define FALLOFFSOFTSPOT() /* No op */
#endif
/***************************************************************************
_rwApplyAmbientLight
On entry : Instanced data
: Light
: Optional inverse object matrix
: (to transform light to object space)
: Inverse scale of object
: Surface properties of the light
On exit :
*/
static void
_rwApplyAmbientLight(VERTSARG,
const void *voidLight,
const RwMatrix * __RWUNUSED__ inverseMat,
RwReal __RWUNUSED__ invScale,
const RwSurfaceProperties * surfaceProps)
{
CAMVERTDECL;
NUMVERTDECL;
const RpLight *light = (const RpLight *) voidLight;
RwReal scale;
RwV3d vertToLight;
RWFUNCTION(RWSTRING("_rwApplyAmbientLight"));
RWASSERT(light);
RWASSERT(surfaceProps);
CAMVERTINIT();
NUMVERTINIT();
/* No directional component:
* (this is used in CAMVERTADDRGBA in a specular lighting node) */
vertToLight.x = 0;
vertToLight.y = 0;
vertToLight.z = 0;
/* rpLIGHTAMBIENT - Constant illumination on all vertices
*/
if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA))
{
scale = 255.0f * light->color.red * surfaceProps->ambient;
/* Ambient light affects all vertices the same */
while (numVert--)
{
RwReal lum = scale;
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFAMBIENT
CAMVERTADDRGBA(1, 1, 1, 0);
CAMVERTINC();
}
}
else
/* perform for coloured lights */
{
scale = 255.0f * surfaceProps->ambient;
/* Ambient light affects all vertices the same */
while (numVert--)
{
RwReal lum = scale;
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFAMBIENT
CAMVERTADDRGBA(light->color.red, light->color.green,
light->color.blue, 0);
CAMVERTINC();
}
}
RWRETURNVOID();
}
/***************************************************************************
_rwApplyDirectionalLight
On entry : Instanced data
: Light
: Optional inverse object matrix
: (to transform light to object space)
: Inverse scale of object
: Surface properties of the light
On exit :
*/
static void
_rwApplyDirectionalLight(VERTSARG,
const void *voidLight,
const RwMatrix * inverseMat,
RwReal __RWUNUSED__ invScale,
const RwSurfaceProperties * surfaceProps)
{
OBJCAMVERTDECL;
NUMVERTDECL;
const RpLight *light = (const RpLight *) voidLight;
RwV3d vertToLight;
RwReal scale;
RwReal dot;
RwFrame *lightFrame;
RWFUNCTION(RWSTRING("_rwApplyDirectionalLight"));
RWASSERT(light);
RWASSERT(surfaceProps);
OBJCAMVERTINIT();
NUMVERTINIT();
/* rpLIGHTDIRECTIONAL - Lighting scaled by dot product
* of vertex normal and light lookAt vector.
*/
/* This may not have a frame - we need to check */
lightFrame = RpLightGetFrame(light);
if (lightFrame)
{
vertToLight = RwFrameGetLTM(lightFrame)->at;
/* Transform the light into object space if necessary */
if (inverseMat)
{
RwV3dTransformVectors(&vertToLight, &vertToLight, 1, inverseMat);
_rwV3dNormalize(&vertToLight, &vertToLight);
}
/* Vert TO light */
RwV3dScale(&vertToLight, &vertToLight, -1);
/* Optimise for grey lights? */
if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA))
{
/* Use one of the light colour intensities as general intensity */
/* light vector tests are to be identical to others */
scale = 255.0f * light->color.red * surfaceProps->diffuse;
/* Loop through each of the vertices */
while (numVert--)
{
RwV3d objNormal;
OBJVERTGETNORMAL(&objNormal);
/* Calculate angle between vertex normal and light vector */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
/* Ensure vector is facing light,
* don't light areas not facing */
if (dot > 0.0f)
{
RwReal lum = dot * scale;
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFDIRECTIONAL
CAMVERTADDRGBA(1, 1, 1, 0);
}
/* Next vertex */
OBJCAMVERTINC();
}
}
else
/* perform for coloured lights */
{
scale = 255.0f * surfaceProps->diffuse;
/* Loop through each of the vertices */
while (numVert--)
{
RwV3d objNormal;
OBJVERTGETNORMAL(&objNormal);
/* Calculate angle between vertex normal and light vector */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
/* Ensure vector is facing light,
* don't light areas not facing */
if (dot > 0.0f)
{
RwReal lum = dot * scale;
#define FALLOFFCALC FALLOFFDIRECTIONAL
CAMVERTADDRGBA(light->color.red, light->color.green,
light->color.blue, 0);
}
/* Next vertex */
OBJCAMVERTINC();
}
}
}
RWRETURNVOID();
}
/***************************************************************************
_rwApplyPointLight
On entry : Instanced data
: Light
: Optional inverse object matrix
: (to transform light to object space)
: Inverse scale of object
: Surface properties of the light
On exit :
*/
static void
_rwApplyPointLight(VERTSARG, const void *voidLight,
const RwMatrix * inverseMat,
RwReal invScale, const RwSurfaceProperties * surfaceProps)
{
OBJCAMVERTDECL;
NUMVERTDECL;
const RpLight *light = (const RpLight *) voidLight;
RwReal scale, recipRad;
RwV3d lightPos, vertToLight;
RwReal radSquared;
RWFUNCTION(RWSTRING("_rwApplyPointLight"));
RWASSERT(light);
RWASSERT(surfaceProps);
OBJCAMVERTINIT();
NUMVERTINIT();
/* rpLIGHTPOINT - Linear falloff with distance, scaled by
* dot product of vertex normal and light to vertex vector.
*/
lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos;
if (inverseMat)
{
RwReal scaledRad;
scaledRad = ((light->radius) * (invScale));
radSquared = ((scaledRad) * (scaledRad));
recipRad = (((RwReal) (1)) / (scaledRad));
/* Transform light into object space */
RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat);
}
else
{
radSquared = ((light->radius) * (light->radius));
recipRad = (((RwReal) (1)) / (light->radius));
}
if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA))
{
/* The scale encapsulates the common elements to do
* with light intensity and surface lighting properties
*/
scale =
((((RwReal) (255)) * (light->color.red))) *
(surfaceProps->diffuse);
while (numVert--)
{
RwV3d objVertex, objNormal;
RwReal dot, dist2;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Discover the vector between vertex and light and it's length */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
/* Ensure vertex lies within the light's radius */
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
if (dist2 < radSquared)
{
RwReal lum;
RwReal recipDist;
RwReal dist;
rwSqrt(&dist, dist2);
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
/*
* The following simplifies down to:
*
* -scale *
* (dot/dist) *
* (1 - dist/lightRadius)
*
* Where
* scale
* takes care of the light intensity and
* diffuse lighting coefficient
* (dot/dist)
* is a normalised dot product of
* light->vertex vector and vertex normal
* (1 - dist/lightRadius)
* is a linear falloff factor
*/
lum = scale * dot * (recipDist - recipRad);
/* Calculate the luminance at vertex */
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFPOINT
CAMVERTADDRGBA(1, 1, 1, 0);
}
}
OBJCAMVERTINC();
}
}
else
{
scale = (((RwReal) (255)) * (surfaceProps->diffuse));
while (numVert--)
{
RwV3d objVertex, objNormal;
RwReal dot, dist2;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Discover the vector between vertex and light and it's length */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
/* Ensure vertex lies within the light's radius */
if (dist2 < radSquared)
{
RwReal lum;
RwReal recipDist;
RwReal dist;
/* Only now calculate the actual length of vector */
rwSqrt(&dist, dist2);
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
lum = scale * dot * (recipDist - recipRad);
/* Alter the luminance according to light colour */
#define FALLOFFCALC FALLOFFPOINT
CAMVERTADDRGBA(light->color.red, light->color.green,
light->color.blue, 0);
}
}
/* Next point */
OBJCAMVERTINC();
}
}
RWRETURNVOID();
}
/***************************************************************************
_rwApplySpotLight
On entry : Instanced data
: Light
: Optional inverse object matrix
: (to transform light to object space)
: Inverse scale of object
: Surface properties of the light
On exit :
*/
static void
_rwApplySpotLight(VERTSARG,
const void *voidLight,
const RwMatrix * inverseMat,
RwReal invScale, const RwSurfaceProperties * surfaceProps)
{
OBJCAMVERTDECL;
NUMVERTDECL;
const RpLight *light = (const RpLight *) voidLight;
RwReal recipRad;
RwReal radSquared;
RwV3d lightPos, at;
RWFUNCTION(RWSTRING("_rwApplySpotLight"));
RWASSERT(light);
RWASSERT(surfaceProps);
OBJCAMVERTINIT();
NUMVERTINIT();
/* rpLIGHTSPOT - Linear falloff with distance, cone to restrict
* angle that light has effect, constant intensity across cone,
* scaled by dot product of vertex normal and light to vertex vector.
*/
lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos;
at = RwFrameGetLTM(RpLightGetFrame(light))->at;
if (inverseMat)
{
RwReal scaledRad;
scaledRad = ((light->radius) * (invScale));
recipRad = (((RwReal) (1)) / (scaledRad));
radSquared = ((scaledRad) * (scaledRad));
/* Transform light into object space */
/* The at is required to ensure within cone */
RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat);
RwV3dTransformVectors(&at, &at, 1, inverseMat);
_rwV3dNormalize(&at, &at);
}
else
{
recipRad = (((RwReal) (1)) / (light->radius));
radSquared = ((light->radius) * (light->radius));
}
if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA))
{
RwReal scale =
((RwReal) 255) * (light->color.red) * (surfaceProps->diffuse);
while (numVert--)
{
RwV3d vertToLight, objVertex, objNormal;
RwReal dot;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Find the squared distance from light point to vertex */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
RwReal dist2;
/* Ensure vertex lies within the light's radius */
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
if (dist2 < radSquared)
{
RwReal dist;
RwReal compare;
RwReal proj;
rwSqrt(&dist, dist2);
compare = dist * light->minusCosAngle;
proj = RwV3dDotProduct(&vertToLight, &at);
if (proj < compare)
{
RwReal lum;
RwReal recipDist;
/* Get the real distance from the light
* to the vertex (not squared) */
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
/* This model is the same as the point source
* inside the cone, zero outside the cone */
lum = scale * dot * (recipDist - recipRad);
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFSPOT
CAMVERTADDRGBA(1, 1, 1, 0);
}
}
/* Next vertex */
OBJCAMVERTINC();
}
}
}
else
{
RwReal scale =
(((RwReal) (255)) * (surfaceProps->diffuse));
while (numVert--)
{
RwV3d vertToLight, objVertex, objNormal;
RwReal dot;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Find the squared distance from light point to vertex */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
RwReal dist2;
/* Ensure vertex lies within the light's radius */
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
if (dist2 < radSquared)
{
RwReal dist;
RwReal compare;
RwReal proj;
rwSqrt(&dist, dist2);
compare = dist * light->minusCosAngle;
proj = RwV3dDotProduct(&vertToLight, &at);
if (proj < compare)
{
RwReal lum;
RwReal recipDist;
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
/* This model is the same as the point source
* inside the cone, zero outside the cone */
lum = scale * dot * (recipDist - recipRad);
/* Introduce the light colours as a
* scaling factor for luminance */
#define FALLOFFCALC FALLOFFSPOT
CAMVERTADDRGBA(light->color.red,
light->color.green, light->color.blue,
0);
}
}
}
/* Next */
OBJCAMVERTINC();
}
}
RWRETURNVOID();
}
/***************************************************************************
_rwApplySpotSoftLight
On entry : Instanced data
: Light
: Optional inverse object matrix
: (to transform light to object space)
: Inverse scale of object
: Surface properties of the light
On exit :
*/
static void
_rwApplySpotSoftLight(VERTSARG, const void *voidLight,
const RwMatrix * inverseMat, RwReal invScale,
const RwSurfaceProperties * surfaceProps)
{
OBJCAMVERTDECL;
NUMVERTDECL;
const RpLight *light = (const RpLight *) voidLight;
RwReal recipRad;
RwReal radSquared;
RwV3d lightPos, at;
RWFUNCTION(RWSTRING("_rwApplySpotSoftLight"));
RWASSERT(light);
RWASSERT(surfaceProps);
OBJCAMVERTINIT();
NUMVERTINIT();
/* rpLIGHTSPOTSOFT - Linear falloff with distance, cone to restrict
* angle that light has effect, falloff to edge of cone, scaled by
* dot product of vertex normal and light to vertex vector.
*/
lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos;
at = RwFrameGetLTM(RpLightGetFrame(light))->at;
if (inverseMat)
{
RwReal scaledRad;
scaledRad = ((light->radius) * (invScale));
recipRad = (((RwReal) (1)) / (scaledRad));
radSquared = ((scaledRad) * (scaledRad));
/* Transform light into object space */
/* The at is required to ensure within cone */
RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat);
RwV3dTransformVectors(&at, &at, 1, inverseMat);
_rwV3dNormalize(&at, &at);
}
else
{
recipRad = 1.0f / light->radius;
radSquared = light->radius * light->radius;
}
if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA))
{
RwReal scale =
((RwReal) 255) * (light->color.red) * (surfaceProps->diffuse);
while (numVert--)
{
RwV3d vertToLight, objVertex, objNormal;
RwReal dot;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Find the squared distance from light point to vertex */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
RwReal dist2;
/* Ensure vertex lies within the light's radius */
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
if (dist2 < radSquared)
{
RwReal dist;
RwReal compare;
RwReal proj;
rwSqrt(&dist, dist2);
compare = dist * light->minusCosAngle;
proj = RwV3dDotProduct(&vertToLight, &at);
if (proj < compare)
{
RwReal lum;
RwReal recipDist;
RwReal normalise;
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
/* This model is the same as the point source
* inside the cone, zero outside the cone */
lum = scale * dot * (recipDist - recipRad);
/* It has an extra term for quadratic falloff
* across the cone though */
normalise = (dist + compare);
RWASSERT(normalise >= 0.0f);
if (normalise > 0.0f)
{
normalise = (dist + proj) / normalise;
normalise *= normalise;
lum *= (((RwReal) 1) - normalise);
}
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFSOFTSPOT
CAMVERTADDRGBA(1, 1, 1, 0);
}
}
}
/* Next */
OBJCAMVERTINC();
}
}
else
{
RwReal scale = 255.0f * surfaceProps->diffuse;
while (numVert--)
{
RwV3d vertToLight, objVertex, objNormal;
RwReal dot;
OBJVERTGETPOS(&objVertex);
OBJVERTGETNORMAL(&objNormal);
/* Find the squared distance from light point to vertex */
RwV3dSub(&vertToLight, &lightPos, &objVertex);
/* Ensure that this vertex is facing the light source */
dot = RwV3dDotProduct(&vertToLight, &objNormal);
if (dot > 0.0f)
{
RwReal dist2;
/* Ensure vertex lies within the light's radius */
dist2 = RwV3dDotProduct(&vertToLight, &vertToLight);
if (dist2 < radSquared)
{
RwReal dist;
RwReal compare;
RwReal proj;
rwSqrt(&dist, dist2);
compare = dist * light->minusCosAngle;
proj = RwV3dDotProduct(&vertToLight, &at);
if (proj < compare)
{
RwReal lum;
RwReal normalise;
RwReal recipDist;
/* Get the real distance from the light
* to the vertex (not squared) */
recipDist =
(dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f;
/* This model is the same as the point source
* inside the cone, zero outside the cone */
lum = scale * dot * (recipDist - recipRad);
/* It has an extra term for quadratic falloff
* across the cone though */
/* It has an extra term for quadratic falloff
* across the cone though */
normalise = (dist + compare);
RWASSERT(normalise >= 0.0f);
if (normalise > 0.0f)
{
normalise = (dist + proj) / normalise;
normalise *= normalise;
lum *= (((RwReal) 1) - normalise);
}
/* Introduce the light colours as a
* scaling factor for luminance */
#undef FALLOFFCALC
#define FALLOFFCALC FALLOFFSOFTSPOT
CAMVERTADDRGBA(light->color.red,
light->color.green,
light->color.blue, 0);
}
}
}
/* Next */
OBJCAMVERTINC();
}
}
RWRETURNVOID();
}

View File

@ -0,0 +1,60 @@
RWECODE(E_RW_BADENGINESTATE,
"Engine in incorrect state for this operation")
RWECODE(E_RW_BADOPEN,
"Error opening the file %s")
RWECODE(E_RW_BADPARAM,
"Invalid Parameter passed. %s")
RWECODE(E_RW_BADVERSION,
"The binary file format version is incompatible with this library")
RWECODE(E_RW_DEBUGSTACK,
"Debug Library has Stack Depth mismatch")
RWECODE(E_RW_DEFAULTPIPELINECREATION,
"Creation of a default pipeline (%s) failed")
RWECODE(E_RW_FRAMENOMATRIX,
"The frame does not have an associated matrix")
RWECODE(E_RW_INVIMAGEDEPTH,
"Invalid Image Depth")
RWECODE(E_RW_INVIMAGEFORMAT,
"Image has no pixel memory allocated")
RWECODE(E_RW_INVIMAGEMASK,
"The mask and image are not the same size")
RWECODE(E_RW_INVIMAGESIZE,
"Destination and source images are of differing sizes")
RWECODE(E_RW_INVRASTERDEPTH,
"Invalid Raster depth")
RWECODE(E_RW_INVRASTERFORMAT,
"Unrecognized raster format")
RWECODE(E_RW_INVRASTERLOCKREQ,
"Invalid Raster lock request")
RWECODE(E_RW_INVRASTERMIPLEVEL,
"Invalid Raster mipmap level")
RWECODE(E_RW_INVRASTERSIZE,
"Invalid Raster size")
RWECODE(E_RW_INVRASTERUNLOCKREQ,
"Invalid Raster unlock request")
RWECODE(E_RW_NOFRAME,
"Unable to find Frame")
RWECODE(E_RW_NOMEM,
"Unable to allocate %d bytes of memory")
RWECODE(E_RW_NOMIPMAPGENERATIONCALLBACK,
"No Mipmap generation callback set - use RtMipmapUseDefaultMipmapGenerationCallback")
RWECODE(E_RW_NOTSSEENABLEDCPU,
"Not SSE enabled CPU")
RWECODE(E_RW_NULLP,
"NULL pointer passed to library routine")
RWECODE(E_RW_PLUGININIT,
"Plugin has already been initialized")
RWECODE(E_RW_PLUGINNOTINIT,
"Plugin not initialized")
RWECODE(E_RW_RANGE,
"A supplied parameter was outside the expected range")
RWECODE(E_RW_READ,
"Read error on stream")
RWECODE(E_RW_REDUNDANT_FUNCTION,
"Call to redundant function - scheduled to be dropped from future releases")
RWECODE(E_RW_WRITE,
"Write error on stream")
RWECODE(E_RX_MESHES_RANGES_OVERLAP,
"\n Geometry is in an invalid format for RxPipeline rendering.\n There may be visible artifacts and/or decreased performance.\n Use RpGeometrySortByMaterial.\n [stream %p type %s]")
RWECODE(E_RW_STRING_TRUNCATION,
"strlen(%s) >= %d; truncating at character #%d == %c")

View File

@ -0,0 +1,117 @@
RWECODE(E_RW_BADWINDOW,
"Invalid view window dimensions supplied")
RWECODE(E_RW_CHUNKTYPEGET,
"Unable to get a chunk of the given type")
RWECODE(E_RW_DEVICEERROR,
"Device specific error: %s")
RWECODE(E_RW_DEVICEOPEN,
"Request to open device system refused")
RWECODE(E_RW_DEVICESTART,
"Attempt to start Device failed")
RWECODE(E_RW_ENDOFSTREAM,
"At the end of the stream.")
RWECODE(E_RW_FRAMEDESTROYSTATIC,
"RwFrameDestroy called on static frame.")
RWECODE(E_RW_FRAMEBUFFERMISMATCH,
"Resolutions of parent rasters of frame buffer and Z buffer are different")
RWECODE(E_RW_FREELISTFREED,
"Free List value already on the free list")
RWECODE(E_RW_FREELISTINVADDRESS,
"Invalid Free List memory address")
RWECODE(E_RW_FREELISTINVMEMBOUND,
"Invalid Free List memory boundary")
RWECODE(E_RW_FREELISTTRASH,
"An unused Free List entry has been overwritten")
RWECODE(E_RW_INSUFFICIENTRESOURCES,
"Insufficient resources to satisfy the allocation of %d bytes.")
RWECODE(E_RW_INVSTREAMACCESSTYPE,
"Invalid stream access type.")
RWECODE(E_RW_INVSTREAMTYPE,
"Invalid stream type.")
RWECODE(E_RW_NEGCLIPPLANE,
"Negative positioned clip planes are invalid")
RWECODE(E_RW_NOCAMERA,
"Cannot render until a Camera has been created")
RWECODE(E_RW_NOFRAMEBUFFER,
"Camera has no frame buffer raster")
RWECODE(E_RW_NOPARENT,
"The given object has no parent")
RWECODE(E_RW_RASTERRECT,
"Rectangle is not totally within Raster")
RWECODE(E_RW_RASTERSTACK,
"Insufficient Raster stack space available")
RWECODE(E_RW_RASTERSTACKEMPTY,
"No Raster Currently on Stack")
RWECODE(E_RW_READTEXMASK,
"Unable to read Texture %s / Mask %s")
RWECODE(E_RW_STREAMOPEN,
"Unable to open stream : %s")
RWECODE(E_RW_SYSTEMREQUEST,
"A system request call has failed, request code : 0x%x")
RWECODE(E_RW_ZEROLENGTH,
"A Vector of Zero Length was passed for normalizing")
RWECODE(E_RX_CANNOT_TRANSFER_BETWEEN_NODES,
"Node %s cannot output to node %s")
RWECODE(E_RX_CANNOT_TRANSFER_FROM_NODE_TO_PIPELINE,
"Node %s cannot output to specified pipeline")
RWECODE(E_RX_CYCLICPIPELINE,
"Pipeline contains cycles; illegal")
RWECODE(E_RX_DEP_DEPENDENCIESMISMATCH,
"\n"
"*** dependencies cannot be satisfied.\n"
"*** rxCLREQ_REQUIRED on cluster %s, originating\n"
"*** with node %s, not serviced by a rxCLVALID_VALID -\n"
"*** blocked at node %s, output #%ld (\"%s\").")
RWECODE(E_RX_DEP_DUPLICATECLUSTERDEFS,
"\n"
"*** Node %s specifies RxClusterDefinition for cluster %s more than once in\n"
"*** clusters of interest array. Distinct clusters within a pipeline must reference\n"
"*** distinct RxClusterDefinitions, even if the clusters contain the same data type\n")
RWECODE(E_RX_DEP_NULLCLUSTERDEF,
"Node %s specified with RxClusterDefinition pointer NULL for cluster of interest %d\n")
RWECODE(E_RX_DEP_OUTOFMEMORY,
"Dependency chasing; memory alloc failed")
RWECODE(E_RX_EMPTYPIPELINE,
"RwPipeline2Execute cannot execute a pipeline with no nodes :)")
RWECODE(E_RX_FRAGMENTEDPIPELINE,
"Pipeline forms two or more unconnected graphs; illegal")
RWECODE(E_RX_IM3DNOTACTIVE,
"Cannot render Im3D primitives outside of a RwIm3dTransform()/RwIm3dEnd() pair")
RWECODE(E_RX_INVALIDENTRYPOINT,
"Pipeline has an invalid entry point")
RWECODE(E_RX_INVALIDPRIMTYPE,
"Unknown primitive type %d")
RWECODE(E_RX_INVALIDRESUMEPIPELINE,
"RwPipeline2Execute cannot resume a different pipeline to the one previously interrupted")
RWECODE(E_RX_LOCKEDPIPE,
"Illegal operation on a locked pipeline")
RWECODE(E_RX_NODETOOMANYCLUSTERSOFINTEREST,
"Node contains more than RXNODEMAXCLUSTERSOFINTEREST clusters of interest; illegal")
RWECODE(E_RX_NODETOOMANYOUTPUTS,
"Node contains more than RXNODEMAXOUTPUTS outputs; illegal")
RWECODE(E_RX_PIPELINETOOMANYNODES,
"Maximum nodes per pipeline exceeded! You may increase the limit by changing the value of _rxPipelineMaxNodes BEFORE starting RenderWare")
RWECODE(E_RX_NODE_EXECUTION_FAILED,
"Node execution failed - %s")
RWECODE(E_RX_NOVERTS,
"Cannot render Im3D primitive - not enough vertices transformed")
RWECODE(E_RX_PACKETPTRINVALID,
"Value of input/output interruption packets pointer not as expected")
RWECODE(E_RX_PACKETSCOPYFAILED,
"Failed to make copies of packets input to RxPipelineExecute()")
RWECODE(E_RX_RUNFROMNOTVALID,
"RunFrom node not a member of the specified pipeline")
RWECODE(E_RX_RUNTOANDRUNFROM,
"RwPipeline2Execute cannot accept both RunTo *and* RunFrom")
RWECODE(E_RX_RUNTONOTVALID,
"RunTo node not a member of the specified pipeline")
RWECODE(E_RX_TOOMANYVERTS,
"More than 65536 vertices passed to RwIm3DTransform; illegal")
RWECODE(E_RX_UNFINISHEDPIPELINE,
"RwPipeline2Execute must resume and finish an interrupted pipeline")
RWECODE(E_RX_UNLOCKEDPIPE,
"Illegal operation on an unlocked pipeline")
RWECODE(E_RX_UNPROCESSED_PACKETS,
"Unprocessed packets found in finished execution context")
RWECODE(E_RX_UNSATISFIED_REQUIREMENTS,
"Cannot send packet between pipelines, requirements not satisfied. Cluster '%s' is missing")

View File

@ -0,0 +1,54 @@
/**
* Anisotropic Texture Sampling Plugin for RenderWare.
*/
#ifndef RPANISOTPLUGIN_H
#define RPANISOTPLUGIN_H
/**
* \defgroup rpanisot RpAnisot
* \ingroup rpplugin
*
* Anisotropic Texture Sampling Plugin for RenderWare Graphics.
*/
/**
* \ingroup rpanisot
* \page rpanisotoverview RpAnisot Plugin Overview
*
* \par Requirements
* \li \b Headers: rwcore.h, rpworld.h, rpanisot.h
* \li \b Libraries: rwcore, rpworld, rpanisot
* \li \b Plugin \b attachments: \ref RpWorldPluginAttach, \ref RpAnisotPluginAttach
*
* \subsection anisotoverview Overview
* The RpAnisot plugin is used to extend an RwTexture with a maximum
* anisotropy value that will be used when a particular texture is drawn.
* When textured polygons are viewed nearly edge on, for example when looking
* dowm a road or a football pitch, distant pixels are not sampled very well
* by trilinear mipmapping and the texture looks smeary.
* Anisotropic sampling takes additional samples, resulting in sharper looking
* textures. Higher numbers of samples will produce better quality results but
* run slower, so should be used in moderation.
*
*/
#include <rwcore.h>
#ifdef __cplusplus
extern "C"
{
#endif
extern RwInt8 RpAnisotGetMaxSupportedMaxAnisotropy(void);
extern RwTexture *RpAnisotTextureSetMaxAnisotropy(RwTexture *tex, RwInt8 val);
extern RwInt8 RpAnisotTextureGetMaxAnisotropy(RwTexture *tex);
extern RwBool RpAnisotPluginAttach(void);
#ifdef __cplusplus
}
#endif
#endif /* RPANISOTPLUGIN_H */

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionLabel
{
e_rwdb_CriterionLabelLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLabel e_rwdb_CriterionLabel;

View File

@ -0,0 +1,372 @@
/*****************************************************************************
*
* File : rpcollis.h
*
* Abstract : World collision plugin for Renderware.
*
*****************************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 2000 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
*****************************************************************************/
#ifndef RPCOLLIS_H
#define RPCOLLIS_H
/* Doxygen plugin groups. */
/**
* \defgroup rpcollis RpCollision
* \ingroup rpplugin
*
* Collision Plugin for RenderWare Graphics.
*/
/******************************************************************************
* Include files
*/
#include <rwcore.h>
#include <rpworld.h>
#include "rpcollis.rpe" /* automatically generated header file */
/******************************************************************************
* Global Types
*/
/**
* \ingroup rpcollis
* RpIntersectType, this type represents the different types of
* primitives that can be used to intersect with an object (for example, see
* \ref RpCollisionWorldForAllIntersections):
*/
enum RpIntersectType
{
rpINTERSECTNONE = 0,
rpINTERSECTLINE, /**<Line Intersection */
rpINTERSECTPOINT, /**<Point Intersection */
rpINTERSECTSPHERE, /**<Sphere Intersection */
rpINTERSECTBOX, /**<Box intersection */
rpINTERSECTATOMIC, /**<Atomic Intersection based on bounding sphere */
rpINTERSECTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpIntersectType RpIntersectType;
/**
* \ingroup rpcollis
* RpIntersectData, this union type is used to specify the parameters
* for an intersection primitive of the desired type (\ref RpIntersectType)
*/
typedef union RpIntersectData RpIntersectData;
union RpIntersectData
{
RwLine line; /**<For type rpINTERSECTLINE */
RwV3d point; /**<For type rpINTERSECTPOINT */
RwSphere sphere; /**<For type rpINTERSECTSPHERE */
RwBBox box; /**<For type rpINTERSECTBOX */
void *object; /**<For type rpINTERSECTATOMIC - this
* should hold a pointer to the atomic */
};
typedef struct RpIntersection RpIntersection;
/**
* \ingroup rpcollis
* \struct RpIntersection
* Intersection Object. This type represents data for an
* intersection primitive. It specifies the intersection type
* (line, sphere, etc.) (type) and parameters describing the given type (t):
*/
struct RpIntersection
{
RpIntersectData t; /**< Intersection data. Union type - one
* of line, point, sphere or RW object */
RpIntersectType type; /**< Intersection type - see
* \ref RpIntersectType */
};
typedef struct RpCollisionTriangle RpCollisionTriangle;
/**
* \ingroup rpcollis
* \struct RpCollisionTriangle
* A structure representing a collision between
* an \ref RpIntersection primitive and a triangle.
* The collision is specified by the triangle's plane normal
* (normal), the first triangle vertex (point), an index to the triangle in
* the object geometry's triangle list (index) and the positions of the
* triangle's vertices (vertices). Note all vector components are in object
* space.
*
* \see RpCollisionWorldForAllIntersections
* \see RpCollisionGeometryForAllIntersections
* \see RpAtomicForAllIntersections
* \see RpIntersectionCallBackWorldTriangle
* \see RpIntersectionCallBackGeometryTriangle
*/
struct RpCollisionTriangle
{
RwV3d normal; /**< Triangle normal */
RwV3d point; /**< First triangle vertex */
RwInt32 index; /**< Index of triangle in object (if applicable) */
RwV3d *vertices[3]; /**< Pointers to three triangle vertices */
};
typedef struct RpCollisionBuildParam RpCollisionBuildParam;
/**
* \ingroup rpcollis
* \struct RpCollisionBuildParam
* This structure is a place-holder for parameters that may be
* introduced in future to control the generation of collision data when using
* the functions \ref RpCollisionWorldSectorBuildData,
* \ref RpCollisionWorldBuildData or \ref RpCollisionGeometryBuildData.
* Currently, a NULL pointer should be passed to these functions, as no
* parameters are defined. If parameters are introduced, a NULL pointer will
* indicate that default values should be used.
*/
struct RpCollisionBuildParam
{
RwInt32 dummy; /**< Not used */
};
/**
* \ingroup rpcollis
* \typedef RpIntersectionCallBackWorldTriangle
* \ref RpIntersectionCallBackWorldTriangle represents the function called
* from \ref RpCollisionWorldForAllIntersections for all intersections between
* the specified primitive and the static geometry in a given world. This
* function should return a pointer to the current collision triangle to
* indicate success. The callback may return NULL to terminate further
* callbacks on the world.
*
* \param intersection Pointer to the intersection primitive.
* \param sector Pointer to the world sector containing the triangle.
* \param collTriangle Pointer to the \ref RpCollisionTriangle representing
* the triangle in the world's static geometry that is intersected.
* \param distance The distance to the intersection point(s).
* Note that the distance returned depends on the intersection type and is
* normalized for the given intersection primitive.
* \li rpINTERSECTLINE Distance from start of line to collision
* triangle, normalized to length of line.
* \li rpINTERSECTSPHERE Distance of sphere's center from the collision
* triangle along the direction of the normal, and normalized
* to the sphere's radius (may be negative if the sphere center
* is behind the triangle's plane with respect to the direction
* of the normal).
* \li rpINTERSECTBOX Distance is undefined.
* \li rpINTERSECTATOMIC Distance of atomic's bounding-sphere center
* from the collision triangle along the direction of the normal
* and normalized to sphere's radius.
* \param data User defined data pointer
*
* \return Pointer to the current collision triangle.
*/
typedef RpCollisionTriangle *(*RpIntersectionCallBackWorldTriangle)
(RpIntersection * intersection,
RpWorldSector * sector,
RpCollisionTriangle * collTriangle, RwReal distance, void *data);
/**
* \ingroup rpcollis
* \typedef RpIntersectionCallBackAtomic
* \ref RpIntersectionCallBackAtomic represents the function called from
* \ref RpWorldForAllAtomicIntersections for all intersections between the
* specified primitive and collision atomics in a given world. This function
* should return the current atomic to indicate success. The callback may
* return NULL to terminate further callbacks on the world.
*
* \param intersection Pointer to the intersection primitive.
* \param sector Pointer to the world sector containing
* the intersected triangles.
* \param atomic Pointer to the intersected atomic.
* \param distance The collision distance. The distance returned
* depends on the intersection type which is defined in \ref RpIntersectType.
* \li rpINTERSECTPOINT Distance of point from atomic's bounding
* sphere center, normalized to sphere's radius.
* \li rpINTERSECTLINE Distance of atomic's bounding-sphere center from
* start of line, projected onto the line, normalized to length of line.
* Note that by this definition, if the line starts or ends inside the
* sphere, this distance maybe negative or greater than one.
* \li rpINTERSECTSPHERE Distance of atomic's bounding-sphere center
* from sphere's center, normalized to sum of spheres' radii.
* \li rpINTERSECTBOX Distance undefined.
* \li rpINTERSECTATOMIC Distance between atomics' bounding-sphere
* centers, normalized to sum of spheres' radii.
* \param data User defined data pointer.
*
* \return Pointer to the current atomic.
*/
typedef RpAtomic *(*RpIntersectionCallBackAtomic)
(RpIntersection * intersection,
RpWorldSector * sector, RpAtomic * atomic, RwReal distance, void *data);
/**
* \ingroup rpcollis
* \typedef RpIntersectionCallBackWorldSector
* \ref RpIntersectionCallBackWorldSector represents the function called from
* \ref RpWorldForAllWorldSectorIntersections for all intersections between the
* specified primitive and world sectors in a given world. This function should
* return the current world sector to indicate success. The callback may return
* NULL to terminate further callbacks on the world.
*
* \param intersection Pointer to the intersection primitive.
* \param sector Pointer to the world sector containing the intersected
* polygons.
* \param data User defined data pointer
*
* \return Pointer to the current world sector.
*/
typedef RpWorldSector *(*RpIntersectionCallBackWorldSector)
(RpIntersection * intersection, RpWorldSector * worldSector, void *data);
/**
* \ingroup rpcollis
* \typedef RpIntersectionCallBackGeometryTriangle
* \ref RpIntersectionCallBackGeometryTriangle represents the function called
* from \ref RpAtomicForAllIntersections and
* \ref RpCollisionGeometryForAllIntersections
* for all intersections between the specified primitive and a given atomic.
* This function should return a pointer to the current collision triangle to
* indicate success. The callback may return NULL to terminate further
* callbacks on the atomic.
*
* Note that the vertices and normal of the collision triangle are given
* in the coordinate space of the geometry. If they are required in world
* coordinates, they must be transformed using \ref RwV3dTransformPoints and
* \ref RwV3dTransformVectors with the LTM of the atomic's frame. This must
* be passed via the user-defined data if required.
*
* \param intersection Pointer to the intersection primitive.
* \param collTri Pointer to the \ref RpCollisionTriangle
* representing the triangle in the atomic that is intersected.
* \param distance The distance to the intersection point(s).
* Note that the distance returned depends on the intersection type and is
* normalized for the given intersection primitive.
* \li rpINTERSECTLINE Distance from start of line to collision
* triangle, normalized to length of line.
* \li rpINTERSECTSPHERE Distance of sphere's center from the collision
* triangle along the direction of the normal, and normalized
* to the sphere's radius (may be negative if the sphere center
* is behind the triangle's plane with respect to the direction
* of the normal).
* \li rpINTERSECTATOMIC Distance of atomic's bounding-sphere center
* from the collision triangle along the direction of the normal, and
* normalized to sphere's radius.
* \param data User defined data pointer
*
* \return Pointer to the current collision triangle.
*/
typedef RpCollisionTriangle *(*RpIntersectionCallBackGeometryTriangle)
(RpIntersection *intersection, RpCollisionTriangle *collTriangle,
RwReal distance, void *data);
/******************************************************************************
* Plugin API Functions
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Plugin attachment */
extern RwBool
RpCollisionPluginAttach(void);
/* World collisions */
extern RpWorldSector *
RpCollisionWorldSectorBuildData(
RpWorldSector *worldSector,
RpCollisionBuildParam *param);
extern RpWorldSector *
RpCollisionWorldSectorDestroyData(
RpWorldSector *worldSector);
extern RwBool
RpCollisionWorldSectorQueryData(
RpWorldSector *worldSector);
extern RpWorld *
RpCollisionWorldBuildData(
RpWorld *world,
RpCollisionBuildParam *param);
extern RpWorld *
RpCollisionWorldDestroyData(
RpWorld *world);
extern RwBool
RpCollisionWorldQueryData(
RpWorld *world);
extern RpWorld *
RpWorldForAllWorldSectorIntersections(
RpWorld *world,
RpIntersection *intersection,
RpIntersectionCallBackWorldSector callBack,
void *data);
extern RpWorld *
RpWorldForAllAtomicIntersections(
RpWorld *world,
RpIntersection *intersection,
RpIntersectionCallBackAtomic callBack,
void *data);
extern RpWorld *
RpCollisionWorldForAllIntersections(
RpWorld *world,
RpIntersection *intersection,
RpIntersectionCallBackWorldTriangle callBack,
void *data);
/* Geometry and atomic collisions */
extern RpGeometry *
RpCollisionGeometryBuildData(
RpGeometry *geometry,
RpCollisionBuildParam *param);
extern RwBool
RpCollisionGeometryQueryData(
RpGeometry *geometry);
extern RpGeometry *
RpCollisionGeometryDestroyData(
RpGeometry *geometry);
extern RpGeometry *
RpCollisionGeometryForAllIntersections(
RpGeometry *geometry,
RpIntersection *intersection,
RpIntersectionCallBackGeometryTriangle callBack,
void *data);
extern RpAtomic *
RpAtomicForAllIntersections(
RpAtomic *atomic,
RpIntersection *intersection,
RpIntersectionCallBackGeometryTriangle callBack,
void *data);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPCOLLIS_H */

View File

@ -0,0 +1,637 @@
enum e_rwdb_CriterionCollis
{
E_RP_COLLIS_INV_INTERSECTION,
e_rwdb_CriterionCollisLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionCollis e_rwdb_CriterionCollis;

View File

@ -0,0 +1,572 @@
/* Doxygen Core Library groups */
/**
* \defgroup rwcore Core Library
*
* Core Library
*/
/**
* \defgroup datatypes Data Types
* \ingroup rwcore
*
* Basic Data Types
*/
#ifndef RWPLCORE
/**
* \defgroup rwbbox RwBBox
* \ingroup rwcore
*
* Bounding Box
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwcamera RwCamera
* \ingroup rwcore
*
* Cameras define how and what things can be seen. They also define the
* depth and width of the view by the use of clip-planes and the view
* window.
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwcameravertex RwCameraVertex
* \ingroup rwcore
*
* Camera space vertex data access
*/
#endif /* RWPLCORE */
/**
* \defgroup rwdebug RwDebug
* \ingroup rwcore
*
* Debug handling
*/
/**
* \defgroup rwengine RwEngine
* \ingroup rwcore
*
* Device handling.
*/
/**
* \defgroup rwerror RwError
* \ingroup rwcore
*
* Error code handling
*/
#ifndef RWPLCORE
/**
* \defgroup rwframe RwFrame
* \ingroup rwcore
*
* Frames define relationships between objects and the world
*/
#endif /* RWPLCORE */
/**
* \defgroup rwfreelist RwFreeList
* \ingroup rwcore
*
* Free lists
*/
#ifndef RWPLCORE
/**
* \defgroup rwimage RwImage
* \ingroup rwcore
*
* Image handling.
*/
#endif /* RWPLCORE */
/**
* \defgroup rwim2d RwIm2D
* \ingroup rwcore
*
* 2D immediate mode support
*/
#ifndef RWPLCORE
/**
* \defgroup rwim2dcameravertex RwIm2DCameraVertex
* \ingroup rwcore
*
* 2D Camera space vertex data access
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwim2dvertex RwIm2DVertex
* \ingroup rwcore
*
* Im2D Vertex data access
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwim3d RwIm3D
* \ingroup rwcore
*
* 3D immediate mode support
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwim3dvertex RwIm3DVertex
* \ingroup rwcore
*
* Im3D Vertex data access
*/
#endif /* RWPLCORE */
/**
* \defgroup rwmatrix RwMatrix
* \ingroup rwcore
*
* Handling binary matrix representations.
*/
/**
* \defgroup rwmem RwMem
* \ingroup rwcore
*
* Memory
*/
#ifndef RWPLCORE
/**
* \defgroup rwobject RwObject
* \ingroup rwcore
*
* object
*/
#endif /* RWPLCORE */
/**
* \defgroup rwos RwOs
* \ingroup rwcore
*
* Operating System
*/
#ifndef RWPLCORE
/**
* \defgroup rwraster RwRaster
* \ingroup rwcore
*
* Image/raster coupling handling.
*/
#endif /* RWPLCORE */
/**
* \defgroup rwrenderstate RwRenderState
* \ingroup rwcore
*
* Render states
*/
/**
* \defgroup rwresources RwResources
* \ingroup rwcore
*
* Resource handling.
* Resources are used to instance objects into.
*/
/**
* \defgroup rwrgba RwRGBA
* \ingroup rwcore
*
* Color space functionality.
*/
/**
* \defgroup rwstream RwStream
* \ingroup rwcore
*
* Stream
*/
#ifndef RWPLCORE
/**
* \defgroup rwtexdict RwTexDictionary
* \ingroup rwcore
*
* Texture Dictionary
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwtexture RwTexture
* \ingroup rwcore
*
* Texture handling.
* Textures are special cases of rasters that can be applied to polygons.
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwv2d RwV2d
* \ingroup rwcore
*
* 2D Vector mathematics.
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwv3d RwV3d
* \ingroup rwcore
*
* 3D Vector mathematics.
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwcorepowerpipe PowerPipe
* \ingroup rwcore
*
* PowerPipe
*/
#endif /* RWPLCORE */
#ifndef RWPLCORE
/**
* \defgroup rwcoregeneric Generic
* \ingroup rwcorepowerpipe
*
* Generic Pipeline
*
*/
#endif /* RWPLCORE */
/* These are plugins */
#define rwID_METRICSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x01)
#define rwID_SPLINEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x02)
#define rwID_STEREOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x03)
#define rwID_VRMLPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x04)
#define rwID_MORPHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x05)
#define rwID_PVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x06)
#define rwID_MEMLEAKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x07)
#define rwID_ANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x08)
#define rwID_GLOSSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x09)
#define rwID_LOGOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0a)
#define rwID_MEMINFOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0b)
#define rwID_RANDOMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0c)
#define rwID_PNGIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0d)
#define rwID_BONEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0e)
#define rwID_VRMLANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0f)
#define rwID_SKYMIPMAPVAL MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x10)
#define rwID_MRMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x11)
#define rwID_LODATMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x12)
#define rwID_MEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x13)
#define rwID_LTMAPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x14)
#define rwID_REFINEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x15)
#define rwID_SKINPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x16)
#define rwID_LABELPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x17)
#define rwID_PARTICLESPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x18)
#define rwID_GEOMTXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x19)
#define rwID_SYNTHCOREPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1a)
#define rwID_STQPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1b)
#define rwID_PARTPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1c)
#define rwID_COLLISPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1d)
#define rwID_HANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1e)
#define rwID_USERDATAPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1f)
#define rwID_MATERIALEFFECTSPLUGIN \
MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x20)
#define rwID_PARTICLESYSTEMPLUGIN \
MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x21)
#define rwID_DMORPHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x22)
#define rwID_PATCHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x23)
#define rwID_TEAMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x24)
#define rwID_CROWDPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x25)
#define rwID_MIPSPLITPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x26)
#define rwID_ANISOTPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x27)
/* #define THIS SPACE FREE! MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x28) */
#define rwID_GCNMATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x29)
#define rwID_GPVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2a)
#define rwID_XBOXMATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2b)
#define rwID_MULTITEXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2c)
#define rwID_CHAINPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2d)
#define rwID_TOONPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2e)
#define rwID_PTANKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2f)
#define rwID_PRTSTDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x30)
/********************************************************/
/* Doxygen plugin groups. */
#ifndef RWPLCORE
/**
* \defgroup rpplugin Plugins
*
* API Plugins
*
*/
/**
* \defgroup rpworld RpWorld
* \ingroup rpplugin
*
* World handling Plugin
*
* Gives objects context,
* and provides a mechanism for efficient static object rendering.
*/
/********************************************************/
/**
* \defgroup rpworlddatatypes Data Types
* \ingroup rpworld
*
* RpWorld Data types
*/
/**
* \defgroup rpatomic RpAtomic
* \ingroup rpworld
*
* Atomics
*/
/**
* \defgroup rpclump RpClump
* \ingroup rpworld
*
* Clumps
*/
/**
* \defgroup rpgeometry RpGeometry
* \ingroup rpworld
*
* Handling atomic's geometry
*/
/**
* \defgroup rpinterpolator RpInterpolator
* \ingroup rpworld
*
* Interpolators
*/
/**
* \defgroup rplight RpLight
* \ingroup rpworld
*
* Lighting 3D objects.
* Lights are used to illuminate atomics and worlds
*/
/**
* \defgroup rpmaterial RpMaterial
* \ingroup rpworld
*
* Handling surface materials
* Materials describe how things are to appear when rendered
*/
/**
* \defgroup rpmesh RpMesh
* \ingroup rpworld
*
* Provide construction and enumeration facilities for meshes.
*/
/**
* \defgroup rpmorphtarget RpMorphTarget
* \ingroup rpworld
*
* Morph Targets
*/
/**
* \defgroup rpworldsub RpWorld
* \ingroup rpworld
*
* RpWorld sub group
*/
/**
* \defgroup rpworldsector RpWorldSector
* \ingroup rpworld
*
* Handling atomic sectors
*/
/**
* \defgroup rpworldrwcamera RwCamera
* \ingroup rpworld
*
* Cameras
*/
/**
* \defgroup rpworldpowerpipe PowerPipe
* \ingroup rpworld
*
* PowerPipe
*/
/**
* \defgroup rpworldp2generic Generic
* \ingroup rpworldpowerpipe
*
* Generic
*/
#endif /* RWPLCORE */
/* These are toolkits */
#define rwID_CHARSEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x80)
#define rwID_NOHSWORLDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x81)
#define rwID_IMPUTILPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x82)
#define rwID_SLERPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x83)
#define rwID_OPTIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x84)
#define rwID_TLWORLDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x85)
#define rwID_DATABASEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x86)
#define rwID_RAYTRACEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x87)
#define rwID_RAYPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x88)
#define rwID_LIBRARYPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x89)
#define rwID_2DPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x90)
#define rwID_TILERENDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x91)
#define rwID_JPEGIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x92)
#define rwID_TGAIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x93)
#define rwID_GIFIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x94)
#define rwID_QUATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x95)
#define rwID_SPLINEPVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x96)
#define rwID_MIPMAPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x97)
#define rwID_MIPMAPKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x98)
#define rwID_2DFONT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x99)
#define rwID_INTSECPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9a)
#define rwID_TIFFIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9b)
#define rwID_PICKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9c)
#define rwID_BMPIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9d)
#define rwID_RASIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9e)
#define rwID_SKINFXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9f)
#define rwID_VCATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa0)
#define rwID_2DPATH MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa1)
#define rwID_2DBRUSH MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa2)
#define rwID_2DOBJECT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa3)
#define rwID_2DSHAPE MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa4)
#define rwID_2DSCENE MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa5)
#define rwID_2DPICKREGION MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa6)
#define rwID_2DOBJECTSTRING MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa7)
#define rwID_2DANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa8)
#define rwID_2DANIM MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa9)
#define rwID_2DKEYFRAME MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb0)
#define rwID_2DMAESTRO MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb1)
#define rwID_BARYCENTRIC MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb2)
#define rwID_PITEXDICTIONARYTK MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb3)
#define rwID_TOCTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb4)
/**********************************************************************/
/* Doxygen Toolkit groups */
/**
* \defgroup rttool Toolkits
*
* API Toolkits
*/
/**
* \defgroup fxpack FXPack
*
* FXPack component group
*/
/**********************************************************************/
/**
* \defgroup platformspecific Platform Specific
*
* Links to all platform specific information in the API Reference can
* be found in this folder.
*/
/**********************************************************************/
/* Index Page definition for API Reference. Don't mess with it unless you know what you're doing. */
/**
* \mainpage RenderWare Graphics API Reference
*
* \image html rwglogo.jpg
*
* This document provides an API Reference for release 3.3 of the RenderWare
* Graphics SDK.
*
* You do not have to wait for a major release to obtain a current API
* Reference. An up-to-date API Reference is compiled every week and goes out
* with the weekly build. The footer declares when it was generated.
*
* \section otherdocs Documentation Available
* RenderWare Graphics is supplied with:
*
* - A top-level README.PDF -- If you read nothing else, at least read this!
* - this API Reference
* - the User Guide
* - Artist's documentation (if installed)
* - Examples documentation
* - Maestro documentation
* - Tools documentation
* - White Papers
* - readme.txt files for each of the supplied Examples
*
* \section contactus Contact Us
*
* \subsection csl Criterion Software Ltd.
* For general information about RenderWare e-mail info@csl.com.
*
* \subsection devrels Developer Relations
*
* For information regarding Support please email devrels@csl.com
*
* \subsection sales Sales
*
* For sales information contact: rw-sales@csl.com
*
* \section copyright Copyright Notice
*
* The information in this document is subject to change without notice and does not represent
* a commitment on the part of Criterion Software Ltd. The software described in this document is
* furnished under a license agreement or a non-disclosure agreement. The software may be used or
* copied only in accordance with the terms of the agreement. It is against the law to copy the
* software on any medium except as specifically allowed in the license or non-disclosure agreement.
*
* No part of this documentation may be reproduced or transmitted in any form or by any means for any
* purpose without the express written permis­sion of Criterion Software Ltd.
*
* Copyright © 1993 - 2002 Criterion Software Ltd. All rights reserved.
*
* Canon and RenderWare are registered trademarks of Canon Inc. Nintendo is a registered trademark
* and NINTENDO GAMECUBE a trademark of Nintendo Co., Ltd. Microsoft is a registered trademark and
* Xbox is a trademark of Microsoft Corporation. PlayStation is a registered trademark of Sony Computer
* Entertainment Inc.
*
* All other trademarks mentioned herein are the property of their respective companies.
*
*/

View File

@ -0,0 +1,90 @@
/*
* Debug handling
*
****************************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 1998 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
****************************************************************************/
/****************************************************************************
Includes
*/
#include <stdlib.h>
#include <string.h>
#include <rwcore.h>
#include <rpdbgerr.h>
static const char rcsid[] __RWUNUSED__ = "@@(#)$Id: //RenderWare/RW33Active/dev/rwsdk/src/plcore/rpdbgerr.c#1 $";
#ifdef RWDEBUG
/****************************************************************************
Defines
*/
/****************************************************************************
Local (static) Globals
*/
/* The strings used in the debug error reporting are derived from the
* .def files
*/
#define RWECODE(a,b) RWSTRING(b),
static const RwChar *rw_err_str[] =
{
#include "rperror.def"
RWSTRING("Last Error")
};
#undef RWECODE
#define RWECODE(a,b) RWSTRING(#a),
static const RwChar *rw_err_cstr[] =
{
#include "rperror.def"
RWSTRING("E_RW_LAST")
};
#undef RWECODE
static RwChar dberr[512];
RwChar *
rwPLUGIN_ERRFUNC(RwInt32 code,...)
{
va_list ap;
#if (0)
RWFUNCTION(RWSTRING("rwPLUGIN_ERRFUNC"));
#endif /* (0) */
va_start(ap, code);
rwstrcpy(dberr, rw_err_cstr[code]);
rwstrcat(dberr, RWSTRING(" : "));
rwvsprintf(&dberr[rwstrlen(dberr)], rw_err_str[code], ap);
va_end(ap);
return dberr;
}
#endif /* RWDEBUG */

View File

@ -0,0 +1,278 @@
/***************************************************************************
* *
* Module : badebug.h *
* *
* Purpose : Debug handling *
* *
**************************************************************************/
#ifndef RWDEBUG_H
#define RWDEBUG_H
#if (defined(RWDEBUG) && defined(RWVERBOSE))
#if (defined(_MSC_VER))
#if (_MSC_VER>=1000)
/* Pick up _ASSERTE macro */
#ifdef _XBOX
#include <xtl.h>
#else /* _XBOX */
#include <windows.h>
#endif /* _XBOX */
#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
#define _CRTDBG_MAP_ALLOC
#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
#include <crtdbg.h>
#undef RWASSERTE
#define RWASSERTE(_condition) _ASSERTE(_condition)
#endif /* (_MSC_VER>=1000) */
#endif /* (defined(_MSC_VER)) */
#endif /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
#if (!defined(RWASSERTE))
#define RWASSERTE(_condition) /* No-Op */
#endif /* (!defined(RWASSERTE)) */
#if (!defined(RWPENTER))
#define RWPENTER(_func) /* No-Op */
#endif /* (!defined(RWPENTER)) */
#if (!defined(RWPEXIT))
#define RWPEXIT(_func) /* No-Op */
#endif /* (!defined(RWPEXIT)) */
/****************************************************************************
Includes
*/
#include <rwcore.h>
#include "rpplugin.h"
/****************************************************************************
Defines
*/
#ifdef RWDEBUG
#if (!(defined(RWDEBUGSTACKDEPTH)))
#define RWDEBUGSTACKDEPTH (RWSRCGLOBAL(debugStackDepth))
#endif /* (!(defined(RWDEBUGSTACKDEPTH))) */
/* Message macros */
#ifdef RWTRACE
/* Note RWTRACE should only be defined for internal builds. It should
* also only be used rarely. It will cause the generation of Trace
* messages for all functions. Not just those directly called from
* the application
*/
#define RWAPIFUNCTION(function) \
static const RwChar __dbFunctionName[] = function; \
const RwInt32 startstackdepth = RWDEBUGSTACKDEPTH++; \
RWPENTER(__dbFunctionName); \
if (RWSRCGLOBAL(debugTrace)) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, \
_rwdbsprintf("Enter %s [Depth %d]", \
(startstackdepth)?"SPI":"API", \
(int)startstackdepth)); \
}
#define RWFUNCTION(function) RWAPIFUNCTION(function)
#define RWRETURN(result) \
do \
{ \
RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
if (_validateStackDepth != startstackdepth) \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
_rwdberrcommon(E_RW_DEBUGSTACK)); \
RWDEBUGSTACKDEPTH = startstackdepth; \
} \
if (RWSRCGLOBAL(debugTrace)) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, RWSTRING("Exit")); \
} \
RWASSERTE(_validateStackDepth == startstackdepth); \
RWPEXIT(__dbFunctionName); \
return (result); \
} \
while (0)
#define RWRETURNVOID() \
do \
{ \
RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
if (_validateStackDepth != startstackdepth) \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
_rwdberrcommon (E_RW_DEBUGSTACK)); \
RWDEBUGSTACKDEPTH = startstackdepth; \
} \
if (RWSRCGLOBAL(debugTrace)) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, RWSTRING("Exit")); \
} \
RWASSERTE(_validateStackDepth == startstackdepth); \
RWPEXIT(__dbFunctionName); \
return; \
} \
while(0)
#else /* RWTRACE */
#define RWAPIFUNCTION(function) \
static const RwChar __dbFunctionName[] = function; \
const RwInt32 startstackdepth = RWDEBUGSTACKDEPTH++; \
RWPENTER(__dbFunctionName); \
if (RWSRCGLOBAL(debugTrace) && !startstackdepth) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, RWSTRING("Enter")); \
}
#define RWFUNCTION(function) RWAPIFUNCTION(function)
#define RWRETURN(result) \
do \
{ \
RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
if (_validateStackDepth != startstackdepth) \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
_rwdberrcommon(E_RW_DEBUGSTACK)); \
RWDEBUGSTACKDEPTH = startstackdepth; \
} \
if (RWSRCGLOBAL(debugTrace) && (!startstackdepth)) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, RWSTRING("Exit")); \
} \
RWASSERTE(_validateStackDepth == startstackdepth); \
RWPEXIT(__dbFunctionName); \
return (result); \
} \
while (0)
#define RWRETURNVOID() \
do \
{ \
RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
if (_validateStackDepth != startstackdepth) \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
_rwdberrcommon (E_RW_DEBUGSTACK)); \
RWDEBUGSTACKDEPTH = startstackdepth; \
} \
if (RWSRCGLOBAL(debugTrace) && (!startstackdepth)) \
{ \
RwDebugSendMessage(rwDEBUGTRACE, \
__dbFunctionName, RWSTRING("Exit")); \
} \
RWASSERTE(_validateStackDepth == startstackdepth); \
RWPEXIT(__dbFunctionName); \
return; \
} \
while(0)
#endif /* RWTRACE */
#define RWERROR(ecode) \
do \
{ \
RwError _rwErrorCode; \
\
_rwErrorCode.pluginID = rwPLUGIN_ID; \
_rwErrorCode.errorCode = _rwerror ecode; \
\
RwErrorSet(&_rwErrorCode); \
\
if (_rwErrorCode.errorCode & 0x80000000) \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
_rwdberrcommon ecode); \
} \
else \
{ \
RwDebugSendMessage(rwDEBUGERROR, \
__dbFunctionName, \
rwPLUGIN_ERRFUNC ecode); \
} \
} \
while(0);
#define RWMESSAGE(args) \
do \
{ \
RwDebugSendMessage(rwDEBUGMESSAGE, \
__dbFunctionName, \
_rwdbsprintf args); \
} \
while (0)
#define RWASSERT(condition) \
do \
{ \
if (!(condition)) \
{ \
RwDebugSendMessage(rwDEBUGASSERT, \
__dbFunctionName, \
RWSTRING(#condition)); \
} \
RWASSERTE(condition); \
} \
while (0)
#else /* RWDEBUG */
#define RWRETURN(value) return(value)
#define RWRETURNVOID() return
#define RWERROR(errorcode) \
do \
{ \
RwError _rwErrorCode; \
\
_rwErrorCode.pluginID = rwPLUGIN_ID; \
_rwErrorCode.errorCode = _rwerror errorcode; \
\
RwErrorSet(&_rwErrorCode); \
} \
while (0)
#define RWFUNCTION(name)
#define RWAPIFUNCTION(name)
#define RWASSERT(condition)
#define RWMESSAGE(args)
#endif
#define RWVALIDATEDEBUGSTACKDEPTH() \
RWASSERT(1 == (RWDEBUGSTACKDEPTH - startstackdepth))
/****************************************************************************
Functions
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
RwChar *rwPLUGIN_ERRFUNC(RwInt32 code, ...);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RWDEBUG_H */

View File

@ -0,0 +1,311 @@
/*****************************************************************************
*
* File : rpdmorph.h
*
* Abstract : DeltaMorph plugin for Renderware.
*
*****************************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 2000 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
*****************************************************************************/
#ifndef RPDMORPH_H
#define RPDMORPH_H
/**
* \defgroup rpdmorph RpDMorph
* \ingroup rpplugin
* \file rpdmorph.h
*
* Delta Morphing Plugin for RenderWare Graphics.
*/
/*===========================================================================*
*--- Include files ---------------------------------------------------------*
*===========================================================================*/
#include <rwcore.h>
#include <rpworld.h>
#include "rpdmorph.rpe" /* automatically generated header file */
/*===========================================================================*
*--- Global Types ----------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rpdmorph
* \struct RpDMorphTarget
* Delta morph target object for defining a target for
* a base geometry.
* This should be considered an opaque type.
* Use the RpDMorphGeometry and RpDMorphTarget API
* functions to access.
*/
typedef struct RpDMorphTarget RpDMorphTarget;
/**
* \ingroup rpdmorph
* \struct RpDMorphAnimation
* Contains frame sequences for animating delta
* morph target objects.
* This should be considered an opaque type.
* Use the RpDMorphAnimation API
* functions to access.
*/
typedef struct RpDMorphAnimation RpDMorphAnimation;
#define rpDMORPHNULLFRAME ((RwUInt32)~0)
/*===========================================================================*
*--- Global variables ------------------------------------------------------*
*===========================================================================*/
extern RwModuleInfo rpDMorphModule;
/*===========================================================================*
*--- Plugin API Functions --------------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*--- DMorphPlugin functions ------------------------------------------------*/
extern RwBool
RpDMorphPluginAttach( void );
/*--- DMorphGeometry functions ----------------------------------------------
*
* These functios work on the DMorphGeometry level.
* Each DMorphGeometry has a list of DMorphTargets.
*/
extern RpGeometry *
RpDMorphGeometryCreateDMorphTargets( RpGeometry *geometry,
RwUInt32 number );
extern RpGeometry *
RpDMorphGeometryDestroyDMorphTargets( RpGeometry *geometry );
extern RpGeometry *
RpDMorphGeometryAddDMorphTarget( RpGeometry *geometry,
RwUInt32 index,
RwV3d *vertices,
RwV3d *normals,
RwRGBA *preLightColors,
RwTexCoords *texCoords,
RwUInt32 flags );
extern RpGeometry *
RpDMorphGeometryRemoveDMorphTarget( RpGeometry *geometry,
RwUInt32 index );
extern RpDMorphTarget *
RpDMorphGeometryGetDMorphTarget( const RpGeometry *geometry,
RwUInt32 index );
extern RwUInt32
RpDMorphGeometryGetNumDMorphTargets( const RpGeometry *geometry );
extern RpGeometry *
RpDMorphGeometryTransformDMorphTargets( RpGeometry *geometry,
const RwMatrix *matrix );
/*--- DMorphTarget functions ------------------------------------------------
*
* These functios work on the DMorphGeometry level.
* Each DMorphGeometry has a list of DMorphTargets.
*/
extern const RwSphere *
RpDMorphTargetGetBoundingSphere( const RpDMorphTarget *dMorphTarget );
extern RpDMorphTarget *
RpDMorphTargetSetName( RpDMorphTarget *dMorphTarget,
RwChar *name );
extern RwChar *
RpDMorphTargetGetName( RpDMorphTarget *dMorphTarget );
extern RpGeometryFlag
RpDMorphTargetGetFlags( RpDMorphTarget *dMorphTarget );
/*--- ANIMATION SYSTEM ------------------------------------------------------
*/
/*--- DMorphAtomic functions ------------------------------------------------
*
* These functions work at the DMorphAtomic level.
*/
extern RpAtomic *
RpDMorphAtomicInitalize( RpAtomic *atomic );
extern RwReal *
RpDMorphAtomicGetDMorphValues( RpAtomic *atomic );
extern RpAtomic *
RpDMorphAtomicSetAnimation( RpAtomic *atomic,
RpDMorphAnimation *animation );
extern RpDMorphAnimation *
RpDMorphAtomicGetAnimation( const RpAtomic *atomic );
extern RpAtomic *
RpDMorphAtomicAddTime( RpAtomic *atomic,
RwReal time );
extern RwReal
RpDMorphAtomicGetAnimTime( const RpAtomic *atomic );
extern RpAtomic *
RpDMorphAtomicSetAnimLoopCallBack( RpAtomic *atomic,
RpAtomicCallBack callBack,
void *data );
extern RpAtomicCallBack
RpDMorphAtomicGetAnimLoopCallBack( const RpAtomic *atomic,
void **callBackData );
extern RpAtomic *
RpDMorphAtomicSetAnimFrame( RpAtomic *atomic,
RwUInt32 dMorphTargetIndex,
RwUInt32 index );
extern RwUInt32
RpDMorphAtomicGetAnimFrame( const RpAtomic *atomic,
RwUInt32 dMorphTargetIndex );
extern RpAtomic *
RpDMorphAtomicSetAnimFrameTime( RpAtomic *atomic,
RwUInt32 dMorphTargetIndex,
RwReal time );
extern RwReal
RpDMorphAtomicGetAnimFrameTime( const RpAtomic *atomic,
RwUInt32 dMorphTargetIndex );
/*--- Animation Functions --------------------------------------------------
*/
extern RpDMorphAnimation *
RpDMorphAnimationCreate(RwUInt32 numDMorphTargets);
extern RpDMorphAnimation *
RpDMorphAnimationDestroy(RpDMorphAnimation *anim);
extern RwUInt32
RpDMorphAnimationGetNumDMorphTargets(RpDMorphAnimation *animation);
/* Animation Frames */
extern RpDMorphAnimation *
RpDMorphAnimationCreateFrames(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 numFrames);
extern RpDMorphAnimation *
RpDMorphAnimationDestroyFrames(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex);
extern RwUInt32
RpDMorphAnimationGetNumFrames(RpDMorphAnimation *animation,
RwUInt32 dMorphTargetIndex);
/* Stream I/O */
extern RpDMorphAnimation *
RpDMorphAnimationStreamRead(RwStream *stream);
extern RpDMorphAnimation *
RpDMorphAnimationStreamWrite(RpDMorphAnimation *animation,
RwStream *stream);
extern RwUInt32
RpDMorphAnimationStreamGetSize(RpDMorphAnimation *animation);
extern RpDMorphAnimation *
RpDMorphAnimationRead(const RwChar *filename);
extern RpDMorphAnimation *
RpDMorphAnimationWrite(RpDMorphAnimation *animation, const RwChar *filename);
/*--- Animation Frame Functions --------------------------------------------
*
* These functions work on the DMorphAnimationFrame level.
* Each Frame can have a reference to the next Frame for the
* DMorphTarget.
*/
extern RpDMorphAnimation *
RpDMorphAnimationFrameSetNext(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex,
RwUInt32 nextFrame );
extern RwUInt32
RpDMorphAnimationFrameGetNext(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex );
extern RpDMorphAnimation *
RpDMorphAnimationFrameSet(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex,
RwReal startValue,
RwReal endValue,
RwReal duration,
RwUInt32 nextFrame );
extern RpDMorphAnimation *
RpDMorphAnimationFrameSetStartValue(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex,
RwReal startValue );
extern RwReal
RpDMorphAnimationFrameGetStartValue(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex );
extern RpDMorphAnimation *
RpDMorphAnimationFrameSetEndValue(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex,
RwReal endValue );
extern RwReal
RpDMorphAnimationFrameGetEndValue(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex );
extern RpDMorphAnimation *
RpDMorphAnimationFrameSetDuration(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex,
RwReal duration );
extern RwReal
RpDMorphAnimationFrameGetDuration(RpDMorphAnimation *anim,
RwUInt32 dMorphTargetIndex,
RwUInt32 frameIndex );
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPDMORPH_H */

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionDMorph
{
e_rwdb_CriterionDMorphLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionDMorph e_rwdb_CriterionDMorph;

View File

@ -0,0 +1,32 @@
/***************************************************************************
* *
* Module : rperror.h *
* *
* Purpose : Used to generate error codes *
* *
**************************************************************************/
#ifndef RPERROR_H
#define RPERROR_H
/****************************************************************************
Includes
*/
#include "rpplugin.h"
/****************************************************************************
Defines
*/
#define RWECODE(a,b) a,
enum rwPLUGIN_ERRENUM
{
#include "rperror.def"
rwPLUGIN_ERRENUMLAST = RWFORCEENUMSIZEINT
};
typedef enum rwPLUGIN_ERRENUM rwPLUGIN_ERRENUM;
#endif /* RPERROR_H */

View File

@ -0,0 +1,873 @@
/******************************************
* *
* RenderWare(TM) Graphics Library *
* *
******************************************/
/*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd.
* or Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. and Canon Inc. will not, under any
* circumstances, be liable for any lost revenue or other damages
* arising from the use of this file.
*
* Copyright (c) 1998. Criterion Software Ltd.
* All Rights Reserved.
*/
/***************************************************************************
* *
* Module : rpanim.h *
* *
* Purpose : Hierarchical animation *
* *
**************************************************************************/
#ifndef RPHANIM_H
#define RPHANIM_H
/**
* Hierarchal animation plugin
*/
/* Doxygen plugin groups. */
/**
* \defgroup rphanim RpHAnim
* \ingroup rpplugin
*
* Hierarchical Animation Plugin for RenderWare Graphics.
*/
/**
* \defgroup rphanimchanges RpHAnim Changes
* \ingroup rphanim
*
*/
/****************************************************************************
Includes
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rwcore.h>
#include <rpworld.h>
#include <rpcriter.h> /* Note: each vendor can choose their own method for
* allocation of unique ID's. This file defines
* the ID's used by Criterion.
*/
#include <rphanim.rpe> /* automatically generated header file */
#include <rtquat.h>
#define rpHANIMSTREAMCURRENTVERSION 0x100
/**
* \ingroup rphanim
* \ref RpHAnimAtomicGlobalVars typedef for struct RpHAnimAtomicGlobalVars
*/
typedef struct RpHAnimAtomicGlobalVars RpHAnimAtomicGlobalVars;
/**
* \ingroup rphanim
* \struct RpHAnimAtomicGlobalVars
*/
struct RpHAnimAtomicGlobalVars
{
RwInt32 engineOffset ; /* Offset into global data */
RwFreeList *HAnimFreeList;
RwFreeList *HAnimAnimationFreeList;
};
extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals;
#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimStdKeyFrame)
#define rpHANIMSTDKEYFRAMETYPEID 0x1
#define RwAnimMalloc() \
RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimFreeList)
#define RwAnimFree(_anim) \
RwFreeListFree(RpHAnimAtomicGlobals.HAnimFreeList, (_anim))
#define RwAnimAnimationMalloc() \
RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimAnimationFreeList)
#define RwAnimAnimationFree(_animAnimation) \
RwFreeListFree(RpHAnimAtomicGlobals.HAnimAnimationFreeList, \
(_animAnimation))
#define RpV3dInterpolate(o, a, s, b) \
MACRO_START \
{ \
(o)->x = (((a)->x) + ((s)) * (((b)->x) - ((a)->x))); \
(o)->y = (((a)->y) + ((s)) * (((b)->y) - ((a)->y))); \
(o)->z = (((a)->z) + ((s)) * (((b)->z) - ((a)->z))); \
} \
MACRO_STOP
/**
* \ingroup rphanim
* \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy
*/
typedef struct RpHAnimHierarchy RpHAnimHierarchy;
/**
* \ingroup rphanim
* \ref RpHAnimAnimation typedef for struct RpHAnimAnimation
*/
typedef struct RpHAnimAnimation RpHAnimAnimation;
/**
* \ingroup rphanim
* \ref RpHAnimHierarchyCallBack
* This typedef defines a callback function for use with the
* \ref RpHAnimHierarchySetAnimCallBack and
* \ref RpHAnimHierarchySetAnimLoopCallBack functions.
*
* \param hierarchy
* A pointer to the AnimHierarchy structure.
*
* \param data User-defined data.
* You can use this to pass your own data
* structure(s) to the callback function.
*
* \see RpHAnimHierarchySetAnimCallBack
* \see RpHAnimHierarchySetAnimLoopCallBack
*
*/
typedef RpHAnimHierarchy * (*RpHAnimHierarchyCallBack) (RpHAnimHierarchy *hierarchy,
void *data);
/*
* The following CallBacks are needed for each overloaded interpolation
* scheme. See RpHAnimInterpolatorInfo.
*/
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameToMatrixCallBack
* This typedef defines a callback function for converting
* an animation keyframe into a modeling matrix. The output matrix will be
* used to construct the array of world or local space matrices for the
* hierarchy as obtained with \ref RpHAnimHierarchyGetMatrixArray, and
* possibly used for updating an external \ref RwFrame hierarchy.
*
* \param matrix This is the matrix to store the output of the conversion
* \param voidIFrame This is a void pointer to the keyframe and should be cast
* to the keyframe type this callback is for.
*/
typedef void (*RpHAnimKeyFrameToMatrixCallBack) (RwMatrix *matrix, void *voidIFrame);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameBlendCallBack
* This typedef defines a callback function for blending between two animation
* keyframes by the given blend factor.
*
* \param voidOut This is the void pointer for the output of the blend
* \param voidIn1 First input keyframe
* \param voidIn2 Second input keyframe
* \param alpha Blend factor
*/
typedef void (*RpHAnimKeyFrameBlendCallBack) (void *voidOut, void *voidIn1,
void *voidIn2, RwReal alpha);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameInterpolateCallBack
* This typedef defines a callback function for interpolating between two
* animation keyframes according to the given time.
*
* \param voidOut This is the void pointer for the output of the
* interpolation
* \param voidIn1 First input keyframe
* \param voidIn2 Second input keyframe
* \param time Time at which to interpolate
*/
typedef void (*RpHAnimKeyFrameInterpolateCallBack) (void *voidOut, void *voidIn1,
void *voidIn2, RwReal time);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameAddCallBack
* This typedef defines a callback function for adding together two animation
* keyframes. One of the keyframes would usually be a delta.
*
* \param voidOut This is the void pointer for the output summed keyframe
* \param voidIn1 First input keyframe
* \param voidIn2 Second input keyframe
*/
typedef void (*RpHAnimKeyFrameAddCallBack) (void *voidOut, void *voidIn1,
void *voidIn2);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameMulRecipCallBack
* This typedef defines a callback function for multiplying a keyframe
* by the inverse of another keyframe
*
* \param voidFrame This is the void pointer for the keyframe to be modified
* \param voidStart First start keyframe to take the reciprocal of.
*/
typedef void (*RpHAnimKeyFrameMulRecipCallBack) (void *voidFrame, void *voidStart);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameStreamReadCallBack
* This typedef defines a callback function for reading in keyframes
* from an \ref RwStream for the given animation.
*
* \param stream The stream to read the keyframes from
* \param animation The animation to read the keyframes into
*
* \return Pointer to the animation.
*/
typedef RpHAnimAnimation * (*RpHAnimKeyFrameStreamReadCallBack) (RwStream *stream, RpHAnimAnimation *animation);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameStreamWriteCallBack
* This typedef defines a callback function for writing keyframes from the
* given animation to an \ref RwStream.
*
* \param animation The animation to write out from
* \param stream The stream to write the keyframes to
*
* \return TRUE if successful.
*/
typedef RwBool (*RpHAnimKeyFrameStreamWriteCallBack) (RpHAnimAnimation *animation, RwStream *stream);
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameStreamGetSizeCallBack
* This typedef defines a callback function for calculating the binary stream
* size of keyframe data within an animation.
*
* \param animation The animation to calculate sizes of
*
* \return Size in bytes of the keyframe data.
*/
typedef RwInt32 (*RpHAnimKeyFrameStreamGetSizeCallBack) (RpHAnimAnimation *animation);
/**
* \ingroup rphanim
* \ref RpHAnimInterpolatorInfo
* typedef for struct \ref RpHAnimInterpolatorInfo
*/
typedef struct RpHAnimInterpolatorInfo RpHAnimInterpolatorInfo;
/**
* \ingroup rphanim
* \struct RpHAnimInterpolatorInfo
* This is used to hold information for a keyframe interpolation scheme.
*
* \see RpHAnimRegisterInterpolationScheme
* \see RpHAnimGetInterpolatorInfo
*/
struct RpHAnimInterpolatorInfo
{
RwInt32 typeID; /**< The ID of the interpolation scheme */
RwInt32 keyFrameSize; /**< Size in bytes of the keyframe structure */
RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Pointer to a function that converts a keyframe to a matrix */
RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Pointer to a function that blends between a pair of keyframes for a given delta value */
RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Pointer to a function that interpolates between two keyframes for a given time in between */
RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Pointer to a function that adds two keyframes (one of which may be a delta) */
RpHAnimKeyFrameMulRecipCallBack keyFrameMulRecipCB; /**< Pointer to a function that multiplies a keyframe by the reciprocal of another */
RpHAnimKeyFrameStreamReadCallBack keyFrameStreamReadCB; /**< Pointer to a function that reads the keyframes from a stream for a given animation */
RpHAnimKeyFrameStreamWriteCallBack keyFrameStreamWriteCB; /**< Pointer to a function that writes the keyframes to a stream for a given animation */
RpHAnimKeyFrameStreamGetSizeCallBack keyFrameStreamGetSizeCB; /**< Pointer to a function that returns the binary stream size of the keyframes for a given animation */
};
/**
* \ingroup rphanim
* \ref RpHAnimKeyFrameHeader
* typedef for struct RpHAnimKeyFrameHeader
*/
typedef struct RpHAnimKeyFrameHeader RpHAnimKeyFrameHeader;
/**
* \ingroup rphanim
* \struct RpHAnimKeyFrameHeader
* Holds header information for a keyframe. All keyframe structures used with
* the overloadable interpolation system should start with this data.
*
* \see RpHAnimStdKeyFrame
* \see RpHAnimRegisterInterpolationScheme
*/
struct RpHAnimKeyFrameHeader
{
void *prevFrame; /**< Previous keyframe for particular hierarchy node */
RwReal time; /**< Time at keyframe */
};
/**
* \ingroup rphanim
* \ref RpHAnimStdKeyFrame
* typedef for struct RpHAnimStdKeyFrame
*/
typedef struct RpHAnimStdKeyFrame RpHAnimStdKeyFrame;
/**
* \ingroup rphanim
* \struct RpHAnimStdKeyFrame
* A structure representing the standard keyframe data. Sequences of
* such keyframes in an \ref RpHAnimAnimation defines the animation of each
* node in a hierarchy.
*/
struct RpHAnimStdKeyFrame
{
RpHAnimStdKeyFrame *prevFrame; /**< Previous keyframe for particular hierarchy node */
RwReal time; /**< Time at keyframe */
RtQuat q; /**< Quaternion rotation at keyframe */
RwV3d t; /**< Translation at keyframe */
};
/* Flags for FrameInfos */
#define rpHANIMPOPPARENTMATRIX 0x01
#define rpHANIMPUSHPARENTMATRIX 0x02
/**
* \ingroup rphanim
* \ref RpHAnimNodeInfo
* typedef for struct RpHAnimNodeInfo
*/
typedef struct RpHAnimNodeInfo RpHAnimNodeInfo;
/**
* \ingroup rphanim
* \struct RpHAnimNodeInfo
*
*/
struct RpHAnimNodeInfo
{
RwInt32 nodeID; /**< User defined ID for this node */
RwInt32 nodeIndex; /**< Array index of node */
RwInt32 flags; /**< Matrix push/pop flags */
RwFrame * pFrame; /**< Pointer to an attached RwFrame (see \ref RpHAnimHierarchyAttach) */
};
/**
* \ingroup rphanim
* \struct RpHAnimAnimation
* A hierarchical animation consists of an array of keyframe structures,
* along with some flags and a duration.
*
* The keyframes should be presented in the order they are needed
* to animate forwards through time. Pointers link all of the keyframes
* for a particular node backwards through time in a list.
*
* For example, a 3 node animation, with keyframes at the following times:
*
* Node 1: 0.0, 1.0, 2.0, 3.0
* Node 2: 0.0, 3.0
* Node 3: 0.0, 2.0, 2.5, 3.0
*
* should be formatted in an RpHAnimAnimation animation like this:
*
* B1,0.0 B2,0.0 B3,0.0 B1,1.0, B2,3.0, B3,2.0, B1,2.0, B1,3.0, B3,2.5 B3,3.0
*
* Each node MUST start at time = 0.0, and each node must terminate with a keyframe
* at time = duration of animation.
*
* \see RpHAnimAnimationCreate
*/
struct RpHAnimAnimation
{
RpHAnimInterpolatorInfo *interpInfo; /**< Pointer to interpolation scheme information */
RwInt32 numFrames; /**< Number of keyframes in the animation */
RwInt32 flags; /**< Specifies details about animation, relative translation modes etc */
RwReal duration; /**< Duration of animation in seconds */
void *pFrames; /**< Pointer to the animation keyframes */
};
/**
* \ingroup rphanim
* \ref RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies
*
* \see RpAnimHierarchyFlag
*/
enum RpHAnimHierarchyFlag
{
/* creation flags */
rpHANIMHIERARCHYSUBHIERARCHY = 0x01, /**< This hierarchy is a sub-hierarchy */
rpHANIMHIERARCHYNOMATRICES = 0x02, /**< This hierarchy has no local matrices */
/* update flags */
rpHANIMHIERARCHYUPDATEMODELLINGMATRICES = 0x1000, /**< This hierarchy updates modeling matrices */
rpHANIMHIERARCHYUPDATELTMS = 0x2000, /**< This hierarchy updates LTMs */
rpHANIMHIERARCHYLOCALSPACEMATRICES = 0x4000, /**< This hierarchy calculates matrices in a space
relative to its root */
rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
/**
* \ingroup rphanim
* \typedef RpHAnimHierarchyFlag
* These flags are used to control the creation and
* update status of the hierarchy
*/
typedef enum RpHAnimHierarchyFlag RpHAnimHierarchyFlag;
/**
* \ingroup rphanim
* \struct RpHAnimHierarchy
* An RpHAnimHierarchy is used to "play back" an animation - it holds the
* interpolated keyframe data for the current state of an animation
* concatenated on the end of the structure.
*
* The rpHANIMHIERARCHYGETINTERPFRAME() macro can be used to access the current
* interpolated data, for the current time or to write to this data to override
* it with procedural animation.
*
* The structure of a hierarchy is defined by an array
* of \ref RpHAnimNodeInfo structures.
*
* The hierarchy is defined by running through the node array in order,
* pushing the parent-node's matrix whenever a child is reached that has
* more than one sibling, and popping the parent matrix when a "leaf"
* node is encountered.
*
*/
struct RpHAnimHierarchy
{
RwInt32 flags; /**< Flags for the hierarchy */
RwInt32 numNodes; /**< Number of nodes in the hierarchy */
RpHAnimAnimation *pCurrentAnim; /**< Current animation applied to hierarchy */
RwReal currentTime; /**< Current animation time */
void *pNextFrame; /**< Next animation keyframe to be played */
RpHAnimHierarchyCallBack pAnimCallBack; /**< Animation callback function pointer */
void *pAnimCallBackData; /**< Animation callback function user data */
RwReal animCallBackTime; /**< Trigger time for callback function */
RpHAnimHierarchyCallBack pAnimLoopCallBack; /**< Animation loop callback function pointer */
void *pAnimLoopCallBackData; /**< Animation loop callback function data */
RwMatrix *pMatrixArray; /**< Pointer to node matrices*/
void *pMatrixArrayUnaligned; /**< Pointer to memory used for node matrices
* from which the aligned pMatrixArray is allocated */
RpHAnimNodeInfo *pNodeInfo; /**< Array of node information (push/pop flags etc) */
RwFrame *parentFrame; /**< Pointer to the Root RwFrame of the hierarchy this
* RpHAnimHierarchy represents */
RwInt32 maxKeyFrameSize; /**< Maximum size of keyframes usable on this hierarhcy
* (set at creation time) */
RwInt32 currentKeyFrameSize; /**< Size of keyframes in the current animation */
RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Internal use */
RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Internal use */
RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Internal use */
RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Internal use */
RpHAnimHierarchy *parentHierarchy; /**< Internal use */
RwInt32 offsetInParent; /**< Internal use */
RwInt32 rootParentOffset; /**< Internal use */
};
#define rpHANIMHIERARCHYGETINTERPFRAME( hierarchy, nodeIndex ) \
( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
((nodeIndex) * \
hierarchy->currentKeyFrameSize) ) ) )
#define rpHANIMHIERARCHYGETINTERPFRAME1( hierarchy, nodeIndex ) \
( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
((hierarchy->numNodes + \
(nodeIndex)) * \
hierarchy->currentKeyFrameSize) ) ) )
#define rpHANIMHIERARCHYGETINTERPFRAME2( hierarchy, nodeIndex ) \
( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
((hierarchy->numNodes * 2 + \
(nodeIndex)) * \
hierarchy->currentKeyFrameSize) ) ) )
/**
* \ingroup rphanim
* \ref RpHAnimFrameExtension typedef for struct RpHAnimFrameExtension
*/
typedef struct RpHAnimFrameExtension RpHAnimFrameExtension;
/**
* \ingroup rphanim
* \struct RpHAnimFrameExtension
*/
struct RpHAnimFrameExtension
{
RwInt32 id; /**< ID given to this RwFrame (default of -1) */
RpHAnimHierarchy *hierarchy; /**< Pointer to Animation hierarchy attached to this RwFrame */
};
/*--- Plugin API Functions ---*/
#define RpHAnimHierarchySetFlagsMacro(hierarchy, _flags) \
MACRO_START \
{ \
(hierarchy)->flags = _flags; \
} \
MACRO_STOP
#define RpHAnimHierarchyGetFlagsMacro(hierarchy) \
((hierarchy)->flags)
#define RpHAnimStdKeyFrameToMatrixMacro(_matrix, _voidIFrame) \
MACRO_START \
{ \
RpHAnimStdKeyFrame * iFrame = (RpHAnimStdKeyFrame *)(_voidIFrame); \
\
/* \
* RpHAnim uses the same types of quaternion as RtQuat \
* hence no conjugate call as in RpSkin \
*/ \
\
RtQuatUnitConvertToMatrix(&iFrame->q, (_matrix)); \
\
(_matrix)->pos.x = iFrame->t.x; \
(_matrix)->pos.y = iFrame->t.y; \
(_matrix)->pos.z = iFrame->t.z; \
} \
MACRO_STOP
#if (! defined(RWDEBUG))
#define RpHAnimHierarchySetFlags(hierarchy, _flags) \
RpHAnimHierarchySetFlagsMacro(hierarchy, _flags)
#define RpHAnimHierarchyGetFlags(hierarchy) \
(RpHAnimHierarchyFlag)RpHAnimHierarchyGetFlagsMacro(hierarchy)
#endif /* (! defined(RWDEBUG)) */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#if (defined(RWDEBUG))
extern RpHAnimHierarchy *
RpHAnimHierarchySetFlags(RpHAnimHierarchy *hierarchy,
RpHAnimHierarchyFlag flags);
extern RpHAnimHierarchyFlag
RpHAnimHierarchyGetFlags(RpHAnimHierarchy *hierarchy);
#endif /* (defined(RWDEBUG)) */
/* Keyframe Interpolator Types */
extern RwBool
RpHAnimRegisterInterpolationScheme(RpHAnimInterpolatorInfo *interpolatorInfo);
extern RpHAnimInterpolatorInfo *
RpHAnimGetInterpolatorInfo(RwInt32 typeID);
/* Animation hierarchy creation */
extern RpHAnimHierarchy *
RpHAnimHierarchyCreate(RwInt32 numNodes,
RwUInt32 *nodeFlags,
RwInt32 *nodeIDs,
RpHAnimHierarchyFlag flags,
RwInt32 maxKeyFrameSize);
extern RpHAnimHierarchy *
RpHAnimHierarchyCreateFromHierarchy(RpHAnimHierarchy *hierarchy,
RpHAnimHierarchyFlag flags,
RwInt32 maxKeyFrameSize);
extern RpHAnimHierarchy *
RpHAnimHierarchyDestroy(RpHAnimHierarchy *hierarchy);
extern RpHAnimHierarchy *
RpHAnimHierarchyCreateSubHierarchy(RpHAnimHierarchy *parentHierarchy,
RwInt32 startNode,
RpHAnimHierarchyFlag flags,
RwInt32 maxKeyFrameSize);
extern RpHAnimHierarchy *
RpHAnimHierarchyAttach(RpHAnimHierarchy *hierarchy);
extern RpHAnimHierarchy *
RpHAnimHierarchyDetach(RpHAnimHierarchy *hierarchy);
extern RpHAnimHierarchy *
RpHAnimHierarchyAttachFrameIndex(RpHAnimHierarchy *hierarchy,
RwInt32 nodeIndex);
extern RpHAnimHierarchy *
RpHAnimHierarchyDetachFrameIndex(RpHAnimHierarchy *hierarchy,
RwInt32 nodeIndex);
extern RwBool
RpHAnimFrameSetHierarchy(RwFrame *frame,
RpHAnimHierarchy *hierarchy);
extern RpHAnimHierarchy *
RpHAnimFrameGetHierarchy(RwFrame *frame);
/* Macros for legacy support of old function names */
#define RpHAnimSetHierarchy(frame, hierarchy) \
RpHAnimFrameSetHierarchy(frame, hierarchy)
#define RpHAnimGetHierarchy(frame) RpHAnimFrameGetHierarchy(frame)
extern RwBool
RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy,
RwInt32 keyFrameTypeID);
extern RwBool
RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy,
RpHAnimAnimation *anim);
extern RwBool
RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy,
RwReal time);
extern RwBool
RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy,
RwReal time);
extern RwBool
RpHAnimHierarchyStdKeyFrameAddAnimTime(RpHAnimHierarchy *hierarchy,
RwReal time);
extern RwBool
RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy,
RwReal time);
extern RpHAnimHierarchy *
RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy,
RpHAnimHierarchyCallBack callBack,
RwReal time,
void *data );
extern RpHAnimHierarchy *
RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy,
RpHAnimHierarchyCallBack callBack,
void *data );
extern RwMatrix *
RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy *hierarchy);
extern RwBool
RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy *hierarchy);
/* Macro for legacy support of old function name */
#define RpHAnimUpdateHierarchyMatrices RpHAnimHierarchyUpdateMatrices
extern RwInt32
RpHAnimIDGetIndex(RpHAnimHierarchy *hierarchy,
RwInt32 ID);
/* Animations */
extern RpHAnimAnimation *
RpHAnimAnimationCreate(RwInt32 typeID,
RwInt32 numFrames,
RwInt32 flags,
RwReal duration);
extern RpHAnimAnimation *
RpHAnimAnimationDestroy(RpHAnimAnimation *animation);
#ifdef RWDEBUG
extern RwInt32
RpHAnimAnimationGetTypeID(RpHAnimAnimation *animation);
#else /* RWDEBUG */
#define RpHAnimAnimationGetTypeID(animation) \
(animation->interpInfo->typeID)
#endif /* RWDEBUG */
extern RpHAnimAnimation *
RpHAnimAnimationRead(const RwChar * filename);
extern RwBool
RpHAnimAnimationWrite(RpHAnimAnimation *animation,
const RwChar * filename);
extern RpHAnimAnimation *
RpHAnimAnimationStreamRead(RwStream *stream);
extern RwBool
RpHAnimAnimationStreamWrite(RpHAnimAnimation *animation,
RwStream *stream);
extern RwInt32
RpHAnimAnimationStreamGetSize(RpHAnimAnimation *animation);
extern RwBool
RpHAnimAnimationMakeDelta(RpHAnimAnimation *animation,
RwInt32 numNodes,
RwReal time);
/* Plugin support */
extern RwBool
RpHAnimPluginAttach(void);
/* Overloadable keyframe functions */
#define RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame) \
MACRO_START \
{ \
const RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB = \
(hierarchy)->keyFrameToMatrixCB; \
\
if (RpHAnimStdKeyFrameToMatrix == keyFrameToMatrixCB) \
{ \
RpHAnimStdKeyFrameToMatrixMacro((matrix), (iFrame)); \
} \
else \
{ \
keyFrameToMatrixCB((matrix), (iFrame)); \
} \
} \
MACRO_STOP
#define RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time) \
MACRO_START \
{ \
(hierarchy)->keyFrameInterpolateCB((out), (in1), (in2), (time)); \
} \
MACRO_STOP
#define RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, fAlpha) \
MACRO_START \
{ \
(hierarchy)->keyFrameBlendCB((out), (in1), (in2), (fAlpha)); \
} \
MACRO_STOP
#define RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2) \
MACRO_START \
{ \
(hierarchy)->keyFrameAddCB((out), (in1), (in2)); \
} \
MACRO_STOP
#ifdef RWDEBUG
void
RpHAnimFrameInterpolate(RpHAnimHierarchy *hierarchy,
void *out, void *in1,
void *in2, RwReal time);
void
RpHAnimFrameBlend(RpHAnimHierarchy *hierarchy,
void *out,
void *in1,
void *in2,
RwReal alpha);
void
RpHAnimFrameToMatrix(RpHAnimHierarchy *hierarchy,
RwMatrix *matrix, void *iFrame);
void
RpHAnimFrameAddTogether(RpHAnimHierarchy *hierarchy,
void *out, void *in1, void *in2);
#else /* RWDEBUG */
#define RpHAnimFrameToMatrix(hierarchy, matrix, iFrame) \
RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame)
#define RpHAnimFrameInterpolate(hierarchy, out, in1, in2, time) \
RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time)
#define RpHAnimFrameBlend(hierarchy, out, in1, in2, alpha) \
RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, alpha)
#define RpHAnimFrameAddTogether(hierarchy, out, in1, in2) \
RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2)
#endif /* RWDEBUG */
/* Standard keyframe functions */
extern void
RpHAnimStdKeyFrameToMatrix(RwMatrix *matrix,
void * voidIFrame);
extern void
RpHAnimStdKeyFrameBlend(void *voidOut,
void *voidIn1,
void *voidIn2,
RwReal alpha);
extern void
RpHAnimStdKeyFrameInterpolate(void *voidOut,
void *voidIn1,
void *voidIn2,
RwReal time);
extern void
RpHAnimStdKeyFrameAdd(void *voidOut,
void *voidIn1,
void *voidIn2);
extern void
RpHAnimStdKeyFrameMulRecip(void *voidFrame,
void *voidStart);
extern RpHAnimAnimation *
RpHAnimStdKeyFrameStreamRead(RwStream *stream,
RpHAnimAnimation *animation);
extern RwBool
RpHAnimStdKeyFrameStreamWrite(RpHAnimAnimation *animation,
RwStream *stream);
extern RwInt32
RpHAnimStdKeyFrameStreamGetSize(RpHAnimAnimation *animation);
/* Hierarchy blending/combination functions */
extern RwBool
RpHAnimHierarchyBlend(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy1,
RpHAnimHierarchy *inHierarchy2,
RwReal alpha);
extern RwBool
RpHAnimHierarchyAddTogether(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy1,
RpHAnimHierarchy *inHierarchy2);
extern RwBool
RpHAnimHierarchyBlendSubHierarchy(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy1,
RpHAnimHierarchy *inHierarchy2,
RwReal alpha);
extern RwBool
RpHAnimHierarchyAddSubHierarchy(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *mainHierarchy,
RpHAnimHierarchy *subHierarchy);
extern RwBool
RpHAnimHierarchyCopy(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy);
/* Access to RwFrame ID's */
extern RwBool
RpHAnimFrameSetID(RwFrame *frame,
RwInt32 id);
extern RwInt32
RpHAnimFrameGetID(RwFrame *frame);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPHANIM_H */

View File

@ -0,0 +1,644 @@
enum e_rwdb_CriterionHANIM
{
E_RP_HANIM_INTERP_IDINUSE,
E_RP_HANIM_INTERP_BLOCKFULL,
E_RP_HANIM_INTERP_IDUNKNOWN,
e_rwdb_CriterionHANIMLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionHANIM e_rwdb_CriterionHANIM;

View File

@ -0,0 +1,131 @@
/******************************************
* *
* RenderWare(TM) Graphics Library *
* *
******************************************/
/*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd.
* or Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. and Canon Inc. will not, under any
* circumstances, be liable for any lost revenue or other damages
* arising from the use of this file.
*
* Copyright (c) 1998. Criterion Software Ltd.
* All Rights Reserved.
*/
/***************************************************************************
* *
* Module : rplodatm.h *
* *
* Purpose : LODATM Geometry *
* *
**************************************************************************/
#ifndef RPLODATM_H
#define RPLODATM_H
/**
* \defgroup rplodatm RpLODAtomic
* \ingroup rpplugin
*
* Level of Detail Management Plugin for RenderWare Graphics.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpcriter.h" /* Note: each vendor can choose their own method for
* allocation of unique ID's. This file defines
* the ID's used by Criterion.
*/
#include "rplodatm.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
#define RPLODATOMICMAXLOD 10
/****************************************************************************
Type defs
*/
typedef RwInt32 (*RpLODAtomicLODCallBack)( RpAtomic *atomic );
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool
RpLODAtomicPluginAttach( void );
extern RpAtomic *
RpLODAtomicSetGeometry(
RpAtomic *atomic, RwInt32 lodIdx, RpGeometry *geometry );
extern RpGeometry *
RpLODAtomicGetGeometry(
RpAtomic *atomic, RwInt32 lodIdx );
extern RpAtomic *
RpLODAtomicSetCurrentLOD(
RpAtomic *atomic, RwInt32 lodIdx );
extern RwInt32
RpLODAtomicGetCurrentLOD(
RpAtomic *atomic );
extern RpAtomic *
RpLODAtomicSetRange(
RpAtomic *atomic, RwReal farRange );
extern RwReal
RpLODAtomicGetRange(
RpAtomic *atomic );
extern void
RpLODAtomicSetCamera(
RwCamera *camera );
extern RpAtomic *
RpLODAtomicSetLODCallBack(
RpAtomic *atomic, RpLODAtomicLODCallBack callback );
extern RpAtomic *
RpLODAtomicSelectLOD(
RpAtomic *atomic );
extern RpAtomic *
RpLODAtomicForAllLODGeometries(
RpAtomic *atomic, RpGeometryCallBack callback, void *pData );
extern RpAtomic *
RpLODAtomicHookRender(
RpAtomic *atomic );
extern RpAtomic *
RpLODAtomicUnHookRender(
RpAtomic *atomic );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPLODATM_H */

View File

@ -0,0 +1,642 @@
enum e_rwdb_CriterionLODATM
{
e_rwdb_CriterionLODATMLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLODATM e_rwdb_CriterionLODATM;

View File

@ -0,0 +1,83 @@
/**
* Logo plugin
*/
/**********************************************************************
*
* File : rplogo.h
*
* Abstract : Add CSL Logo
*
**********************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 1998 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
************************************************************************/
#ifndef RPLOGO_H
#define RPLOGO_H
/**
* \defgroup rplogo RpLogo
* \ingroup rpplugin
*
* Logo Plugin for RenderWare Graphics.
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rplogo.rpe" /* automatically generated header file */
/*--- Global Structures ---*/
enum RpLogoPosition
{
rpNALOGOPOSITION = 0,
rpLOGOTOP,
rpLOGOCENTER,
rpLOGOBOTTOM,
rpLOGOLEFT,
rpLOGORIGHT,
rpLOGOTOPLEFT,
rpLOGOTOPRIGHT,
rpLOGOBOTTOMLEFT,
rpLOGOBOTTOMRIGHT,
rpLOGOPOSITIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpLogoPosition RpLogoPosition;
/*--- Plugin API Functions ---*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
RwBool RpLogoPluginAttach(void);
RwBool RpLogoSetPosition(RpLogoPosition pos);
RpLogoPosition RpLogoGetPosition(void);
RwBool RpLogoSetState(RwCamera * cam, RwBool state);
RwBool RpLogoGetState(RwCamera * cam);
RwRect *RpLogoGetRenderingRect(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPLOGO_H */

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionLogo
{
e_rwdb_CriterionLogoLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLogo e_rwdb_CriterionLogo;

View File

@ -0,0 +1,90 @@
/**
* \defgroup rpltmap RpLtMap
* \ingroup rpplugin
*
* Lightmap Plugin for RenderWare Graphics.
*/
#ifndef RPLTMAP_H
#define RPLTMAP_H
/*===========================================================================*
*--- Includes --------------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
#define rpLTMAPDEFAULTLIGHTMAPSIZE 128
#define rpLTMAPMINLIGHTMAPSIZE 16
#define rpLTMAPMAXLIGHTMAPSIZE 512/*?? any better way of determining this ??*/
#define rpLTMAPMAXPREFIXSTRINGLENGTH 4
#define rpLTMAPDEFAULTMAXAREALIGHTSAMPLESPERMESH 256
/* The default tolerance for errors induced by area light ROIs is 1
* (being the smallest difference in lightmap colour values) */
#define rpLTMAPDEFAULTAREALIGHTROICUTOFF (1.0f)
/**
* \ingroup rpltmap
* \ref RpLtMapStyle
* Flags specifying the rendering style of the lightmap plugin.
*
* \see RpLtMapGetRenderStyle
* \see RpLtMapSetRenderStyle
*/
enum RpLtMapStyle
{
rpLTMAPSTYLENASTYLE = 0x0,
rpLTMAPSTYLERENDERBASE = 0x1, /**< The base texture should be rendered */
rpLTMAPSTYLERENDERLIGHTMAP = 0x2, /**< The lightmap should be rendered */
rpLTMAPSTYLEPOINTSAMPLE = 0x4, /**< The lightmap should be point-sampled */
rpLTMAPSTYLEFORCEENUMSIZEINT = 0x7FFFFFFF
};
typedef enum RpLtMapStyle RpLtMapStyle;
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool
RpLtMapPluginAttach(void);
extern RxPipeline *
RpLtMapGetPlatformAtomicPipeline(void);
extern RxPipeline *
RpLtMapGetPlatformWorldSectorPipeline(void);
extern RwBool
RpLtMapSetRenderStyle(RpLtMapStyle style, RpWorld *world);
extern RpLtMapStyle
RpLtMapGetRenderStyle(void);
extern RwUInt32
RpLtMapWorldLightMapsQuery(RpWorld *world);
extern RwTexture *
RpLtMapWorldSectorGetLightMap(RpWorldSector *sector);
extern RpWorldSector *
RpLtMapWorldSectorSetLightMap(RpWorldSector *sector, RwTexture *lightMap);
extern RwTexture *
RpLtMapAtomicGetLightMap(RpAtomic *atomic);
extern RpAtomic *
RpLtMapAtomicSetLightMap(RpAtomic *atomic, RwTexture *lightMap);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPLTMAP_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionLTMAP
{
e_rwdb_CriterionLTMAPLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLTMAP e_rwdb_CriterionLTMAP;

View File

@ -0,0 +1,237 @@
#ifndef RPMATFX_H
#define RPMATFX_H
/*===========================================================================*
*--- Include files ---------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
/*---- start: ./matfx.h----*/
#ifndef RPMATFX_MATFX_H
#define RPMATFX_MATFX_H
/**
* \defgroup rpmatfx RpMatFX
* \ingroup rpplugin
*
* Material Effects Plugin for RenderWare Graphics.
*/
/*===========================================================================*
*--- Global Types ----------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rpmatfx
* RpMatFXMaterialFlags, this type represents the different types of
* material effects that can be used on a material. The effects are
* initialized with \ref RpMatFXMaterialSetEffects:
*/
enum RpMatFXMaterialFlags
{
rpMATFXEFFECTNULL = 0,
rpMATFXEFFECTBUMPMAP = 1, /**<Bump mapping */
rpMATFXEFFECTENVMAP = 2, /**<Environment mapping */
rpMATFXEFFECTBUMPENVMAP = 3, /**<Bump and environment mapping */
rpMATFXEFFECTDUAL = 4, /**<Dual pass */
rpMATFXEFFECTMAX,
rpMATFXNUMEFFECTS = rpMATFXEFFECTMAX - 1,
rpMATFXFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpMatFXMaterialFlags RpMatFXMaterialFlags;
/*===========================================================================*
*--- Plugin API Functions --------------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*--- Plugin functions ------------------------------------------------------*/
extern RwBool
RpMatFXPluginAttach( void );
/*--- Setup functions -------------------------------------------------------*/
extern RpAtomic *
RpMatFXAtomicEnableEffects( RpAtomic *atomic );
extern RwBool
RpMatFXAtomicQueryEffects( RpAtomic *atomic );
extern RpWorldSector *
RpMatFXWorldSectorEnableEffects( RpWorldSector *worldSector );
extern RwBool
RpMatFXWorldSectorQueryEffects( RpWorldSector *worldSector );
extern RpMaterial *
RpMatFXMaterialSetEffects( RpMaterial *material,
RpMatFXMaterialFlags flags );
/*--- Setup Effects ---------------------------------------------------------*/
extern RpMaterial *
RpMatFXMaterialSetupBumpMap( RpMaterial *material,
RwTexture *texture,
RwFrame *frame,
RwReal coef );
extern RpMaterial *
RpMatFXMaterialSetupEnvMap( RpMaterial *material,
RwTexture *texture,
RwFrame *frame,
RwBool useFrameBufferAlpha,
RwReal coef );
extern RpMaterial *
RpMatFXMaterialSetupDualTexture( RpMaterial *material,
RwTexture *texture,
RwBlendFunction srcBlendMode,
RwBlendFunction dstBlendMode );
/*--- Tinker with effects ---------------------------------------------------*/
extern RpMatFXMaterialFlags
RpMatFXMaterialGetEffects( const RpMaterial *material );
/*--- Bump Map --------------------------------------------------------------*/
extern RpMaterial *
RpMatFXMaterialSetBumpMapTexture( RpMaterial *material,
RwTexture *texture );
extern RpMaterial *
RpMatFXMaterialSetBumpMapFrame( RpMaterial *material,
RwFrame *frame );
extern RpMaterial *
RpMatFXMaterialSetBumpMapCoefficient( RpMaterial *material,
RwReal coef );
extern RwTexture *
RpMatFXMaterialGetBumpMapTexture( const RpMaterial *material );
extern RwTexture *
RpMatFXMaterialGetBumpMapBumpedTexture( const RpMaterial *material );
extern RwFrame *
RpMatFXMaterialGetBumpMapFrame( const RpMaterial *material );
extern RwReal
RpMatFXMaterialGetBumpMapCoefficient( const RpMaterial *material );
/*--- Env Map ---------------------------------------------------------------*/
extern RpMaterial *
RpMatFXMaterialSetEnvMapTexture( RpMaterial *material,
RwTexture *texture );
extern RpMaterial *
RpMatFXMaterialSetEnvMapFrame( RpMaterial *material,
RwFrame *frame );
extern RpMaterial *
RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material,
RwBool useFrameBufferAlpha );
extern RpMaterial *
RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material,
RwReal coef );
extern RwTexture *
RpMatFXMaterialGetEnvMapTexture( const RpMaterial *material );
extern RwFrame *
RpMatFXMaterialGetEnvMapFrame( const RpMaterial *material );
extern RwBool
RpMatFXMaterialGetEnvMapFrameBufferAlpha( const RpMaterial *material );
extern RwReal
RpMatFXMaterialGetEnvMapCoefficient( const RpMaterial *material );
/*--- Dual Pass -------------------------------------------------------------*/
extern RpMaterial *
RpMatFXMaterialSetDualTexture( RpMaterial *material,
RwTexture *texture );
extern RpMaterial *
RpMatFXMaterialSetDualBlendModes( RpMaterial *material,
RwBlendFunction srcBlendMode,
RwBlendFunction dstBlendMode );
extern RwTexture *
RpMatFXMaterialGetDualTexture( const RpMaterial *material );
extern const RpMaterial *
RpMatFXMaterialGetDualBlendModes( const RpMaterial *material,
RwBlendFunction *srcBlendMode,
RwBlendFunction *dstBlendMode );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPMATFX_MATFX_H */
/*---- end: ./matfx.h----*/
/*---- start: c:/daily/rwsdk/plugin/matfx/d3d8/matfxplatform.h----*/
/**
* \defgroup rpmatfxd3d8 D3D8
* \ingroup rpmatfx
*
* D3D8 specific documentation.
*/
/******************************************************************************
* Enum types
*/
/**
* \ingroup rpmatfxd3d8
* \ref RpMatFXD3D8Pipeline
*/
enum RpMatFXD3D8Pipeline
{
rpNAMATFXD3D8PIPELINE = 0,
rpMATFXD3D8ATOMICPIPELINE = 1, /**<D3D8 atomic material effect rendering pipeline. */
rpMATFXD3D8WORLDSECTORPIPELINE = 2, /**<D3D8 world sector material effect rendering pipeline. */
rpMATFXD3D8PIPELINEMAX,
rpMATFXD3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpMatFXD3D8Pipeline RpMatFXD3D8Pipeline;
/******************************************************************************
* Global types
*/
/******************************************************************************
* Functions
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RxPipeline *
RpMatFXGetD3D8Pipeline( RpMatFXD3D8Pipeline d3d8Pipeline );
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---- end: c:/daily/rwsdk/plugin/matfx/d3d8/matfxplatform.h----*/
#endif /* RPMATFX_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionMATERIALEFFECTS
{
e_rwdb_CriterionMATERIALEFFECTSLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionMATERIALEFFECTS e_rwdb_CriterionMATERIALEFFECTS;

View File

@ -0,0 +1,38 @@
/**
* PS2 Mipmap K&L plugin for Renderware.
*/
#ifndef RPMIPMAPKLPLUGIN_H
#define RPMIPMAPKLPLUGIN_H
/**
* \defgroup rpmipkl RpMipmapKL
* \ingroup rpplugin
*
* PS2/MipMap KL Value Plugin for RenderWare Graphics.
*/
#include <rwcore.h>
#ifdef __cplusplus
extern "C"
{
#endif
extern RwReal RpMipmapKLTextureSetDefaultK(RwReal val);
extern RwUInt32 RpMipmapKLTextureSetDefaultL(RwUInt32 val);
extern RwReal RpMipmapKLTextureGetDefaultK(void);
extern RwUInt32 RpMipmapKLTextureGetDefaultL(void);
extern RwTexture *RpMipmapKLTextureSetK(RwTexture *tex, RwReal val);
extern RwTexture *RpMipmapKLTextureSetL(RwTexture *tex, RwUInt32 val);
extern RwReal RpMipmapKLTextureGetK(RwTexture *tex);
extern RwUInt32 RpMipmapKLTextureGetL(RwTexture *tex);
extern RwBool RpMipmapKLPluginAttach(void);
#ifdef __cplusplus
}
#endif
#endif /* RPMIPMAPKLPLUGIN_H */

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionLabel
{
e_rwdb_CriterionLabelLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLabel e_rwdb_CriterionLabel;

View File

@ -0,0 +1,138 @@
/******************************************/
/* */
/* RenderWare(TM) Graphics Library */
/* */
/******************************************/
/*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd.
* or Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. and Canon Inc. will not, under any
* circumstances, be liable for any lost revenue or other damages
* arising from the use of this file.
*
* Copyright (c) 1998. Criterion Software Ltd.
* All Rights Reserved.
*/
/****************************************************************************
*
* Morph animation controller
* Copyright (C) 1998 Criterion Technologies
*
* Module : rpmorph.h
*
* Purpose : Functions for controlling morph target animation
*
****************************************************************************/
#ifndef RPMORPH_H
#define RPMORPH_H
/**
* \defgroup rpmorph RpMorph
* \ingroup rpplugin
*
* Morphing Plugin for RenderWare Graphics.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpmorph.rpe" /* automatically generated header file */
/****************************************************************************
Global Types
*/
typedef struct RpMorphInterpolator RpMorphInterpolator;
/**
* \ingroup rpmorph
* \struct RpMorphInterpolator
* structure describing morph interpolator
*/
struct RpMorphInterpolator
{
RwInt32 flags; /**< flags */
RwInt16 startMorphTarget; /**< startMorphTarget */
RwInt16 endMorphTarget; /**< endMorphTarget */
RwReal time; /**< time */
RwReal recipTime; /**< recipTime */
RpMorphInterpolator *next; /**< next */
};
/* Morph Animation */
/**
* \ingroup rpmorph
* \typedef RpMorphGeometryCallBack
* This is the callback function supplied to \ref RpMorphGeometrySetCallBack
* and returned from \ref RpMorphGeometryGetCallBack.
* The supplied function will be passed a pointer to the geometry's parent atomic,
* and the position of the current interpolator.
* The function will only be called when the position of the geometry's current
* interpolator moves out of the current range.
*
* \param atomic Pointer to the geometry's parent atomic.
* \param position Value of the current interpolator.
*
* \return
*
* \see RpMorphGeometrySetCallBack
* \see RpMorphGeometryGetCallBack
*/
typedef RwReal (*RpMorphGeometryCallBack)(RpAtomic *atomic, RwReal position);
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool RpMorphPluginAttach(void);
/* Morph Animation */
extern RpGeometry *RpMorphGeometryCreateInterpolators(RpGeometry *geometry, RwInt32 numInterps);
extern RpGeometry *RpMorphGeometrySetInterpolator(RpGeometry *geometry,
RwInt32 interpNum,
RwInt32 startKey, RwInt32 endKey, RwReal time);
extern RpGeometry *RpMorphGeometrySetNextInterpolator(RpGeometry *geometry,
RwInt32 interpNum, RwInt32 interpNumNext);
extern RpGeometry *RpMorphGeometrySetCallBack(RpGeometry *geometry, RpMorphGeometryCallBack animCB);
extern RpMorphGeometryCallBack RpMorphGeometryGetCallBack(const RpGeometry *geometry);
extern RpAtomic *RpMorphAtomicSetCurrentInterpolator(RpAtomic *atomic, RwInt32 interpNum);
extern RwInt32 RpMorphAtomicGetCurrentInterpolator(RpAtomic *atomic);
extern RpMorphInterpolator *RpMorphGeometryGetInterpolator(RpGeometry *geometry, RwInt32 interpNum);
extern RpAtomic *RpMorphAtomicSetTime(RpAtomic *atomic, RwReal time);
extern RpAtomic *RpMorphAtomicAddTime(RpAtomic *atomic, RwReal time);
/* LEGACY-SUPPORT version: */
extern RpMorphInterpolator *_rpMorphAtomicGetInterpolator(RpAtomic *atomic, RwInt32 interpNum);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define RpMorphAtomicGetInterpolator(_atomic, _interpNum) \
_rpMorphAtomicGetInterpolator(_atomic, _interpNum)
#endif /* RPMORPH_H */

View File

@ -0,0 +1,641 @@
enum e_rwdb_CriterionMorph
{
E_RP_MORPH_INVALIDINTERP,
E_RP_MORPH_NOGEOMETRY,
e_rwdb_CriterionMorphLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionMorph e_rwdb_CriterionMorph;

View File

@ -0,0 +1,683 @@
#ifndef RPPATCH_H
#define RPPATCH_H
/**
* \defgroup rppatch RpPatch
* \ingroup rpplugin
*
* Bezier patch library
*
* This library provides efficient evaluation of patches.
*/
/*===========================================================================*
*--- Include files ---------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpcriter.h"
#include "rppatch.rpe"
/*===========================================================================*
*--- Defines ---------------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rppatch
* \def rpQUADPATCHNUMCONTROLPOINTS defines the number of control points in
* a quadrilateral patch.
*
* \see RpQuadPatch
* \see rpQUADPATCHNUMCONTROLINDICES
* \see RpPatchMeshSetQuadPatch
*/
#define rpQUADPATCHNUMCONTROLPOINTS (16)
/**
* \ingroup rppatch
* \def rpTRIPATCHNUMCONTROLPOINTS defines the number of control points in
* a triangular patch.
*
* \see RpTriPatch
* \see rpTRIPATCHNUMCONTROLINDICES
* \see RpPatchMeshSetTriPatch
*/
#define rpTRIPATCHNUMCONTROLPOINTS (10)
/**
* \ingroup rppatch
* \def rpQUADPATCHNUMCONTROLINDICES defines the number of control point
* indices in a \ref RpQuadPatch quadrilateral patch.
*
* \see rpQUADPATCHNUMCONTROLPOINTS
* \see RpPatchMeshSetQuadPatch
*/
#define rpQUADPATCHNUMCONTROLINDICES rpQUADPATCHNUMCONTROLPOINTS
/**
* \ingroup rppatch
* \def rpTRIPATCHNUMCONTROLINDICES defines the number of control points
* indices in a \ref RpTriPatch triangular patch.
*
* \see rpTRIPATCHNUMCONTROLPOINTS
* \see RpPatchMeshSetTriPatch
*/
#define rpTRIPATCHNUMCONTROLINDICES rpTRIPATCHNUMCONTROLPOINTS
/**
* \ingroup rppatch
* \def rpPATCHLODMAXVALUE defines the maximum value that can be returned for
* the patch evaluation LOD.
*
* \see rpPATCHSKINLODMAXVALUE
* \see rpPATCHLODMINVALUE
* \see RpPatchLODCallBack
*/
#define rpPATCHLODMAXVALUE (20)
/**
* \ingroup rppatch
* \def rpPATCHSKINLODMAXVALUE defines the maximum value that can be returned
* for the skinned patch evaluation LOD.
*
* \see rpPATCHLODMAXVALUE
* \see rpPATCHLODMINVALUE
* \see RpPatchLODCallBack
*/
#define rpPATCHSKINLODMAXVALUE (18)
/**
* \ingroup rppatch
* \def rpPATCHLODMINVALUE defines the minimum value that can be returned for
* the patch evaluation LOD.
*
* \see rpPATCHSKINLODMAXVALUE
* \see rpPATCHLODMAXVALUE
* \see RpPatchLODCallBack
*/
#define rpPATCHLODMINVALUE (4)
/**
* \ingroup rppatch
* \def rpPATCHMESHTEXCOORDSETS Multi texture coordinate format specifier
* for \ref RpPatchMeshCreate(). This should be OR'd into the
* \ref RpPatchMeshFlag .
*/
#define rpPATCHMESHTEXCOORDSETS(_num) \
((_num & 0xff) << 16)
/**
* \ingroup rppatch
* \def rpPATCHMESHLOCKTEXCOORDSIDX
* Convenience macro for generating a texture coordinate lock flag.
*/
#define rpPATCHMESHLOCKTEXCOORDSIDX(_idx) \
(rpPATCHMESHLOCKTEXCOORDS1 << (_idx))
/*===========================================================================*
*--- Global Types ----------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rppatch
* \ref RpPatchMeshFlag
* When creating a \ref RpPatchMesh, these flags can be OR'ed together to
* specify the format along with the \ref rpPATCHMESHTEXCOORDSETS (n) macro
* to specify the number of texture coordinate sets required.
*
* \see RpPatchMeshCreate
*/
enum RpPatchMeshFlag
{
rpNAPATCHMESHFLAG = 0,
rpPATCHMESHPOSITIONS = 0x01, /**<Patch mesh contains control point
positions. */
rpPATCHMESHNORMALS = 0x02, /**<Patch mesh contains control point
normals. */
rpPATCHMESHPRELIGHTS = 0x04, /**<Patch mesh contains control point
pre-light color values. */
rpPATCHMESHTEXTURED = 0x08, /**<Patch mesh is textured. The number
of texture sets must also be
defined. */
rpPATCHMESHLIGHT = 0x10, /**<Patch mesh will be lit. */
rpPATCHMESHMODULATEMATERIALCOLOR = 0x20,
/**<Control point color will be
modulated with the material color. */
rpPATCHMESHSMOOTHNORMALS = 0x40,
/**<Patch mesh normals will be
smoothed automatically. */
rpPATCHMESHFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPatchMeshFlag RpPatchMeshFlag;
/**
* \ingroup rppatch
* \ref RpPatchMeshLockMode patch mesh lock flags.
*
* \see rpPATCHMESHLOCKTEXCOORDSIDX
*/
enum RpPatchMeshLockMode
{
rpNAPATCHMESHLOCKMODE = 0,
rpPATCHMESHLOCKPATCHES = 0x0001, /**<Lock the mesh patches. */
rpPATCHMESHLOCKPOSITIONS = 0x0002, /**<Lock the control point
positions. */
rpPATCHMESHLOCKNORMALS = 0x0004, /**<Lock the control point
normals. */
rpPATCHMESHLOCKPRELIGHTS = 0x0008, /**<Lock the control point
pre-light color values. */
rpPATCHMESHLOCKTEXCOORDS1 = 0x0100, /**<Lock the texture coordinates
set 1. */
rpPATCHMESHLOCKTEXCOORDS2 = 0x0200, /**<Lock the texture coordinates
set 2. */
rpPATCHMESHLOCKTEXCOORDS3 = 0x0400, /**<Lock the texture coordinates
set 3. */
rpPATCHMESHLOCKTEXCOORDS4 = 0x0800, /**<Lock the texture coordinates
set 4. */
rpPATCHMESHLOCKTEXCOORDS5 = 0x1000, /**<Lock the texture coordinates
set 5. */
rpPATCHMESHLOCKTEXCOORDS6 = 0x2000, /**<Lock the texture coordinates
set 6. */
rpPATCHMESHLOCKTEXCOORDS7 = 0x4000, /**<Lock the texture coordinates
set 7. */
rpPATCHMESHLOCKTEXCOORDS8 = 0x8000, /**<Lock the texture coordinates
set 8. */
rpPATCHMESHLOCKTEXCOORDSALL = 0xff00, /**<Lock all texture coordinate
sets. */
rpPATCHMESHLOCKALL = 0xffff, /**<Combination of all the
above. */
rpPATCHMESHLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPatchMeshLockMode RpPatchMeshLockMode;
typedef struct RpPatchMeshDefinition RpPatchMeshDefinition;
/**
* \ingroup rppatch
* \struct RpPatchMeshDefinition
* holds the definition sizes of the patch mesh. This data should be considered
* read only.
*/
struct RpPatchMeshDefinition
{
RwUInt32 flag; /**<Patch mesh definition flag. */
RwUInt32 numControlPoints; /**<Number of control points. */
RwUInt32 numTriPatches; /**<Number of tri patches. */
RwUInt32 numQuadPatches; /**<Number of quad patches. */
RwUInt32 numTexCoordSets; /**<Number of sets of texture coordinates. */
};
typedef struct RpPatchMesh RpPatchMesh;
/**
* \ingroup rppatch
* \struct RpPatchMesh
* holds the control point data for a patch mesh. The patch mesh should be
* created with \ref RpPatchMeshCreate. The patch mesh should be locked with
* \ref RpPatchMeshLock before the data is edited. Quadrilateral and triangle
* patches can be defined from the control points with
* \ref RpPatchMeshSetQuadPatch and \ref RpPatchMeshSetTriPatch respectively.
* The patch mesh should be unlocked with \ref RpPatchMeshUnlock before it is
* added to an \ref RpAtomic with \ref RpPatchAtomicSetPatchMesh.
*
* \see RpPatchMesDefinition
*/
struct RpPatchMesh
{
RwV3d *positions; /**<Control point positions. */
RwV3d *normals; /**<Control point normals. */
RwRGBA *preLightColors; /**<Control point pre-light colors. */
RwTexCoords *texCoords[rwMAXTEXTURECOORDS];
/**<Control point texture coordinates. */
RpPatchMeshDefinition definition; /**<Patch mesh definition data. */
};
typedef struct RpQuadPatch RpQuadPatch;
/**
* \ingroup rppatch
* \struct RpQuadPatch
* holds the control point indices for a quadrilateral patch. There are
* \ref rpQUADPATCHNUMCONTROLINDICES indices for a quadrilateral patch.
*
* \see RpPatchMeshSetQuadPatch
*/
struct RpQuadPatch
{
RwUInt32 cpIndices[rpQUADPATCHNUMCONTROLINDICES]; /**<Control point
indices. */
};
typedef struct RpTriPatch RpTriPatch;
/**
* \ingroup rppatch
* \struct RpTriPatch
* holds the control point indices for a triangle patch. There are
* \ref rpTRIPATCHNUMCONTROLINDICES indices for a triangular patch.
*
* \see RpPatchMeshSetTriPatch
*/
struct RpTriPatch
{
RwUInt32 cpIndices[rpTRIPATCHNUMCONTROLINDICES]; /**<Control point
indices. */
};
typedef struct RpPatchLODRange RpPatchLODRange;
/**
* \ingroup rppatch
* \struct RpPatchLODRange
* holds the variables used by the default atomic LOD call back function.
*/
struct RpPatchLODRange
{
RwUInt32 minLod; /**<Minimum LOD value. */
RwUInt32 maxLod; /**<Maximum LOD value. */
RwReal minRange; /**<Minimum LOD range. */
RwReal maxRange; /**<Maximum LOD range. */
};
/**
* \ingroup rppatch
* \typedef RpPatchLODUserData
* typedef for the user data passed to the \ref RpPatchLODCallBack
* function which calculates the atomics' LOD.
*
* \see RpPatchAtomicSetPatchLODCallBack
* \see RpPatchAtomicGetPatchLODCallBack
*/
typedef void *RpPatchLODUserData;
/**
* \ingroup rppatch
* \typedef RpPatchLODCallBack
* typedef for the patch atomic LOD calculation function.
*
* \see RpPatchAtomicSetPatchLODCallBack
* \see RpPatchAtomicGetPatchLODCallBack
*/
typedef RwUInt32 (* RpPatchLODCallBack)( RpAtomic *atomic,
RpPatchLODUserData userData );
/*===========================================================================*
*--- Plugin API Functions --------------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*---------------------------------------------------------------------------*
*- Plugin functions -*
*---------------------------------------------------------------------------*/
extern RwBool
RpPatchPluginAttach(void);
/*---------------------------------------------------------------------------*
*- Patch Mesh functions -*
*---------------------------------------------------------------------------*/
extern RpPatchMesh *
RpPatchMeshCreate( RwUInt32 numQuadPatches,
RwUInt32 numTriPatches,
RwUInt32 numControlPoints,
RwUInt32 definitionFlag );
extern RwBool
RpPatchMeshDestroy( RpPatchMesh *patchMesh );
extern RpPatchMesh *
RpPatchMeshLock( RpPatchMesh *patchMesh,
RwUInt32 lockMode );
extern RpPatchMesh *
RpPatchMeshUnlock( RpPatchMesh *patchMesh );
/*---------------------------------------------------------------------------*
*- Patch mesh helper functions -*
*---------------------------------------------------------------------------*/
extern RpPatchMesh *
RpPatchMeshTransform( RpPatchMesh *patchMesh,
const RwMatrix *matrix );
/*---------------------------------------------------------------------------*/
#define RpPatchMeshGetFlagsMacro(patchMesh) \
(patchMesh->definition.flag)
#define RpPatchMeshSetFlagsMacro(patchMesh, flags) \
(patchMesh->definition.flag = flags)
#define RpPatchMeshGetNumControlPointsMacro(patchMesh) \
(patchMesh->definition.numControlPoints)
#define RpPatchMeshGetNumTriPatchesMacro(patchMesh) \
(patchMesh->definition.numTriPatches)
#define RpPatchMeshGetNumQuadPatchesMacro(patchMesh) \
(patchMesh->definition.numQuadPatches)
#define RpPatchMeshGetNumTexCoordSetsMacro(patchMesh) \
(patchMesh->definition.numTexCoordSets)
#define RpPatchMeshGetPositionsMacro(patchMesh) \
(patchMesh->positions)
#define RpPatchMeshGetNormalsMacro(patchMesh) \
(patchMesh->normals)
#define RpPatchMeshGetPreLightColorsMacro(patchMesh) \
(patchMesh->preLightColors)
#define RpPatchMeshGetTexCoordsMacro(patchMesh, index) \
(patchMesh->texCoords[index - 1])
/*---------------------------------------------------------------------------*/
#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
/*---------------------------------------------------------------------------*/
extern RwUInt32
RpPatchMeshGetFlags( const RpPatchMesh *patchMesh );
extern RpPatchMesh *
RpPatchMeshSetFlags( RpPatchMesh *patchMesh,
RwUInt32 flags );
extern RwUInt32
RpPatchMeshGetNumControlPoints( const RpPatchMesh *patchMesh );
extern RwUInt32
RpPatchMeshGetNumTriPatches( const RpPatchMesh *patchMesh );
extern RwUInt32
RpPatchMeshGetNumQuadPatches( const RpPatchMesh *patchMesh );
extern RwUInt32
RpPatchMeshGetNumTexCoordSets( const RpPatchMesh *patchMesh );
extern RwV3d *
RpPatchMeshGetPositions( const RpPatchMesh *patchMesh );
extern RwV3d *
RpPatchMeshGetNormals( const RpPatchMesh *patchMesh );
extern RwRGBA *
RpPatchMeshGetPreLightColors( const RpPatchMesh *patchMesh );
extern RwTexCoords *
RpPatchMeshGetTexCoords( const RpPatchMesh *patchMesh,
RwTextureCoordinateIndex index );
/*---------------------------------------------------------------------------*/
#else /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
/*---------------------------------------------------------------------------*/
#define RpPatchMeshGetFlags(patchMesh) \
RpPatchMeshGetFlagsMacro(patchMesh)
#define RpPatchMeshSetFlags(patchMesh, flags) \
RpPatchMeshSetFlagsMacro(patchMesh, flags)
#define RpPatchMeshGetNumControlPoints(patchMesh) \
RpPatchMeshGetNumControlPointsMacro(patchMesh)
#define RpPatchMeshGetNumTriPatches(patchMesh) \
RpPatchMeshGetNumTriPatchesMacro(patchMesh)
#define RpPatchMeshGetNumQuadPatches(patchMesh) \
RpPatchMeshGetNumQuadPatchesMacro(patchMesh)
#define RpPatchMeshGetNumTexCoordSets(patchMesh) \
RpPatchMeshGetNumTexCoordSetsMacro(patchMesh)
#define RpPatchMeshGetPositions(patchMesh) \
RpPatchMeshGetPositionsMacro(patchMesh)
#define RpPatchMeshGetNormals(patchMesh) \
RpPatchMeshGetNormalsMacro(patchMesh)
#define RpPatchMeshGetPreLightColors(patchMesh) \
RpPatchMeshGetPreLightColorsMacro(patchMesh)
#define RpPatchMeshGetTexCoords(patchMesh, index) \
RpPatchMeshGetTexCoordsMacro(patchMesh, index)
/*---------------------------------------------------------------------------*/
#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
/*---------------------------------------------------------------------------*
*- Patch streaming functions -*
*---------------------------------------------------------------------------*/
extern RwUInt32
RpPatchMeshStreamGetSize( const RpPatchMesh *patchMesh );
extern RpPatchMesh *
RpPatchMeshStreamRead( RwStream *stream );
extern const RpPatchMesh *
RpPatchMeshStreamWrite( const RpPatchMesh *patchMesh,
RwStream *stream );
/*---------------------------------------------------------------------------*
*- Patch Mesh patch functions -*
*---------------------------------------------------------------------------*/
extern RpPatchMesh *
RpPatchMeshSetQuadPatch( RpPatchMesh *patchMesh,
RwUInt32 quadIndex,
RpQuadPatch *quadPatch );
extern RpPatchMesh *
RpPatchMeshSetTriPatch( RpPatchMesh *patchMesh,
RwUInt32 triIndex,
RpTriPatch *triPatch );
extern const RpQuadPatch *
RpPatchMeshGetQuadPatch( const RpPatchMesh *patchMesh,
RwUInt32 quadIndex );
extern const RpTriPatch *
RpPatchMeshGetTriPatch( const RpPatchMesh *patchMesh,
RwUInt32 triIndex );
/*---------------------------------------------------------------------------*
*- Patch Mesh material functions -*
*---------------------------------------------------------------------------*/
extern RpPatchMesh *
RpPatchMeshSetQuadPatchMaterial( RpPatchMesh *patchMesh,
RwUInt32 quadIndex,
RpMaterial *material );
extern RpPatchMesh *
RpPatchMeshSetTriPatchMaterial( RpPatchMesh *patchMesh,
RwUInt32 triIndex,
RpMaterial *material );
extern RpMaterial *
RpPatchMeshGetQuadPatchMaterial( const RpPatchMesh *patchMesh,
RwUInt32 quadIndex );
extern RpMaterial *
RpPatchMeshGetTriPatchMaterial( const RpPatchMesh *patchMesh,
RwUInt32 triIndex );
extern const RpPatchMesh *
RpPatchMeshForAllMaterials( const RpPatchMesh *patchMesh,
RpMaterialCallBack callBack,
void *userData );
extern RwUInt32
RpPatchMeshGetNumMaterials( const RpPatchMesh *patchMesh );
extern RpMaterial *
RpPatchMeshGetMaterial( const RpPatchMesh *patchMesh,
RwUInt32 materialIndex );
/*---------------------------------------------------------------------------*
*- Patch Skin functions -*
*---------------------------------------------------------------------------*/
#if (defined(RPSKIN_H))
extern RpSkin *
RpPatchMeshGetSkin( RpPatchMesh *patchMesh );
extern RpPatchMesh *
RpPatchMeshSetSkin( RpPatchMesh *patchMesh,
RpSkin *skin );
#endif /* (defined(RPSKIN_H)) */
/*---------------------------------------------------------------------------*
*- Patch Atomic functions -*
*---------------------------------------------------------------------------*/
extern RpAtomic *
RpPatchAtomicSetPatchMesh( RpAtomic *atomic,
RpPatchMesh *patchMesh );
extern RpPatchMesh *
RpPatchAtomicGetPatchMesh( const RpAtomic *atomic );
/*---------------------------------------------------------------------------*
*- Patch Atomic LOD functions -*
*---------------------------------------------------------------------------*/
extern RwBool
RpPatchAtomicSetPatchLODCallBack( RpAtomic *atomic,
RpPatchLODCallBack callback,
RpPatchLODUserData userData );
extern RwBool
RpPatchAtomicGetPatchLODCallBack( const RpAtomic *atomic,
RpPatchLODCallBack *callback,
RpPatchLODUserData *userData );
/*---------------------------------------------------------------------------*
*- Patch default LOD range -*
*---------------------------------------------------------------------------*/
extern RwBool
RpPatchSetDefaultLODCallBackRange( RpPatchLODRange *lodRange );
extern RwBool
RpPatchGetDefaultLODCallBackRange( RpPatchLODRange *lodRange );
/*---------------------------------------------------------------------------*
*- Patch pipeline -*
*---------------------------------------------------------------------------*/
/**
* \ingroup rppatch
* \ref RpPatchType defines the different ways a patch atomic can be rendered.
* Once a \ref RpPatchMesh has been attached to an \ref RpAtomic with
* \ref RpPatchAtomicSetPatchMesh the atomic must be setup with the correct
* rendering pipeline with \ref RpPatchAtomicSetType .
*
* The patch plugin makes no assumptions about how to render the
* patch atomics. Once an \ref RpPatchMesh has been attached to an
* \ref RpAtomic it is necessary to attach a suitable patch
* rendering pipeline. The patch plugin supports four different
* rendering types, these are defined in the \ref RpPatchType
* enumeration:-
* \li \ref rpPATCHTYPEGENERIC
* The patch \ref RpAtomic will be rendered with the
* default generic patch rendering pipeline.
* \li \ref rpPATCHTYPESKIN
* The patch \ref RpAtomic will be rendered with a
* custom pipeline for rendering skinning patches. Make sure
* an \ref RpSkin has been attached to the \ref RpPatchMesh
* and an \ref RpHAnimHierarchy has been attached to the
* \ref RpAtomic.
* \li \ref rpPATCHTYPEMATFX
* The patch \ref RpAtomic will be rendered with a
* custom pipeline for rendering the material effects
* of patches. The
* patch matfx pipeline supports all the material effects
* defined in the \ref rpmatfx plugin. The patches
* materials should be setup as usual.
* \li \ref rpPATCHTYPESKINMATFX
* The patch \ref RpAtomic will be rendered with a
* custom skinned material effects patch rendering pipeline.
* The \ref RpPatchMesh, \ref RpAtomic and the patches'
* \ref RpMaterial's must be setup correctly.
*/
enum RpPatchType
{
rpNAPATCHTYPE = 0, /**<Invalid patch pipeline. */
rpPATCHTYPEGENERIC = 1, /**<Generic patch rendering. */
rpPATCHTYPESKIN = 2, /**<Skinned patch rendering. */
rpPATCHTYPEMATFX = 3, /**<Material effects patch rendering. */
rpPATCHTYPESKINMATFX = 4, /**<Skinned material effects patch rendering. */
rpPATCHTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPatchType RpPatchType;
extern RpAtomic *
RpPatchAtomicSetType( RpAtomic *atomic,
RpPatchType type );
extern RpPatchType
RpPatchAtomicGetType( const RpAtomic *atomic );
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---- start: ./d3d8/patchplatform.h----*/
/**
* \defgroup rppatchd3d8 D3D8
* \ingroup rppatch
*
* D3D8 patch pipeline extension.
*/
/*===========================================================================*
*--- D3D8 Defines -----------------------------------------------------------*
*===========================================================================*/
/*===========================================================================*
*--- D3D8 Global Types ------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rppatchd3d8
* \ref RpPatchD3D8Pipeline rendering pipelines available within the
* \ref rppatch plugin. Use \ref RpPatchGetD3D8Pipeline to retrieve
* the \ref RxPipeline s.
*/
enum RpPatchD3D8Pipeline
{
rpPATCHD3D8PIPELINEGENERIC = 0, /**<D3D8 generic
patch rendering pipeline. */
rpPATCHD3D8PIPELINEMATFX = 1, /**<D3D8 material effect
(single set of texture coordinates)
patch rendering pipeline. */
rpPATCHD3D8PIPELINESKINNED = 2, /**<D3D8 skinned
patch rendering pipeline. */
rpPATCHD3D8PIPELINESKINMATFX = 3, /**<D3D8 skinned material effect
(single set of texture coordinates)
patch rendering pipeline. */
rpPATCHD3D8PIPELINEMAX,
rpPATCHD3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPatchD3D8Pipeline RpPatchD3D8Pipeline;
/*===========================================================================*
*--- D3D8 Plugin API Functions ----------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*---------------------------------------------------------------------------*/
extern RxPipeline *
RpPatchGetD3D8Pipeline( RpPatchD3D8Pipeline d3d8Pipeline );
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---- end: ./d3d8/patchplatform.h----*/
#endif /* RPPATCH_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionPATCH
{
e_rwdb_CriterionPATCHLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionPATCH e_rwdb_CriterionPATCH;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionParticleStandard
{
e_rwdb_CriterionParticleStandardLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionParticleStandard e_rwdb_CriterionParticleStandard;

View File

@ -0,0 +1,781 @@
#ifndef RPPTANK_H
#define RPPTANK_H
/*===========================================================================*
*--- Include files ---------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
/*---- start: ./ptank.h----*/
/**
* \defgroup rpptank RpPTank
* \ingroup rpplugin
*
* PTank Plugin for RenderWare.
*/
/*--- Include files ---*/
#include <string.h>
#include "rwcore.h"
#include "rpptank.rpe" /* automatically generated header file */
/******************************************************************************
* Global Types
*/
/**
* \ingroup rpptank
* Passed to \ref RpPTankAtomicCreate, these flags specify
* the type and properties held by the particles.
* Some flags are mutually exclusive and should not be mixed.
* The debug version of the library will assert and signal these problems.
*/
enum RpPTankDataFlags
{
rpPTANKDFLAGNONE = ((int)0x00000000),
rpPTANKDFLAGPOSITION = ((int)0x00000001), /**<Uses a position per particle*/
rpPTANKDFLAGCOLOR = ((int)0x00000002), /**<Uses a color per particle*/
rpPTANKDFLAGSIZE = ((int)0x00000004), /**<Uses a size per particle*/
rpPTANKDFLAGMATRIX = ((int)0x00000008), /**<Uses a matrix per particle*/
rpPTANKDFLAGNORMAL = ((int)0x00000010), /**<Uses a normal per particle*/
rpPTANKDFLAG2DROTATE = ((int)0x00000020), /**<Uses a 2D rotation per particle*/
rpPTANKDFLAGVTXCOLOR = ((int)0x00000040), /**<Uses a color per Billboard vertex*/
rpPTANKDFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Uses Top-Left and Bottom-Right Texture coordinates*/
rpPTANKDFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Uses a texture UV per vertex*/
/* free = ((int)0x00000200), */
/* free = ((int)0x00000400), */
/* free = ((int)0x00000800), */
/* free = ((int)0x00001000), */
/* free = ((int)0x00002000), */
/* free = ((int)0x00004000), */
rpPTANKDFLAGCNSMATRIX = ((int)0x00008000), /**<Uses a constant matrix*/
rpPTANKDFLAGCNSNORMAL = ((int)0x00010000), /**<Uses a constant normal*/
rpPTANKDFLAGCNS2DROTATE = ((int)0x00020000), /**<Uses a constant 2D rotation*/
rpPTANKDFLAGCNSVTXCOLOR = ((int)0x00040000), /**<Uses a constant color per Billboard vertex*/
rpPTANKDFLAGCNSVTX2TEXCOORDS = ((int)0x00080000), /**<Uses constant Top-Left and Bottom-Right Texture coordinates*/
rpPTANKDFLAGCNSVTX4TEXCOORDS = ((int)0x00100000), /**<Uses a constant texture UV per vertex*/
/* free = ((int)0x00200000), */
/* free = ((int)0x00400000), */
/* free = ((int)0x00800000), */
rpPTANKDFLAGUSECENTER = ((int)0x01000000), /**<The position of the particles are shifted*/
/* free = ((int)0x04000000), */
/* free = ((int)0x08000000), */
rpPTANKDFLAGARRAY = ((int)0x10000000), /**<Data is organized in an array */
rpPTANKDFLAGSTRUCTURE = ((int)0x20000000), /**<Data is organized in a structure */
RPPTANKDATAFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPTankDataFlags RpPTankDataFlags;
#define rpPTANKDFLAGTHINPARTICLES (rpPTANKDFLAGPOSITION)
#define rpPTANKDFLAGFATPARTICLES ( rpPTANKDFLAGPOSITION | rpPTANKDFLAGSIZE \
| rpPTANKDFLAG2DROTATE | rpPTANKDFLAGVTXCOLOR \
| rpPTANKDFLAGVTX4TEXCOORDS)
/**
* \ingroup rpptank
* Passed to \ref RpPTankAtomicLock, these flags specify
* the data accessed.
* those flags are mutually exclusive and should not be mixed.
*/
enum RpPTankDataLockFlags
{
rpPTANKLFLAGNONE = ((int)0x00000000),
rpPTANKLFLAGPOSITION = ((int)0x00000001), /**<Access the positions buffer*/
rpPTANKLFLAGCOLOR = ((int)0x00000002), /**<Access the colors buffer*/
rpPTANKLFLAGSIZE = ((int)0x00000004), /**<Access the sizes buffer*/
rpPTANKLFLAGMATRIX = ((int)0x00000008), /**<Access the matrixes buffer*/
rpPTANKLFLAGNORMAL = ((int)0x00000010), /**<Access the normals buffer*/
rpPTANKLFLAG2DROTATE = ((int)0x00000020), /**<Access the 2D rotations buffer*/
rpPTANKLFLAGVTXCOLOR = ((int)0x00000040), /**<Access the colors buffer (when using a color per vertex) */
rpPTANKLFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Access the Top-Left and Bottom-Right Texture coordinates buffer*/
rpPTANKLFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Access the texture UVs Buffer (when using a color per vertex)*/
RPPTANKLOCKFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPTankDataLockFlags RpPTankDataLockFlags;
#if (!defined(DOXYGEN))
/**
* \ingroup rpptank
* RpPTankInstanceFlags
*/
enum RpPTankInstanceFlags
{
rpPTANKIFLAGNONE = ((int)0x00000000),
rpPTANKIFLAGPOSITION = ((int)0x00000001), /**<Particles position changed*/
rpPTANKIFLAGCOLOR = ((int)0x00000002), /**<Particles color changed*/
rpPTANKIFLAGSIZE = ((int)0x00000004), /**<Particles size changed*/
rpPTANKIFLAGMATRIX = ((int)0x00000008), /**<Particles matrix changed*/
rpPTANKIFLAGNORMAL = ((int)0x00000010), /**<Particles normal changed*/
rpPTANKIFLAG2DROTATE = ((int)0x00000020), /**<Particles 2D rotation changed*/
rpPTANKIFLAGVTXCOLOR = ((int)0x00000040), /**<Vertex color changed*/
rpPTANKIFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Vertex 2 Texture coordinates changed*/
rpPTANKIFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Vertex 4 Texture coordinates changed*/
/* free = ((int)0x00000200), */
/* free = ((int)0x00000400), */
/* free = ((int)0x00000800), */
/* free = ((int)0x00001000), */
rpPTANKIFLAGCNSCOLOR = ((int)0x00002000), /**<Constant color changed*/
rpPTANKIFLAGCNSSIZE = ((int)0x00004000), /**<Constant size changed*/
rpPTANKIFLAGCNSMATRIX = ((int)0x00008000), /**<Constant matrix changed*/
rpPTANKIFLAGCNSNORMAL = ((int)0x00010000), /**<Constant normal changed*/
rpPTANKIFLAGCNS2DROTATE = ((int)0x00020000), /**<Constant 2D rotation changed*/
rpPTANKIFLAGCNSVTXCOLOR = ((int)0x00040000), /**<Constant vertex color changed*/
rpPTANKIFLAGCNSVTX2TEXCOORDS = ((int)0x00080000), /**<Constant vertex 2 Texture coordinates changed*/
rpPTANKIFLAGCNSVTX4TEXCOORDS = ((int)0x00100000), /**<Constant vertex 4 Texture coordinates changed*/
/* free = ((int)0x00200000), */
/* free = ((int)0x00400000), */
rpPTANKIFLAGACTNUMCHG = ((int)0x00800000), /**<Number of active particle changed*/
rpPTANKIFLAGCENTER = ((int)0x01000000), /**<Center position changed*/
/* free = ((int)0x04000000), */
/* free = ((int)0x08000000), */
/* free = ((int)0x10000000), */
rpPTANKIFLAGALL = ((int)0xFFFFFFFF),
RPPTANKINSTANCEFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpPTankInstanceFlags RpPTankInstanceFlags;
#endif
/**
* \ingroup rpptank
* Passed to \ref RpPTankAtomicLock to specify the type of access needed.
*
* Accessing data using \ref rpPTANKLOCKWRITE will force the PTank object to reinstance
* the rendered data. The instantiation of this data takes place at rendering
* time and is done once per frame.
*/
enum RpPTankLockFlags
{
rpPTANKLOCKWRITE = ((int)0x40000000), /**<Lock data for writing. */
rpPTANKLOCKREAD = ((int)0x80000000) /**<Lock data for reading. */
};
typedef enum RpPTankLockFlags RpPTankLockFlags;
typedef struct RpPTankLockStruct RpPTankLockStruct;
/**
* \ingroup rpptank
* \struct RpPTankLockStruct
* Returned by \ref RpPTankAtomicLock
*/
struct RpPTankLockStruct{
RwUInt8 *data; /**<Pointer to the locked data. */
RwInt32 stride; /**<Stride of the data accessed. */
};
typedef struct RpPTankFormatDescriptor RpPTankFormatDescriptor;
/**
* \ingroup rpptank
* \struct RpPTankFormatDescriptor
* Returned by \ref RpPTankAtomicGetDataFormat
*/
struct RpPTankFormatDescriptor
{
RwInt32 numClusters; /**<Number of clusters */
RwInt32 stride; /**<Size of a single structure when using
* structure organization, 0 otherwise */
RwInt32 dataFlags; /**<flags passed to \ref RpPTankAtomicCreate */
};
#if (!defined(DOXYGEN))
typedef struct RpPTankData RpPTankData;
struct RpPTankData
{
void *data; /* PI data array
* in the A form :
* Point to the ptrList table
* in the S form :
* point to the structure
*
*/
RpPTankLockStruct clusters[9];
void *userData; /* void pointer for platform use */
RpPTankFormatDescriptor format;
/* constant values */
RwUInt32 srcBlend;
RwUInt32 dstBlend;
RwBool vertexAlphaBlend;
RwV2d cCenter;
RwV2d cSize;
RwReal cRotate;
RwRGBA cColor;
RwRGBA cVtxColor[4];
RwTexCoords cUV[4];
RwMatrix cMatrix;
};
/* data piece size */
extern const RwInt32 datasize[];
#define RPPTANKSIZEPOSITION 0
#define RPPTANKSIZEMATRIX 1
#define RPPTANKSIZENORMAL 2
#define RPPTANKSIZESIZE 3
#define RPPTANKSIZECOLOR 4
#define RPPTANKSIZEVTXCOLOR 5
#define RPPTANKSIZE2DROTATE 6
#define RPPTANKSIZEVTX2TEXCOORDS 7
#define RPPTANKSIZEVTX4TEXCOORDS 8
/**
* \ingroup rpptank
* \typedef rpptankAllocCallBack
* ...
*/
typedef void *(* rpPTankAllocCallBack)(RpPTankData *ptankGlobal,
RwInt32 maxPCount,
RwUInt32 dataFlags,
RwUInt32 platFlags);
/**
* \ingroup rpptank
* \typedef rpPTankCreateCallBack
* ...
*/
typedef RwBool (* rpPTankCreateCallBack)(RpAtomic *atomic,
RpPTankData *ptankGlobal,
RwInt32 maxPCount,
RwUInt32 dataFlags,
RwUInt32 platFlags);
/**
* \ingroup rpptank
* \typedef rpPTankInstanceCallBack
* ...
*/
typedef RwBool (* rpPTankInstanceCallBack)(RpAtomic *atomic,
RpPTankData *ptankGlobal,
RwInt32 actPCount,
RwUInt32 instFlags);
/**
* \ingroup rpptank
* \typedef rpPTankRenderCallBack
* ...
*/
typedef RwBool (* rpPTankRenderCallBack)(RpAtomic *atomic,
RpPTankData *ptankGlobal,
RwInt32 actPCount);
typedef struct rpPTankCallBacks rpPTankCallBacks;
struct rpPTankCallBacks
{
rpPTankAllocCallBack alloc;
rpPTankCreateCallBack create;
rpPTankInstanceCallBack instance;
rpPTankRenderCallBack render;
};
/* private typedefs */
typedef struct rpPTANKInstanceSetupData rpPTANKInstanceSetupData;
struct rpPTANKInstanceSetupData
{
RwBool instancePositions;
RwBool instanceUVs;
RwBool instanceColors;
RwBool instanceNormals;
RpPTankLockStruct positionOut;
RpPTankLockStruct UVOut;
RpPTankLockStruct colorsOut;
RpPTankLockStruct normalsOut;
RwV3d right;
RwV3d up;
};
typedef void (* rpPTankGENInstancePosCallback)(
RpPTankLockStruct *dstCluster,
RwV3d *right,
RwV3d *up,
RwInt32 pCount,
RpPTankData *ptankGlobal);
typedef void (* rpPTankGENInstanceCallback)(
RpPTankLockStruct *dstCluster,
RwInt32 pCount,
RpPTankData *ptankGlobal);
typedef void (* rpPTankGENInstanceSetupCallback)(
rpPTANKInstanceSetupData *data,
RpAtomic *atomic,
RpPTankData *ptankGlobal,
RwInt32 actPCount,
RwUInt32 instFlags);
typedef void (* rpPTankGENInstanceEndingCallback)(
rpPTANKInstanceSetupData *data,
RpAtomic *atomic,
RpPTankData *ptankGlobal,
RwInt32 actPCount,
RwUInt32 instFlags);
typedef struct RpPTankAtomicExtPrv RpPTankAtomicExtPrv;
struct RpPTankAtomicExtPrv
{
RwInt32 maxPCount; /* max number of particles */
RwInt32 actPCount; /* number of actives particles */
RwBool isAStructure; /* is in a structure of array form */
void *rawdata; /* unaligned pointer to the PI data */
/* Rendering callback */
RpAtomicCallBackRender defaultRenderCB;
rpPTankCallBacks ptankCallBacks;
/* Instancing CallBacks */
rpPTankGENInstanceSetupCallback insSetupCB;
rpPTankGENInstancePosCallback insPosCB;
rpPTankGENInstanceCallback insUVCB;
rpPTankGENInstanceCallback insColorsCB;
rpPTankGENInstanceCallback insNormalsCB;
rpPTankGENInstanceEndingCallback insEndingCB;
RwUInt32 lockFlags;
RwUInt32 instFlags;
RwUInt32 platFlags;
RpPTankData publicData;
};
/*--- Plugin API Functions ---*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* private globals */
extern RwInt32 _rpPTankAtomicDataOffset; /* Offset in RpAtomic */
extern RwInt32 _rpPTankGlobalsOffset; /* Offset in RwEngine */
/* Macro tools */
#define RPATOMICPTANKPLUGINDATA(atomic) \
(*RWPLUGINOFFSET(RpPTankAtomicExtPrv *, (atomic), _rpPTankAtomicDataOffset))
#define GLOBALPTANKPLUGINDATA() \
(*RWPLUGINOFFSET(void *, RwEngineInstance, _rpPTankGlobalsOffset))
#endif
extern RwBool
RpPTankPluginAttach(void);
/*
* PTank Management API ******************************************************
*/
extern RpAtomic *
RpPTankAtomicCreate(RwInt32 maxParticleNum,
RwUInt32 dataFlags,
RwUInt32 platFlags);
extern void
RpPTankAtomicDestroy(RpAtomic *ptank);
extern RwBool
RpAtomicIsPTank(RpAtomic *atomic);
extern const RpPTankFormatDescriptor *
RpPTankAtomicGetDataFormat(RpAtomic *atomic);
/*
* Particles Management API **************************************************
*/
#define RpPTankAtomicGetActiveParticlesCountMacro(_atm)\
(RPATOMICPTANKPLUGINDATA(_atm)->actPCount)
#define RpPTankAtomicGetMaximumParticlesCountMacro(_atm)\
(RPATOMICPTANKPLUGINDATA(_atm)->maxPCount)
#define RpPTankAtomicSetActiveParticlesCountMacro(atm_,cnt_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGACTNUMCHG;\
RPATOMICPTANKPLUGINDATA(atm_)->actPCount = cnt_;\
}\
MACRO_STOP
#define RpPTankAtomicSetTextureMacro(atm_, tex_)\
MACRO_START\
{\
RpMaterialSetTexture(RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0), tex_);\
}\
MACRO_STOP
#define RpPTankAtomicGetTextureMacro(atm_)\
(RpMaterialGetTexture(RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0)))
#define RpPTankAtomicGetMaterialMacro(atm_)\
(RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0))
#define RpPTankAtomicSetBlendModesMacro(atm_,src_,dst_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.srcBlend = src_;\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.dstBlend = dst_;\
}\
MACRO_STOP
#define RpPTankAtomicGetBlendModesMacro(atm_,src_,dst_)\
MACRO_START\
{\
*src_ =\
(RwBlendFunction)(RPATOMICPTANKPLUGINDATA(atm_)->publicData.srcBlend);\
*dst_ =\
(RwBlendFunction)(RPATOMICPTANKPLUGINDATA(atm_)->publicData.dstBlend);\
}\
MACRO_STOP
#define RpPTankAtomicSetVertexAlphaMacro(atm_, vas_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.vertexAlphaBlend = vas_;\
}\
MACRO_STOP
#define RpPTankAtomicGetVertexAlphaMacro(atm_)\
(RPATOMICPTANKPLUGINDATA(atm_)->publicData.vertexAlphaBlend)
#define RpPTankAtomicSetConstantCenterMacro(atm_, ctr_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.cCenter = *ctr_;\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCENTER;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantCenterMacro(atm_)\
(&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cCenter))
#define RpPTankAtomicSetConstantSizeMacro(atm_, size_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.cSize = *size_;\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSSIZE;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantSizeMacro(atm_)\
(&RPATOMICPTANKPLUGINDATA(atm_)->publicData.cSize)
#define RpPTankAtomicSetConstantRotateMacro(atm_, rot_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.cRotate = rot_;\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNS2DROTATE;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantRotateMacro(atm_)\
(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cRotate)
#define RpPTankAtomicSetConstantMatrixMacro(atm_, mtx_)\
MACRO_START\
{\
RwMatrixCopy(&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cMatrix),mtx_);\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSMATRIX;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantMatrixMacro(atm_)\
(&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cMatrix))
#define RpPTankAtomicSetConstantColorMacro(atm_, col_)\
MACRO_START\
{\
RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor = *col_;\
if( RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0) )\
{\
RpMaterialSetColor(\
RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0),\
&RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor);\
}\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSCOLOR;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantColorMacro(atm_)\
(&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor))
#define RpPTankAtomicSetConstantVtxColorMacro(atm_, col_)\
MACRO_START\
{\
memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cVtxColor,\
col_,\
sizeof(RwRGBA)*4);\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTXCOLOR;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantVtxColorMacro(atm_)\
(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cVtxColor)
#define RpPTankAtomicSetConstantVtx2TexCoordsMacro(atm_, uv_)\
MACRO_START\
{\
memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV,\
uv_,\
sizeof(RwTexCoords)*2);\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTX2TEXCOORDS;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantVtx2TexCoordsMacro(atm_)\
(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV)
#define RpPTankAtomicSetConstantVtx4TexCoordsMacro(atm_, uv_)\
MACRO_START\
{\
memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV,\
uv_,\
sizeof(RwTexCoords)*4);\
RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTX4TEXCOORDS;\
}\
MACRO_STOP
#define RpPTankAtomicGetConstantVtx4TexCoordsMacro(atm_)\
(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV)
#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
extern RwInt32
RpPTankAtomicGetActiveParticlesCount(RpAtomic *atomic);
extern RwInt32
RpPTankAtomicGetMaximumParticlesCount(RpAtomic *atomic);
extern void
RpPTankAtomicSetActiveParticlesCount(RpAtomic *atomic, RwInt32 count);
extern void
RpPTankAtomicSetTexture(RpAtomic *atomic, RwTexture *texture);
extern RwTexture *
RpPTankAtomicGetTexture(RpAtomic *atomic);
extern RpAtomic *
RpPTankAtomicSetMaterial(RpAtomic *atomic, RpMaterial *material);
extern RpMaterial *
RpPTankAtomicGetMaterial(RpAtomic *atomic);
extern void
RpPTankAtomicSetBlendModes(RpAtomic *atomic,
RwBlendFunction srcBlendMode,
RwBlendFunction dstBlendMode );
extern void
RpPTankAtomicGetBlendModes(RpAtomic *atomic,
RwBlendFunction *srcBlendMode,
RwBlendFunction *dstBlendMode );
extern void
RpPTankAtomicSetVertexAlpha(RpAtomic *atomic, RwBool vtxAlphaState);
extern RwBool
RpPTankAtomicGetVertexAlpha(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantCenter(RpAtomic *atomic, RwV2d *center);
const RwV2d *
RpPTankAtomicGetConstantCenter(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantSize(RpAtomic *atomic, RwV2d *size);
extern const RwV2d *
RpPTankAtomicGetConstantSize(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantRotate(RpAtomic *atomic, RwReal rotate);
extern RwReal
RpPTankAtomicGetConstantRotate(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantMatrix(RpAtomic *atomic, RwMatrix *matrix);
extern const RwMatrix *
RpPTankAtomicGetConstantMatrix(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantColor(RpAtomic *atomic, RwRGBA *color);
extern const RwRGBA *
RpPTankAtomicGetConstantColor(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantVtxColor(RpAtomic *atomic, RwRGBA *color);
extern const RwRGBA *
RpPTankAtomicGetConstantVtxColor(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantVtx2TexCoords(RpAtomic *atomic, RwTexCoords *UVs);
extern const RwTexCoords *
RpPTankAtomicGetConstantVtx2TexCoords(RpAtomic *atomic);
extern void
RpPTankAtomicSetConstantVtx4TexCoords(RpAtomic *atomic, RwTexCoords *UVs);
extern const RwTexCoords *
RpPTankAtomicGetConstantVtx4TexCoords(RpAtomic *atomic);
#else
#define RpPTankAtomicGetActiveParticlesCount(atm_)\
RpPTankAtomicGetActiveParticlesCountMacro(atm_)
#define RpPTankAtomicGetMaximumParticlesCount(atm_)\
RpPTankAtomicGetMaximumParticlesCountMacro(atm_)
#define RpPTankAtomicSetActiveParticlesCount(atm_,cnt_)\
RpPTankAtomicSetActiveParticlesCountMacro(atm_,cnt_)
#define RpPTankAtomicSetTexture(atm_,tex_)\
RpPTankAtomicSetTextureMacro(atm_,tex_)
#define RpPTankAtomicGetTexture(atm_)\
RpPTankAtomicGetTextureMacro(atm_)
extern RpAtomic *
RpPTankAtomicSetMaterial(RpAtomic *atomic, RpMaterial *material);
#define RpPTankAtomicGetMaterial(atm_)\
RpPTankAtomicGetMaterialMacro(atm_)
#define RpPTankAtomicSetBlendModes(atm_,src_,dst_)\
RpPTankAtomicSetBlendModesMacro(atm_,src_,dst_)
#define RpPTankAtomicGetBlendModes(atm_,src_,dst_)\
RpPTankAtomicGetBlendModesMacro(atm_,src_,dst_)
#define RpPTankAtomicSetVertexAlpha(atm_, vas_)\
RpPTankAtomicSetVertexAlphaMacro(atm_, vas_)
#define RpPTankAtomicGetVertexAlpha(atm_)\
RpPTankAtomicGetVertexAlphaMacro(atm_)
#define RpPTankAtomicSetConstantCenter(atm_, ctr_)\
RpPTankAtomicSetConstantCenterMacro(atm_, ctr_)
#define RpPTankAtomicGetConstantCenter(atm_)\
RpPTankAtomicGetConstantCenterMacro(atm_)
#define RpPTankAtomicSetConstantSize(atm_, size_)\
RpPTankAtomicSetConstantSizeMacro(atm_, size_)
#define RpPTankAtomicGetConstantSize(atm_)\
RpPTankAtomicGetConstantSizeMacro(atm_)
#define RpPTankAtomicSetConstantRotate(atm_, rot_)\
RpPTankAtomicSetConstantRotateMacro(atm_, rot_)
#define RpPTankAtomicGetConstantRotate(atm_)\
RpPTankAtomicGetConstantRotateMacro(atm_)
#define RpPTankAtomicSetConstantMatrix(atm_, mtx_)\
RpPTankAtomicSetConstantMatrixMacro(atm_, mtx_)
#define RpPTankAtomicGetConstantMatrix(atm_)\
RpPTankAtomicGetConstantMatrixMacro(atm_)
#define RpPTankAtomicSetConstantColor(atm_, col_)\
RpPTankAtomicSetConstantColorMacro(atm_, col_)
#define RpPTankAtomicGetConstantColor(atm_)\
RpPTankAtomicGetConstantColorMacro(atm_)
#define RpPTankAtomicSetConstantVtxColor(atm_, _col)\
RpPTankAtomicSetConstantVtxColorMacro(atm_, _col)
#define RpPTankAtomicGetConstantVtxColor(atm_)\
RpPTankAtomicGetConstantVtxColorMacro(atm_)
#define RpPTankAtomicSetConstantVtx2TexCoords(atm_, uv_)\
RpPTankAtomicSetConstantVtx2TexCoordsMacro(atm_, uv_)
#define RpPTankAtomicGetConstantVtx2TexCoords(atm_)\
RpPTankAtomicGetConstantVtx2TexCoordsMacro(atm_)\
#define RpPTankAtomicSetConstantVtx4TexCoords(atm_, uv_)\
RpPTankAtomicSetConstantVtx4TexCoordsMacro(atm_, uv_)
#define RpPTankAtomicGetConstantVtx4TexCoords(atm_)\
RpPTankAtomicGetConstantVtx4TexCoordsMacro(atm_)
#endif
/*
* Data access API ***********************************************************
*/
extern RwBool
RpPTankAtomicLock(RpAtomic *atomic, RpPTankLockStruct *dst,
RwUInt32 dataFlags, RpPTankLockFlags lockFlag);
extern void *
RpPTankAtomicLockByIndex(RpAtomic *atomic, RwInt32 idx, RwUInt32 dataFlags, RpPTankLockFlags lockFlag);
extern RpAtomic *
RpPTankAtomicUnlock(RpAtomic *atomic);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---- end: ./ptank.h----*/
/*---- start: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/
enum RpPTankD3D8Flags
{
rpPTANKD3D8FLAGSUSEPOINTSPRITES = 0x00000001,
rpPTANKD3D8FLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
/*---- end: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/
#endif /* RPPTANK_H */

View File

@ -0,0 +1,643 @@
enum e_rwdb_CriterionPTank
{
e_rwdb_CriterionPTankLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionPTank e_rwdb_CriterionPTank;

395
rwsdk/include/d3d8/rppvs.h Normal file
View File

@ -0,0 +1,395 @@
/*
* Potentially Visible Set plug-in
*/
/**********************************************************************
*
* file : rppvs.h
*
* abstract : handle culling of worldsectors in RenderWare
*
**********************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 2001 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
************************************************************************/
#ifndef _RPPVS_H
#define _RPPVS_H
/**
* \defgroup rppvs RpPVS
* \ingroup rpplugin
*
* Geometric Potentially Visible Set Plugin for RenderWare Graphics.
*/
/****************************************************************************
Defines
*/
typedef RwUInt8 RpPVSVisMap;
#define PVSFROMWORLDSECTOR(sector) \
((RpPVS *)(((char *)(sector))+rpPVSGlobals.sectorOffset))
#define WORLDSECTORFROMPVS(pvs) \
((RpWorldSector *)(((char *)(pvs))-rpPVSGlobals.sectorOffset))
#define PVSFROMCONSTWORLDSECTOR(sector) \
((const RpPVS *)(((const char *)(sector))+rpPVSGlobals.sectorOffset))
#define PVSCACHEFROMWORLD(world) \
((RpPVSCache *)(((char *)(world))+rpPVSGlobals.worldOffset))
#define PVSCACHEFROMCONSTWORLD(world) \
((const RpPVSCache *)(((const char *)(world))+rpPVSGlobals.worldOffset))
#define PVSVISMAPSETSECTOR(_vismap, _id) \
(_vismap)[(_id) >> 3] |= (1 << ((_id) & 7))
#define PVSVISMAPUNSETSECTOR(_vismap, _id) \
(_vismap)[(_id) >> 3] ^= (1 << ((_id) & 7))
#define PVSVISMAPGETSECTOR(_vismap, _id) \
((_vismap)[(_id) >> 3] & (1 << ((_id) & 7)))
#define PVSVISMAPLENGTH(_vismaplength, _nosectors) \
(_vismaplength) = ((_nosectors + 7) >> 3)
/* Progress callback message types */
#define rpPVSPROGRESSSTART 20
#define rpPVSPROGRESSUPDATE 12
#define rpPVSPROGRESSEND 22
/**
* \ingroup rppvs
* \ref RpPVSProgressCallBack
* This typedef sets the callback function for sampling within a world sector.
*
* \param value A value between 0.0 and 100.0 to represent the percentage completion.
* \param msg The message may take one of the following:
*
* \li rpPVSPROGRESSSTART
* The PVS creation process is about to start. The argument value is equal to 0.0.
*
* \li rpPVSPROGRESSUPDATE
* The PVS creation process has finished processing a subsection of the world.
* The argument value is equal to the percentage of the world processed up to this point.
*
* \li rpPVSPROGRESSEND
* The PVS creation process has ended. All world sectors have been processed.
* The argument value is equal to 100.0.
*
* The progress callback may return FALSE to indicate that the generation of PVS data
* should terminate. Otherwise, return TRUE to continue.
*
* The PVS plugin must be attached before using this function.
*
*
*/
typedef RwBool(*RpPVSProgressCallBack) (RwInt32 msg,
RwReal value);
/**
* \ingroup rppvs
* \ref RpPVSCallBack
* This typedef sets the callback function for sampling within a world sector.
*
* \param worldSector A pointer to the \ref RpWorldSector being sampled.
* \param box The bounding box of the region being sampled.
* \param pData A pointer to private data for the sampling function.
*/
typedef RpWorldSector *(*RpPVSCallBack) (RpWorldSector * worldSector,
const RwBBox * box,
void *pData);
#define RpPVSCallback RpPVSCallBack
typedef struct _RpPVSCallBack _RpPVSCallBack;
struct _RpPVSCallBack
{
RpPVSCallBack callback;
void *data;
};
enum _rpPVSPartitionId
{
rpNAPVSPARTITIONID = 0,
rpPVSFRONT,
rpPVSBACK,
rpPVSSPLIT,
rpPVSCOPLANAR,
rpPVSPARTITIONIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum _rpPVSPartitionId _rpPVSPartitionId;
typedef struct _rpPVSPolyList _rpPVSPolyList;
typedef struct _rpPVSPolyList *_rpPVSPolyListPtr;
typedef struct _rpPVSPoly _rpPVSPoly;
typedef struct _rpPVSPoly *_rpPVSPolyPtr;
typedef struct _rpPVSPlaneEq _rpPVSPlaneEq;
struct _rpPVSPlaneEq
{
RwReal x;
RwReal y;
RwReal z;
RwReal w;
RwReal l; /* recip of length of the normal */
_rpPVSPartitionId lastresult; /* temp: stores result of last polygon wrt this plane */
};
typedef struct
{
RwInt32 x;
RwInt32 y;
RwInt32 z;
}RwV3i;
typedef struct _rpPVSPolyRecord _rpPVSPolyRecord;
struct _rpPVSPolyRecord
{
RwBool original; /* True if not a fragment */
RwReal priority; /* Used for sorting, lower values higher priority */
_rpPVSPolyListPtr parent; /* Unique pointer to original parent */
_rpPVSPolyPtr geom; /* corners of the poly */
_rpPVSPlaneEq plane; /* plane equation of the poly */
RwInt32 home; /* world sector id in range 0..numsectors */
RpWorldSector *homeaddr; /* world sector pointer */
RwBool translucent;
RwBool hasbeenclipper; /* Used during WA creation */
/* used by proximity culling, calculated once */
RwV3d centroid;
RwReal radius;
RwV3d extreme; /* the vertex furthest away from the centroid */
RwReal coneRadius; /* Used during clipping only */
};
struct _rpPVSPoly
{
RwV3d v;
_rpPVSPoly *next;
RwInt32 pscalar; /* Used during clipping only */
RwReal scalar; /* Used during clipping only */
_rpPVSPlaneEq shadowPlane; /* Used during clipping only */
};
struct _rpPVSPolyList
{
_rpPVSPolyRecord data;
_rpPVSPolyList *next;
};
typedef struct RpPVS RpPVS;
struct RpPVS
{
RwInt32 sectorID; /* Id of the sector */
RwInt32 vismaplength; /* Length of vismap */
RwInt32 sampleKey; /* Currently unused, for future use */
RpPVSVisMap *vismap;
_rpPVSPolyListPtr sectailpoly; /* Pointer to last polygon in polygons list that is in this sector */
_rpPVSPartitionId potential; /* temp: is sector in out or split from current shadow volume - for heirarchical clip */
RwUInt32 numpols;
RwBBox sbox; /* Bounding box of the sector */
RwBBox gbox; /* Bounding box of the geometry of the sector */
RwReal diagonal; /* Diagonal size of bounding box of the sector */
RwV3d centre; /* Centre of the sector */
RwInt32 axessig[3]; /* sampling significance of the axes of the gbox */
};
typedef struct RpPVSCache RpPVSCache;
struct RpPVSCache
{
RwBool processed; /* flag to indicate exisiting PVS data for the world */
RwBool formatted; /* flag to indicate exisiting intermediate polygonal data for PVS generation */
/* stats collection */
RwInt32 ptotal;
RwInt32 paccept;
/* pipeline hooking */
RwBool hooked;
/* used during vismap allocation */
RwUInt32 nextID;
RwInt32 viscount;
/* Used during construction */
RpPVSProgressCallBack progressCallBack;
_rpPVSPolyListPtr polygons; /* A copy of the input data set of all world polygons */
RpWorldSectorCallBackRender renderCallBack;
};
typedef struct RpPVSGlobalVars RpPVSGlobalVars;
struct RpPVSGlobalVars
{
RpWorld *World;
RwInt32 worldOffset; /* Offset into global data */
RwInt32 sectorOffset; /* Offset into global data */
RwBool collis; /* Collision detection */
RwBool bfc; /* Backface culling */
RwInt32 NumWorldSectors;
RwInt32 progress_count;
RwReal diagonal;
RwReal gran;
RwInt32 InSector; /* Current sector id */
RwV3d ViewPos; /* Current view pos */
RpPVS *CurrPVS; /* Current PVS sector */
};
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RpPVSGlobalVars rpPVSGlobals;
extern RpWorld *
RpPVSSetProgressCallBack(RpWorld * wpWorld,
RpPVSProgressCallBack
callback);
extern RpWorldSector *
RpPVSSetViewPosition(RpWorld * wpWorld,
RwV3d * pos);
extern RpWorldSector *
RpPVSSetViewSector(RpWorld * wpWorld, RpWorldSector * spSect);
extern RpWorldSector *
RpPVSSetWorldSectorPairedVisibility(RpWorldSector * spSectA,
RpWorldSector * spSectB,
RwBool visible,
RwBool mutual);
extern RpWorld *
RpPVSDestroy(RpWorld * wpWorld);
extern RwBool
RpPVSWorldSectorVisible(RpWorldSector * spSect);
extern RwBool
RpPVSPluginAttach(void);
extern RwBool
RpPVSQuery(RpWorld * wpWorld);
extern RwBool
RpPVSAtomicVisible(RpAtomic * atom);
extern RpWorld *
RpPVSStatisticsGet(RpWorld * wpWorld,
RwInt32 * ptotal,
RwInt32 * paccept);
extern RpPVSProgressCallBack
RpPVSGetProgressCallBack(RpWorld *
wpWorld);
extern RpWorld *
RpPVSConstruct(RpWorld * wpWorld,
RpPVSCallBack callback,
void *pData);
extern RpWorld*
RpPVSConstructSector(RpWorld * wpWorld,
RpWorldSector * spSector,
RpPVSCallBack callback,
void *pData);
extern RpWorldSector *
RpPVSGeneric(RpWorldSector * spSect,
const RwBBox __RWUNUSED__ * box,
void *data);
extern RwBool
RpPVSSetCollisionDetection(RwBool collis);
extern RwBool
RpPVSSetBackFaceCulling(RwBool bfc);
extern RpWorld *
RpPVSUnhook(RpWorld * wpWorld);
extern RpWorld *
RpPVSHook(RpWorld * wpWorld);
extern RpWorldSector *
RpPVSSetWorldSectorVisibility(RpWorldSector * spSect,
RwBool visible);
extern RwBool
RpPVSSamplePOV(RwV3d * pos,
RwBool colltest);
extern RxNodeDefinition *
RxNodeDefinitionGetPVSWorldSectorCSL(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* These functions are added for backwards compatibility... */
#define RpPVSCreate(_wpWorld, \
_raster, _zraster, _mindist, \
_maxdist, _maxdepth, _callback, _pData) \
RpPVSConstruct(_wpWorld, _callback, _pData)
#define RpPVSAddPOV(_pos) \
RpPVSSamplePOV(_pos, FALSE)
#define RpPVSAddWorldSector(_sector) \
RpPVSSetWorldSectorVisibility(_sector, TRUE)
#define RpPVSAddExtraPOV(_world, _raster, _zraster, _mindist, _mazdist, _matrix) \
MACRO_START \
{ \
rpPVSGlobals.World = (_world); \
RpPVSSamplePOV(&((_matrix)->pos), TRUE); \
} \
MACRO_STOP
#endif /* _RPPVS_H */

View File

@ -0,0 +1,640 @@
enum e_rwdb_CriterionGPVS
{
e_rwdb_CriterionGPVSLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionGPVS e_rwdb_CriterionGPVS;

View File

@ -0,0 +1,65 @@
/**********************************************************************
*
* File : rprandom.h
*
* Abstract : Random Number Generator
*
**********************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 1998 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
************************************************************************/
#ifndef RPRANDOM_H
#define RPRANDOM_H
/**
* \defgroup rprandom RpRandom
* \ingroup rpplugin
*
* Random Number Generation Plugin for RenderWare Graphics.
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rprandom.rpe" /* automatically generated header file */
/*--- Plugin API Functions ---*/
#define RPRANDMAX (~((~0)<<31))
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
RwBool RpRandomPluginAttach(void);
/* Getting values */
extern RwUInt32 RpRandom(void);
extern void RpRandomSeed(RwUInt32 seed);
extern RwUInt32 RpRandomMT(void);
extern void RpRandomSeedMT(RwUInt32 seed);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPRANDOM_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionRandom
{
e_rwdb_CriterionRandomLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionRandom e_rwdb_CriterionRandom;

222
rwsdk/include/d3d8/rpskin.h Normal file
View File

@ -0,0 +1,222 @@
#ifndef RPSKIN_H
#define RPSKIN_H
/**
* \defgroup rpskin RpSkin
* \ingroup rpplugin
*
* Skin Plugin for RenderWare Graphics.
*/
/*===========================================================================*
*--- Include files ---------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpcriter.h"
#include "rpskin.rpe"
#include "rphanim.h"
/*===========================================================================*
*--- Global Types ----------------------------------------------------------*
*===========================================================================*/
typedef struct RwMatrixWeights RwMatrixWeights;
/**
* \ingroup rpskin
* \struct RwMatrixWeights
* A structure for defining up to four matrix weights per vertex.
* Not all entries need to be used.
*
* \note
* Values should be sorted, such that any zero 0.0f entries appear
* after the valid weights. Any weights that appear after a zero
* entry will be ignored.
*
* \see RpSkinCreate
*/
struct RwMatrixWeights
{
RwReal w0; /**< The first matrix weight. */
RwReal w1; /**< The second matrix weight. */
RwReal w2; /**< The third matrix weight. */
RwReal w3; /**< The fourth matrix weight. */
};
/**
* \ingroup rpskin
* \typedef RpSkin
*
* Skin object. This should be considered an opaque type.
* Use the RpSkin API functions to access.
*
* \see RpSkinCreate
* \see RpSkinDestroy
*/
typedef struct RpSkin RpSkin;
/*===========================================================================*
*--- Plugin API Functions --------------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*---------------------------------------------------------------------------*
*- Plugin functions -*
*---------------------------------------------------------------------------*/
extern RwBool
RpSkinPluginAttach(void);
/*---------------------------------------------------------------------------*
*- Skin Atomic functions -*
*---------------------------------------------------------------------------*/
extern RpAtomic *
RpSkinAtomicSetHAnimHierarchy( RpAtomic *atomic,
RpHAnimHierarchy *hierarchy );
extern RpHAnimHierarchy *
RpSkinAtomicGetHAnimHierarchy( const RpAtomic *atomic );
/*---------------------------------------------------------------------------*
*- Skin Geometry functions -*
*---------------------------------------------------------------------------*/
extern RpGeometry *
RpSkinGeometrySetSkin( RpGeometry *geometry,
RpSkin *skin );
extern RpSkin *
RpSkinGeometryGetSkin( RpGeometry *geometry );
extern RpSkin *
RpSkinCreate( RwUInt32 numVertices,
RwUInt32 numBones,
RwMatrixWeights *vertexWeights,
RwUInt32 *vertexIndices,
RwMatrix *inverseMatrices );
extern RpSkin *
RpSkinDestroy( RpSkin *skin );
extern RwUInt32
RpSkinGetNumBones( RpSkin *skin );
extern const RwMatrixWeights *
RpSkinGetVertexBoneWeights( RpSkin *skin );
extern const RwUInt32 *
RpSkinGetVertexBoneIndices( RpSkin *skin );
extern const RwMatrix *
RpSkinGetSkinToBoneMatrices( RpSkin *skin );
/*---------------------------------------------------------------------------*
*- Skin pipeline -*
*---------------------------------------------------------------------------*/
/**
* \ingroup rpskin
* \ref RpSkinType defines the different ways a skinned atomic can
* be rendered. Once a skinned \ref RpGeometry has been attached to
* an \ref RpAtomic the atomic must be setup with the correct skin
* rendering pipeline with \ref RpSkinAtomicSetType.
*/
enum RpSkinType
{
rpNASKINTYPE = 0, /**<Invalid skin pipeline. */
rpSKINTYPEGENERIC = 1, /**<Generic skin rendering. */
rpSKINTYPEMATFX = 2, /**<Material effects skin rendering. */
rpSKINTYPETOON = 3, /**<Toon skin rendering. */
rpSKINTYPEMATFXTOON = 4, /**<Note Toon + MatFX on same object NOT currently supported */
rpSKINTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpSkinType RpSkinType;
extern RpAtomic *
RpSkinAtomicSetType( RpAtomic *atomic,
RpSkinType type );
extern RpSkinType
RpSkinAtomicGetType( RpAtomic *atomic );
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---------------------------------------------------------------------------*
*- Backwards macros -*
*---------------------------------------------------------------------------*/
#define RpSkinAtomicGetSkin(_a) \
RpSkinGeometryGetSkin(RpAtomicGetGeometry(_a))
/*---------------------------------------------------------------------------*/
/*---- start: ./d3d8/skinplatform.h----*/
/**
* \defgroup rpskind3d8 D3D8
* \ingroup rpskin
*
* D3D8 skin pipeline extension.
*/
/*===========================================================================*
*--- D3D8 Defines -----------------------------------------------------------*
*===========================================================================*/
/*===========================================================================*
*--- D3D8 Global Types ------------------------------------------------------*
*===========================================================================*/
/**
* \ingroup rpskind3d8
* \ref RpSkinD3D8Pipeline rendering pipelines available within
* the \ref RpSkin plugin. Use \ref RpSkinGetD3D8Pipeline to
* retrieve the \ref RxPipeline's.
*/
enum RpSkinD3D8Pipeline
{
rpNASKIND3D8PIPELINE = 0,
rpSKIND3D8PIPELINEGENERIC = 1,
/**<D3D8 generic skin rendering pipeline. */
rpSKIND3D8PIPELINEMATFX = 2,
/**<D3D8 material effect skin rendering pipeline. */
rpSKIND3D8PIPELINETOON = 3,
/**<D3D8 toon skin rendering pipeline. */
rpSKIND3D8PIPELINEMATFXTOON = 4,
/**<D3D8 toon matfx skin rendering pipeline not supported */
rpSKIND3D8PIPELINEMAX,
rpSKIND3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpSkinD3D8Pipeline RpSkinD3D8Pipeline;
/*===========================================================================*
*--- D3D8 Plugin API Functions ----------------------------------------------*
*===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*---------------------------------------------------------------------------*/
extern RxPipeline *
RpSkinGetD3D8Pipeline( RpSkinD3D8Pipeline D3D8Pipeline );
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*---- end: ./d3d8/skinplatform.h----*/
#endif /* RPSKIN_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionSKIN
{
e_rwdb_CriterionSKINLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionSKIN e_rwdb_CriterionSKIN;

View File

@ -0,0 +1,141 @@
/*
* Structure for splines
*
*
* Copyright (c) Criterion Software Limited
*/
/******************************************/
/* */
/* RenderWare(TM) Graphics Library */
/* */
/******************************************/
/*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd.
* or Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. and Canon Inc. will not, under any
* circumstances, be liable for any lost revenue or other damages
* arising from the use of this file.
*
* Copyright (c) 1998. Criterion Software Ltd.
* All Rights Reserved.
*/
/***************************************************************************
* *
* Module : rpspline.h *
* *
* Purpose : Spline operations *
* *
**************************************************************************/
#ifndef RPSPLINE_H
#define RPSPLINE_H
/**
* \defgroup rpspline RpSpline
* \ingroup rpplugin
*
* Spline Plugin for RenderWare Graphics.
*/
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpspline.rpe" /* automatically generated header file */
/****************************************************************************
Global Types
*/
#define rpSPLINENAMELENGTH (32)
typedef struct RpSpline RpSpline;
/**
* \ingroup rpspline
* \struct RpSpline
* Spline object. This should be considered an opaque type.
* Use the RpSpline API functions to access.
*/
struct RpSpline
{
RwObject tType; /**< Internal Use */
RwInt32 numCtrlPoints; /**< Internal Use */
RwInt32 nSplineType; /**< Internal Use */
void *pUser; /**< Internal Use */
RwV3d *ctrlPoints; /**< Internal Use */
RwChar caName[rpSPLINENAMELENGTH]; /**< Internal Use */
/* Keep this at tail */
RwV3d vPts[1]; /**< Internal Use */
};
/* Spline types */
#define rpSPLINETYPEOPENLOOPBSPLINE (1) /* Bezier spline, open loop */
#define rpSPLINETYPECLOSEDLOOPBSPLINE (2) /* Bezier spline, closed loop */
/* Spline path types */
#define rpSPLINEPATHSMOOTH (10) /* Normal */
#define rpSPLINEPATHNICEENDS (11) /* Slows down the path at the ends */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Opening the spline plugin */
extern RwBool RpSplinePluginAttach(void);
/* Creating and destroying splines */
extern RpSpline *RpSplineCreate(RwInt32 numCtrlPoints, RwInt32 type, RwV3d *ctrlPoints);
extern RwBool RpSplineDestroy(RpSpline *spline);
/* Finding a point and its tangent vector on the spline */
extern RwV3d *RpSplineFindPosition(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *pos, RwV3d *tangent);
/* Finding a frame on the spline */
extern RwReal RpSplineFindMatrix(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *up, RwMatrix *matrix);
/* LEGACY-SUPPORT MACRO */
#define RpSplineFindFrame RpSplineFindMatrix
/* Getting and setting the control points */
extern RwInt32 RpSplineGetNumControlPoints(const RpSpline *spline);
extern RwV3d *RpSplineGetControlPoint(RpSpline *spline, RwInt32 control, RwV3d *point);
extern RpSpline *RpSplineSetControlPoint(RpSpline *spline, RwInt32 control, RwV3d * point);
/* Copy a spline */
extern RpSpline *RpSplineClone(RpSpline *spline);
/* Spline reading and writing helper functions */
extern RpSpline *RpSplineRead(RwChar *name);
extern RwBool RpSplineWrite(RpSpline *spline, RwChar *name);
/* Binary format */
extern RwUInt32 RpSplineStreamGetSize(const RpSpline *spline);
extern RpSpline *RpSplineStreamRead(RwStream *stream);
extern const RpSpline *RpSplineStreamWrite(const RpSpline *spline, RwStream *stream);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPSPLINE_H */

View File

@ -0,0 +1,642 @@
enum e_rwdb_CriterionSpline
{
E_RP_SPLINE_INVNAME,
E_RP_SPLINE_INVTYPE,
E_RP_SPLINE_INVCONTROLS,
E_RP_SPLINE_OPEN,
E_RP_SPLINE_PLUGINNOTINIT,
e_rwdb_CriterionSplineLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionSpline e_rwdb_CriterionSpline;

View File

@ -0,0 +1,141 @@
/*
* Stereo camera plugin
*/
/**********************************************************************
*
* File : rpstereo.h
*
* Abstract : Add Stereo Camera support to RenderWare
*
**********************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 1998 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
************************************************************************/
#ifndef RPSTEREO_H
#define RPSTEREO_H
/**
* \defgroup rpstereo RpStereo
* \ingroup rpplugin
*
* Stereo Camera Plugin for RenderWare Graphics.
*/
/*--- Include files ---*/
#include <rwcore.h>
#include <rpworld.h>
#include "rpstereo.rpe" /* automatically generated header file */
/*--- Global Structures ---*/
/* Supported Stereo Modes */
/**
* \ingroup rpstereo
* \ref RpStereoCameraMode
* Stereo camera mode enumeration.
*/
enum RpStereoCameraMode
{
rpNASTEREOMODE = 0,
rpSTEREOMONO, /**< Render as Mono camera - single
* image
*/
rpSTEREOLEFTRIGHT, /**< Vertical split screen. Left eye
* image on left of screen. Right eye
* image on right of screen.
*/
rpSTEREORIGHTLEFT, /**< Vertical split screen. Right eye
* image on left of screen. Left eye image
* on right of screen.
*/
rpSTEREOROTATE90, /**< As for rpSTEREOLEFTRIGHT - with
* the images rotated inwards by 90 degrees
*/
rpSTEREOINTERLACEDLEFTRIGHT, /**< Left and right eye images on
* alternate scanlines. The left eye image
* on the topmost line of the display.
*/
rpSTEREOINTERLACEDRIGHTLEFT, /**< Left and right eye images on
* alternate scanlines. The right eye
* image is on the topmost line of the
* display.
*/
rpSTEREOLASTMODE,
rpSTEREOCAMERAMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
/*
* typedef for stereo camera mode enumeration.
*/
typedef enum RpStereoCameraMode RpStereoCameraMode;
/*--- Constants ---*/
/* These may be used to quickly adapt an existing application to a
* stereo version.
*/
#ifdef RPSTEREO_OVERLOAD
#define RwCameraBeginUpdate RpStereoCameraBeginUpdate
#define RwCameraEndUpdate RpStereoCameraEndUpdate
#undef RpWorldRender
#define RpWorldRender RpStereoWorldRender
#undef RpClumpRender
#define RpClumpRender RpStereoClumpRender
#undef RpAtomicRender
#define RpAtomicRender RpStereoAtomicRender
#undef RpWorldSectorRender
#define RpWorldSectorRender RpStereoWorldSectorRender
#endif
/*--- Plugin API Functions ---*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
RwBool RpStereoPluginAttach(void);
RpWorld *RpStereoWorldRender(RpWorld *world);
RpClump *RpStereoClumpRender(RpClump *clump);
RpAtomic *RpStereoAtomicRender(RpAtomic *atomic);
RpWorldSector *RpStereoWorldSectorRender(RpWorldSector *sector);
RwCamera *RpStereoCameraBeginUpdate(RwCamera *camera);
RwCamera *RpStereoCameraEndUpdate(RwCamera *stereoCam);
RwReal RpStereoCameraGetSeparation(RwCamera *stereoCam);
RwReal RpStereoCameraGetFocal(RwCamera *stereoCam);
RpStereoCameraMode RpStereoCameraGetMode(RwCamera *stereoCam);
RwCamera *RpStereoCameraSetSeparation(RwCamera *stereoCam, RwReal dist);
RwCamera *RpStereoCameraSetFocal(RwCamera *stereoCam, RwReal focal);
RwCamera *RpStereoCameraSetMode(RwCamera *stereoCam, RpStereoCameraMode newMode);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RPSTEREO_H */

View File

@ -0,0 +1,641 @@
enum e_rwdb_CriterionStereo
{
E_RP_STEREO_INVMODE,
E_RP_STEREO_INVFOCAL,
e_rwdb_CriterionStereoLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionStereo e_rwdb_CriterionStereo;

View File

@ -0,0 +1,124 @@
#ifndef RPUSERDATAPLUGIN_H
#define RPUSERDATAPLUGIN_H
/**
* \defgroup rpuserdata RpUserData
* \ingroup rpplugin
*
* User Data Plugin for RenderWare Graphics.
*/
/*
* UserData plugin
*/
#include <rwcore.h>
#include <rpworld.h>
/**
* \ingroup rpuserdata
* User data formats
*/
enum RpUserDataFormat
{
rpNAUSERDATAFORMAT = 0,
rpINTUSERDATA, /**< 32 bit int data */
rpREALUSERDATA, /**< 32 bit float data */
rpSTRINGUSERDATA, /**< unsigned byte pointer data */
rpUSERDATAFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
typedef enum RpUserDataFormat RpUserDataFormat;
typedef struct RpUserDataArray RpUserDataArray;
/**
* \ingroup rpuserdata
* \struct RpUserDataArray
* A structure representing an array of user data values
*/
struct RpUserDataArray
{
RwChar *name; /**< Identifier for this data array */
RpUserDataFormat format; /**< Data format of this array */
RwInt32 numElements; /**< Number of elements in this array */
void *data; /**< Pointer to the array data */
};
#ifdef __cplusplus
extern "C"
{
#endif
/* Plugin API */
extern RwBool RpUserDataPluginAttach(void);
/* Geometry API */
extern RwInt32 RpGeometryAddUserDataArray(RpGeometry *geometry, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RpGeometry *RpGeometryRemoveUserDataArray(RpGeometry *geometry, RwInt32 index);
extern RpUserDataArray *RpGeometryGetUserDataArray(const RpGeometry *geometry, RwInt32 data);
extern RwInt32 RpGeometryGetUserDataArrayCount(const RpGeometry *geometry);
/* World Sector API */
extern RwInt32 RpWorldSectorAddUserDataArray(RpWorldSector *sector, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RpWorldSector *RpWorldSectorRemoveUserDataArray(RpWorldSector *sector, RwInt32 index);
extern RpUserDataArray *RpWorldSectorGetUserDataArray(const RpWorldSector *sector, RwInt32 data);
extern RwInt32 RpWorldSectorGetUserDataArrayCount(const RpWorldSector *sector);
/* RwFrame API */
extern RwInt32 RwFrameAddUserDataArray(RwFrame *frame, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RwFrame *RwFrameRemoveUserDataArray(RwFrame *frame, RwInt32 index);
extern RpUserDataArray *RwFrameGetUserDataArray(const RwFrame *frame, RwInt32 data);
extern RwInt32 RwFrameGetUserDataArrayCount(const RwFrame *frame);
/* RwCamera API */
extern RwInt32 RwCameraAddUserDataArray(RwCamera *camera, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RwCamera *RwCameraRemoveUserDataArray(RwCamera *camera, RwInt32 index);
extern RpUserDataArray *RwCameraGetUserDataArray(const RwCamera *camera, RwInt32 data);
extern RwInt32 RwCameraGetUserDataArrayCount(const RwCamera *camera);
/* RpLight API */
extern RwInt32 RpLightAddUserDataArray(RpLight *light, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RpLight *RpLightRemoveUserDataArray(RpLight *light, RwInt32 index);
extern RpUserDataArray *RpLightGetUserDataArray(const RpLight *light, RwInt32 data);
extern RwInt32 RpLightGetUserDataArrayCount(const RpLight *light);
/* RpMaterial API */
extern RwInt32 RpMaterialAddUserDataArray(RpMaterial *material, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RpMaterial *RpMaterialRemoveUserDataArray(RpMaterial *material, RwInt32 index);
extern RpUserDataArray *RpMaterialGetUserDataArray(const RpMaterial *material, RwInt32 data);
extern RwInt32 RpMaterialGetUserDataArrayCount(const RpMaterial *material);
/* RwTexture API */
extern RwInt32 RwTextureAddUserDataArray(RwTexture *texture, RwChar *name,
RpUserDataFormat format, RwInt32 numElements);
extern RwTexture *RwTextureRemoveUserDataArray(RwTexture *texture, RwInt32 index);
extern RpUserDataArray *RwTextureGetUserDataArray(const RwTexture *texture, RwInt32 data);
extern RwInt32 RwTextureGetUserDataArrayCount(const RwTexture *texture);
/* User Data Array API */
extern RwChar *RpUserDataArrayGetName(RpUserDataArray *userData);
extern RpUserDataFormat RpUserDataArrayGetFormat(RpUserDataArray *userData);
extern RwInt32 RpUserDataArrayGetNumElements(RpUserDataArray *userData);
extern RwInt32 RpUserDataArrayGetInt(RpUserDataArray *userData, RwInt32 index);
extern RwReal RpUserDataArrayGetReal(RpUserDataArray *userData, RwInt32 index);
extern RwChar *RpUserDataArrayGetString(RpUserDataArray *userData, RwInt32 index);
extern void RpUserDataArraySetInt(RpUserDataArray *userData, RwInt32 index, RwInt32 value);
extern void RpUserDataArraySetReal(RpUserDataArray *userData, RwInt32 index, RwReal value);
extern void RpUserDataArraySetString(RpUserDataArray *userData, RwInt32 index, RwChar *value);
extern RwInt32 RpUserDataGetFormatSize(RpUserDataFormat format);
#ifdef __cplusplus
}
#endif
#endif /* RPUSERDATAPLUGIN_H */

View File

@ -0,0 +1,639 @@
enum e_rwdb_CriterionUserData
{
e_rwdb_CriterionUserDataLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionUserData e_rwdb_CriterionUserData;

3735
rwsdk/include/d3d8/rpworld.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
enum e_rwdb_CriterionWorld
{
E_RP_WORLD_INVSPHERE,
E_RP_WORLD_INVINTERSECTION,
E_RP_WORLD_MATRANGE,
E_RP_WORLD_CLUMPINWORLD,
E_RP_WORLD_CLUMPNOTINWORLD,
E_RP_WORLD_ATOMICNOFRAME,
E_RP_WORLD_TOOMANYVERTICES,
e_rwdb_CriterionWorldLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionWorld e_rwdb_CriterionWorld;

911
rwsdk/include/d3d8/rt2d.h Normal file
View File

@ -0,0 +1,911 @@
/*
* Data structures for 2d toolkit
*
* Copyright (c) Criterion Software Limited
*/
/***************************************************************************
* *
* Module : rt2d.h *
* *
* Purpose : *
* *
**************************************************************************/
#ifndef RT2D_H
#define RT2D_H
/**
* \defgroup rt2d Rt2d
* \ingroup rttool
*
* 2D Rendering Toolkit for RenderWare.
*/
/**
* \defgroup rt2ddatatypes Data Types
* \ingroup rt2d
*
* Basic Data Types
*/
/**
* \defgroup rt2dsub Rt2d
* \ingroup rt2d
*
* Rt2d functions
*/
/**
* \defgroup rt2dbrush Rt2dBrush
* \ingroup rt2d
*
* Brush functions
*/
/**
* \defgroup rt2dctm Rt2dCTM
* \ingroup rt2d
*
* Current Transformation Matrix (CTM)
*/
/**
* \defgroup rt2ddevice Rt2dDevice
* \ingroup rt2d
*
* Camera device functions
*/
/**
* \defgroup rt2dfont Rt2dFont
* \ingroup rt2d
*
* Font functions
*/
/**
* \defgroup rt2dobject Rt2dObject
* \ingroup rt2d
*
* Objects
*/
/**
* \defgroup rt2dobjectstring Rt2dObjectString
* \ingroup rt2d
*
* String functions
*/
/**
* \defgroup rt2dpath Rt2dPath
* \ingroup rt2d
*
* Path functions
*/
/**
* \defgroup rt2dpickregion Rt2dPickRegion
* \ingroup rt2d
*
* Pick regions
*/
/**
* \defgroup rt2dscene Rt2dScene
* \ingroup rt2d
*
* Scenes
*/
/**
* \defgroup rt2dshape Rt2dShape
* \ingroup rt2d
*
* Shapes
*/
/**
* \defgroup rt2drwv2d RwV2d
* \ingroup rt2d
*
* Rt2d plugin directly extends the Core Library's RwV2d API functions.
*/
/****************************************************************************
Includes
*/
#include "rt2d.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
#define Rt2dBrushSetWidthMacro(_brush, _width) \
( ( (_brush)->halfwidth = ((_width) * 0.5f) ), (_brush) )
#define Rt2dBrushGetWidthMacro(_brush) \
( (_brush)->halfwidth * 2.0f )
#define Rt2dCTMReadMacro(_result) \
(RwMatrixCopy((_result), _rt2dCTMGet()), (_result))
/****************************************************************************
Global Types
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*
* rt2dShadeParameters
* typedef for a structure describing Shade Parameters
*/
typedef struct rt2dShadeParameters rt2dShadeParameters;
/*
*
* rt2dShadeParameters
* describes Shade Parameters
*/
struct rt2dShadeParameters
{
RwRGBAReal col; /* col */
RwV2d uv; /* uv */
};
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dBrush
* typedef for a structure describing a Brush (opaque)
*/
typedef struct Rt2dBrush Rt2dBrush;
/*
* Rt2dBrush
* structure describing a Brush
*/
#if defined (GCN_DRVMODEL_H)
#define VERTEXCACHESIZE 64
#else
#define VERTEXCACHESIZE 256
#endif
struct Rt2dBrush
{
RWIM3DVERTEX vertex[VERTEXCACHESIZE];
rt2dShadeParameters top;
rt2dShadeParameters dtop;
rt2dShadeParameters bottom;
rt2dShadeParameters dbottom;
RwInt32 calcFields;
RwTexture *texture;
RwReal halfwidth;
};
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dPath
* typedef for a structure describing a Path (opaque)
*/
typedef struct Rt2dPath Rt2dPath;
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dFont
* typedef for a structure describing a Font (opaque)
*/
typedef struct Rt2dFont Rt2dFont;
/*
* typedef used for referencing a spot in a font dictionary
*/
typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode;
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dBBox
* typedef for a structure describing a Bounding Box
*/
typedef struct Rt2dBBox Rt2dBBox;
/**
* \ingroup rt2ddatatypes
* \struct Rt2dBBox
* structure describing a Bounding Box
*/
struct Rt2dBBox
{
RwReal x; /**< x-coordinate of lower-left corner */
RwReal y; /**< y-coordinate of lower-left corner */
RwReal w; /**< Width */
RwReal h; /**< Height */
};
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dObject
* typedef for a structure describing a 2d Object
* This should be considered an opaque type.
* Use Rt2dObject, Rt2dScene, Rt2dShape, Rt2dPickRegion or Rt2dObjectString
* API functions to access.
*/
typedef struct Rt2dObject Rt2dObject;
/*
* typedef for a structure describing a scene of shapes (opaque)
*/
typedef struct _rt2dScene _rt2dScene;
/*
* typedef for a structure describing the depth of an object
*/
typedef struct _rt2dDepthOfObject _rt2dDepthOfObject;
/*
* typedef for a structure describing the depth of an object
*/
struct _rt2dDepthOfObject
{
Rt2dObject *object;
RwInt32 depth;
};
/*
* structure describing a scene of shapes
*/
struct _rt2dScene
{
RwSList *objects; /* collection of objects in scene */
RwInt32 objectCount; /* number of objects */
RwSList *depths; /* depths for depthsort */
RwBool isDirtyDepths; /* depthsort needs updating */
};
/*
* typedef for a structure describing a shape (opaque)
*/
typedef struct _rt2dShape _rt2dShape;
struct _rt2dShape
{
RwSList *nodes; /* individual stroked/filled regions of the shape */
};
/*
* typedef for a structure describing a pick region that can be tested for point inclusion (opaque)
*/
typedef struct _rt2dPickRegion _rt2dPickRegion;
/*
* structure describing a pick region that can be tested for point inclusion
*/
struct _rt2dPickRegion
{
Rt2dPath *path; /* path that defines region for testing */
Rt2dBBox bbox; /* bounding box of path */
RwMatrix transformation;
/* ivnert transformation used to place the pick region */
};
/*
* structure describing a renderable text string
*/
struct _rt2dObjectString
{
RwChar *textString; /* Text string to be rendered */
Rt2dBrush *brush; /* Brush to be used to draw text */
RwInt32 maxLength; /* Maximum string length before reallocation, excluding null */
RwReal height; /* Font rendering Height */
_rt2dFontDictionaryNode *font; /* Dictionary node identifying font to be used */
};
/*
* typedef for a renderable string
*/
typedef struct _rt2dObjectString _rt2dObjectString;
/**
* \ingroup rt2ddatatypes
* \ref Rt2dObjectTypeEnum
* enumeration describing types of Rt2dObject
*/
enum Rt2dObjectTypeEnum {
rt2DOBJECTTYPEOBJECT=0, /**<An untyped (yet) object */
rt2DOBJECTTYPESCENE, /**<Container of objects */
rt2DOBJECTTYPESHAPE, /**<Shape object */
rt2DOBJECTTYPEPICKREGION, /**<Pick region object */
rt2DOBJECTTYPEOBJECTSTRING, /**<Text string object */
rt2DOBJECTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
};
typedef union _rt2dObjectdata _rt2dObjectdata;
union _rt2dObjectdata
{
_rt2dShape shape;
_rt2dScene scene;
_rt2dPickRegion pickRegion;
_rt2dObjectString objectString;
};
/*
* A base structure for forming a hierarchy of 2D shapes
*/
#if (!defined(DOXYGEN))
#define Rt2dObjectIsLocked 0x00000001
#define Rt2dObjectDirtyLTM 0x00000002
#define Rt2dObjectVisible 0x00000004
struct Rt2dObject
{
RwInt32 type; /* tag identifying type of object */
RwInt32 depth; /* z-order of object under parent */
RwInt32 flag; /* ... */
RwMatrix MTM; /* local transformation matrix for object */
RwMatrix LTM; /* global transformation matrix for object */
RwRGBAReal colorMult; /* color multiply applied to object */
RwRGBAReal colorOffs; /* color offset applied to object */
_rt2dObjectdata data;
};
#endif /* (!defined(DOXYGEN)) */
/**
* \ingroup rt2ddatatypes
* \typedef Rt2dObjectCallBack
* typedef for a callback on an object
*/
typedef Rt2dObject *(* Rt2dObjectCallBack)(Rt2dObject *object, Rt2dObject *parent, void *data);
/**
* \ingroup rt2ddatatypes
* \ref Rt2dJustificationType
* enumeration describing Justification
*/
enum Rt2dJustificationType
{
rt2dJUSTIFYLEFT, /**<Left-justification */
rt2dJUSTIFYCENTER, /**<Center-justification */
rt2dJUSTIFYRIGHT, /**<Right-justification */
rt2DJUSTIFICATIONTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
};
/*
* Rt2dObjectEnum
* typedef for a enumeration describing an object type enclosed by Rt2dObject
*/
typedef enum Rt2dJustificationType Rt2dJustificationType;
#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
#define Rt2dBrushSetWidth(_brush, _width) \
Rt2dBrushSetWidthMacro(_brush, _width)
#define Rt2dBrushGetWidth(_brush) \
Rt2dBrushGetWidthMacro(_brush)
#define Rt2dCTMRead(_result) \
Rt2dCTMReadMacro(_result)
#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
/****************************************************************************
Function prototypes
*/
/*
* INITIALIZE
*/
extern void
Rt2dOpen(RwCamera *cam);
extern void
Rt2dClose(void);
/*
* PATHS
*/
extern Rt2dPath *
Rt2dPathCreate(void);
extern RwBool
Rt2dPathDestroy(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathLock(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathUnlock(Rt2dPath *path);
extern RwBool
Rt2dPathIsLocked(Rt2dPath *path);
extern RwUInt32
Rt2dPathStreamGetSize(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathStreamWrite(Rt2dPath *path, RwStream *stream);
extern Rt2dPath *
Rt2dPathStreamRead(RwStream *stream);
extern Rt2dPath *
Rt2dPathEmpty(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathCopy(Rt2dPath *dst, const Rt2dPath *src);
extern Rt2dPath *
Rt2dPathInset(Rt2dPath *path, RwReal inset);
extern Rt2dPath *
Rt2dPathMoveto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathLineto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathRLineto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
extern Rt2dPath *
Rt2dPathRCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
extern Rt2dPath *
Rt2dPathClose(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
extern Rt2dPath *
Rt2dPathRoundRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h, RwReal radius);
extern Rt2dPath *
Rt2dPathOval(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
extern Rt2dPath *
Rt2dPathFlatten(Rt2dPath *path);
extern const Rt2dPath *
Rt2dPathGetBBox(const Rt2dPath *path, Rt2dBBox *bbox);
extern Rt2dPath *
Rt2dPathCreateMorphResultPath(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathMorph(Rt2dPath *result, Rt2dPath *source, Rt2dPath *destination, RwReal alpha);
/*
* BRUSHES
*/
extern Rt2dBrush *
Rt2dBrushCreate(void);
extern RwBool
Rt2dBrushDestroy(Rt2dBrush * brush);
extern Rt2dBrush *
Rt2dBrushSetRGBA(Rt2dBrush *brush, RwRGBA * col0, RwRGBA * col1, RwRGBA * col2, RwRGBA * col3);
extern Rt2dBrush *
Rt2dBrushSetUV(Rt2dBrush *brush, RwV2d *uv0, RwV2d *uv1, RwV2d *uv2, RwV2d *uv3);
extern Rt2dBrush *
Rt2dBrushSetTexture(Rt2dBrush* brush, RwTexture* texture);
extern RwUInt32
Rt2dBrushStreamGetSize(Rt2dBrush *brush);
extern Rt2dBrush *
Rt2dBrushStreamWrite(Rt2dBrush *brush, RwStream *stream);
extern Rt2dBrush *
Rt2dBrushStreamRead(RwStream *stream);
/*
* FONTS
*/
extern const RwChar *
Rt2dFontSetPath(const RwChar *path);
extern Rt2dFont *
Rt2dFontRead(const RwChar *name);
extern RwUInt32
_rt2dFontStreamGetSize(Rt2dFont *font);
extern Rt2dFont *
_rt2dFontStreamWrite(Rt2dFont *font, RwStream *stream);
extern Rt2dFont *
_rt2dFontStreamRead(RwStream *stream);
extern RwBool
Rt2dFontDestroy(Rt2dFont *font);
extern RwReal
Rt2dFontGetHeight(Rt2dFont *font);
extern RwReal
Rt2dFontGetStringWidth(Rt2dFont *font, const RwChar *string, RwReal height);
extern Rt2dFont *
Rt2dFontShow(Rt2dFont *font, const RwChar *string, RwReal height, RwV2d *anchor, Rt2dBrush *brush);
extern Rt2dFont *
Rt2dFontFlow(Rt2dFont* font, RwChar* string, RwReal height, Rt2dBBox* bbox, Rt2dJustificationType format, Rt2dBrush* brush);
extern Rt2dFont *
Rt2dFontSetIntergapSpacing(Rt2dFont *font, RwReal gap);
extern RwBool
Rt2dFontCacheFlush(void);
/*
* FILLING
*/
extern Rt2dPath *
Rt2dPathFill(Rt2dPath *path, Rt2dBrush *brush);
/*
* STROKING
*/
extern Rt2dPath *
Rt2dPathStroke(Rt2dPath *path, Rt2dBrush *brush);
/*
* TRANSFORMS
*/
extern RwBool
Rt2dCTMPush(void);
extern RwBool
Rt2dCTMPop(void);
extern RwBool
Rt2dCTMSetIdentity(void);
extern RwBool
Rt2dCTMScale(RwReal x, RwReal y);
extern RwBool
Rt2dCTMTranslate(RwReal x, RwReal y);
extern RwBool
Rt2dCTMRotate(RwReal theta);
extern RwBool
RwV2dIsInPath(RwV2d *point, Rt2dPath *path);
extern RwV2d *
RwV2dInvertTransform(RwV2d *pointOut, RwV2d *pointIn);
/*
* DEVICE SETTINGS
*/
extern RwBool
Rt2dDeviceSetCamera(RwCamera *cam);
extern RwCamera *
Rt2dDeviceGetCamera(void);
extern RwBool
Rt2dDeviceGetStep(RwV2d *xstep, RwV2d *ystep, RwV2d *origin);
extern RwBool
Rt2dDeviceSetMetric(RwReal x, RwReal y, RwReal w, RwReal h);
extern RwBool
Rt2dDeviceGetMetric(RwReal *x, RwReal *y, RwReal *w, RwReal *h);
extern RwBool
Rt2dDeviceSetFlat(RwReal r);
extern RwBool
Rt2dDeviceGetClippath(Rt2dPath *path);
extern RwBool
Rt2dVisible(RwReal x, RwReal y, RwReal w, RwReal h);
extern RwBool
Rt2dDeviceSetLayerDepth(RwReal depth);
extern RwBool
Rt2dSetPipelineFlags(RwUInt32 flags);
/*
* HIERARCHICAL SCENE FUNCTIONS - OBJECT MANIPULATION
*/
extern Rt2dObject *
Rt2dObjectSetVisible(Rt2dObject *object,RwBool visible);
extern RwBool
Rt2dObjectIsVisible(Rt2dObject *object);
extern void
Rt2dObjectMTMChanged(Rt2dObject *object);
extern RwMatrix *
Rt2dObjectGetLTM(Rt2dObject *object);
extern RwMatrix *
Rt2dObjectGetMTM(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetMTM(Rt2dObject *object, RwMatrix *mtm);
extern void
Rt2dObjectApplyCTM(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectMTMSetIdentity(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectMTMScale(Rt2dObject *object, RwReal x, RwReal y);
extern Rt2dObject *
Rt2dObjectMTMTranslate(Rt2dObject *object, RwReal x, RwReal y);
extern Rt2dObject *
Rt2dObjectMTMRotate(Rt2dObject *object, RwReal theta);
extern RwRGBAReal *
Rt2dObjectGetColorMultiplier(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetColorMultiplier(Rt2dObject *object, RwRGBAReal *multCol);
extern RwRGBAReal *
Rt2dObjectGetColorOffset(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetColorOffset(Rt2dObject *object, RwRGBAReal *oofsCol);
extern RwInt32
Rt2dObjectGetObjectType(Rt2dObject *object);
extern RwInt32
Rt2dObjectGetDepth(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetDepth(Rt2dObject *object, RwInt32 depth);
extern RwBool
Rt2dObjectIsScene(Rt2dObject *object);
extern RwBool
Rt2dObjectIsShape(Rt2dObject *object);
extern RwBool
Rt2dObjectIsPickRegion(Rt2dObject *object);
extern RwBool
Rt2dObjectIsObjectString(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src);
/*
* HIERARCHICAL SCENE FUNCTIONS - SCENE
*/
extern Rt2dObject *
Rt2dSceneCreate(void);
extern RwBool
Rt2dSceneDestroy(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneLock(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneUnlock(Rt2dObject *object);
extern RwInt32
Rt2dSceneGetChildCount(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneGetChildByIndex(Rt2dObject *scene, RwInt32 index);
extern RwV2d
Rt2dSceneGetCoordFromScreen(Rt2dObject *scene,RwV2d screenCoord );
extern Rt2dObject *
Rt2dSceneAddChild(Rt2dObject *scene, Rt2dObject *object);
/* Those are keeped for compatiblity with the present code */
extern Rt2dObject *
Rt2dSceneGetNewChildScene(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildShape(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildPickRegion(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildObjectString(Rt2dObject *object, const RwChar *text,
const RwChar *font);
extern Rt2dObject *
Rt2dSceneStreamWrite(Rt2dObject *shape, RwStream *stream);
extern RwUInt32
Rt2dSceneStreamGetSize(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dSceneRender(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneForAllChildren(Rt2dObject *scene, Rt2dObjectCallBack callback, void *pData );
extern Rt2dObject *
Rt2dSceneSetDepthDirty(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneUpdateLTM(Rt2dObject *scene);
/*
* HIERARCHICAL SCENE FUNCTIONS - SHAPE
*/
extern Rt2dObject *
Rt2dShapeCreate(void);
extern RwBool
Rt2dShapeDestroy(Rt2dObject * shape);
extern Rt2dBrush *
Rt2dShapeGetNewBrush(Rt2dObject *shape);
extern Rt2dPath *
Rt2dShapeGetNewPath(Rt2dObject *shape);
extern Rt2dObject *
Rt2dShapeAddNode(Rt2dObject *shape, Rt2dPath *path, Rt2dBrush *fill, Rt2dBrush *stroke );
extern RwInt32
Rt2dShapeGetNodeCount(Rt2dObject *shape);
extern Rt2dObject *
Rt2dShapeStreamWrite(Rt2dObject *shape, RwStream *stream);
extern RwUInt32
Rt2dShapeStreamGetSize(Rt2dObject *shape);
extern Rt2dObject *
Rt2dShapeStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dShapeRender(Rt2dObject *object);
extern Rt2dObject *
Rt2dShapeMorph(Rt2dObject *result,
Rt2dObject *source,
Rt2dObject *destination,
RwReal alpha);
/*
* HIERARCHICAL SCENE FUNCTIONS - PICK REGION
*/
extern Rt2dObject *
Rt2dPickRegionCreate(void);
extern RwBool
Rt2dPickRegionDestroy(Rt2dObject *pickRegion);
extern Rt2dPath *
Rt2dPickRegionGetPath(Rt2dObject *pickRegion);
extern RwBool
Rt2dPickRegionIsPointIn(Rt2dObject *pickRegion, RwV2d *point);
extern Rt2dObject *
Rt2dPickRegionStreamWrite(Rt2dObject *pickRegion, RwStream *stream);
extern RwUInt32
Rt2dPickRegionStreamGetSize(Rt2dObject *pickRegion);
extern Rt2dObject *
Rt2dPickRegionStreamRead(RwStream *stream);
/*
* HIERARCHICAL SCENE FUNCTIONS - TEXT STRINGS
*/
extern Rt2dObject *
Rt2dObjectStringCreate(const RwChar *textString, const RwChar *font);
extern RwBool
Rt2dObjectStringDestroy(Rt2dObject *object);
extern Rt2dBrush *
Rt2dObjectStringGetBrush(Rt2dObject *object);
extern RwChar *
Rt2dObjectStringGetText(Rt2dObject *object);
extern RwChar *
Rt2dObjectStringGetFont(Rt2dObject *object);
extern RwReal
Rt2dObjectStringGetHeight(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectStringSetBrush(Rt2dObject *object, Rt2dBrush *);
extern Rt2dObject *
Rt2dObjectStringSetText(Rt2dObject *object, const RwChar *text);
extern Rt2dObject *
Rt2dObjectStringSetFont(Rt2dObject *object, const RwChar *font);
extern Rt2dObject *
Rt2dObjectStringSetHeight(Rt2dObject *object, const RwReal height);
extern Rt2dObject *
Rt2dObjectStringStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dObjectStringStreamWrite(Rt2dObject *object, RwStream *stream);
extern RwUInt32
Rt2dObjectStringStreamGetSize(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectStringRender(Rt2dObject *object);
/*
* SPI for macros
*/
extern RwBool
_rt2dCTMPush(RwMatrix *matrix);
extern RwBool
_rt2dCTMSet(RwMatrix *matrix);
extern RwMatrix *
_rt2dCTMGet(void);
extern RwMatrix *
_rt2dCTMGetDirect(void);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern Rt2dBrush *
Rt2dBrushSetWidth(Rt2dBrush *brush, RwReal width);
extern RwReal
Rt2dBrushGetWidth(Rt2dBrush * brush);
extern RwMatrix *
Rt2dCTMRead(RwMatrix * result);
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define Rt2dFontStreamGetSize(_font) \
_rt2dFontStreamGetSize(_font)
#define Rt2dFontStreamWrite(_font,_stream) \
_rt2dFontStreamWrite(_font,_stream)
#define Rt2dFontStreamRead(_stream) \
_rt2dFontStreamRead(_stream)
#endif /* RT2D_H */

629
rwsdk/include/d3d8/rt2d.rpe Normal file
View File

@ -0,0 +1,629 @@
enum e_rwdb_Criterion2D
{
e_rwdb_Criterion2DLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_Criterion2D e_rwdb_Criterion2D;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,629 @@
enum rwPLUGIN_ERRENUM
{
rwPLUGIN_ERRENUMLAST = RWFORCEENUMSIZEINT
};
typedef enum rwPLUGIN_ERRENUM rwPLUGIN_ERRENUM;

141
rwsdk/include/d3d8/rtbary.h Normal file
View File

@ -0,0 +1,141 @@
/***************************************************************************
* *
* Module : rtbary.h *
* *
* Purpose : Barycentric operations *
* *
**************************************************************************/
#ifndef RTBARY_H
#define RTBARY_H
/**
* \defgroup rtbary RtBary
* \ingroup rttool
*
* Barycentric Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include <rwcore.h>
#include <rtbary.rpe> /* automatically generated header file */
/****************************************************************************
Global types
*/
/**
* \ingroup rtbary
* \typedef RtBaryV4d
* typedef for the 4 element homogeneous row of a transform matrix mapping
* a point from Cartesian space to the barycentric space defined by a triangle.
*/
typedef RwReal RtBaryV4d[4];
/**
* \ingroup rtbary
* \typedef RtBaryTransform
* typedef for the 4x4 homogeneous transform matrix mapping a point
* from Cartesian space to the barycentric space defined by a triangle.
*/
typedef RtBaryV4d RtBaryTransform[4];
/****************************************************************************
Defines
*/
#define RtBaryV3dFromWeightsMacro(_out, _b, _v0, _v1, _v2) \
MACRO_START \
{ \
(_out)->x = (RwReal)( ((_v0)->x * (_b)[0]) + \
((_v1)->x * (_b)[1]) + \
((_v2)->x * (_b)[2]) ); \
(_out)->y = (RwReal)( ((_v0)->y * (_b)[0]) + \
((_v1)->y * (_b)[1]) + \
((_v2)->y * (_b)[2]) ); \
(_out)->z = (RwReal)( ((_v0)->z * (_b)[0]) + \
((_v1)->z * (_b)[1]) + \
((_v2)->z * (_b)[2]) ); \
} \
MACRO_STOP
#define RtBaryWeightsFromV3dMacro(_out, _m, _in) \
MACRO_START \
{ \
(_out)[0] = ( (_m)[0][0] * (_in)->x + \
(_m)[1][0] * (_in)->y + \
(_m)[2][0] * (_in)->z + \
(_m)[3][0] ); \
(_out)[1] = ( (_m)[0][1] * (_in)->x + \
(_m)[1][1] * (_in)->y + \
(_m)[2][1] * (_in)->z + \
(_m)[3][1] ); \
(_out)[2] = ( (_m)[0][2] * (_in)->x + \
(_m)[1][2] * (_in)->y + \
(_m)[2][2] * (_in)->z + \
(_m)[3][2] ); \
(_out)[3] = ( (_m)[0][3] * (_in)->x + \
(_m)[1][3] * (_in)->y + \
(_m)[2][3] * (_in)->z + \
(_m)[3][3] ); \
} \
MACRO_STOP
#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
#define RtBaryV3dFromWeights(_out, _b, _v0, _v1, _v2) \
RtBaryV3dFromWeightsMacro(_out, _b, _v0, _v1, _v2)
#define RtBaryWeightsFromV3d(_out, _m, _in) \
RtBaryWeightsFromV3dMacro(_out, _m, _in)
#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool
RtBaryGetTransform(RtBaryTransform m,
RwReal * const area,
const RwV3d * const v0,
const RwV3d * const v1,
const RwV3d * const v2);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern void
RtBaryV3dFromWeights(RwV3d * const out,
const RtBaryV4d weights,
const RwV3d * const v0,
const RwV3d * const v1,
const RwV3d * const v2);
extern void
RtBaryWeightsFromV3d(RtBaryV4d out,
RtBaryTransform mat,
const RwV3d * const in);
extern void
_rtImportWorldBaryFromEdge(RtBaryV4d out,
RtBaryTransform mat,
const RwV3d * const in);
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTBARY_H */

View File

@ -0,0 +1,645 @@
enum e_rwdb_CriterionBary
{
e_rwdb_CriterionBaryLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionBary e_rwdb_CriterionBary;

View File

@ -0,0 +1,401 @@
/*
* Data structures for rtbezpat toolkit
* Copyright (c) Criterion Software Limited
*/
#if (!defined(RTBEZPAT_H))
#define RTBEZPAT_H
/**
* \defgroup rtbezpatch RtBezPat
* \ingroup rttool
*
* The Bezier Patch Toolkit is a group of functions that support the way
* RenderWare processes patches.
*/
/**
* \ingroup rtbezpatch
* \typedef RtBezierV4d
* typedef for struct RtBezierV4d.
*/
typedef struct RtBezierV4d RtBezierV4d;
/**
* \ingroup rtbezpatch
* \struct RtBezierV4d
* This type represents 4d points and vectors specified by
* the (x, y, z, w) coordinates of a 4d point or
* the (x, y, z, w) components of a 4d vector.
*/
struct RtBezierV4d
{
RwReal x;
/**< X value */
RwReal y;
/**< Y value */
RwReal z;
/**< Z value */
RwReal w;
/**< W value */
};
/**
* \ingroup rtbezpatch
* \typedef RtBezierRow
* typedef for a row of vectors.
* RtBezierRow is an array of 4 vectors
*/
typedef RtBezierV4d RtBezierRow[4];
/**
* \ingroup rtbezpatch
* \typedef RtBezierMatrix
* typedef for a matrix of 4*4 vectors.
* RtBezierMatrix is an array of 4 rows.
*/
typedef RtBezierRow RtBezierMatrix[4];
/*
* Bernstein polynomials;
*/
#define RtBern03(_u, _cu) ( (_cu) * (_cu) * (_cu) )
#define RtBern13(_u, _cu) ( 3 * (_u) * (_cu) * (_cu) )
#define RtBern23(_u, _cu) ( 3 * (_u) * (_u) * (_cu) )
#define RtBern33(_u, _cu) ( (_u) * (_u) * (_u) )
#define RtBezierQuadSample3dMacro(_out, _P, _u, _v) \
MACRO_START \
{ \
const RtBezierV4d * const P0 = &(_P)[0][0]; \
const RtBezierV4d * const P1 = &(_P)[1][0]; \
const RtBezierV4d * const P2 = &(_P)[2][0]; \
const RtBezierV4d * const P3 = &(_P)[3][0]; \
const RwReal _pu = (_u); \
const RwReal _cu = ((RwReal)1) - _pu; \
const RwReal B03u = RtBern03(_pu,_cu); \
const RwReal B13u = RtBern13(_pu,_cu); \
const RwReal B23u = RtBern23(_pu,_cu); \
const RwReal B33u = RtBern33(_pu,_cu); \
const RwReal _pv = (_v); \
const RwReal _cv = ((RwReal)1) - _pv; \
const RwReal B03v = RtBern03(_pv,_cv); \
const RwReal B13v = RtBern13(_pv,_cv); \
const RwReal B23v = RtBern23(_pv,_cv); \
const RwReal B33v = RtBern33(_pv,_cv); \
RtBezierRow A; \
\
A[0].x = B03u*P0[0].x + B13u*P1[0].x + B23u*P2[0].x + B33u*P3[0].x; \
A[0].y = B03u*P0[0].y + B13u*P1[0].y + B23u*P2[0].y + B33u*P3[0].y; \
A[0].z = B03u*P0[0].z + B13u*P1[0].z + B23u*P2[0].z + B33u*P3[0].z; \
A[1].x = B03u*P0[1].x + B13u*P1[1].x + B23u*P2[1].x + B33u*P3[1].x; \
A[1].y = B03u*P0[1].y + B13u*P1[1].y + B23u*P2[1].y + B33u*P3[1].y; \
A[1].z = B03u*P0[1].z + B13u*P1[1].z + B23u*P2[1].z + B33u*P3[1].z; \
A[2].x = B03u*P0[2].x + B13u*P1[2].x + B23u*P2[2].x + B33u*P3[2].x; \
A[2].y = B03u*P0[2].y + B13u*P1[2].y + B23u*P2[2].y + B33u*P3[2].y; \
A[2].z = B03u*P0[2].z + B13u*P1[2].z + B23u*P2[2].z + B33u*P3[2].z; \
A[3].x = B03u*P0[3].x + B13u*P1[3].x + B23u*P2[3].x + B33u*P3[3].x; \
A[3].y = B03u*P0[3].y + B13u*P1[3].y + B23u*P2[3].y + B33u*P3[3].y; \
A[3].z = B03u*P0[3].z + B13u*P1[3].z + B23u*P2[3].z + B33u*P3[3].z; \
\
(_out)->x = A[0].x*B03v + A[1].x*B13v + A[2].x*B23v + A[3].x*B33v; \
(_out)->y = A[0].y*B03v + A[1].y*B13v + A[2].y*B23v + A[3].y*B33v; \
(_out)->z = A[0].z*B03v + A[1].z*B13v + A[2].z*B23v + A[3].z*B33v; \
} \
MACRO_STOP
#define RtBezierQuadDifferenceStepU3dMacro(_row) \
MACRO_START \
{ \
(_row)[0].x += (_row)[1].x; \
(_row)[0].y += (_row)[1].y; \
(_row)[0].z += (_row)[1].z; \
\
(_row)[1].x += (_row)[2].x; \
(_row)[1].y += (_row)[2].y; \
(_row)[1].z += (_row)[2].z; \
\
(_row)[2].x += (_row)[3].x; \
(_row)[2].y += (_row)[3].y; \
(_row)[2].z += (_row)[3].z; \
\
} \
MACRO_STOP
#define RtBezierQuadDifferenceStepU4dMacro(_row) \
MACRO_START \
{ \
(_row)[0].x += (_row)[1].x; \
(_row)[0].y += (_row)[1].y; \
(_row)[0].z += (_row)[1].z; \
(_row)[0].w += (_row)[1].w; \
\
(_row)[1].x += (_row)[2].x; \
(_row)[1].y += (_row)[2].y; \
(_row)[1].z += (_row)[2].z; \
(_row)[1].w += (_row)[2].w; \
\
(_row)[2].x += (_row)[3].x; \
(_row)[2].y += (_row)[3].y; \
(_row)[2].z += (_row)[3].z; \
(_row)[2].w += (_row)[3].w; \
\
} \
MACRO_STOP
#define RtBezierQuadDifferenceStepV3dMacro(_mat) \
MACRO_START \
{ \
RtBezierV4d * const m0 = &(_mat)[0][0]; \
RtBezierV4d * const m1 = &(_mat)[1][0]; \
RtBezierV4d * const m2 = &(_mat)[2][0]; \
RtBezierV4d * const m3 = &(_mat)[3][0]; \
\
/* (_row) 0 */ \
m0[0].x += m1[0].x; \
m0[0].y += m1[0].y; \
m0[0].z += m1[0].z; \
\
m0[1].x += m1[1].x; \
m0[1].y += m1[1].y; \
m0[1].z += m1[1].z; \
\
m0[2].x += m1[2].x; \
m0[2].y += m1[2].y; \
m0[2].z += m1[2].z; \
\
m0[3].x += m1[3].x; \
m0[3].y += m1[3].y; \
m0[3].z += m1[3].z; \
\
/* (_row) 1 */ \
m1[0].x += m2[0].x; \
m1[0].y += m2[0].y; \
m1[0].z += m2[0].z; \
\
m1[1].x += m2[1].x; \
m1[1].y += m2[1].y; \
m1[1].z += m2[1].z; \
\
m1[2].x += m2[2].x; \
m1[2].y += m2[2].y; \
m1[2].z += m2[2].z; \
\
m1[3].x += m2[3].x; \
m1[3].y += m2[3].y; \
m1[3].z += m2[3].z; \
\
/* (_row) 2 */ \
m2[0].x += m3[0].x; \
m2[0].y += m3[0].y; \
m2[0].z += m3[0].z; \
\
m2[1].x += m3[1].x; \
m2[1].y += m3[1].y; \
m2[1].z += m3[1].z; \
\
m2[2].x += m3[2].x; \
m2[2].y += m3[2].y; \
m2[2].z += m3[2].z; \
\
m2[3].x += m3[3].x; \
m2[3].y += m3[3].y; \
m2[3].z += m3[3].z; \
} \
MACRO_STOP
#define RtBezierQuadDifferenceStepV4dMacro(_mat) \
MACRO_START \
{ \
RtBezierV4d * const m0 = &(_mat)[0][0]; \
RtBezierV4d * const m1 = &(_mat)[1][0]; \
RtBezierV4d * const m2 = &(_mat)[2][0]; \
RtBezierV4d * const m3 = &(_mat)[3][0]; \
\
/* (_row) 0 */ \
m0[0].x += m1[0].x; \
m0[0].y += m1[0].y; \
m0[0].z += m1[0].z; \
m0[0].w += m1[0].w; \
\
m0[1].x += m1[1].x; \
m0[1].y += m1[1].y; \
m0[1].z += m1[1].z; \
m0[1].w += m1[1].w; \
\
m0[2].x += m1[2].x; \
m0[2].y += m1[2].y; \
m0[2].z += m1[2].z; \
m0[2].w += m1[2].w; \
\
m0[3].x += m1[3].x; \
m0[3].y += m1[3].y; \
m0[3].z += m1[3].z; \
m0[3].w += m1[3].w; \
\
/* (_row) 1 */ \
m1[0].x += m2[0].x; \
m1[0].y += m2[0].y; \
m1[0].z += m2[0].z; \
m1[0].w += m2[0].w; \
\
m1[1].x += m2[1].x; \
m1[1].y += m2[1].y; \
m1[1].z += m2[1].z; \
m1[1].w += m2[1].w; \
\
m1[2].x += m2[2].x; \
m1[2].y += m2[2].y; \
m1[2].z += m2[2].z; \
m1[2].w += m2[2].w; \
\
m1[3].x += m2[3].x; \
m1[3].y += m2[3].y; \
m1[3].z += m2[3].z; \
m1[3].w += m2[3].w; \
\
/* (_row) 2 */ \
m2[0].x += m3[0].x; \
m2[0].y += m3[0].y; \
m2[0].z += m3[0].z; \
m2[0].w += m3[0].w; \
\
m2[1].x += m3[1].x; \
m2[1].y += m3[1].y; \
m2[1].z += m3[1].z; \
m2[1].w += m3[1].w; \
\
m2[2].x += m3[2].x; \
m2[2].y += m3[2].y; \
m2[2].z += m3[2].z; \
m2[2].w += m3[2].w; \
\
m2[3].x += m3[3].x; \
m2[3].y += m3[3].y; \
m2[3].z += m3[3].z; \
m2[3].w += m3[3].w; \
} \
MACRO_STOP
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern void
RtBezierQuadControlFit3d(RtBezierMatrix B,
RtBezierMatrix P);
extern void
RtBezierQuadBernsteinWeight3d(RtBezierMatrix W,
RtBezierMatrix B);
extern void
RtBezierQuadBernsteinWeight4d(RtBezierMatrix W,
RtBezierMatrix B);
extern void
RtBezierQuadPointDifference3d(RtBezierMatrix D,
RtBezierMatrix W,
RwReal PointU,
RwReal PointV,
RwReal StepU,
RwReal stepV);
extern void
RtBezierQuadPointDifference4d(RtBezierMatrix D,
RtBezierMatrix W,
RwReal PointU,
RwReal PointV,
RwReal StepU,
RwReal stepV);
extern void
RtBezierQuadOriginDifference3d(RtBezierMatrix D,
RtBezierMatrix W,
RwReal stepU,
RwReal setpV);
extern void
RtBezierQuadOriginDifference4d(RtBezierMatrix D,
RtBezierMatrix W,
RwReal stepU,
RwReal setpV);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern void
RtBezierQuadSample3d(RwV3d * out,
RtBezierMatrix B,
RwReal u,
RwReal v);
extern void RtBezierQuadDifferenceStepU3d(RtBezierRow row);
extern void RtBezierQuadDifferenceStepU4d(RtBezierRow row);
extern void RtBezierQuadDifferenceStepV3d(RtBezierMatrix mat);
extern void RtBezierQuadDifferenceStepV4d(RtBezierMatrix mat);
#else /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#define RtBezierQuadSample3d(_out, _P, _u, _v) \
RtBezierQuadSample3dMacro(_out, _P, _u, _v)
#define RtBezierQuadDifferenceStepU3d(_row) \
RtBezierQuadDifferenceStepU3dMacro(_row)
#define RtBezierQuadDifferenceStepU4d(_row) \
RtBezierQuadDifferenceStepU4dMacro(_row)
#define RtBezierQuadDifferenceStepV3d(_mat) \
RtBezierQuadDifferenceStepV3dMacro(_mat)
#define RtBezierQuadDifferenceStepV4d(_mat) \
RtBezierQuadDifferenceStepV4dMacro(_mat)
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
/*
*
*/
extern void
RtBezierTriangleControlFit3d(RtBezierMatrix T, RtBezierMatrix P);
extern void
RtBezierQuadFromTriangle(RtBezierMatrix Q, RtBezierMatrix T);
extern void
RtBezierQuadTangent(RtBezierMatrix D,
RwReal theta,
RtBezierMatrix P);
extern void
RtBezierQuadTangentPair(RtBezierMatrix Dt,
RtBezierMatrix Dp,
RwReal theta,
RtBezierMatrix P);
extern void
RtBezierQuadGetNormals(RtBezierMatrix N,
RtBezierMatrix B);
#if (defined(RWDEBUG) && defined(RWVERBOSE))
extern void
_rtBezierGnuPlot(RtBezierMatrix B,
RwChar * name,
RwChar * title);
#else /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
#define _rtBezierGnuPlot(B, name, title) /* No-op */
#endif /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* (!defined(RTBEZPAT_H)) */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionBEZPATCH
{
e_rwdb_CriterionBEZPATCHLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionBEZPATCH e_rwdb_CriterionBEZPATCH;

View File

@ -0,0 +1,51 @@
/***************************************************************************
* *
* Module : rtBMP.h *
* *
* Purpose : Load BMP format files *
* *
**************************************************************************/
#ifndef RTBMP_H
#define RTBMP_H
/**
* \defgroup rtbmp RtBMP
* \ingroup rttool
*
* BMP Image Format Toolkit for RenderWare.
*
* See also http://www.daubnet.com/formats/BMP.html
*/
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rtbmp.rpe" /* automatically generated header file */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwImage *RtBMPImageWrite(RwImage * image,
const RwChar * imageName);
extern RwImage *RtBMPImageRead(const RwChar * imageName);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTBMP_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionBMP
{
e_rwdb_CriterionBMPLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionBMP e_rwdb_CriterionBMP;

View File

@ -0,0 +1,111 @@
/*
*
* Data structures for the charse toolkit
*/
/***************************************************************************
* *
* Module : rtcharse.h *
* *
* Purpose : Charset handling *
* *
**************************************************************************/
#ifndef RTCHARSE_H
#define RTCHARSE_H
/**
* \defgroup rtcharset RtCharset
* \ingroup rttool
*
* Character Set/Foot Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include <rwcore.h>
/****************************************************************************
Global Types
*/
/* RWPUBLIC */
typedef struct RtCharsetDesc RtCharsetDesc;
/**
* \ingroup rtcharset
* \struct RtCharsetDesc
* Holds information about a character set.
*/
struct RtCharsetDesc
{
RwInt32 width;
/**< Pixel-width of each character. */
RwInt32 height;
/**< Pixel-height of each character. */
RwInt32 width_internal;
/**< Pixel-width used internally, this is usually width+1 to add a border */
RwInt32 height_internal;
/**< Pixel-height used internally, this is usually height+1 to add a border */
RwInt32 count;
/**< Number of characters in the set. */
RwInt32 tilewidth;
/**< Width of raster in characters. */
RwInt32 tileheight;
/**< Height of raster in characters. */
};
/**
* \ingroup rtcharset
* \typedef RtCharset
* typedef for a structure defining a character set (opaque).
* \see RtCharsetCreate
*/
typedef RwRaster RtCharset;
/* RWPUBLICEND */
/****************************************************************************
Function prototypes
*/
/* RWPUBLIC */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool RtCharsetOpen(void);
extern void RtCharsetClose(void);
extern RtCharset *RtCharsetPrint(RtCharset * charSet,
const RwChar * string,
RwInt32 x, RwInt32 y);
extern RtCharset *RtCharsetPrintBuffered(RtCharset * charSet,
const RwChar * string,
RwInt32 x, RwInt32 y,
RwBool hideSpaces);
extern RwBool RtCharsetBufferFlush(void);
extern RtCharset *RtCharsetSetColors(RtCharset * charSet,
const RwRGBA * foreGround,
const RwRGBA * backGround);
extern RtCharset *RtCharsetGetDesc(RtCharset * charset,
RtCharsetDesc * desc);
extern RtCharset *RtCharsetCreate(const RwRGBA * foreGround,
const RwRGBA * backGround);
extern RwBool RtCharsetDestroy(RtCharset * charSet);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTCHARSE_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionCharset
{
e_rwdb_CriterionCharsetLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionCharset e_rwdb_CriterionCharset;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,640 @@
enum e_rwdb_CriterionNoHSWorld
{
E_RW_SECTORDEGENERATE,
E_RW_SECTORINVNOPOLYGONS,
E_RW_NOPLANE,
E_RW_SECTORINVPOLY,
E_RW_SECTORUSED,
E_RW_MAXBSPDEPTHEXCEEDED,
e_rwdb_CriterionNoHSWorldLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionNoHSWorld e_rwdb_CriterionNoHSWorld;

1206
rwsdk/include/d3d8/rtintel.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,645 @@
enum e_rwdb_CriterionIntel
{
e_rwdb_CriterionIntelLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionIntel e_rwdb_CriterionIntel;

View File

@ -0,0 +1,138 @@
/***************************************************************************
* *
* Module : rtintsec.h *
* *
* Purpose : Intersection tests on geometry primitives. *
* *
**************************************************************************/
#ifndef RTINTSEC_H
#define RTINTSEC_H
/**
* \defgroup rtintersect RtIntersection
* \ingroup rttool
*
* Object Intersection Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include <rwcore.h>
#include "rtintsec.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
#define RTINTSECEPSILON (RwReal)(1e-8)
#define RTINTSECEDGEEPS (RwReal)(1e-5)
#define RtIntersectionLineTriangleMacro(_result, \
_lineStart, _lineDelta, \
_v0, _v1, _v2, \
_distance) \
MACRO_START \
{ \
RwV3d edge1, edge2, tVec, pVec, qVec; \
RwReal det; \
\
/* Find vectors for two edges sharing vert0 */ \
RwV3dSubMacro(&edge1, (_v1), (_v0)); \
RwV3dSubMacro(&edge2, (_v2), (_v0)); \
\
/* Begin calculating determinant \
* - also used to calculate U parameter */ \
RwV3dCrossProductMacro(&pVec, (_lineDelta), &edge2); \
\
/* If determinant is \
* + near zero, ray lies in plane of \
* triangle \
* + negative, triangle is backfacing \
*/ \
det = RwV3dDotProductMacro(&edge1, &pVec); \
(_result) = (det > RTINTSECEPSILON); \
\
if ((_result)) \
{ \
RwReal lo, hi, u; \
\
/* Calculate bounds for parameters with tolerance */ \
lo = - det*RTINTSECEDGEEPS; \
hi = det - lo; \
\
/* Calculate U parameter and test bounds */ \
RwV3dSubMacro(&tVec, (_lineStart), (_v0)); \
u = RwV3dDotProductMacro(&tVec, &pVec); \
(_result) = (u >= lo && u <= hi); \
\
if ((_result)) \
{ \
RwReal v; \
\
/* Calculate V parameter and test bounds */ \
RwV3dCrossProductMacro(&qVec, &tVec, &edge1); \
v = RwV3dDotProductMacro((_lineDelta), &qVec); \
(_result) = (v >= lo && (u + v) <= hi); \
\
if ((_result)) \
{ \
/* Calculate t, \
* and make sure intersection is in bounds of line */ \
*(_distance) = RwV3dDotProductMacro(&edge2, &qVec); \
\
/* Within bounds of line? */ \
(_result) = (*(_distance) >= lo && *(_distance) <= hi); \
\
if ((_result)) \
{ \
*(_distance) = ((*(_distance)) / (det)); \
} \
} \
} \
} \
} \
MACRO_STOP
/****************************************************************************
Global Types
*/
/* RWPUBLIC */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Line intersections */
extern RwBool
RtIntersectionLineTriangle(RwV3d *lineStart, RwV3d *lineDelta,
RwV3d *v0, RwV3d *v1, RwV3d *v2,
RwReal *distance);
/* Sphere intersections */
extern RwBool
RtIntersectionSphereTriangle(RwSphere *sphere,
RwV3d *v0, RwV3d *v1, RwV3d *v2,
RwV3d *normal,
RwReal *distance);
/* BBox intersections */
extern RwBool
RtIntersectionBBoxTriangle(RwBBox *bbox, RwV3d *v0, RwV3d *v1, RwV3d *v2);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTINTSEC_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionIntsec
{
e_rwdb_CriterionIntsecLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionIntsec e_rwdb_CriterionIntsec;

View File

@ -0,0 +1,601 @@
/**
* \defgroup rtltmap RtLtMap
* \ingroup rttool
*
* Lightmap Generation Toolkit for RenderWare.
*/
#ifndef RTLTMAP_H
#define RTLTMAP_H
/*===========================================================================*
*--- Includes --------------------------------------------------------------*
*===========================================================================*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpltmap.h"
/**
* \ingroup rtltmap
* \typedef RtLtMapIlluminateSampleCallBack
* \ref RtLtMapIlluminateSampleCallBack is the callback to be called, from
* within \ref RtLtMapIlluminate, for groups of samples in the objects
* currently being illuminated.
*
* For lightmapped objects, samples are grouped on a per-polygon basis and
* for vertex-lit objects, samples are grouped on a per-object basis (see
* \ref RtLtMapObjectFlags).
*
* This callback will receive an array of color values to fill in, each
* representing one sample in the current object - this may correspond to
* a texel in the current object's lightmap or the prelight colour of a
* vertex, depending on whether the object is lightmapped and/or vertex-lit.
* It will receive positions (in world-space) for each sample and the normal
* vector (again, in world-space) of each sample (normals are interpolated
* across polygons for non-flat-shaded materials. See \ref RtLtMapMaterialFlags).
* For lightmap samples (not vertex-lighting samples), it will receive
* barycentric coordinates within the current polygon. It will also receive
* a list of RpLights affecting the current object.
*
* The barycentric coordinates may be used, for example, to allow a callback
* to easily import existing lighting data (e.g from previously generated
* lightmaps in a different format, or from an art package with lighting
* functionality).
*
* NOTE: The alpha channel of the RwRGBA results array must NOT be modified.
* These values are used internally and their modification may result in
* unwanted visual artifacts in the resulting lighting solution.
*
* The default RtLtMapIlluminateSampleCallBacks supplied with RtLtMap is
* \ref RtLtMapDefaultSampleCallBack. This callback performs point and area
* lighting (the area lights use are those passed to \ref RtLtMapIlluminate).
*
* \param results A pointer to an array of \ref RwRGBA sample color values
* \param samplePositions A pointer to an array of \ref RwV3d values specifying the
* world-space positions of each of the samples in the results array
* \param baryCoords A pointer to an array of \ref RwV3d values specifying the
* barycentric coordinates (within the current polygon) of
* each of the samples in the results array
* \param numSamples The length of the results, samplePositions, baryCoords and normals arrays
* \param lights An array of pointers to \ref RpLight's affecting the current object
* \param numLights The length of the lights array
* \param normals A pointer to an array of \ref RwV3d values specifying the
* world-space, unit normals of each of the samples in the results array
*
* \return A pointer to the results array on success, NULL otherwise
*
* \see RtLtMapIlluminate
* \see RtLtMapIlluminateVisCallBack
* \see RtLtMapIlluminateProgressCallBack
*/
typedef RwRGBA *(*RtLtMapIlluminateSampleCallBack)(RwRGBA *results,
RwV3d *samplePositions,
RwV3d *baryCoords,
RwUInt32 numSamples,
RpLight **lights,
RwUInt32 numLights,
RwV3d *normals);
/**
* \ingroup rtltmap
* \typedef RtLtMapIlluminateVisCallBack
* \ref RtLtMapIlluminateVisCallBack is the callback to be called, from
* within \ref RtLtMapIlluminate, to determine the visibility between a
* sample and a light.
*
* This callback is called for all samples in the current
* \ref RtLtMapLightingSession and for each light source which may
* potentially affect each of those samples (this may not be all the
* lights in the scene, as some hierarchical culling is performed).
* Each sample may represent a texel in the current object's lightmap
* or the prelight color of a vertex, depending on whether the object
* is lightmapped and/or vertex-lit (see \ref RtLtMapObjectFlags).
*
* The callback will receive a pointer to the world of the current
* \ref RtLtMapLightingSession (this may be used to perform intersection
* tests), the world-space position of the sample, the world-space
* position of the light, a pointer to a light and a pointer to an
* \ref RwRGBAReal result value.
*
* If the light pointer is NULL, this means that the current light
* is an area light (as opposed to an \ref RpLight), of an internal
* format. The area lights use are those passed to \ref RtLtMapIlluminate.
*
* The callback should return FALSE to signify that the light is wholly
* occluded w.r.t the sample position, otherwise it should return TRUE.
* Partial degrees of (color-frequency-dependent) occlusion may be
* expressed by modifying the RwRGBAReal value. This defaults to bright
* white but may be reduced to signify that the light from the light
* source should be attenuated. This could be used to take into account
* light-filtering objects in the scene (such as coloured glass or fog).
*
* The default RtLtMapIlluminateVisCallBack supplied with RtLtMap is
* \ref RtLtMapDefaultVisCallBack. This callback performs visibility
* tests using the line-intersection tests from \ref rtintersect. It tests
* for occlusion by RpWorldSectors and RpAtomics and it respects the
* relevant \ref RtLtMapObjectFlags and \ref RtLtMapMaterialFlags but it
* does not filter light; visibility is determined to be either one or zero.
*
* \param world The world of the current RtLtMapLightingSession
* \param result An RwRGBAReal value to attentuate this light's
* contribution to the current sample
* \param samplePos The world-space positiuon of the sample
* \param lightPos The world-space positiuon of the light
* \param light A pointer to the light (NULL if it is an are light)
*
* \return TRUE if the light is visible from the sample, FALSE if it is occluded
*
* \see RtLtMapIlluminate
* \see RtLtMapIlluminateSampleCallBack
* \see RtLtMapIlluminateProgressCallBack
*/
typedef RwBool (*RtLtMapIlluminateVisCallBack)(RpWorld *world,
RwRGBAReal *result,
RwV3d *samplePos,
RwV3d *lightPos,
RpLight *light);
/**
* \ingroup rtltmap
* \typedef RtLtMapIlluminateProgressCallBack
* \ref RtLtMapIlluminateProgressCallBack is the callback to be called, from
* within \ref RtLtMapIlluminate, to allow a user to track lighting progress.
*
* The progress callback will be called at several stages during lighting,
* with a different 'message' parameter value used at each stage (see
* \ref RtLtMapProgressMessage). It will be called at the very start of
* lighting (for a given \ref RtLtMapLightingSession), before any samples
* are lit. It will also be called at the very end of lighting, after all
* samples have been lit. It will be called before and after each lighting
* 'slice' (see \ref RtLtMapIlluminate) and also after each group of
* samples have been lit.
*
* For lightmapped objects, samples are grouped on a per-polygon basis and
* for vertex-lit objects, samples are grouped on a per-object basis (see
* \ref RtLtMapObjectFlags).
*
* The progress callback will receive a RwReal value specifying the percentage
* of samples already lit in the current \ref RtLtMapLightingSession (see
* \ref RtLtMapLightingSessionGetNumSamples).
*
* By returning FALSE, the progress callback may cause early termination of
* the current lighting 'slice' (this may be used, for example, to keep
* the time spent lighting each slice fairly constant).
*
* There is no default progress callback supplied with RtLtMap.
*
* \param message A \ref RtLtMapProgressMessage identifying the stage
* of the current call to the progress callback
* \param value The percentage of samples already lit in the
* current \ref RtLtMapLightingSession
*
* \return FALSE to immediately terminate lighting, otherwise TRUE
*
* \see RtLtMapIlluminate
* \see RtLtMapIlluminateSampleCallBack
* \see RtLtMapIlluminateVisCallBack
*/
typedef RwBool (*RtLtMapIlluminateProgressCallBack)(RwInt32 message,
RwReal value);
/**
* \ingroup rtltmap
* \ref RtLtMapProgressMessage is an enumerated type identifying the different
* stages at which the \ref RtLtMapIlluminateProgressCallBack may be called
* from within \ref RtLtMapIlluminate.
*
* \see RtLtMapIlluminateProgressCallBack
* \see RtLtMapIlluminate
*/
enum RtLtMapProgressMessage
{
rtLTMAPPROGRESSNAMESSAGE = 0,
rtLTMAPPROGRESSSTART = 1, /**< This is issued at the beginning of
* an incremental lighting session */
rtLTMAPPROGRESSSTARTSLICE = 2, /**< This is issued at the beginning of every
* slice in an incremental lighting session */
rtLTMAPPROGRESSUPDATE = 3, /**< This is issued after the lighting of each
* lightmapped triangle or vertex-lit object */
rtLTMAPPROGRESSENDSLICE = 4, /**< This is issued at the end of every slice
* in an incremental lighting session */
rtLTMAPPROGRESSEND = 5, /**< This is issued at the end of an
* incremental lighting session */
rtLTMAPPROGRESSFORCEENUMSIZEINT = 0x7FFFFFFF
};
typedef enum RtLtMapProgressMessage RtLtMapProgressMessage;
typedef struct RtLtMapLightingSession RtLtMapLightingSession;
/**
* \ingroup rtltmap
* \typedef RtLtMapLightingSession
* The \ref RtLtMapLightingSession structure holds information to be passed to
* \ref RtLtMapIlluminate. It is used to parameterize the lighting process.
*
* The \ref RtLtMapLightingSession structure encapsulates a set of objects and
* keeps track of the proportion of samples, within that set, that have already
* been lit by calls to \ref RtLtMapIlluminate. Each call performs lighting for
* one 'slice' of the whole 'session'. If the camera member is non-NULL, it is
* important that the camera is not moved between lighting slices.
*
* The \ref RtLtMapLightingSession is also passed to
* \ref RtLtMapLightMapsCreate, \ref RtLtMapLightMapsClear,
* \ref RtLtMapLightMapsDestroy and \ref RtLtMapAreaLightGroupCreate,
* though not all of the session structure's member will be used in
* each of these cases.
*
* \see RtLtMapIlluminate
* \see RtLtMapLightMapsCreate
* \see RtLtMapLightMapsClear
* \see RtLtMapLightMapsDestroy
* \see RtLtMapAreaLightGroupCreate
*/
struct RtLtMapLightingSession
{
RpWorld *world; /**< This world is that in which collisions are performed
* during illumination (for the purposes of lighting
* visibility determination) */
RwCamera *camera; /**< An optional pointer to a camera. The camera's frustum
* may be used to cull objects and/or triangles from the
* set of those to be processed. */
RpWorldSector **sectorList; /**< An optional array of \ref RpWorldSector pointers,
* specifying which sectors in the world to light. If
* this is NULL, then all sectors in the world (or those
* inside the optional camera's frustum) will be lit. */
RwInt32 numSectors; /**< The length of the sectorList array. If this is set to
* '-1' then none of the sectors in the world will be lit. */
RpAtomic **atomicList; /**< An optional array of \ref RpAtomic pointers,
* specifying which atomics to light. If this is NULL
* then all atomics in the world (or those inside the
* optional camera's frustum) will be lit. */
RwInt32 numAtomics; /**< The length of the atomicList array. If this is set to
* '-1' then none of the atomics in the world will be lit. */
RwUInt32 startSample; /**< Lighting for the current 'slice' should begin with this
* sample. It is the user's responsibility to increment this
* value after each slice. Note that partial lighting is
* quantized to be per-polygon (for lightmapped objects).
* startSample will always be rounded down, not up. */
RwUInt32 numSamples; /**< This specifies how many lightmap samples should be lit.
* If it is left zero then all samples in the current set
* of objects will be lit. Note that partial lighting is
* quantized to be per-polygon (for lightmapped objects).
* numSamples will always be rounded up, not down. */
RwUInt32 totalSamples;/**< This specifies how many lightmap samples will be lit in
* total for the world specified (this is filled in by
* \ref RtLtMapIlluminate, not the calling function). */
RtLtMapIlluminateSampleCallBack sampleCallBack; /**< A \ref RtLtMapIlluminateSampleCallBack
* to use during lighting. If this is left
* NULL, the default callback will be used. */
RtLtMapIlluminateVisCallBack visCallBack; /**< A \ref RtLtMapIlluminateVisCallBack
* to use during lighting. If this is left
* NULL, the default callback will be used. */
RtLtMapIlluminateProgressCallBack progressCallBack; /**< A \ref RtLtMapIlluminateProgressCallBack
* to use during lighting. If this is left
* NULL, no progress callback will be used. */
};
/**
* \ingroup rtltmap
* \ref RtLtMapMaterialFlags is an enumerated type specifying the different
* lightmap-related flags which may be applied to materials. These values
* will be taken into consideration within \ref RtLtMapIlluminate.
*
* \see RtLtMapMaterialGetFlags
* \see RtLtMapMaterialSetFlags
* \see RtLtMapMaterialGetAreaLightColor
* \see RtLtMapMaterialSetAreaLightColor
* \see RtLtMapMaterialGetLightMapDensityModifier
* \see RtLtMapMaterialSetLightMapDensityModifier
* \see RtLtMapMaterialGetAreaLightDensityModifier
* \see RtLtMapMaterialSetAreaLightDensityModifier
* \see RtLtMapMaterialSetAreaLightRadiusModifier
* \see RtLtMapMaterialGetAreaLightRadiusModifier
* \see RtLtMapIlluminate
* \see RtLtMapAreaLightGroupCreate
* \see RtLtMapIlluminateVisCallBack
*/
enum RtLtMapMaterialFlags
{
rtLTMAPMATERIALNAFLAG = 0,
rtLTMAPMATERIALLIGHTMAP = 1, /**< This material should be lightmapped
* [for non-lightmapped materials within lightmapped objects,
* texel values will be set to (0, 0, 0) (or (255, 255, 255) if
* the rtLTMAPMATERIALAREALIGHT flag is present, so that light-
* emitting textures appear as bright as the light which they are
* emittering) and the mesh may be 'shrunk' in UV-space so as not
* to waste lightmap texels] */
rtLTMAPMATERIALAREALIGHT = 2, /**< This material is an area light emitter
* (see \ref RtLtMapAreaLightGroupCreate) */
rtLTMAPMATERIALNOSHADOW = 4, /**< This material does not block light */
rtLTMAPMATERIALSKY = 8, /**< This material blocks everything but directional
* lights, to allow sky polygons to occlude geometry
* and yet emit directional light (sky or sun light,
* being as if cast from an infinite distance) */
rtLTMAPMATERIALFLATSHADE = 16, /**< This material will be lit as if flat-shaded
* (polygon normals will be used during illumination) */
rtLTMAPMATERIALFLAGFORCEENUMSIZEINT = 0x7FFFFFFF
};
typedef enum RtLtMapMaterialFlags RtLtMapMaterialFlags;
/**
* \ingroup rtltmap
* \ref RtLtMapObjectFlags is an enumerated type specifying the different
* lightmap-related flags which may be applied to world sectors and
* atomics. These values will be taken into consideration within
* \ref RtLtMapLightMapsCreate and \ref RtLtMapIlluminate.
*
* \see RtLtMapAtomicGetFlags
* \see RtLtMapAtomicSetFlags
* \see RtLtMapWorldSectorGetFlags
* \see RtLtMapWorldSectorSetFlags
* \see RtLtMapLightMapsCreate
* \see RtLtMapIlluminate
* \see RtLtMapIlluminateVisCallBack
*/
enum RtLtMapObjectFlags
{
rtLTMAPOBJECTNAFLAG = 0,
rtLTMAPOBJECTLIGHTMAP = 1, /**< This object is to be lightmapped */
rtLTMAPOBJECTVERTEXLIGHT = 2, /**< This object's vertex prelight colours should
* be lit within \ref RtLtMapIlluminate. */
rtLTMAPOBJECTNOSHADOW = 4, /**< This object does not cast shadows (useful, for
* example, for moving objects for which dynamic
* shadows are to be rendered - such as doors) */
rtLTMAPOBJECTFLAGFORCEENUMSIZEINT = 0x7FFFFFFF
};
typedef enum RtLtMapObjectFlags RtLtMapObjectFlags;
/* Area-lighting stuff:*
***********************/
/**
* \ingroup rtltmap
* \typedef RtLtMapAreaLightGroup
* \ref RtLtMapAreaLightGroup is a structure which acts as a container
* for area lights created by a call to \ref RtLtMapAreaLightGroupCreate.
* The containers may be chained and passed to \ref RtLtMapIlluminate.
* Each container has an optional pointer to a RwFrame which is used to
* transform the contained area lights relative to the world of the current
* \ref RtLtMapLightingSession and relative to each other (such that, for
* example, lights from multiple worlds, which are connected by portals,
* or which are composed of atomics and not world sectors, may be used
* within a single call to \ref RtLtMapIlluminate).
*
* \see RtLtMapAreaLightGroupCreate
* \see RtLtMapAreaLightGroupDestroy
* \see RtLtMapIlluminate
* \see RtLtMapIlluminateVisCallBack
*/
typedef struct RtLtMapAreaLightGroup RtLtMapAreaLightGroup;
struct RtLtMapAreaLightGroup
{
RwSList *meshes; /**< A list of hierarchically-grouped area lights */
RwFrame *frame; /**< An (optional) pointer to a frame (owned by something else)
* whose LTM specifies the coordinate system of this container,
* relative to the world of the current \ref RtLtMapLightingSession. */
RtLtMapAreaLightGroup *next; /**< A pointer for chaining are light groups together */
};
/* Area light triangles are grouped by source mesh (this may change) */
typedef struct LtMapAreaLightMesh LtMapAreaLightMesh;
struct LtMapAreaLightMesh
{
RwUInt32 flags; /* To hold hierarchical visibility culling flags,
* relevant to the object/triangle *currently* being lit. */
RpMaterial *material; /* The emitter material, containing colour, etc */
RwSphere sphere; /* Each mesh has an associated center and radius */
RwReal ROI; /* Centred on the above sphere, the R.O.I. of the
* samples in this mesh (a conservative estimate) */
RwSList *triangles; /* A list of the area light triangles in this mesh */
};
/* Area light samples are grouped by source triangle */
typedef struct LtMapAreaLight LtMapAreaLight;
struct LtMapAreaLight
{
RwUInt16 flags; /* To hold hierarchical visibility culling flags,
* relevant to the object/triangle *currently* being lit. */
RwUInt16 numSamples; /* Number of area light samples in this triangle */
RwReal areaPerSample; /* (triangleArea / numSamples) for this triangle */
RwPlane plane; /* This 'area light' is a triangle, this is its plane. */
RwSphere sphere; /* This bounds the triangle's points in world-space (it's
* not worth storing 3 points, coarse culling is fine) */
RwV3d *lights; /* Array of area light sample positions (in world-space) */
};
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Lightmap creation functionality: */
extern RtLtMapLightingSession *
RtLtMapLightMapsCreate(RtLtMapLightingSession *session,
RwReal density, RwRGBA *color);
extern void
RtLtMapLightMapsDestroy(RtLtMapLightingSession *session);
extern RpAtomic *
RtLtMapAtomicLightMapDestroy(RpAtomic *atomic);
extern RpWorldSector *
RtLtMapWorldSectorLightMapDestroy(RpWorldSector *sector);
extern RwReal
RtLtMapGetVertexWeldThreshold(void);
extern RwBool
RtLtMapSetVertexWeldThreshold(RwReal threshold);
extern RwUInt32
RtLtMapLightMapGetDefaultSize(void);
extern RwBool
RtLtMapLightMapSetDefaultSize(RwUInt32 size);
extern RwUInt32
RtLtMapAtomicGetLightMapSize(RpAtomic *atomic);
extern RpAtomic *
RtLtMapAtomicSetLightMapSize(RpAtomic *atomic, RwUInt32 size);
extern RwUInt32
RtLtMapWorldSectorGetLightMapSize(RpWorldSector *sector);
extern RpWorldSector *
RtLtMapWorldSectorSetLightMapSize(RpWorldSector *sector, RwUInt32 size);
extern RwUInt32
RtLtMapAtomicGetFlags(RpAtomic *atomic);
extern RpAtomic *
RtLtMapAtomicSetFlags(RpAtomic *atomic, RwUInt32 flags);
extern RwUInt32
RtLtMapWorldSectorGetFlags(RpWorldSector *sector);
extern RpWorldSector *
RtLtMapWorldSectorSetFlags(RpWorldSector *sector, RwUInt32 flags);
/* Lightmap illumination functionality: */
extern RwUInt32
RtLtMapIlluminate(RtLtMapLightingSession *session,
RtLtMapAreaLightGroup *lights);
extern RwReal
RtLtMapGetSliverAreaThreshold(void);
extern RwBool
RtLtMapSetSliverAreaThreshold(RwReal threshold);
extern RwRGBA *
RtLtMapDefaultSampleCallBack(RwRGBA *results,
RwV3d *samplePositions,
RwV3d * __RWUNUSED__ baryCoords,
RwUInt32 numSamples,
RpLight **lights,
RwUInt32 numLights,
RwV3d *normals);
extern RwBool
RtLtMapDefaultVisCallBack(RpWorld *world,
RwRGBAReal __RWUNUSED__ *result,
RwV3d *samplePos,
RwV3d *lightPos,
RpLight __RWUNUSED__ *light);
extern RtLtMapLightingSession *
RtLtMapLightingSessionInitialize(RtLtMapLightingSession *session,
RpWorld *world);
extern RwInt32
RtLtMapLightingSessionGetNumSamples(RtLtMapLightingSession *session);
extern RwInt32
RtLtMapWorldSectorGetNumSamples(RpWorldSector *sector);
extern RwInt32
RtLtMapAtomicGetNumSamples(RpAtomic *atomic);
extern RtLtMapLightingSession *
RtLtMapImagesPurge(RtLtMapLightingSession *session);
extern RpAtomic *
RtLtMapAtomicImagePurge(RpAtomic *atomic);
extern RpWorldSector *
RtLtMapWorldSectorImagePurge(RpWorldSector *sector);
extern RtLtMapLightingSession *
RtLtMapLightMapsClear(RtLtMapLightingSession *session, RwRGBA *color);
extern RpAtomic *
RtLtMapAtomicLightMapClear(RpAtomic *atomic, RwRGBA *color);
extern RpWorldSector *
RtLtMapWorldSectorLightMapClear(RpWorldSector *sector, RwRGBA *color);
/* Material/area-lighting functionality: */
extern RtLtMapAreaLightGroup *
RtLtMapAreaLightGroupCreate(RtLtMapLightingSession *session, RwReal density);
extern RwBool
RtLtMapAreaLightGroupDestroy(RtLtMapAreaLightGroup *lights);
extern RwUInt32
RtLtMapMaterialGetFlags(RpMaterial *material);
extern RpMaterial *
RtLtMapMaterialSetFlags(RpMaterial *material, RwUInt32 flags);
extern RwReal
RtLtMapMaterialGetLightMapDensityModifier(RpMaterial *material);
extern RpMaterial *
RtLtMapMaterialSetLightMapDensityModifier(RpMaterial *material, RwReal modifier);
extern RwRGBA
RtLtMapMaterialGetAreaLightColor(RpMaterial *material);
extern RpMaterial *
RtLtMapMaterialSetAreaLightColor(RpMaterial *material, RwRGBA color);
extern RwReal
RtLtMapMaterialGetAreaLightDensityModifier(RpMaterial *material);
extern RpMaterial *
RtLtMapMaterialSetAreaLightDensityModifier(RpMaterial *material, RwReal modifier);
extern RwReal
RtLtMapMaterialGetAreaLightRadiusModifier(RpMaterial *material);
extern RpMaterial *
RtLtMapMaterialSetAreaLightRadiusModifier(RpMaterial *material, RwReal modifier);
extern RwUInt32
RtLtMapGetMaxAreaLightSamplesPerMesh(void);
extern RwBool
RtLtMapSetMaxAreaLightSamplesPerMesh(RwUInt32 maxSamples);
extern RwReal
RtLtMapGetAreaLightDensityModifier(void);
extern RwBool
RtLtMapSetAreaLightDensityModifier(RwReal modifier);
extern RwReal
RtLtMapGetAreaLightRadiusModifier(void);
extern RwBool
RtLtMapSetAreaLightRadiusModifier(RwReal modifier);
extern RwReal
RtLtMapGetAreaLightErrorCutoff(void);
extern RwBool
RtLtMapSetAreaLightErrorCutoff(RwReal tolerance);
/* Texture-saving functionality: */
extern RwTexDictionary *
RtLtMapTexDictionaryCreate(RtLtMapLightingSession *session);
extern const RwChar *
RtLtMapGetDefaultPrefixString(void);
extern RwBool
RtLtMapSetDefaultPrefixString(RwChar *string);
extern RwUInt32
RtLtMapGetLightMapCounter(void);
extern RwBool
RtLtMapSetLightMapCounter(RwUInt32 value);
#if (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H))
/* PS2-specific functionality: */
extern RwTexture *RtLtMapSkyLightMapMakeDarkMap(RwTexture *lightMap);
extern RwTexture *RtLtMapSkyBaseTextureProcess(RwTexture *texture);
extern RpAtomic *RtLtMapSkyAtomicBaseTexturesProcess(RpAtomic *atomic);
extern RpWorldSector *
RtLtMapSkyWorldSectorBaseTexturesProcess(RpWorldSector *sector);
extern RtLtMapLightingSession *
RtLtMapSkyBaseTexturesProcess(RtLtMapLightingSession *session);
#endif /* (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTLTMAP_H */

View File

@ -0,0 +1,638 @@
enum e_rwdb_CriterionLTMAPTOOL
{
e_rwdb_CriterionLTMAPTOOLLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionLTMAPTOOL e_rwdb_CriterionLTMAPTOOL;

View File

@ -0,0 +1,58 @@
/**
* Mipmap K toolkit
*/
/***************************************************************************
* *
* Module : rtmipk.h *
* *
* Purpose : To calculate mipmap K values for Sky *
* *
**************************************************************************/
#ifndef RTMIPK_H
#define RTMIPK_H
/**
* \defgroup rtmipk RtMipmapK
* \ingroup rttool
*
* Ps2/Mipmap K Value Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpworld.h"
/* RWPUBLIC */
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern void RtMipKWorldCalculateKValues(RpWorld *world, RwCamera *camera);
extern void RtMipKClumpCalculateKValues(RpClump *clump, RwCamera *camera);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTMIPK_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionMipmapK
{
e_rwdb_CriterionMipmapKLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionMipmapK e_rwdb_CriterionMipmapK;

View File

@ -0,0 +1,59 @@
/***************************************************************************
* *
* Module : rtpick.h *
* *
* Purpose : Utils for picking atomics. *
* *
**************************************************************************/
#ifndef RTPICK_H
#define RTPICK_H
/**
* \defgroup rtpick RtPick
* \ingroup rttool
*
* Picking Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rtpick.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Camera pixel ray */
extern const RwCamera *RwCameraCalcPixelRay(const RwCamera *camera,
RwLine *line,
const RwV2d *pixel);
/* Picking atomics */
extern RpAtomic *RpWorldPickAtomicOnLine(RpWorld *world,
const RwLine *line);
extern RpAtomic *RwCameraPickAtomicOnPixel(const RwCamera *camera,
const RwV2d *pixel);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTPICK_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionPick
{
e_rwdb_CriterionPickLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionPick e_rwdb_CriterionPick;

View File

@ -0,0 +1,74 @@
/***********************************************************************
*
* Module: rtpitexd.h
*
* Purpose: Platform Independent Texture Dictionaries
*
***********************************************************************/
#if !defined( RTPITEXD_H )
#define RTPITEXD_H
/**
* \defgroup rtpitexd RtPITexD
* \ingroup rttool
*
* Platform Independent Texture Dictionaries
*
*/
/* =====================================================================
* Includes
* ===================================================================== */
#include <rwcore.h>
#include <rtpitexd.rpe> /* automatically generated */
/* =====================================================================
* Defines
* ===================================================================== */
/* =====================================================================
* Module specific type definitions
* ===================================================================== */
/* =====================================================================
* Extern variables
* ===================================================================== */
/* =====================================================================
* Extern function prototypes
* ===================================================================== */
#if defined( __cplusplus )
extern "C"
{
#endif /* defined( __cplusplus ) */
/* RWPUBLIC */
extern RwUInt32
RtPITexDictionaryStreamGetSize( const RwTexDictionary *texDict );
extern RwTexDictionary *
RtPITexDictionaryStreamRead( RwStream *stream );
extern RwTexDictionary *
RtPITexDictionaryStreamWrite( RwTexDictionary *texDict,
RwStream *stream );
/* RWPUBLICEND */
extern void
_rwImageGammaUnCorrectArrayOfRGBA( RwRGBA * rgbaOut,
RwRGBA * rgbaIn,
RwInt32 numEls );
#if defined( __cplusplus )
}
#endif /* defined( __cplusplus ) */
#endif /* !defined( RTPITEXD_H ) */

View File

@ -0,0 +1,682 @@
enum e_rwdb_CriterionPITexDict
{
e_rwdb_CriterionPITexDictLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionPITexDict e_rwdb_CriterionPITexDict;

View File

@ -0,0 +1,49 @@
/***************************************************************************
* *
* Module : rtPng.h *
* *
* Purpose : Load PNG format files *
* *
**************************************************************************/
#ifndef RTPNG_H
#define RTPNG_H
/**
* \defgroup rtpng RtPNG
* \ingroup rttool
*
* PNG/Portable Network Graphics Image Format Toolkit for RenderWare.
*
* See also http://www.libpng.org/pub/png/
*/
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rtpng.rpe" /* automatically generated header file */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwImage *RtPNGImageWrite(RwImage * image, const RwChar * imageName);
extern RwImage *RtPNGImageRead(const RwChar * imageName);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTPNG_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionPNG
{
e_rwdb_CriterionPNGLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionPNG e_rwdb_CriterionPNG;

646
rwsdk/include/d3d8/rtquat.h Normal file
View File

@ -0,0 +1,646 @@
/*
* Data structures for Quaternions
* See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Hamilton.html
*
* Copyright (c) Criterion Software Limited
*/
#ifndef RTQUAT_H
#define RTQUAT_H
/**
* \defgroup rtquat RtQuat
* \ingroup rttool
*
* Quaternion Toolkit for RenderWare.
*
* See also http://www.gamasutra.com/features/19980703/quaternions_01.htm
*/
/*
* See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Hamilton.html
* On 16 October 1843 (a Monday) Hamilton was walking in along the Royal
* Canal with his wife to preside at a Council meeting of the Royal Irish
* Academy.
*
* Although his wife talked to him now and again Hamilton hardly
* heard, for the discovery of the quaternions, the first noncommutative
* algebra to be studied, was taking shape in his mind:-
*
* "And here there dawned on me the notion that we must admit, in
* some sense, a fourth dimension of space for the purpose of calculating
* with triples ... An electric circuit seemed to close, and a spark
* flashed forth."
*/
/****************************************************************************
Includes
*/
#include <math.h>
/* renderware */
#include "rwcore.h"
#include "rtquat.rpe" /* automatically generated header file */
#define RW_TOL_ORTHONORMAL ((RwReal)0.01)
/****************************************************************************
Global Types
*/
typedef struct RtQuat RtQuat;
/**
* \ingroup rtquat
* \struct RtQuat
* A structure describing a Quaternion
*
*/
struct RtQuat
{
RwV3d imag; /**< The imaginary part(s) */
RwReal real; /**< The real part */
};
/****************************************************************************
Defines
*/
#define RtQuatInitMacro( result, _x, _y, _z, _w) \
MACRO_START \
{ \
(result)->real = (_w); \
(result)->imag.x = (_x); \
(result)->imag.y = (_y); \
(result)->imag.z = (_z); \
} \
MACRO_STOP
#if (!defined(RtQuatAssignMacro))
#define RtQuatAssignMacro(_target, _source) \
( *(_target) = *(_source) )
#endif /* (!defined(RtQuatAssignMacro)) */
#define RtQuatAddMacro( result, q1, q2 ) \
MACRO_START \
{ \
(result)->real = (q1)->real + (q2)->real; \
RwV3dAddMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
} \
MACRO_STOP
#define RtQuatIncrementRealPartMacro(result, s, q) \
MACRO_START \
{ \
(result)->real = (q)->real + s; \
(result)->imag.x = (q)->imag.x; \
(result)->imag.y = (q)->imag.y; \
(result)->imag.z = (q)->imag.z; \
} \
MACRO_STOP
#define RtQuatDecrementRealPartMacro(result, s, q) \
MACRO_START \
{ \
(result)->real = (q)->real - s; \
(result)->imag.x = (q)->imag.x; \
(result)->imag.y = (q)->imag.y; \
(result)->imag.z = (q)->imag.z; \
} \
MACRO_STOP
#define RtQuatIncrementMacro( result, dq ) \
MACRO_START \
{ \
(result)->real = (result)->real + (dq)->real; \
RwV3dAddMacro(&(result)->imag, &(result)->imag, &(dq)->imag); \
} \
MACRO_STOP
#define RtQuatSubMacro( result, q1, q2 ) \
MACRO_START \
{ \
(result)->real = (q1)->real - (q2)->real; \
RwV3dSubMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
} \
MACRO_STOP
#define RtQuatNegateMacro( result, q ) \
MACRO_START \
{ \
(result)->real = -(q)->real; \
(result)->imag.x = -(q)->imag.x; \
(result)->imag.y = -(q)->imag.y; \
(result)->imag.z = -(q)->imag.z; \
} \
MACRO_STOP
#define RtQuatConjugateMacro( result, q) \
MACRO_START \
{ \
(result)->real = (q)->real; \
(result)->imag.x = -(q)->imag.x; \
(result)->imag.y = -(q)->imag.y; \
(result)->imag.z = -(q)->imag.z; \
} \
MACRO_STOP
#define RtQuatScaleMacro(result, q, scale ) \
MACRO_START \
{ \
(result)->real = (q)->real * scale; \
RwV3dScaleMacro(&(result)->imag, &(q)->imag, scale); \
} \
MACRO_STOP
#define RtQuatModulusSquaredMacro( q ) \
((q)->real * (q)->real + \
RwV3dDotProductMacro(&(q)->imag, &(q)->imag))
#define RtQuatModulusMacro( result, q ) \
MACRO_START \
{ \
(result) = RtQuatModulusSquaredMacro(q); \
rwSqrtMacro(&result, result); \
} \
MACRO_STOP
#define RtQuatMultiplyMacro( result, q1, q2) \
MACRO_START \
{ \
/* \
* Assumes q1 != result != q2 \
*/ \
(result)->real = \
(q1)->real * (q2)->real - \
RwV3dDotProductMacro(&(q1)->imag,&(q2)->imag); \
RwV3dCrossProductMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
RwV3dIncrementScaledMacro(&(result)->imag, &(q2)->imag, (q1)->real); \
RwV3dIncrementScaledMacro(&(result)->imag, &(q1)->imag, (q2)->real); \
} \
MACRO_STOP
#define RtQuatReciprocalMacro( result, q) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
RwReal val = RtQuatModulusSquaredMacro(q); \
\
if (val > (RwReal) 0) \
{ \
val = ((RwReal)1) / val; \
(result)->real = (q)->real * val; \
val = -val; \
RwV3dScaleMacro(&(result)->imag, &(q)->imag, val); \
} \
} \
MACRO_STOP
#define RtQuatSquareMacro( result, q ) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
RwReal val = ((RwReal)2) * (q)->real ; \
\
(result)->real = \
(q)->real * (q)->real - \
RwV3dDotProductMacro(&(q)->imag, &(q)->imag); \
RwV3dScaleMacro(&(result)->imag, &(q)->imag, val); \
} \
MACRO_STOP
#define RtQuatSquareRootMacro( result, q ) \
MACRO_START \
{ \
/* \
* Assumes result != q \
* other root is of course -result \
*/ \
RwReal val; \
\
RtQuatModulusMacro(val,q); \
val = ((q)->real + val) * ((RwReal) 0.5); \
\
if (val > ((RwReal)0)) \
{ \
rwSqrtMacro(&val, val); \
(result)->real = val; \
val = ((RwReal)0.5) / val; \
RwV3dScale(&(result)->imag, &(q)->imag, val); \
} \
else \
{ \
result->imag.x = -(q)->real; \
rwSqrtMacro(&(result->imag.x), result->imag.x); \
result->imag.y = ((RwReal)0); \
result->imag.x = ((RwReal)0); \
result->real = ((RwReal)0); \
} \
} \
MACRO_STOP
#define RtQuatLogMacro(result, q) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
const RwReal mod2 = RtQuatModulusSquaredMacro(q); \
RwReal sin_b; \
RwReal radians; \
RwReal factor; \
\
sin_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
rwSqrtMacro(&sin_b, sin_b); \
radians = (RwReal) RwATan2(sin_b, (q)->real); \
factor = (sin_b > (RwReal) 0) ? (((RwReal)radians) / sin_b) : 0 ; \
\
RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
(result)->real = ((RwReal) RwLog(mod2)) * ((RwReal) 0.5); \
\
} \
MACRO_STOP
#define RtQuatExpMacro(result, q) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
const RwReal exp_a = (RwReal)RwExp((q)->real); \
RwReal mod_b; \
RwReal factor; \
\
mod_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
rwSqrtMacro(&mod_b, mod_b); \
factor = ( (mod_b > (RwReal) 0) ? \
(exp_a * ((RwReal)RwSin(mod_b)) / mod_b) : \
0 ) ; \
\
RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
(result)->real = exp_a * (RwReal)RwCos(mod_b); \
} \
MACRO_STOP
#define RtQuatPowMacro( result, q, e) \
MACRO_START \
{ \
RtQuat qLog; \
\
RtQuatLogMacro(&qLog, q); \
RtQuatScaleMacro(&qLog, &qLog, e); \
RtQuatExpMacro(result, &qLog); \
} \
MACRO_STOP
#define RtQuatUnitLogMacro(result, q) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
RwReal sin_b ; \
RwReal radians ; \
RwReal factor ; \
\
sin_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
rwSqrtMacro(&sin_b, sin_b); \
radians = (RwReal)RwATan2(sin_b, (q)->real); \
factor = (sin_b > (RwReal) 0) ? (((RwReal)radians) / sin_b) : 0 ; \
\
RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
(result)->real = (RwReal)0; \
\
} \
MACRO_STOP
#define RtQuatUnitExpMacro(result, q) \
MACRO_START \
{ \
/* \
* Assumes result != q \
*/ \
RwReal mod_b; \
RwReal factor; \
\
mod_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
rwSqrtMacro(&mod_b, mod_b); \
factor = (mod_b > (RwReal) 0) ? (((RwReal)RwSin(mod_b)) / mod_b) : 0 ; \
\
RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
(result)->real = (RwReal)RwCos(mod_b); \
\
} \
MACRO_STOP
#define RtQuatUnitPowMacro( result, q, e) \
MACRO_START \
{ \
RtQuat qLog; \
\
RtQuatUnitLogMacro(&qLog, q); \
RwV3dScaleMacro(&qLog.imag, &qLog.imag, e); \
RtQuatUnitExpMacro(result, &qLog); \
} \
MACRO_STOP
#define RtQuatConvertToMatrixMacro(qpQuat, mpMatrix) \
MACRO_START \
{ \
RwReal rS; \
RwV3d rV; \
RwV3d rW; \
RwV3d square; \
RwV3d cross; \
\
rS = ((RwReal) 2) / RtQuatModulusSquaredMacro((qpQuat)); \
\
RwV3dScale(&rV, &(qpQuat)->imag, rS); \
RwV3dScale(&rW, &rV, (qpQuat)->real); \
\
square.x = (qpQuat)->imag.x * rV.x; \
square.y = (qpQuat)->imag.y * rV.y; \
square.z = (qpQuat)->imag.z * rV.z; \
\
cross.x = (qpQuat)->imag.y * rV.z; \
cross.y = (qpQuat)->imag.z * rV.x; \
cross.z = (qpQuat)->imag.x * rV.y; \
\
(mpMatrix)->right.x = ((RwReal) 1) - (square.y + square.z); \
(mpMatrix)->right.y = cross.z + rW.z; \
(mpMatrix)->right.z = cross.y - rW.y; \
\
(mpMatrix)->up.x = cross.z - rW.z; \
(mpMatrix)->up.y = ((RwReal) 1) - (square.z + square.x); \
(mpMatrix)->up.z = cross.x + rW.x; \
\
(mpMatrix)->at.x = cross.y + rW.y; \
(mpMatrix)->at.y = cross.x - rW.x; \
(mpMatrix)->at.z = ((RwReal) 1) - (square.x + square.y); \
\
/* Set position */ \
(mpMatrix)->pos.x = ((RwReal) 0); \
(mpMatrix)->pos.y = ((RwReal) 0); \
(mpMatrix)->pos.z = ((RwReal) 0); \
\
/* Matrix is orthogonal */ \
rwMatrixSetFlags((mpMatrix), \
(rwMATRIXTYPEORTHOGANAL & \
~rwMATRIXINTERNALIDENTITY) ); \
\
} \
MACRO_STOP
#define RtQuatUnitConvertToMatrixMacro(qpQuat, mpMatrix) \
MACRO_START \
{ \
const RwReal x = (qpQuat)->imag.x; \
const RwReal y = (qpQuat)->imag.y; \
const RwReal z = (qpQuat)->imag.z; \
const RwReal w = (qpQuat)->real; \
RwV3d square; \
RwV3d cross; \
RwV3d wimag; \
\
square.x = x * x; \
square.y = y * y; \
square.z = z * z; \
\
cross.x = y * z; \
cross.y = z * x; \
cross.z = x * y; \
\
wimag.x = w * x; \
wimag.y = w * y; \
wimag.z = w * z; \
\
(mpMatrix)->right.x = 1 - 2 * (square.y + square.z); \
(mpMatrix)->right.y = 2 * (cross.z + wimag.z); \
(mpMatrix)->right.z = 2 * (cross.y - wimag.y); \
\
(mpMatrix)->up.x = 2 * (cross.z - wimag.z); \
(mpMatrix)->up.y = 1 - 2 * (square.x + square.z); \
(mpMatrix)->up.z = 2 * (cross.x + wimag.x); \
\
(mpMatrix)->at.x = 2 * (cross.y + wimag.y); \
(mpMatrix)->at.y = 2 * (cross.x - wimag.x); \
(mpMatrix)->at.z = (1 - 2 * (square.x + square.y)); \
\
/* Set position */ \
(mpMatrix)->pos.x = ((RwReal) 0); \
(mpMatrix)->pos.y = ((RwReal) 0); \
(mpMatrix)->pos.z = ((RwReal) 0); \
\
/* Matrix is orthonormal */ \
rwMatrixSetFlags((mpMatrix), \
(rwMATRIXTYPEORTHONORMAL & \
~rwMATRIXINTERNALIDENTITY) ); \
} \
MACRO_STOP
#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
#define RtQuatInit( result, _x, _y, _z, _w) \
RtQuatInitMacro( result, _x, _y, _z, _w)
#define RtQuatAssign( to, from ) \
RtQuatAssignMacro( to, from )
#define RtQuatAdd( result, q1, q2 ) \
RtQuatAddMacro( result, q1, q2 )
#define RtQuatIncrementRealPart(result, s, q) \
RtQuatIncrementRealPartMacro(result, s, q)
#define RtQuatDecrementRealPart(result, s, q) \
RtQuatDecrementRealPartMacro(result, s, q)
#define RtQuatIncrement( result, dq ) \
RtQuatIncrementMacro( result, dq )
#define RtQuatSub( result, q1, q2 ) \
RtQuatSubMacro( result, q1, q2 )
#define RtQuatNegate( result, q ) \
RtQuatNegateMacro( result, q )
#define RtQuatConjugate( result, q) \
RtQuatConjugateMacro( result, q)
#define RtQuatScale(result, q, scale ) \
RtQuatScaleMacro(result, q, scale )
#define RtQuatModulusSquared( q ) \
RtQuatModulusSquaredMacro( q )
#define RtQuatMultiply( result, q1, q2) \
RtQuatMultiplyMacro( result, q1, q2)
#define RtQuatReciprocal( result, q) \
RtQuatReciprocalMacro( result, q)
#define RtQuatSquare( result, q ) \
RtQuatSquareMacro( result, q )
#define RtQuatSquareRoot( result, q ) \
RtQuatSquareRootMacro( result, q )
#define RtQuatLog( result, q ) \
RtQuatLogMacro( result, q )
#define RtQuatExp( result, q ) \
RtQuatExpMacro( result, q )
#define RtQuatPow( result, q, e ) \
RtQuatPowMacro( result, q, e )
#define RtQuatUnitLog( result, q ) \
RtQuatUnitLogMacro( result, q )
#define RtQuatUnitExp( result, q ) \
RtQuatUnitExpMacro( result, q )
#define RtQuatUnitPow( result, q, e ) \
RtQuatUnitPowMacro( result, q, e )
#define RtQuatConvertToMatrix(qpQuat, mpMatrix) \
RtQuatConvertToMatrixMacro(qpQuat, mpMatrix)
#define RtQuatUnitConvertToMatrix(qpQuat, mpMatrix) \
RtQuatUnitConvertToMatrixMacro(qpQuat, mpMatrix)
#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwBool
RtQuatConvertFromMatrix(RtQuat * const qpQuat,
const RwMatrix * const mpMatrix);
extern RtQuat *
RtQuatRotate(RtQuat * quat,
const RwV3d * axis,
RwReal angle,
RwOpCombineType combineOp);
extern const RtQuat *
RtQuatQueryRotate(const RtQuat *quat,
RwV3d * unitAxis,
RwReal * angle);
extern RwV3d *
RtQuatTransformVectors(RwV3d * vectorsOut,
const RwV3d * vectorsIn,
const RwInt32 numPoints,
const RtQuat *quat);
extern RwReal
RtQuatModulus(RtQuat * q);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern void
RtQuatInit(RtQuat * result, RwReal x, RwReal y, RwReal z, RwReal w);
extern void
RtQuatAssign(RtQuat * to, RtQuat * from);
extern void
RtQuatAdd(RtQuat * result, RtQuat * q1, RtQuat * q2);
extern void
RtQuatIncrementRealPart(RtQuat * result, RwReal s, RtQuat * q);
extern void
RtQuatDecrementRealPart(RtQuat * result, RwReal s, RtQuat * q);
extern void
RtQuatIncrement(RtQuat * result, RtQuat * dq);
extern void
RtQuatSub(RtQuat * result, RtQuat * q1, RtQuat * q2);
extern void
RtQuatNegate(RtQuat * result, RtQuat * q);
extern void
RtQuatConjugate(RtQuat * result, RtQuat * q);
extern void
RtQuatScale(RtQuat * result, RtQuat * q, RwReal scale);
extern RwReal
RtQuatModulusSquared(RtQuat * q);
extern void
RtQuatMultiply(RtQuat * result, RtQuat * q1, RtQuat * q2);
extern void
RtQuatReciprocal(RtQuat * result, RtQuat * q);
extern void
RtQuatSquare(RtQuat * result, RtQuat * q);
extern void
RtQuatSquareRoot(RtQuat * result, RtQuat * q);
extern void
RtQuatLog(RtQuat * result, RtQuat * q);
extern void
RtQuatExp(RtQuat * result, RtQuat * q);
extern void
RtQuatPow(RtQuat * result, RtQuat * q, RwReal e);
extern void
RtQuatUnitLog(RtQuat * result, RtQuat * q);
extern void
RtQuatUnitExp(RtQuat * result, RtQuat * q);
extern void
RtQuatUnitPow(RtQuat * result, RtQuat * q, RwReal e);
extern void
RtQuatConvertToMatrix(const RtQuat * const qpQuat,
RwMatrix * const mpMatrix);
extern void
RtQuatUnitConvertToMatrix(const RtQuat * const qpQuat,
RwMatrix * const mpMatrix);
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*
* Backwards compatibility code
*/
typedef RtQuat RpQuat;
#define RpAnimQuatConvertFromMatrix(qpQuat, mpMatrix) \
RtQuatConvertFromMatrix(qpQuat, mpMatrix)
#define RpAnimQuatConvertToMatrix(qpQuat,mpMatrix) \
RtQuatUnitConvertToMatrix(qpQuat,mpMatrix)
#endif /* RTQUAT_H */

View File

@ -0,0 +1,645 @@
enum e_rwdb_CriterionQuat
{
e_rwdb_CriterionQuatLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionQuat e_rwdb_CriterionQuat;

View File

@ -0,0 +1,54 @@
/***************************************************************************
* *
* Module : rtRAS.h *
* *
* Purpose : Load RAS format files *
* *
**************************************************************************/
#ifndef RTRAS_H
#define RTRAS_H
/**
* \defgroup rtras RtRAS
* \ingroup rttool
*
* RAS/Sun Raster Fule Format Image Format Toolkit for RenderWare.
*
* See also http://www.sworks.com/hollasch/cgindex/formats/sunraster.html
*
*/
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rtras.rpe" /* automatically generated header file */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwImage *RtRASImageWrite(RwImage * image,
const RwChar * imageName);
extern RwImage *RtRASImageRead(const RwChar * imageName);
extern void _rwImageGammaUnCorrectArrayOfRGBA(RwRGBA * rgbaOut,
RwRGBA * rgbaIn,
RwInt32 numEls);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTRAS_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionRAS
{
e_rwdb_CriterionRASLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionRAS e_rwdb_CriterionRAS;

View File

@ -0,0 +1,61 @@
/***************************************************************************
* *
* Module : rtray.h *
* *
* Purpose : Picking with rays *
* *
**************************************************************************/
#ifndef RTRAY_H
#define RTRAY_H
/**
* \defgroup rtray RtRay
* \ingroup rttool
*
* Line Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rtray.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
/* RWPUBLIC */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Line intersections */
extern RwReal RtLineTriangleIntersectionTest(RwLine *line, RwV3d *normal,
RwV3d *v0, RwV3d *v1, RwV3d *v2);
extern RwReal RtLineSphereIntersectionTest(RwLine *line, RwSphere *sphere);
/* Line clipping */
extern RwLine *RtLineClipPlane(RwLine *line, RwPlane *plane);
extern RwLine *RtLineClipBBox(RwLine *line, RwBBox *box);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RTRAY_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionRay
{
e_rwdb_CriterionRayLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionRay e_rwdb_CriterionRay;

View File

@ -0,0 +1,262 @@
/*
* Data Structures for Slerps/Spherical Linear Interpolations
* See also GemsIII/quatspin.c in
* http://www.acm.org/pubs/tog/GraphicsGems/gemsiii.zip
* Copyright (c) Criterion Software Limited
*/
/***************************************************************************
* *
* Module : rtslerp.h *
* *
* Purpose : Slerp functionality *
* *
**************************************************************************/
#ifndef RTSLERP_H
#define RTSLERP_H
/**
* \defgroup rtslerp RtSlerp
* \ingroup rttool
*
* Slerp/Spherical Linear Interpolations Toolkit for RenderWare.
*
* See also http://www.cis.ohio-state.edu/~parent/book/Full.html
*/
#include "rwcore.h"
#include "rtquat.h"
/****************************************************************************
Includes
*/
#include "rtslerp.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
/* Masks for specifying which matrices to store by reference */
#define rtSLERPREFNONE 0x00
#define rtSLERPREFSTARTMAT 0x01
#define rtSLERPREFENDMAT 0x02
#define rtSLERPREFALL (~rtSLERPREFNONE)
/****************************************************************************
Global Types
*/
typedef struct RtSlerp RtSlerp;
/**
* \ingroup rtslerp
* \struct RtSlerp
* structure describing a Slerps/Spherical Linear Interpolations.
* See also GemsIII/quatspin.c in
* http://www.acm.org/pubs/tog/GraphicsGems/gemsiii.zip
*/
struct RtSlerp
{
RwInt32 matRefMask; /**< Which matrices do we NOT own */
RwMatrix *startMat; /**< The start matrix */
RwMatrix *endMat; /**< The end matrix */
RwV3d axis; /**< The axis of rotation for the slerp */
RwReal angle; /**< The angle (in degrees) between src & dest */
/* Though a slerp may be a bad idea and opting for a lerp is better */
RwBool useLerp; /**< Do we want to use lerps? */
};
/* static frame sequence animation - contains no state */
typedef struct RtQuatSlerpCache RtQuatSlerpCache;
/**
* \ingroup rtslerp
* \struct RtQuatSlerpCache
* structure describing a SlerpCache,
* which should be initialized with \ref RtQuatSetupSlerpCache.
*/
struct RtQuatSlerpCache
{
RtQuat raFrom; /**< Scaled initial quaternion */
RtQuat raTo; /**< Scaled final quaternion */
RwReal omega; /**< Angular displacement in radians */
RwBool nearlyZeroOm; /**< Flags near-zero angular
displacement*/
};
typedef struct RtQuatSlerpArgandCache RtQuatSlerpArgandCache;
/**
* \ingroup rtslerp
* \struct RtQuatSlerpArgandCache
* a structure describing
* an Argand SlerpCache which should be
* initialized with \ref RtQuatSetupSlerpArgandCache.
* See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Argand.html
* Jean Argand was an accountant and amateur mathematician.
* He is famed for his geometrical interpretation of the complex numbers
* where i is interpreted as a rotation through 90.
*/
struct RtQuatSlerpArgandCache
{
RtQuat logTo; /**< field Logarithm of final quaternion */
RtQuat logBase; /**< Logarithm of initial relative to final quaternion */
};
#define RtQuatSlerpMacro(qpResult, qpFrom, qpTo, rT, sCache) \
MACRO_START \
{ \
if ((rT) <= ((RwReal) 0)) \
{ \
/* t is before start */ \
*(qpResult) = *(qpFrom); \
} \
else if (((RwReal) 1) <= (rT)) \
{ \
\
/* t is after end */ \
*(qpResult) = *(qpTo); \
} \
else \
{ \
/* ... so t must be in the interior then */ \
/* Calc coefficients rSclFrom, rSclTo */ \
RwReal rSclFrom = ((RwReal) 1) - (rT); \
RwReal rSclTo = (rT); \
\
if (!((sCache)->nearlyZeroOm)) \
{ \
/* Standard case: slerp */ \
/* SLERPMESSAGE(("Neither nearly ZERO nor nearly PI")); */ \
\
rSclFrom *= (sCache)->omega; \
RwSinMinusPiToPiMacro(rSclFrom, rSclFrom); \
rSclTo *= (sCache)->omega; \
RwSinMinusPiToPiMacro(rSclTo, rSclTo); \
} \
\
/* Calc final values */ \
RwV3dScaleMacro(&(qpResult)->imag, \
&(sCache)->raFrom.imag, rSclFrom); \
RwV3dIncrementScaledMacro(&(qpResult)->imag, \
&(sCache)->raTo.imag, rSclTo); \
(qpResult)->real = \
((sCache)->raFrom.real * rSclFrom) + \
((sCache)->raTo.real * rSclTo); \
} \
} \
MACRO_STOP
#define RtQuatSlerpArgandMacro(qpResult, qpFrom, qpTo, rT, sArgandCache) \
MACRO_START \
{ \
if ((rT) <= ((RwReal) 0)) \
{ \
/* t is before start */ \
*(qpResult) = *(qpFrom); \
} \
else if (((RwReal) 1) <= (rT)) \
{ \
/* t is after end */ \
*(qpResult) = *(qpTo); \
} \
else \
{ \
RtQuat logBlend; \
\
/* ... so t must be in the interior then */ \
\
logBlend.imag.x = \
(sArgandCache)->logBase.imag.x + \
(rT) * (sArgandCache)->logTo.imag.x; \
logBlend.imag.y = \
(sArgandCache)->logBase.imag.y + \
(rT) * (sArgandCache)->logTo.imag.y; \
logBlend.imag.z = \
(sArgandCache)->logBase.imag.z + \
(rT) * (sArgandCache)->logTo.imag.z; \
logBlend.real = 0; \
\
RtQuatUnitExpMacro((qpResult), &logBlend); \
\
} \
} \
MACRO_STOP
#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
#define RtQuatSlerp(qpResult, qpFrom, qpTo, rT, sCache) \
RtQuatSlerpMacro(qpResult, qpFrom, qpTo, rT, sCache)
#define RtQuatSlerpArgand(qpResult, qpFrom, qpTo, rT, sArgandCache) \
RtQuatSlerpArgandMacro(qpResult, qpFrom, qpTo, rT, sArgandCache)
#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Creating and destroying slerps */
extern RtSlerp *RtSlerpCreate(RwInt32 nMatRefMask);
extern void RtSlerpDestroy(RtSlerp * spSlerp);
/* setting up a slerp */
extern RtSlerp *RtSlerpInitialize(RtSlerp * spSlerp,
RwMatrix * mpMat1,
RwMatrix * mpMat2);
/* Get a matrix */
extern RwMatrix *RtSlerpGetMatrix(RtSlerp * spSlerp,
RwMatrix * mpResultMat,
RwReal nDelta);
/* Set if lerp or slerp */
extern RtSlerp *RtSlerpSetLerp(RtSlerp * spSlerp,
RwBool bUseLerp);
extern void
RtQuatSetupSlerpCache(RtQuat * qpFrom,
RtQuat * qpTo,
RtQuatSlerpCache * sCache);
extern void
RtQuatSetupSlerpArgandCache(RtQuat * qpFrom,
RtQuat * qpTo,
RtQuatSlerpArgandCache * sArgandCache);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern void
RtQuatSlerp(RtQuat * qpResult,
RtQuat * qpFrom,
RtQuat * qpTo,
RwReal rT,
RtQuatSlerpCache * sCache);
extern void
RtQuatSlerpArgand(RtQuat * qpResult,
RtQuat * qpFrom,
RtQuat * qpTo,
RwReal rT,
RtQuatSlerpArgandCache * sArgandCache);
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTSLERP_H */

View File

@ -0,0 +1,646 @@
enum e_rwdb_CriterionSlerp
{
e_rwdb_CriterionSlerpLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionSlerp e_rwdb_CriterionSlerp;

View File

@ -0,0 +1,65 @@
/***************************************************************************
* *
* Module : rtsplpvs.h *
* *
* Purpose : To generate pvs data for a world froma spline *
* *
**************************************************************************/
#ifndef RTSPLINEPVS_H
#define RTSPLINEPVS_H
/**
* \defgroup rtsplinepvs RtSplinePVS
* \ingroup rttool
*
* Spline PVS Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpworld.h"
#include "rpspline.h"
/* RWPUBLIC */
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RpWorld *
RtSplinePVSConstruct(RpWorld * world,
RpSpline *spline, RwInt32 samples);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
/* for back compatibility */
#define RtSplinePVSCreate(_world, _raster, _zraster, \
_mindist, _maxdist, _spline, _samples) \
RtSplinePVSConstruct(_world, \
_spline, _samples)
#endif /* RTSPLINEPVS_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionSplinePVS
{
e_rwdb_CriterionSplinePVSLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionSplinePVS e_rwdb_CriterionSplinePVS;

View File

@ -0,0 +1,47 @@
/***************************************************************************
* *
* Module : rttiff.h *
* *
* Purpose : Load TIFF format files *
* *
**************************************************************************/
#ifndef RWTIFF_H
#define RWTIFF_H
/**
* \defgroup rttiff RtTIFF
* \ingroup rttool
*
* TIFF/Tag Image File Format Image Format Toolkit for RenderWare.
*
* See also http://www.libtiff.org
*/
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rttiff.rpe" /* automatically generated header file */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern RwImage *RtTIFFImageRead(const RwChar *imageName);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RWTIFF_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionTIFF
{
e_rwdb_CriterionTIFFLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionTIFF e_rwdb_CriterionTIFF;

View File

@ -0,0 +1,70 @@
/***************************************************************************
* *
* Module : rttilerd.h *
* *
* Purpose : Tile renderer *
* *
**************************************************************************/
#ifndef RTTILERD_H
#define RTTILERD_H
/**
* \defgroup rttilerender RtTileRender
* \ingroup rttool
*
* Tile renderer - e.g. grabbing screen shots - Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpcriter.h"
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
typedef RwCamera * (*RtTileRenderCallBack)(RwCamera *camera,
RwInt32 x, RwInt32 y,
void *pData);
typedef RwImage * (*RtTileArchiveCallBack)(RwImage *image,
RwInt32 x, RwInt32 y,
void *pData);
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Tile renderer */
extern RwCamera *
RtTileRender(RwCamera *camera,
RwInt32 imageWidth, RwInt32 imageHeight,
RwInt32 tileWidth, RwInt32 tileHeight,
RtTileRenderCallBack renderCallBack,
RtTileArchiveCallBack archiveCallBack,
void *pData);
extern RwImage *
RtTileDefaultArchive(RwImage *image,
RwInt32 x, RwInt32 y, void *pData);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTTILERD_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionTileRend
{
e_rwdb_CriterionTileRendLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionTileRend e_rwdb_CriterionTileRend;

View File

@ -0,0 +1,99 @@
/***************************************************************************
* *
* Module : rttoc.h *
* *
* Purpose : Table Of Contents (TOC) *
* *
**************************************************************************/
#ifndef RTTOC_H
#define RTTOC_H
/**
* \defgroup rttoc RtTOC
* \ingroup rttool
*
* Table Of Contents (TOC) - e.g. creating a TOC for a RwStream.
*/
/****************************************************************************
Includes
*/
#include "rwcore.h"
#include "rpcriter.h"
/****************************************************************************
Defines
*/
/****************************************************************************
Global Types
*/
typedef struct _rtTOCGUID _rtTOCGUID;
struct _rtTOCGUID
{
RwUInt32 data1;
RwUInt16 data2;
RwUInt16 data3;
RwUInt8 data4[8];
};
typedef struct RtTOCEntry RtTOCEntry;
/**
* \ingroup rttoc
* \struct RtTOCEntry
*
* BLAH
*/
struct RtTOCEntry
{
RwCorePluginID id; /**< Chunk ID */
RwUInt32 offset;/**< Offset of chunk from the start of the file
* including TOC */
_rtTOCGUID guid; /**< GUID */
};
typedef struct RtTOC RtTOC;
/**
* \ingroup rttoc
* \struct RtTOC
*
* BLAH
*/
struct RtTOC
{
RwInt32 numEntries; /**< Number of entries*/
RtTOCEntry entry[1]; /**< Entry*/
};
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Create/Destroy */
extern RtTOC *RtTOCCreate(RwStream *stream);
extern void RtTOCDestroy(RtTOC *toc);
/* Access */
extern RwInt32 RtTOCGetNumEntries(const RtTOC *toc);
extern RtTOCEntry *RtTOCGetEntry(RtTOC *toc, RwInt32 entry);
/* Serialization */
extern RwUInt32 RtTOCStreamGetSize(const RtTOC *toc);
extern const RtTOC *RtTOCStreamWrite(RtTOC *toc, RwStream *stream);
extern RtTOC *RtTOCStreamRead(RwStream *stream);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RTTOC_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionTOC
{
e_rwdb_CriterionTOCLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionTOC e_rwdb_CriterionTOC;

View File

@ -0,0 +1,38 @@
/***************************************************************************
* *
* Module : rtvcat.h *
* *
* Purpose : Tristripping callback for vertex cache aware strips *
* *
**************************************************************************/
#ifndef RTVCAT_H
#define RTVCAT_H
/****************************************************************************
Includes
*/
/*--- Include files ---*/
#include "rwcore.h"
#include "rtvcat.rpe" /* automatically generated header file */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
extern RpMeshHeader *
RpBuildMeshGenerateCacheAwareTriStrip(RpBuildMesh *buildMesh,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* RTVCAT_H */

View File

@ -0,0 +1,629 @@
enum e_rwdb_CriterionVextexCacheStrip
{
e_rwdb_CriterionVextexCacheStripLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionVextexCacheStrip e_rwdb_CriterionVextexCacheStrip;

View File

@ -0,0 +1,85 @@
/*
* World toolkit.
*/
/***************************************************************************
* *
* Module : rtworld.h *
* *
* Purpose : World tool helper functions header *
* *
**************************************************************************/
#ifndef RTWORLD_H
#define RTWORLD_H
/**
* \defgroup rtworld RtWorld
* \ingroup rttool
*
* World Import Toolkit for RenderWare.
*/
/****************************************************************************
Includes
*/
#include "rpworld.h"
#include "rtworld.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
/* RWPUBLIC */
/****************************************************************************
Global Types
*/
/* RWPUBLICEND */
/****************************************************************************
Exported globals
*/
/* RWPUBLIC */
/****************************************************************************
Function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Get the number of various things in the world */
extern RwInt32 RtWorldGetNumWorldSectors(RpWorld *world);
extern RwInt32 RtWorldGetNumVertices(RpWorld *world);
extern RwInt32 RtWorldGetNumPolygons(RpWorld *world);
/* Find things out about materials in the world */
extern RwInt32 RtWorldFindMaterialNum(RpWorld *world, RpMaterial *material);
extern RpMaterial *RtWorldFindMaterialWithTextureName(RpWorld *world, RwChar *name);
/* Optimisation functions in optimise.c */
extern RpClump *RtClumpOptimize(RpClump *clump, RwReal dist);
extern RpAtomic *RtAtomicOptimize(RpAtomic *atomic, RwReal dist);
/*
* This function has been removed, however it still exists as a stealth
* function, _rtGeometryOptimize.
*/
#define RtGeometryOptimize(geometry, dist) (geometry)
extern RpGeometry *_rtGeometryOptimize(RpGeometry *geometry, RwReal dist);
/* Import utility functions from imputil.c */
extern RpGeometry *RtGeometryCalculateVertexNormals(RpGeometry *geometry);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* RWPUBLICEND */
#endif /* RWTLWRLD_H */

View File

@ -0,0 +1,628 @@
enum e_rwdb_CriterionTlWorld
{
e_rwdb_CriterionTlWorldLAST = RWFORCEENUMSIZEINT
};
typedef enum e_rwdb_CriterionTlWorld e_rwdb_CriterionTlWorld;

4791
rwsdk/include/d3d8/rwcore.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,11 @@
#include "common.h"
#include "patcher.h"
#include "Weather.h"
#include "Collision.h"
#include "SurfaceTable.h"
float (*CSurfaceTable::ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS] = (float (*)[NUMADHESIVEGROUPS])0x8E29D4;
int
CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
{
@ -42,3 +46,52 @@ CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
default: return ADHESIVE_ROAD;
}
}
float
CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
{
switch(surfaceType){
case SURFACE_0:
case SURFACE_1:
case SURFACE_4:
case SURFACE_5:
case SURFACE_8:
case SURFACE_20:
case SURFACE_21:
case SURFACE_22:
case SURFACE_25:
case SURFACE_30:
case SURFACE_31:
return 1.0f - CWeather::WetRoads*0.25f;
case SURFACE_2:
case SURFACE_6:
case SURFACE_7:
case SURFACE_9:
case SURFACE_10:
case SURFACE_11:
case SURFACE_12:
case SURFACE_13:
case SURFACE_14:
case SURFACE_15:
case SURFACE_16:
case SURFACE_17:
case SURFACE_23:
case SURFACE_24:
case SURFACE_26:
case SURFACE_27:
case SURFACE_28:
case SURFACE_29:
case SURFACE_32:
return 1.0f - CWeather::WetRoads*0.4f;
default:
return 1.0f;
}
}
float
CSurfaceTable::GetAdhesiveLimit(CColPoint &colpoint)
{
return ms_aAdhesiveLimitTable[GetAdhesionGroup(colpoint.surfaceB)][GetAdhesionGroup(colpoint.surfaceA)];
}

View File

@ -92,8 +92,14 @@ enum
NUMADHESIVEGROUPS
};
struct CColPoint;
class CSurfaceTable
{
// static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
static float (*ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS];
public:
static int GetAdhesionGroup(uint8 surfaceType);
static float GetWetMultiplier(uint8 surfaceType);
static float GetAdhesiveLimit(CColPoint &colpoint);
};

Some files were not shown because too many files have changed in this diff Show More