Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,173 @@
# Microsoft Developer Studio Project File - Name="PRT" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=PRT - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Prt.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Prt.mak" CFG="PRT - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "PRT - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "PRT - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "PRT - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/PRT", KAEAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "PRT - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\PRTP5_vr.lib"
!ELSEIF "$(CFG)" == "PRT - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "X:\CPA\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\PRTP5_vd.lib"
!ELSEIF "$(CFG)" == "PRT - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "PRT___Wi"
# PROP BASE Intermediate_Dir "PRT___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp\retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "RETAIL" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\PRTP5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\PRTP5_vf.lib"
!ENDIF
# Begin Target
# Name "PRT - Win32 Release"
# Name "PRT - Win32 Debug"
# Name "PRT - Win32 Retail"
# Begin Group "Includes"
# PROP Default_Filter "h"
# Begin Source File
SOURCE=..\..\public\PRT\PointPrt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\PrtEnv.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\PrtMeca.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\PrtSrc.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\PrtSyst.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\SegmtPrt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\PRT\SprtPrt.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\PointPrt.c
# End Source File
# Begin Source File
SOURCE=.\Prt.mak
# End Source File
# Begin Source File
SOURCE=.\PrtEnv.c
# End Source File
# Begin Source File
SOURCE=.\PrtMeca.c
# End Source File
# Begin Source File
SOURCE=.\PrtSrc.c
# End Source File
# Begin Source File
SOURCE=.\PrtSyst.c
# End Source File
# Begin Source File
SOURCE=.\SegmtPrt.c
# End Source File
# Begin Source File
SOURCE=.\SprtPrt.c
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,391 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="PRT"
ProjectGUID="{3FD62EE0-8461-4284-B6D1-621A91B9F52C}"
SccProjectName="&quot;$/cpa/tempgrp/PRT&quot;, KAEAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;USE_PROFILER"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/PRT.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\PRTP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\tmp\retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;RETAIL"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp\retail/PRT.pch"
AssemblerListingLocation=".\tmp\retail/"
ObjectFile=".\tmp\retail/"
ProgramDataBaseFileName=".\tmp\retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\PRTP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="X:\CPA\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\Debug/PRT.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\PRTP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Includes"
Filter="h">
<File
RelativePath="..\..\public\PRT\PointPrt.h">
</File>
<File
RelativePath="..\..\public\PRT.h">
</File>
<File
RelativePath="..\..\public\PRT\PrtEnv.h">
</File>
<File
RelativePath="..\..\public\PRT\PrtMeca.h">
</File>
<File
RelativePath="..\..\public\PRT\PrtSrc.h">
</File>
<File
RelativePath="..\..\public\PRT\PrtSyst.h">
</File>
<File
RelativePath="..\..\public\PRT\SegmtPrt.h">
</File>
<File
RelativePath="..\..\public\PRT\SprtPrt.h">
</File>
</Filter>
<File
RelativePath="PointPrt.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Prt.mak">
</File>
<File
RelativePath="PrtEnv.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="PrtMeca.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="PrtSrc.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="PrtSyst.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="SegmtPrt.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="SprtPrt.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,356 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/PointPrt.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Point particles creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreatePointParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GMT_tdxHandleToGameMaterial _hMaterial )
{
ACP_tdxHandleOfElement hElementPoint;
ACP_tdxIndex xPointIndex;
GEO_tdstColor stColor;
PRT_tdstPointCommonData *p_stPointCommonData;
_p_stParticlesSystem->xParticlesType = PRT_C_xPointParticles;
/* Table de vitesse de particules */
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stSpeed,
MTH3D_tdstVector *,
sizeof ( MTH3D_tdstVector ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stListOfParticles,
void *,
sizeof ( PRT_tdstPointParticle ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->p_stCommonData,
void *,
sizeof ( PRT_tdstPointCommonData ),
E_uwGEONotEnoughtMemory );
stColor.xR = 1.0f;
stColor.xG = 1.0f;
stColor.xB = 1.0f;
stColor.xA = 1.0f;
GEO_vCreateGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject), _p_stParticlesSystem->xNbParticles, 1 );
GEO_xCreateElementPoints ( _p_stParticlesSystem->hParticlesSystemObject, &hElementPoint, _p_stParticlesSystem->xNbParticles );
GEO_xSetGameMaterialOfElementPoints ( _p_stParticlesSystem->hParticlesSystemObject, hElementPoint, _hMaterial );
for ( xPointIndex = 0 ; xPointIndex < _p_stParticlesSystem->xNbParticles ; xPointIndex ++ )
{
GEO_xSetIndexOfElementPoints ( _p_stParticlesSystem->hParticlesSystemObject, hElementPoint, xPointIndex, xPointIndex );
}
GEO_vEndCreateObject ( _p_stParticlesSystem->hParticlesSystemObject );
p_stPointCommonData = (PRT_tdstPointCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stPointCommonData->hMaterial = _hMaterial;
}
/*
--------------------------------------------------------------------------------
-- Description : Point particles destruction
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructPointParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->xParticlesType = PRT_C_xNullParticles;
/* Table de vitesse de particules */
GEO_M_CPAFree ( _p_stParticlesSystem->d_stSpeed );
_p_stParticlesSystem->d_stSpeed = NULL;
GEO_M_CPAFree ( _p_stParticlesSystem->d_stListOfParticles );
_p_stParticlesSystem->d_stListOfParticles = NULL;
GEO_M_CPAFree ( _p_stParticlesSystem->p_stCommonData );
_p_stParticlesSystem->p_stCommonData = NULL;
GEO_vDeleteGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject) );
_p_stParticlesSystem->hParticlesSystemObject = NULL;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetGameMaterialPointParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GMT_tdxHandleToGameMaterial _hGameMaterial )
{
PRT_tdstPointCommonData *p_stPointCommonData;
p_stPointCommonData = (PRT_tdstPointCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stPointCommonData->hMaterial = _hGameMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vGeneratePointParticle ( MTH3D_tdstVector *_p_stParticlePosition,
MTH3D_tdstVector *_p_stParticleSpeed,
PRT_tdstPointParticle *_p_stPointParticle,
PRT_tdstPointCommonData *_p_stPointCommonData,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT )
{
MTH3D_tdstVector stSpeedVariation;
MTH_tdxReal xC1;
MTH_tdxReal xC2;
MTH_tdxReal xC3;
MTH_tdxReal xC4;
MTH3D_tdstVector stTrans;
/* vecteur variation de vitesse */
MTH3D_M_vSetVectorElements ( &stSpeedVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ) );
/* vitesse initiale */
MTH3D_M_vMullAddVector ( _p_stParticleSpeed, _p_stParticlesSource->xSpeed, &(_p_stParticlesSource->stNormal), &stSpeedVariation );
if ( (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink) || (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink) )
{
POS_fn_vMulMatrixVector ( _p_stParticleSpeed, _p_stSourceMatrix, _p_stParticleSpeed );
}
/* position initiale */
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucPoint )
{
MTH3D_M_vCopyVector ( _p_stParticlePosition, &(_p_stParticlesSource->stVertex1) );
}
else
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucQuad )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ;
}
else
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucParallelepipede )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC4 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 ), xC4 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX + xC4*_p_stParticlesSource->stVertex4.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY + xC4*_p_stParticlesSource->stVertex4.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ + xC4*_p_stParticlesSource->stVertex4.xZ;
}
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink )
{
POS_fn_vMulMatrixVertex( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
else
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucTranslationLink )
{
POS_fn_vGetTranslationVector( _p_stSourceMatrix, &stTrans );
MTH3D_M_vAddVector ( _p_stParticlePosition, &stTrans, _p_stParticlePosition );
}
else
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink )
{
POS_fn_vMulMatrixVector ( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
/* BirthDate */
/* p_stBubbleParticle->xBirthDate = xTimeT;*/
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vMecaPointParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesEnvironment *_p_stParticlesEnvironment,
MTH_tdxReal _xTimeT,
MTH_tdxReal _xDeltaT )
{
PRT_tdstPointParticle *p_stPointParticle;
PRT_tdstPointParticle *p_stLastPointParticle;
MTH3D_tdstVector *p_stParticlePosition;
MTH3D_tdstVector *p_stLastParticlePosition;
MTH3D_tdstVector *p_stParticleSpeed;
MTH3D_tdstVector *p_stLastParticleSpeed;
ACP_tdxBool bAlivedParticle;
MTH3D_tdstVector stAccelerationVariation;
p_stPointParticle = (PRT_tdstPointParticle *)(_p_stParticlesSystem->d_stListOfParticles);
p_stLastPointParticle = p_stPointParticle + _p_stParticlesSystem->xNbActiveParticles;
p_stParticlePosition = _p_stParticlesSystem->hParticlesSystemObject->d_stListOfPoints;
p_stLastParticlePosition = p_stParticlePosition + _p_stParticlesSystem->xNbActiveParticles;
p_stParticleSpeed = _p_stParticlesSystem->d_stSpeed;
p_stLastParticleSpeed = p_stParticleSpeed + _p_stParticlesSystem->xNbActiveParticles;
while ( p_stPointParticle != p_stLastPointParticle )
{
/* appliquer la meca */
/* vecteur variation de l acceleration */
MTH3D_M_vSetVectorElements ( &stAccelerationVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ) );
MTH3D_M_vAddVector ( &stAccelerationVariation, &(_p_stParticlesEnvironment->stAcceleration), &stAccelerationVariation );
/* Vit t = f( Vit t-1, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticleSpeed, _xDeltaT, &stAccelerationVariation, p_stParticleSpeed );
/* Pos t = f( Vit t, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticlePosition, _xDeltaT, p_stParticleSpeed, p_stParticlePosition );
bAlivedParticle = ( _p_stParticlesEnvironment->ulEnvType == PRT_C_ulAlignedBoxEnv ) ?
INT_fn_bGetInclusionPointInBox ( p_stParticlePosition,
&(_p_stParticlesEnvironment->stMinPoint),
&(_p_stParticlesEnvironment->stMaxPoint) ) :
INT_fn_bGetInclusionPointInSphere ( p_stParticlePosition,
&(_p_stParticlesEnvironment->stSphereCenter),
_p_stParticlesEnvironment->xRadius );
if ( bAlivedParticle )
{
p_stPointParticle ++;
p_stParticlePosition ++;
p_stParticleSpeed ++;
}
else
{
_p_stParticlesSystem->xNbActiveParticles --;
p_stLastPointParticle --;
if ( p_stPointParticle != p_stLastPointParticle )
{
*p_stPointParticle = *p_stLastPointParticle;
p_stLastParticlePosition --;
*p_stParticlePosition = *p_stLastParticlePosition;
p_stLastParticleSpeed --;
*p_stParticleSpeed = *p_stLastParticleSpeed;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSourceGeneratePointParticle ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT )
{
PRT_tdstPointParticle *p_stPointParticle;
MTH3D_tdstVector *p_stParticlePosition;
MTH3D_tdstVector *p_stParticleSpeed;
ACP_tdxIndex xNbParticlesToInject;
ACP_tdxIndex xIndex;
/* generation de particules ? */
if ( PRT_fn_bComputeParticlesGeneration ( _p_stParticlesSource ) )
{
/*ANNECY VL PRT 18/03/98{*/
xNbParticlesToInject = (ACP_tdxIndex) MTH_M_xRealToLong ( MTH_M_xMul ( MTH_M_xLongToReal ( PRT_fn_xComputeNbParticlesToInject ( _p_stParticlesSource ) ), PRT_g_xNbParticlesFactor ) );
/*ENDANNECY VL}*/
if ( xNbParticlesToInject > 0 )
{
if ( _p_stParticlesSystem->xNbActiveParticles + xNbParticlesToInject > _p_stParticlesSystem->xNbParticles )
{
xNbParticlesToInject = _p_stParticlesSystem->xNbParticles - _p_stParticlesSystem->xNbActiveParticles;
}
p_stPointParticle = (PRT_tdstPointParticle *)(_p_stParticlesSystem->d_stListOfParticles) + _p_stParticlesSystem->xNbActiveParticles;
p_stParticlePosition = _p_stParticlesSystem->hParticlesSystemObject->d_stListOfPoints + _p_stParticlesSystem->xNbActiveParticles;
p_stParticleSpeed = _p_stParticlesSystem->d_stSpeed + _p_stParticlesSystem->xNbActiveParticles;
_p_stParticlesSystem->xNbActiveParticles += xNbParticlesToInject;
for ( xIndex = 0 ; xIndex < xNbParticlesToInject ; xIndex ++ )
{
/* reset meca */
PRT_fn_vGeneratePointParticle ( p_stParticlePosition, p_stParticleSpeed,
p_stPointParticle, (PRT_tdstPointCommonData *)(_p_stParticlesSystem->p_stCommonData),
_p_stParticlesSource, _p_stSourceMatrix, _xTimeT );
p_stPointParticle ++;
p_stParticlePosition ++;
p_stParticleSpeed ++;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vPreDrawPointParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->hParticlesSystemObject->xNbPoints = _p_stParticlesSystem->xNbActiveParticles;
((GEO_tdstElementPoints *)(_p_stParticlesSystem->hParticlesSystemObject->d_stListOfElements[0]))->xNbPoints = _p_stParticlesSystem->xNbActiveParticles;
}
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,62 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/PrtEnv.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Particles environment creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreateParticlesEnvironment ( PRT_tdstParticlesEnvironment **_p_pstParticlesEnvironment )
{
GEO_M_CPAMalloc ( *_p_pstParticlesEnvironment,
PRT_tdstParticlesEnvironment *,
sizeof ( PRT_tdstParticlesEnvironment ),
E_uwGEONotEnoughtMemory );
}
/*
--------------------------------------------------------------------------------
-- Description : Particles environment destruction
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructParticlesEnvironment ( PRT_tdstParticlesEnvironment *_p_stParticlesEnvironment )
{
GEO_M_CPAFree ( _p_stParticlesEnvironment );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,191 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/PrtMeca.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Particles system destruction
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructParticlesSystem( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
switch ( _p_stParticlesSystem->xParticlesType )
{
case PRT_C_xPointParticles :
PRT_fn_vDestructPointParticles ( _p_stParticlesSystem );
break;
case PRT_C_xSegmentParticles :
PRT_fn_vDestructSegmentParticles ( _p_stParticlesSystem );
break;
case PRT_C_xSpriteParticles :
PRT_fn_vDestructSpriteParticles ( _p_stParticlesSystem );
break;
default :
break;
}
GEO_M_CPAFree ( _p_stParticlesSystem );
}
/*
--------------------------------------------------------------------------------
-- Description : Particles system creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCopyCloneParticlesSystem
(
PRT_tdstParticlesSystem *_p_stParticlesSystemDst,
PRT_tdstParticlesSystem *_p_stParticlesSystemSrc
)
{
_p_stParticlesSystemDst->xNbParticles = _p_stParticlesSystemSrc->xNbParticles;
_p_stParticlesSystemDst->xNbActiveParticles = _p_stParticlesSystemSrc->xNbActiveParticles;
switch ( _p_stParticlesSystemSrc->xParticlesType )
{
case PRT_C_xPointParticles :
PRT_fn_vCreatePointParticles ( _p_stParticlesSystemDst, ((PRT_tdstPointCommonData *)(_p_stParticlesSystemDst->p_stCommonData))->hMaterial );
break;
case PRT_C_xSegmentParticles :
PRT_fn_vCreateSegmentParticles ( _p_stParticlesSystemDst, ((PRT_tdstSegmentCommonData *)(_p_stParticlesSystemDst->p_stCommonData))->hMaterial );
break;
case PRT_C_xSpriteParticles :
PRT_fn_vCreateSpriteParticles ( _p_stParticlesSystemDst, ((PRT_tdstSpriteCommonData *)(_p_stParticlesSystemDst->p_stCommonData))->hSprite );
break;
default :
break;
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Particles system mechanic
--------------------------------------------------------------------------------
-- Creation date : 02 sep 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/*
void PRT_fn_vMecaParticlesSystem
(
PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesEnvironment *_p_stParticlesEnvironment,
MTH_tdxReal _xTimeT,
MTH_tdxReal _xDeltaT
)
*/
void PRT_fn_vMecaParticlesSystem
(
tdstParticleGenerator *_p_stPrtGen,
MTH_tdxReal _xTimeT,
MTH_tdxReal _xDeltaT
)
{
switch ( _p_stPrtGen->p_stPrtSys->xParticlesType )
{
case PRT_C_xSpriteParticles :
PRT_fn_vMecaSpriteParticlesSystem ( _p_stPrtGen, _xTimeT, _xDeltaT );
break;
case PRT_C_xPointParticles :
PRT_fn_vMecaPointParticlesSystem ( _p_stPrtGen->p_stPrtSys, _p_stPrtGen->p_stPrtEnv, _xTimeT, _xDeltaT );
break;
case PRT_C_xSegmentParticles :
PRT_fn_vMecaSegmentParticlesSystem ( _p_stPrtGen->p_stPrtSys, _p_stPrtGen->p_stPrtEnv, _xTimeT, _xDeltaT );
break;
default :
break;
}
}
/*
--------------------------------------------------------------------------------
-- Description : Particles system generation
--------------------------------------------------------------------------------
-- Creation date : 02 sep 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSourceGenerateParticle
(
PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT
)
{
switch ( _p_stParticlesSystem->xParticlesType )
{
case PRT_C_xSpriteParticles :
PRT_fn_vSourceGenerateSpriteParticle ( _p_stParticlesSystem, _p_stParticlesSource, _p_stSourceMatrix, _xTimeT );
break;
case PRT_C_xPointParticles :
PRT_fn_vSourceGeneratePointParticle ( _p_stParticlesSystem, _p_stParticlesSource, _p_stSourceMatrix, _xTimeT );
break;
case PRT_C_xSegmentParticles :
PRT_fn_vSourceGenerateSegmentParticle ( _p_stParticlesSystem, _p_stParticlesSource, _p_stSourceMatrix, _xTimeT );
break;
default :
break;
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/*void PRT_fn_vPreDrawParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem )*/
void PRT_fn_vPreDrawParticlesSystem ( tdstParticleGenerator *_p_stPrtGen )
{
switch ( _p_stPrtGen->p_stPrtSys->xParticlesType )
{
case PRT_C_xPointParticles :
PRT_fn_vPreDrawPointParticlesSystem ( _p_stPrtGen->p_stPrtSys );
break;
case PRT_C_xSegmentParticles :
PRT_fn_vPreDrawSegmentParticlesSystem ( _p_stPrtGen->p_stPrtSys );
break;
case PRT_C_xSpriteParticles :
PRT_fn_vPreDrawSpriteParticlesSystem ( _p_stPrtGen->p_stPrtSys );
break;
default :
break;
}
}
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,186 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/PrtSrc.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
MTH_tdxReal PRT_g_xNbParticlesFactor = MTH_C_ONE;
/*
--------------------------------------------------------------------------------
-- Description : Particles source creation
--------------------------------------------------------------------------------
-- Creation date : 15 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreateParticlesSource ( PRT_tdstParticlesSource **_p_pstParticlesSource )
{
GEO_M_CPAMalloc
(
*_p_pstParticlesSource,
PRT_tdstParticlesSource *,
sizeof ( PRT_tdstParticlesSource ),
E_uwGEONotEnoughtMemory
);
(*_p_pstParticlesSource)->ucLifeMode = PRT_C_ucNoLifeTime;
}
/*
--------------------------------------------------------------------------------
-- Description : Particles source destruction
--------------------------------------------------------------------------------
-- Creation date : 15 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructParticlesSource ( PRT_tdstParticlesSource *_p_stParticlesSource )
{
GEO_M_CPAFree ( _p_stParticlesSource );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetQuadParticlesSource
(
PRT_tdstParticlesSource *_p_stParticlesSource,
MTH3D_tdstVector *_p_stVertex1,
MTH3D_tdstVector *_p_stVertex2,
MTH3D_tdstVector *_p_stVertex3
)
{
MTH3D_tdstVector stEdge12;
MTH3D_tdstVector stEdge13;
MTH3D_M_vCopyVector ( &(_p_stParticlesSource->stVertex1), _p_stVertex1 );
MTH3D_M_vCopyVector ( &(_p_stParticlesSource->stVertex2), _p_stVertex2 );
MTH3D_M_vCopyVector ( &(_p_stParticlesSource->stVertex3), _p_stVertex3 );
MTH3D_M_vSubVector ( &stEdge12, _p_stVertex2, _p_stVertex1 );
MTH3D_M_vSubVector ( &stEdge13, _p_stVertex3, _p_stVertex1 );
MTH3D_M_vCrossProductVectorWithoutBuffer ( &(_p_stParticlesSource->stNormal) , &stEdge12 , &stEdge13 );
MTH3D_M_vNormalizeVector ( &(_p_stParticlesSource->stNormal), &(_p_stParticlesSource->stNormal) );
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vSetPointParticlesSource( PRT_tdstParticlesSource *_p_stParticlesSource,MTH3D_tdstVector *_p_stVertex )
{
MTH3D_M_vCopyVector( &(_p_stParticlesSource->stVertex1), _p_stVertex );
MTH3D_M_vNullVector( &(_p_stParticlesSource->stNormal) );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
ACP_tdxBool PRT_fn_bComputeParticlesGeneration ( PRT_tdstParticlesSource *_p_stParticlesSource )
{
/* continuous generation */
if ( _p_stParticlesSource->ucGenerationMode == PRT_C_ucContinousGeneration )
return TRUE;
/* probabilist generattion */
if ( _p_stParticlesSource->ucGenerationMode == PRT_C_ucProbabilistGeneration )
{
if ( _p_stParticlesSource->xGenerationProbability > RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE ) )
return TRUE;
return FALSE;
}
/* Crenel generation */
if ( _p_stParticlesSource->ucGenerationMode == PRT_C_ucCrenelGeneration )
{
if ( _p_stParticlesSource->xFramesCounter < _p_stParticlesSource->xNbFramesNoGeneration )
{
_p_stParticlesSource->xFramesCounter ++;
return FALSE;
}
_p_stParticlesSource->xFramesCounter = (_p_stParticlesSource->xFramesCounter+1)%_p_stParticlesSource->xNbFramesTotal;
return TRUE;
}
/* bad generation code or no generation */
return FALSE;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
ACP_tdxIndex PRT_fn_xComputeNbParticlesToInject ( PRT_tdstParticlesSource *_p_stParticlesSource )
{
if ( _p_stParticlesSource->ucNbParticlesToGenerateMode == PRT_C_ucConstantNb )
return _p_stParticlesSource->xNbParticlesToGenerate;
if ( _p_stParticlesSource->ucNbParticlesToGenerateMode == PRT_C_ucProbabilistNb )
return (ACP_tdxIndex) RND_fn_ulGetUnsignedLongRandomValue ( 0, _p_stParticlesSource->xNbMin, _p_stParticlesSource->xNbMax );
return 0;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vSetNbParticlesFactor ( MTH_tdxReal _xNbParticlesFactor )
{
PRT_g_xNbParticlesFactor = _xNbParticlesFactor;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,83 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/PrtSyst.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Particles system creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreateParticlesSystem ( PRT_tdstParticlesSystem **_p_pstParticlesSystem,
ACP_tdxIndex _xNbParticles )
{
GEO_M_CPAMalloc ( *_p_pstParticlesSystem,
PRT_tdstParticlesSystem *,
sizeof ( PRT_tdstParticlesSystem ),
E_uwGEONotEnoughtMemory );
(*_p_pstParticlesSystem)->xNbParticles = _xNbParticles;
(*_p_pstParticlesSystem)->xNbActiveParticles = 0;
/* Objet graphique */
(*_p_pstParticlesSystem)->hParticlesSystemObject = NULL;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 13 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vInitParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->xNbActiveParticles = 0;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetObjectParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
ACP_tdxHandleOfObject _hParticlesSystemObject )
{
_p_stParticlesSystem->hParticlesSystemObject = _hParticlesSystemObject;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,431 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/SegmtPrt.h"
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Segment particles creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreateSegmentParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GMT_tdxHandleToGameMaterial _hMaterial )
{
ACP_tdxHandleOfElement hElementSegment;
ACP_tdxIndex xSegmentIndex;
GEO_tdstDoubledIndex stSegmentPoints;
GEO_tdstColor stColor;
PRT_tdstSegmentCommonData *p_stSegmentCommonData;
_p_stParticlesSystem->xParticlesType = PRT_C_xSegmentParticles;
/* Table de vitesse de particules */
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stSpeed,
MTH3D_tdstVector *,
sizeof ( MTH3D_tdstVector ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stListOfParticles,
void *,
sizeof ( PRT_tdstSegmentParticle ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->p_stCommonData,
void *,
sizeof ( PRT_tdstSegmentCommonData ),
E_uwGEONotEnoughtMemory );
stColor.xR = 1.0f;
stColor.xG = 1.0f;
stColor.xB = 1.0f;
stColor.xA = 1.0f;
GEO_vCreateGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject), (ACP_tdxIndex) (2*_p_stParticlesSystem->xNbParticles), (ACP_tdxIndex)1 );
GEO_xCreateElementLines ( _p_stParticlesSystem->hParticlesSystemObject, &hElementSegment, _p_stParticlesSystem->xNbParticles );
for ( xSegmentIndex = 0 ; xSegmentIndex < _p_stParticlesSystem->xNbParticles ; xSegmentIndex ++ )
{
stSegmentPoints.a2_xIndex[0] = 2*xSegmentIndex;
stSegmentPoints.a2_xIndex[1] = 2*xSegmentIndex + 1;
GEO_xSetIndexOfElementLines ( _p_stParticlesSystem->hParticlesSystemObject, hElementSegment, xSegmentIndex, &stSegmentPoints );
GEO_xSetGameMaterialOfElementLines ( _p_stParticlesSystem->hParticlesSystemObject, hElementSegment, xSegmentIndex, _hMaterial );
}
GEO_vEndCreateObject ( _p_stParticlesSystem->hParticlesSystemObject );
p_stSegmentCommonData = (PRT_tdstSegmentCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSegmentCommonData->hMaterial = _hMaterial;
}
/*
--------------------------------------------------------------------------------
-- Description : Segment particles destruction
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructSegmentParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->xParticlesType = PRT_C_xNullParticles;
/* Table de vitesse de particules */
GEO_M_CPAFree ( _p_stParticlesSystem->d_stSpeed );
_p_stParticlesSystem->d_stSpeed = NULL;
GEO_M_CPAFree ( _p_stParticlesSystem->d_stListOfParticles );
_p_stParticlesSystem->d_stListOfParticles = NULL;
GEO_M_CPAFree ( _p_stParticlesSystem->p_stCommonData );
_p_stParticlesSystem->p_stCommonData = NULL;
GEO_vDeleteGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject) );
_p_stParticlesSystem->hParticlesSystemObject = NULL;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetGameMaterialSegmentParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GMT_tdxHandleToGameMaterial _hGameMaterial )
{
PRT_tdstSegmentCommonData *p_stSegmentCommonData;
p_stSegmentCommonData = (PRT_tdstSegmentCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSegmentCommonData->hMaterial = _hGameMaterial;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetPointColorSegmentParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GEO_tdstColor *_p_stColor )
{
PRT_tdstSegmentCommonData *p_stSegmentCommonData;
p_stSegmentCommonData = (PRT_tdstSegmentCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSegmentCommonData->stPointColor = *_p_stColor;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetLastPointColorSegmentParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GEO_tdstColor *_p_stColor )
{
PRT_tdstSegmentCommonData *p_stSegmentCommonData;
p_stSegmentCommonData = (PRT_tdstSegmentCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSegmentCommonData->stLastPointColor = *_p_stColor;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vGenerateSegmentParticle ( MTH3D_tdstVector *_p_stParticlePosition,
MTH3D_tdstVector *_p_stParticleSpeed,
PRT_tdstSegmentParticle *_p_stSegmentParticle,
PRT_tdstSegmentCommonData *_p_stSegmentCommonData,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT )
{
MTH3D_tdstVector stSpeedVariation;
MTH_tdxReal xC1;
MTH_tdxReal xC2;
MTH_tdxReal xC3;
MTH_tdxReal xC4;
MTH3D_tdstVector stTrans;
/* vecteur variation de vitesse */
MTH3D_M_vSetVectorElements ( &stSpeedVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ) );
/* vitesse initiale */
MTH3D_M_vMullAddVector ( _p_stParticleSpeed, _p_stParticlesSource->xSpeed, &(_p_stParticlesSource->stNormal), &stSpeedVariation );
if ( (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink) || (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink) )
{
POS_fn_vMulMatrixVector ( _p_stParticleSpeed, _p_stSourceMatrix, _p_stParticleSpeed );
}
/* position initiale */
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucPoint )
{
MTH3D_M_vCopyVector ( _p_stParticlePosition, &(_p_stParticlesSource->stVertex1) );
}
else
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucQuad )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ;
}
else
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucParallelepipede )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC4 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 ), xC4 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX + xC4*_p_stParticlesSource->stVertex4.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY + xC4*_p_stParticlesSource->stVertex4.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ + xC4*_p_stParticlesSource->stVertex4.xZ;
}
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink )
{
POS_fn_vMulMatrixVertex( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
else
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucTranslationLink )
{
POS_fn_vGetTranslationVector( _p_stSourceMatrix, &stTrans );
MTH3D_M_vAddVector ( _p_stParticlePosition, &stTrans, _p_stParticlePosition );
}
else
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink )
{
POS_fn_vMulMatrixVector ( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
/* LastPos */
MTH3D_M_vCopyVector ( _p_stParticlePosition+1, _p_stParticlePosition );
/* couleur du segment */
_p_stSegmentParticle->stPointColor = _p_stSegmentCommonData->stPointColor;
_p_stSegmentParticle->stLastPointColor = _p_stSegmentCommonData->stLastPointColor;
/* DeathDate */
if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucNoLifeTime )
{
_p_stSegmentParticle->xDeathDate = MTH_C_InfinitPlus;
}
else
if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucConstantLifeTime )
{
_p_stSegmentParticle->xDeathDate = MTH_M_xAdd ( _xTimeT, _p_stParticlesSource->xMinTime );
}
else
if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucProbabilistLifeTime )
{
_p_stSegmentParticle->xDeathDate = MTH_M_xAdd ( _xTimeT, RND_fn_xGetRealRandomValue ( 0, _p_stParticlesSource->xMinTime, _p_stParticlesSource->xMaxTime ) );
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vMecaSegmentParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesEnvironment *_p_stParticlesEnvironment,
MTH_tdxReal _xTimeT,
MTH_tdxReal _xDeltaT )
{
PRT_tdstSegmentParticle *p_stSegmentParticle;
PRT_tdstSegmentParticle *p_stLastSegmentParticle;
MTH3D_tdstVector *p_stParticlePosition;
MTH3D_tdstVector *p_stParticleLastPosition;
MTH3D_tdstVector *p_stLastParticlePosition;
MTH3D_tdstVector *p_stLastParticleLastPosition;
MTH3D_tdstVector *p_stParticleSpeed;
MTH3D_tdstVector *p_stLastParticleSpeed;
ACP_tdxBool bAlivedParticle;
MTH3D_tdstVector stAccelerationVariation;
p_stSegmentParticle = (PRT_tdstSegmentParticle *)(_p_stParticlesSystem->d_stListOfParticles);
p_stLastSegmentParticle = p_stSegmentParticle + _p_stParticlesSystem->xNbActiveParticles;
p_stParticlePosition = _p_stParticlesSystem->hParticlesSystemObject->d_stListOfPoints;
p_stParticleLastPosition = p_stParticlePosition + 1;
p_stLastParticlePosition = p_stParticlePosition + 2*_p_stParticlesSystem->xNbActiveParticles;
p_stLastParticleLastPosition = p_stLastParticlePosition + 1;
p_stParticleSpeed = _p_stParticlesSystem->d_stSpeed;
p_stLastParticleSpeed = p_stParticleSpeed + _p_stParticlesSystem->xNbActiveParticles;
while ( p_stSegmentParticle != p_stLastSegmentParticle )
{
/* LastPos */
MTH3D_M_vCopyVector ( p_stParticleLastPosition, p_stParticlePosition );
/* appliquer la meca */
/* vecteur variation de l acceleration */
MTH3D_M_vSetVectorElements ( &stAccelerationVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesEnvironment->xAccelerationRange ), _p_stParticlesEnvironment->xAccelerationRange ) );
MTH3D_M_vAddVector ( &stAccelerationVariation, &(_p_stParticlesEnvironment->stAcceleration), &stAccelerationVariation );
/* Vit t = f( Vit t-1, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticleSpeed, _xDeltaT, &stAccelerationVariation, p_stParticleSpeed );
/* Pos t = f( Vit t, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticlePosition, _xDeltaT, p_stParticleSpeed, p_stParticlePosition );
bAlivedParticle = MTH_M_bGreater ( p_stSegmentParticle->xDeathDate, _xTimeT );
if ( bAlivedParticle )
{
bAlivedParticle = ( _p_stParticlesEnvironment->ulEnvType == PRT_C_ulAlignedBoxEnv ) ?
INT_fn_bGetInclusionPointInBox ( p_stParticlePosition,
&(_p_stParticlesEnvironment->stMinPoint),
&(_p_stParticlesEnvironment->stMaxPoint) ) :
INT_fn_bGetInclusionPointInSphere ( p_stParticlePosition,
&(_p_stParticlesEnvironment->stSphereCenter),
_p_stParticlesEnvironment->xRadius );
}
if ( bAlivedParticle )
{
p_stSegmentParticle ++;
p_stParticlePosition ++;
p_stParticlePosition ++;
p_stParticleLastPosition ++;
p_stParticleLastPosition ++;
p_stParticleSpeed ++;
}
else
{
_p_stParticlesSystem->xNbActiveParticles --;
p_stLastSegmentParticle --;
if ( p_stSegmentParticle != p_stLastSegmentParticle )
{
*p_stSegmentParticle = *p_stLastSegmentParticle;
p_stLastParticlePosition --;
p_stLastParticlePosition --;
*p_stParticlePosition = *p_stLastParticlePosition;
p_stLastParticleLastPosition --;
p_stLastParticleLastPosition --;
*p_stParticleLastPosition = *p_stLastParticleLastPosition;
p_stLastParticleSpeed --;
*p_stParticleSpeed = *p_stLastParticleSpeed;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSourceGenerateSegmentParticle ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT )
{
PRT_tdstSegmentParticle *p_stSegmentParticle;
MTH3D_tdstVector *p_stParticlePosition;
MTH3D_tdstVector *p_stParticleSpeed;
long lNbParticlesToInject;
ACP_tdxIndex xIndex;
/* generation de particules ? */
if ( PRT_fn_bComputeParticlesGeneration ( _p_stParticlesSource ) )
{
lNbParticlesToInject = MTH_M_xRealToLong ( MTH_M_xMul ( MTH_M_xLongToReal ( PRT_fn_xComputeNbParticlesToInject ( _p_stParticlesSource ) ), PRT_g_xNbParticlesFactor ) );
if ( lNbParticlesToInject > 0 )
{
if ( _p_stParticlesSystem->xNbActiveParticles + lNbParticlesToInject > _p_stParticlesSystem->xNbParticles )
{
lNbParticlesToInject = _p_stParticlesSystem->xNbParticles - _p_stParticlesSystem->xNbActiveParticles;
}
p_stSegmentParticle = (PRT_tdstSegmentParticle *)(_p_stParticlesSystem->d_stListOfParticles) + _p_stParticlesSystem->xNbActiveParticles;
p_stParticlePosition = _p_stParticlesSystem->hParticlesSystemObject->d_stListOfPoints + 2*_p_stParticlesSystem->xNbActiveParticles;
p_stParticleSpeed = _p_stParticlesSystem->d_stSpeed + _p_stParticlesSystem->xNbActiveParticles;
_p_stParticlesSystem->xNbActiveParticles += (short)lNbParticlesToInject;
for ( xIndex = 0 ; xIndex < lNbParticlesToInject ; xIndex ++ )
{
/* reset meca */
PRT_fn_vGenerateSegmentParticle ( p_stParticlePosition, p_stParticleSpeed,
p_stSegmentParticle, (PRT_tdstSegmentCommonData *)(_p_stParticlesSystem->p_stCommonData),
_p_stParticlesSource, _p_stSourceMatrix, _xTimeT );
p_stSegmentParticle ++;
p_stParticlePosition ++;
p_stParticlePosition ++;
p_stParticleSpeed ++;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vPreDrawSegmentParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->hParticlesSystemObject->xNbPoints = 2*_p_stParticlesSystem->xNbActiveParticles;
((GEO_tdstElementLines *)(_p_stParticlesSystem->hParticlesSystemObject->d_stListOfElements[0]))->xNbLines = _p_stParticlesSystem->xNbActiveParticles;
}
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,656 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Particles system
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef D_THROW_PRT
#include "acp_base.h"
#include "MTH.h"
#include "RND.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PRT/SprtPrt.h"
extern float a64_fSinTable[64];
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
-- Description : Sprite particles creation
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vCreateSpriteParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem, ACP_tdxHandleOfSprite _hSprite )
{
ACP_tdxHandleOfElement hElementSprite;
ACP_tdxIndex xSpriteIndex;
MTH2D_tdstVector stDefaultSize = { MTH_C_ONE, MTH_C_ONE };
PRT_tdstSpriteCommonData *p_stSpriteCommonData;
_p_stParticlesSystem->xParticlesType = PRT_C_xSpriteParticles;
/* Table de vitesse de particules */
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stSpeed,
MTH3D_tdstVector *,
sizeof ( MTH3D_tdstVector ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->d_stListOfParticles,
void *,
sizeof ( PRT_tdstSpriteParticle ) * _p_stParticlesSystem->xNbParticles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc ( _p_stParticlesSystem->p_stCommonData,
void *,
sizeof ( PRT_tdstSpriteCommonData ),
E_uwGEONotEnoughtMemory );
GEO_vCreateGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject), _p_stParticlesSystem->xNbParticles, 1 );
GEO_vCreateElementSprite ( _p_stParticlesSystem->hParticlesSystemObject, &hElementSprite, _p_stParticlesSystem->xNbParticles );
/*ANNECY VL PRT 18/03/98{*/
((GEO_tdstElementSprite *) _p_stParticlesSystem->hParticlesSystemObject->d_stListOfElements[0])->cFastDraw = 1;
/*ENDANNECY VL}*/
for ( xSpriteIndex = 0 ; xSpriteIndex < _p_stParticlesSystem->xNbParticles ; xSpriteIndex ++ )
{
GEO_vSetSizeOfIndexedSprite ( _p_stParticlesSystem->hParticlesSystemObject, hElementSprite, xSpriteIndex, &stDefaultSize );
GEO_vSetCenterPointOfIndexedSprite ( _p_stParticlesSystem->hParticlesSystemObject, hElementSprite, xSpriteIndex, xSpriteIndex );
GEO_vSetHandleOfIndexedSprite ( _p_stParticlesSystem->hParticlesSystemObject, hElementSprite, xSpriteIndex, _hSprite );
}
GEO_vEndCreateObject ( _p_stParticlesSystem->hParticlesSystemObject );
p_stSpriteCommonData = (PRT_tdstSpriteCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSpriteCommonData->hSprite = _hSprite;
}
/*
--------------------------------------------------------------------------------
-- Description : Sprite particles destruction
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vDestructSpriteParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
PRT_tdstSpriteCommonData *p_stSpriteCommonData;
_p_stParticlesSystem->xParticlesType = PRT_C_xNullParticles;
/* Table de vitesse de particules */
GEO_M_CPAFree ( _p_stParticlesSystem->d_stSpeed );
_p_stParticlesSystem->d_stSpeed = NULL;
GEO_M_CPAFree ( _p_stParticlesSystem->d_stListOfParticles );
_p_stParticlesSystem->d_stListOfParticles = NULL;
p_stSpriteCommonData = (PRT_tdstSpriteCommonData *) _p_stParticlesSystem->p_stCommonData;
if ( p_stSpriteCommonData->d_stSpriteData != NULL )
GEO_M_CPAFree ( p_stSpriteCommonData->d_stSpriteData );
GEO_M_CPAFree ( p_stSpriteCommonData );
_p_stParticlesSystem->p_stCommonData = NULL;
GEO_vDeleteGeometricObject ( &(_p_stParticlesSystem->hParticlesSystemObject) );
_p_stParticlesSystem->hParticlesSystemObject = NULL;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSetGameMaterialSpriteParticles ( PRT_tdstParticlesSystem *_p_stParticlesSystem,
GMT_tdxHandleToGameMaterial _hGameMaterial )
{
PRT_tdstSpriteCommonData *p_stSpriteCommonData;
p_stSpriteCommonData = (PRT_tdstSpriteCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSpriteCommonData->hMaterial = _hGameMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vGenerateSpriteParticle
(
MTH3D_tdstVector *_p_stParticlePosition,
MTH3D_tdstVector *_p_stParticleSpeed,
PRT_tdstSpriteParticle *_p_stSpriteParticle,
PRT_tdstSpriteCommonData *_p_stSpriteCommonData,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
MTH3D_tdstVector stSpeedVariation;
MTH_tdxReal xC1, xC2, xC3, xC4;
MTH3D_tdstVector stTrans;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* vecteur variation de vitesse */
MTH3D_M_vSetVectorElements
(
&stSpeedVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( _p_stParticlesSource->xSpeedRange ), _p_stParticlesSource->xSpeedRange )
);
/* vitesse initiale */
MTH3D_M_vMullAddVector ( _p_stParticleSpeed, _p_stParticlesSource->xSpeed, &(_p_stParticlesSource->stNormal), &stSpeedVariation );
if ( (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink) || (_p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink) )
{
POS_fn_vMulMatrixVector ( _p_stParticleSpeed, _p_stSourceMatrix, _p_stParticleSpeed );
}
/* position initiale */
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucPoint )
{
MTH3D_M_vCopyVector ( _p_stParticlePosition, &(_p_stParticlesSource->stVertex1) );
}
else
if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucQuad )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ;
}
else if ( _p_stParticlesSource->ucGeometryMode == PRT_C_ucParallelepipede )
{
/* genere les deux parametres */
xC2 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC3 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC4 = RND_fn_xGetRealRandomValue ( 0, MTH_C_ZERO, MTH_C_ONE );
xC1 = MTH_M_xSub ( MTH_M_xSub ( MTH_M_xSub ( MTH_C_ONE, xC2 ), xC3 ), xC4 );
_p_stParticlePosition->xX = xC1*_p_stParticlesSource->stVertex1.xX + xC2*_p_stParticlesSource->stVertex2.xX + xC3*_p_stParticlesSource->stVertex3.xX + xC4*_p_stParticlesSource->stVertex4.xX;
_p_stParticlePosition->xY = xC1*_p_stParticlesSource->stVertex1.xY + xC2*_p_stParticlesSource->stVertex2.xY + xC3*_p_stParticlesSource->stVertex3.xY + xC4*_p_stParticlesSource->stVertex4.xY;
_p_stParticlePosition->xZ = xC1*_p_stParticlesSource->stVertex1.xZ + xC2*_p_stParticlesSource->stVertex2.xZ + xC3*_p_stParticlesSource->stVertex3.xZ + xC4*_p_stParticlesSource->stVertex4.xZ;
}
if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotAndTransLink )
{
POS_fn_vMulMatrixVertex( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
else if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucTranslationLink )
{
POS_fn_vGetTranslationVector( _p_stSourceMatrix, &stTrans );
MTH3D_M_vAddVector ( _p_stParticlePosition, &stTrans, _p_stParticlePosition );
}
else if ( _p_stParticlesSource->ucLinkMode == PRT_C_ucRotationLink )
{
POS_fn_vMulMatrixVector ( _p_stParticlePosition, _p_stSourceMatrix, _p_stParticlePosition );
}
/* DeathDate */
if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucNoLifeTime )
{
_p_stSpriteParticle->xDeathDate = MTH_C_InfinitPlus;
}
else if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucConstantLifeTime )
{
_p_stSpriteParticle->xDeathDate = MTH_M_xAdd ( _xTimeT, _p_stParticlesSource->xMinTime );
}
else if ( _p_stParticlesSource->ucLifeMode == PRT_C_ucProbabilistLifeTime )
{
_p_stSpriteParticle->xDeathDate = MTH_M_xAdd ( _xTimeT, RND_fn_xGetRealRandomValue ( 0, _p_stParticlesSource->xMinTime, _p_stParticlesSource->xMaxTime ) );
}
/* particle rotation */
{
static int iRotation = 0;
if (iRotation)
{
_p_stSpriteParticle->a2_cRotateSpeed[0] = (char) (RND_fn_ulGetUnsignedLongRandomValue( 0, 0, 9) - 4 );
_p_stSpriteParticle->a2_cRotateSpeed[1] = (char) (RND_fn_ulGetUnsignedLongRandomValue( 0, 0, 9) - 4 );
}
}
}
/*
--------------------------------------------------------------------------------
Description : add a particle in a particle generator
--------------------------------------------------------------------------------
Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vAddSpriteParticle( tdstParticleGenerator *_p_stPrtGen, MTH3D_tdstVector *_p_stParticlePosition, MTH3D_tdstVector *_p_stParticleSpeed, MTH_tdxReal _xTime )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
MTH3D_tdstVector *p_stVect;
PRT_tdstParticlesSystem *p_stPrtSys;
PRT_tdstParticlesSource *p_stPrtSrc;
PRT_tdstSpriteParticle *p_stSprPrt;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stPrtSys = _p_stPrtGen->p_stPrtSys;
if (p_stPrtSys->xNbActiveParticles == p_stPrtSys->xNbParticles)
return;
/* DeathDate */
p_stPrtSrc = _p_stPrtGen->p_stPrtSrc;
p_stSprPrt = (PRT_tdstSpriteParticle *)(p_stPrtSys->d_stListOfParticles) + p_stPrtSys->xNbActiveParticles;
if ( p_stPrtSrc->ucLifeMode == PRT_C_ucNoLifeTime )
p_stSprPrt->xDeathDate = MTH_C_InfinitPlus;
else if ( p_stPrtSrc->ucLifeMode == PRT_C_ucConstantLifeTime )
p_stSprPrt->xDeathDate = MTH_M_xAdd ( _xTime, p_stPrtSrc->xMinTime );
else if ( p_stPrtSrc->ucLifeMode == PRT_C_ucProbabilistLifeTime )
p_stSprPrt->xDeathDate = MTH_M_xAdd ( _xTime, RND_fn_xGetRealRandomValue ( 0, p_stPrtSrc->xMinTime, p_stPrtSrc->xMaxTime ) );
p_stVect = p_stPrtSys->hParticlesSystemObject->d_stListOfPoints + p_stPrtSys->xNbActiveParticles;
MTH3D_M_vCopyVector( p_stVect, _p_stParticlePosition );
p_stVect = p_stPrtSys->d_stSpeed + p_stPrtSys->xNbActiveParticles;
MTH3D_M_vCopyVector( p_stVect, _p_stParticleSpeed );
p_stPrtSys->xNbActiveParticles++;
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vMecaSpriteParticlesSystem ( tdstParticleGenerator *_p_stPrtGen,MTH_tdxReal _xTimeT,MTH_tdxReal _xDeltaT )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
PRT_tdstSpriteParticle *p_stSpriteParticle, *p_stLastSpriteParticle;
MTH3D_tdstVector *p_stParticlePosition, *p_stLastParticlePosition;
MTH3D_tdstVector *p_stParticleSpeed, *p_stLastParticleSpeed;
ACP_tdxBool bAlivedParticle;
MTH3D_tdstVector stAccelerationVariation;
PRT_tdstParticlesEnvironment *p_stPrtEnv;
PRT_tdstParticlesSystem *p_stPrtSys;
/*XB980505*/
/* GEO_tdstIndexedSprite *p_stGeoSprite, *p_stLastGeoSprite;*/
GEO_tdstIndexedSprite *p_stGeoSprite, *p_stLastGeoSprite=NULL;
/*End XB*/
PRT_tdstSpriteData *p_stSprData;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stPrtEnv = _p_stPrtGen->p_stPrtEnv;
p_stPrtSys = _p_stPrtGen->p_stPrtSys;
p_stSpriteParticle = (PRT_tdstSpriteParticle *)(p_stPrtSys->d_stListOfParticles);
p_stLastSpriteParticle = p_stSpriteParticle + p_stPrtSys->xNbActiveParticles;
p_stParticlePosition = p_stPrtSys->hParticlesSystemObject->d_stListOfPoints;
p_stLastParticlePosition = p_stParticlePosition + p_stPrtSys->xNbActiveParticles;
p_stParticleSpeed = p_stPrtSys->d_stSpeed;
p_stLastParticleSpeed = p_stParticleSpeed + p_stPrtSys->xNbActiveParticles;
if (PRT_fn_cSystemIsMultipleSprites( p_stPrtSys) )
{
p_stGeoSprite = ((GEO_tdstElementSprite *) p_stPrtSys->hParticlesSystemObject->d_stListOfElements[0])->d_stListOfSprites;
p_stLastGeoSprite = p_stGeoSprite + p_stPrtSys->xNbActiveParticles;
}
else
p_stGeoSprite = NULL;
while ( p_stSpriteParticle != p_stLastSpriteParticle )
{
/* first test death date */
bAlivedParticle = MTH_M_bGreater ( p_stSpriteParticle->xDeathDate, _xTimeT );
if (bAlivedParticle)
{
/* appliquer la meca */
/* vecteur variation de l acceleration */
MTH3D_M_vSetVectorElements
(
&stAccelerationVariation,
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( p_stPrtEnv->xAccelerationRange ), p_stPrtEnv->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( p_stPrtEnv->xAccelerationRange ), p_stPrtEnv->xAccelerationRange ),
RND_fn_xGetRealRandomValue ( 0, MTH_M_xNeg ( p_stPrtEnv->xAccelerationRange ), p_stPrtEnv->xAccelerationRange )
);
MTH3D_M_vAddVector ( &stAccelerationVariation, &(p_stPrtEnv->stAcceleration), &stAccelerationVariation );
/* Vit t = f( Vit t-1, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticleSpeed, _xDeltaT, &stAccelerationVariation, p_stParticleSpeed );
/* Pos t = f( Vit t, Pos t-1, Accel t ) */
MTH3D_M_vMullAddVector ( p_stParticlePosition, _xDeltaT, p_stParticleSpeed, p_stParticlePosition );
bAlivedParticle =
( p_stPrtEnv->ulEnvType == PRT_C_ulAlignedBoxEnv ) ?
INT_fn_bGetInclusionPointInBox ( p_stParticlePosition, &(p_stPrtEnv->stMinPoint), &(p_stPrtEnv->stMaxPoint) ) :
INT_fn_bGetInclusionPointInSphere ( p_stParticlePosition,&(p_stPrtEnv->stSphereCenter),p_stPrtEnv->xRadius );
}
if ( bAlivedParticle )
{
/*
* treatment on alive particle that have not to be done to death particles
*/
/* rotation */
if (p_stSpriteParticle->a2_cRotateSpeed[0])
{
p_stSpriteParticle->a2_ucRotateAngle[0] += p_stSpriteParticle->a2_cRotateSpeed[0];
p_stGeoSprite->stSize.xX = p_stSpriteParticle->stSize.xX * a64_fSinTable[ p_stSpriteParticle->a2_ucRotateAngle[0] & 0x3F ] / 2;
}
if (p_stSpriteParticle->a2_cRotateSpeed[1])
{
p_stSpriteParticle->a2_ucRotateAngle[1] += p_stSpriteParticle->a2_cRotateSpeed[1];
p_stGeoSprite->stSize.xY = p_stSpriteParticle->stSize.xY * a64_fSinTable[ p_stSpriteParticle->a2_ucRotateAngle[1] & 0x3F ] / 2;
}
/* change sprite */
if ( p_stGeoSprite && MTH_M_bGreater( _xTimeT, p_stSpriteParticle->xChangeSpriteDate ) )
{
p_stSprData = ((PRT_tdstSpriteCommonData *) p_stPrtSys->p_stCommonData)->d_stSpriteData + p_stSpriteParticle->cNextSpriteIndex;
p_stGeoSprite->hSprite = p_stSprData->hSprite;
if ( p_stSprData->xTime < 0 )
p_stSpriteParticle->xChangeSpriteDate = MTH_C_InfinitPlus;
else
{
p_stSpriteParticle->xChangeSpriteDate = _xTimeT + p_stSprData->xTime;
p_stSpriteParticle->cNextSpriteIndex = p_stSprData->cNextSprite;
}
}
/*
* goto next particle
*/
p_stSpriteParticle ++;
p_stParticlePosition ++;
p_stParticleSpeed ++;
if (p_stGeoSprite)
p_stGeoSprite++;
}
else
{
p_stPrtSys->xNbActiveParticles --;
p_stLastSpriteParticle --;
/*
* If there's a linked generator add this particle to linked generator
*/
if (_p_stPrtGen->p_stLinkedPrtGen)
{
if (_p_stPrtGen->ulLinkedPrtGenMask & 1 )
MTH3D_M_vNullVector( p_stParticleSpeed );
PRT_fn_vAddSpriteParticle( _p_stPrtGen->p_stLinkedPrtGen, p_stParticlePosition, p_stParticleSpeed, _xTimeT );
}
if ( p_stSpriteParticle != p_stLastSpriteParticle )
{
*p_stSpriteParticle = *p_stLastSpriteParticle;
p_stLastParticlePosition --;
*p_stParticlePosition = *p_stLastParticlePosition;
p_stLastParticleSpeed --;
*p_stParticleSpeed = *p_stLastParticleSpeed;
if (p_stGeoSprite)
p_stGeoSprite->hSprite = (--p_stLastGeoSprite)->hSprite;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vSourceGenerateSpriteParticle
(
PRT_tdstParticlesSystem *_p_stParticlesSystem,
PRT_tdstParticlesSource *_p_stParticlesSource,
POS_tdstCompletePosition *_p_stSourceMatrix,
MTH_tdxReal _xTimeT
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
PRT_tdstSpriteParticle *p_stSpriteParticle;
MTH3D_tdstVector *p_stParticlePosition;
MTH3D_tdstVector *p_stParticleSpeed;
ACP_tdxIndex xNbParticlesToInject;
ACP_tdxIndex xIndex;
ACP_tdxIndex xSpriteIndex;
PRT_tdstSpriteCommonData *p_stSpriteCommonData;
PRT_tdstSpriteData *p_stSprData;
char cProba;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* generation de particules ? */
if ( PRT_fn_bComputeParticlesGeneration ( _p_stParticlesSource ) )
{
xNbParticlesToInject = (ACP_tdxIndex) MTH_M_xRealToLong ( MTH_M_xMul ( MTH_M_xLongToReal ( PRT_fn_xComputeNbParticlesToInject ( _p_stParticlesSource ) ), PRT_g_xNbParticlesFactor ) );
if ( xNbParticlesToInject > 0 )
{
if ( _p_stParticlesSystem->xNbActiveParticles + xNbParticlesToInject > _p_stParticlesSystem->xNbParticles )
{
xNbParticlesToInject = _p_stParticlesSystem->xNbParticles - _p_stParticlesSystem->xNbActiveParticles;
}
p_stSpriteCommonData = (PRT_tdstSpriteCommonData *)(_p_stParticlesSystem->p_stCommonData);
p_stSpriteParticle = (PRT_tdstSpriteParticle *)(_p_stParticlesSystem->d_stListOfParticles) + _p_stParticlesSystem->xNbActiveParticles;
p_stParticlePosition = _p_stParticlesSystem->hParticlesSystemObject->d_stListOfPoints + _p_stParticlesSystem->xNbActiveParticles;
p_stParticleSpeed = _p_stParticlesSystem->d_stSpeed + _p_stParticlesSystem->xNbActiveParticles;
xSpriteIndex = _p_stParticlesSystem->xNbActiveParticles;
_p_stParticlesSystem->xNbActiveParticles += xNbParticlesToInject;
for ( xIndex = 0 ; xIndex < xNbParticlesToInject ; xIndex ++ )
{
/* reset meca */
PRT_fn_vGenerateSpriteParticle
(
p_stParticlePosition,
p_stParticleSpeed,
p_stSpriteParticle,
p_stSpriteCommonData,
_p_stParticlesSource,
_p_stSourceMatrix,
_xTimeT
);
/* special for multi sprite particles : to be deplaced in generation part code */
if ( (p_stSprData = p_stSpriteCommonData->d_stSpriteData) != NULL )
{
cProba = (char) RND_fn_ulGetUnsignedLongRandomValue( 0, 0, 100 );
while (p_stSprData->cProba <= cProba )
p_stSprData++;
GEO_vSetHandleOfIndexedSprite( _p_stParticlesSystem->hParticlesSystemObject, 0, xSpriteIndex, p_stSprData->hSprite );
if (p_stSprData->xTime < 0)
p_stSpriteParticle->xChangeSpriteDate = MTH_C_InfinitPlus;
else
{
p_stSpriteParticle->xChangeSpriteDate = _xTimeT + p_stSprData->xTime;
p_stSpriteParticle->cNextSpriteIndex = p_stSprData->cNextSprite;
}
xSpriteIndex++;
}
/* end multi sprite special code */
p_stSpriteParticle ++;
p_stParticlePosition ++;
p_stParticleSpeed ++;
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description :
--------------------------------------------------------------------------------
-- Creation date : 12 jun 1997 Author : FPI
--------------------------------------------------------------------------------
*/
void PRT_fn_vPreDrawSpriteParticlesSystem ( PRT_tdstParticlesSystem *_p_stParticlesSystem )
{
_p_stParticlesSystem->hParticlesSystemObject->xNbPoints = _p_stParticlesSystem->xNbActiveParticles;
((GEO_tdstElementSprite *)(_p_stParticlesSystem->hParticlesSystemObject->d_stListOfElements[0]))->xNbSprites = _p_stParticlesSystem->xNbActiveParticles;
}
/*ANNECY VL PRT 30/03/98{*/
/*
----------------------------------------------------------------------------------------
Description : create multiple sprites particles system
_p_stPrtSys -> system
_xNbSprites -> number of different sprites
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vCreateMultipleSpritesParticles( PRT_tdstParticlesSystem *_p_stPrtSys, ACP_tdxIndex _xNbSprites )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
PRT_tdstSpriteCommonData *p_stSprCommonData;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_p_stPrtSys->xParticlesType = PRT_C_xSpriteParticles;
/* Table de vitesse de particules */
GEO_M_CPAMalloc ( _p_stPrtSys->d_stSpeed, MTH3D_tdstVector *, sizeof ( MTH3D_tdstVector ) * _p_stPrtSys->xNbParticles, E_uwGEONotEnoughtMemory );
/* list of sprite particles */
GEO_M_CPAMalloc ( _p_stPrtSys->d_stListOfParticles, void *, sizeof ( PRT_tdstSpriteParticle ) * _p_stPrtSys->xNbParticles, E_uwGEONotEnoughtMemory );
/* common data for sprite system */
GEO_M_CPAMalloc ( _p_stPrtSys->p_stCommonData, void *, sizeof ( PRT_tdstSpriteCommonData ), E_uwGEONotEnoughtMemory );
p_stSprCommonData = (PRT_tdstSpriteCommonData *)(_p_stPrtSys->p_stCommonData);
/* common data for sprite system */
GEO_M_CPAMalloc ( p_stSprCommonData->d_stSpriteData, PRT_tdstSpriteData *, _xNbSprites * sizeof( PRT_tdstSpriteData ), E_uwGEONotEnoughtMemory );
p_stSprCommonData->xNumberOfSprites = 0;
}
/*
----------------------------------------------------------------------------------------
Description : end creation of multiple sprite particles system (create geom object)
_p_stPrtSys -> system
----------------------------------------------------------------------------------------
*/
void PRT_fn_vEndCreateMultipleSpritesParticles( PRT_tdstParticlesSystem *_p_stPrtSys )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
ACP_tdxHandleOfElement hElementSprite;
ACP_tdxIndex xSpriteIndex;
MTH2D_tdstVector stDefaultSize = { MTH_C_ONE, MTH_C_ONE };
PRT_tdstSpriteCommonData *p_stSprCommonData;
PRT_tdstSpriteParticle *p_stSprParticle;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (_p_stPrtSys->xParticlesType != PRT_C_xSpriteParticles )
return;
GEO_vCreateGeometricObject ( &(_p_stPrtSys->hParticlesSystemObject), _p_stPrtSys->xNbParticles, 1 );
GEO_vCreateElementSprite ( _p_stPrtSys->hParticlesSystemObject, &hElementSprite, _p_stPrtSys->xNbParticles );
((GEO_tdstElementSprite *) _p_stPrtSys->hParticlesSystemObject->d_stListOfElements[0])->cFastDraw = 1;
p_stSprCommonData = (PRT_tdstSpriteCommonData *) _p_stPrtSys->p_stCommonData;
p_stSprParticle = _p_stPrtSys->d_stListOfParticles;
for ( xSpriteIndex = 0 ; xSpriteIndex < _p_stPrtSys->xNbParticles ; xSpriteIndex ++, p_stSprParticle++ )
{
GEO_vSetSizeOfIndexedSprite ( _p_stPrtSys->hParticlesSystemObject, hElementSprite, xSpriteIndex, &stDefaultSize );
GEO_vSetCenterPointOfIndexedSprite ( _p_stPrtSys->hParticlesSystemObject, hElementSprite, xSpriteIndex, xSpriteIndex );
GEO_vSetHandleOfIndexedSprite ( _p_stPrtSys->hParticlesSystemObject, hElementSprite, xSpriteIndex, p_stSprCommonData->d_stSpriteData[ xSpriteIndex % p_stSprCommonData->xNumberOfSprites ].hSprite );
p_stSprParticle->stSize = stDefaultSize;
}
GEO_vEndCreateObject ( _p_stPrtSys->hParticlesSystemObject );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
----------------------------------------------------------------------------------------
Description : Test if system is a multiple sprite particle system
_p_stPrtSys -> system
Returns (char ) : 0 if false, otherwise 0
----------------------------------------------------------------------------------------
*/
char PRT_fn_cSystemIsMultipleSprites( PRT_tdstParticlesSystem *_p_stPrtSys )
{
if (_p_stPrtSys->xParticlesType != PRT_C_xSpriteParticles )
return 0;
return ( ((PRT_tdstSpriteCommonData *) _p_stPrtSys->p_stCommonData)->d_stSpriteData != NULL );
}
/*
----------------------------------------------------------------------------------------
Description : add a sprite in a multiple sprite particle system
_p_stPrtSys -> system
_hSprite -> sprite
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void PRT_fn_vAddSprite( PRT_tdstParticlesSystem *_p_stPrtSys, ACP_tdxHandleOfSprite _hSprite )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
PRT_tdstSpriteCommonData *p_stSpriteCommonData;
PRT_tdstSpriteData *p_stSprData;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (_p_stPrtSys->xParticlesType != PRT_C_xSpriteParticles )
return;
p_stSpriteCommonData = (PRT_tdstSpriteCommonData *) _p_stPrtSys->p_stCommonData;
p_stSprData = p_stSpriteCommonData->d_stSpriteData + p_stSpriteCommonData->xNumberOfSprites++;
p_stSprData->hSprite = _hSprite;
if (p_stSpriteCommonData->xNumberOfSprites == 1)
{
p_stSprData->cProba = 100;
p_stSprData->xTime = 2;
p_stSprData->cNextSprite = 1;
}
else if (p_stSpriteCommonData->xNumberOfSprites == 5)
{
p_stSprData->cProba = 0;
p_stSprData->xTime = 0.1f;
p_stSprData->cNextSprite = 0;
}
else
{
p_stSprData->cProba = 0;
p_stSprData->xTime = 0.1f;
p_stSprData->cNextSprite = (char)(p_stSpriteCommonData->xNumberOfSprites);
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* D_THROW_PRT */

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[PRT.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project