mirror of
https://github.com/ENSL/NS.git
synced 2024-11-21 20:21:14 +00:00
PR Merge of Patch 63 to Patch 61 (#6)
* handle particles project VC++ compilation errors with MVCS and project property changes - retarget to v142 platformtoolset - remove explicit windows SDK version; use latest by default - remove settings that are otherwise default values in project or are best determined by solution * attempt to handle clang++ issues regarding unsupported c++11 features * reset file changes to particledefs.h * removing PARTICLEDLL_API definition and replacing usage with extern "C" block statements * add g++ compiler option to specify c++11 standard * attempt to resolve forward enum errors by adding std to base cflags * replacing deprecated libstdc++ and removing -lstdc++ flag, updating MacOSX10 sdk version * small refactor to Makefiles, and add libstdc++ back to linux build * remove added type to enum * reset makefile changes that may be causing unexpected linux build failures * refactoring std=c++11 declarations in Makefile to mitgate linux build failing * ensure std is set for hl_cdll make * attempt to define a standard library to resolve vector initialization_list constructor issue * attempt to update MacOS sdk, set minimum os to be 10.7, and include export in travis ci to define deployment target
This commit is contained in:
parent
594c4a28f1
commit
36c78acbce
22 changed files with 1118 additions and 1138 deletions
|
@ -37,6 +37,7 @@ matrix:
|
||||||
before_script:
|
before_script:
|
||||||
- export CC=clang
|
- export CC=clang
|
||||||
- export CPLUS=clang++
|
- export CPLUS=clang++
|
||||||
|
- export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||||
script: cd main/source/linux && make
|
script: cd main/source/linux && make
|
||||||
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<SccLocalPath />
|
<SccLocalPath />
|
||||||
<SccProvider />
|
<SccProvider />
|
||||||
<ProjectGuid>{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}</ProjectGuid>
|
<ProjectGuid>{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}</ProjectGuid>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<UseOfAtl>false</UseOfAtl>
|
<UseOfAtl>false</UseOfAtl>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -107,17 +107,6 @@ int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 );
|
||||||
void LoadData(void* inBuffer, const unsigned char* inData, int inSizeToCopy, int& inSizeVariable);
|
void LoadData(void* inBuffer, const unsigned char* inData, int inSizeToCopy, int& inSizeVariable);
|
||||||
void SaveData(unsigned char* inBuffer, const void* inData, int inSizeToCopy, int& inSizeVariable);
|
void SaveData(unsigned char* inBuffer, const void* inData, int inSizeToCopy, int& inSizeVariable);
|
||||||
|
|
||||||
void Output(const char* szFormat, ...)
|
|
||||||
{
|
|
||||||
char szBuff[1024];
|
|
||||||
va_list arg;
|
|
||||||
va_start(arg, szFormat);
|
|
||||||
_vsnprintf(szBuff, sizeof(szBuff), szFormat, arg);
|
|
||||||
va_end(arg);
|
|
||||||
|
|
||||||
OutputDebugString(szBuff);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ScorePanel_InitializeDemoPlayback(int inSize, unsigned char* inBuffer)
|
int ScorePanel_InitializeDemoPlayback(int inSize, unsigned char* inBuffer)
|
||||||
{
|
{
|
||||||
int theBytesRead = 0;
|
int theBytesRead = 0;
|
||||||
|
@ -398,6 +387,7 @@ ScorePanel::ScorePanel(int x, int y, int wide, int tall) : Panel(x, y, wide, tal
|
||||||
m_pCloseButton->setFont(tfont);
|
m_pCloseButton->setFont(tfont);
|
||||||
m_pCloseButton->setBoundKey( (char)255 );
|
m_pCloseButton->setBoundKey( (char)255 );
|
||||||
m_pCloseButton->setContentAlignment(Label::a_center);
|
m_pCloseButton->setContentAlignment(Label::a_center);
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,10 +1090,7 @@ void ScorePanel::FillGrid()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// set Player Color
|
// set Player Color
|
||||||
//Output((to_string(thePlayerId)+ string("\n")).c_str());
|
|
||||||
//ConsolePrint((to_string(thePlayerId)+ string("\n")).c_str());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (theTeamNumber) {
|
switch (theTeamNumber) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1327,13 +1314,16 @@ void ScorePanel::FillGrid()
|
||||||
pLabel->setFgColorAsImageColor(false);
|
pLabel->setFgColorAsImageColor(false);
|
||||||
|
|
||||||
// Parse color (last 3 bytes are the RGB values 1-9)
|
// Parse color (last 3 bytes are the RGB values 1-9)
|
||||||
string theColor = theCustomIcon.substr( strlen(theCustomIcon.c_str())-3, 3);
|
string theColor = theCustomIcon.substr( strlen(theCustomIcon.c_str()) - 3, 3);
|
||||||
|
|
||||||
|
string rStr = theColor.substr(0, 1);
|
||||||
|
string bStr = theColor.substr(1, 1);
|
||||||
|
string gStr = theColor.substr(2, 1);
|
||||||
|
|
||||||
|
//pass reference type
|
||||||
int theRed = (MakeIntFromString(theColor.substr(0, 1))/9.0f)*255;
|
int theRed = (MakeIntFromString(rStr) / 9.0f) * 255;
|
||||||
int theGreen = (MakeIntFromString(theColor.substr(1, 1))/9.0f)*255;
|
int theGreen = (MakeIntFromString(bStr) / 9.0f) * 255;
|
||||||
int theBlue = (MakeIntFromString(theColor.substr(2, 1))/9.0f)*255;
|
int theBlue = (MakeIntFromString(gStr) / 9.0f) * 255;
|
||||||
|
|
||||||
|
|
||||||
pIcon->setColor(BuildColor(theRed, theGreen, theBlue, gHUD.GetGammaSlope()));
|
pIcon->setColor(BuildColor(theRed, theGreen, theBlue, gHUD.GetGammaSlope()));
|
||||||
|
@ -1364,12 +1354,6 @@ void ScorePanel::FillGrid()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
/* case COLUMN_PLAYER_COLOR:
|
|
||||||
Preparation for Player Color in own column
|
|
||||||
pLabel->setImage(m_pCYellow);
|
|
||||||
pLabel->setFgColorAsImageColor(false);
|
|
||||||
m_pCYellow->setColor(BuildColor(255, 255, 255, gHUD.GetGammaSlope()));
|
|
||||||
break;*/
|
|
||||||
case COLUMN_SCORE:
|
case COLUMN_SCORE:
|
||||||
if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
|
if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
BIN
main/source/dlls/Playtest/vc142.idb
Normal file
BIN
main/source/dlls/Playtest/vc142.idb
Normal file
Binary file not shown.
|
@ -26,29 +26,29 @@
|
||||||
<SccLocalPath />
|
<SccLocalPath />
|
||||||
<SccProvider />
|
<SccProvider />
|
||||||
<ProjectGuid>{BC87A180-F17B-83FC-5D7D-470FAD003ABC}</ProjectGuid>
|
<ProjectGuid>{BC87A180-F17B-83FC-5D7D-470FAD003ABC}</ProjectGuid>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest - balance disabled|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest - balance disabled|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -49,7 +49,7 @@ ifeq ($(OS),Darwin)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#SDKROOT ?= $(SDK_DIR)/MacOSX10.6.sdk
|
#SDKROOT ?= $(SDK_DIR)/MacOSX10.6.sdk
|
||||||
SDKROOT ?= $(SDK_DIR)/MacOSX10.8.sdk
|
SDKROOT ?= $(SDK_DIR)/MacOSX10.10.sdk
|
||||||
|
|
||||||
ARCH_FLAGS ?= -arch i386 -m32 -march=prescott -gdwarf-2 -g2 -Wno-typedef-redefinition -momit-leaf-frame-pointer -mtune=core2
|
ARCH_FLAGS ?= -arch i386 -m32 -march=prescott -gdwarf-2 -g2 -Wno-typedef-redefinition -momit-leaf-frame-pointer -mtune=core2
|
||||||
CPP_LIB=-lstdc++ -lpthread
|
CPP_LIB=-lstdc++ -lpthread
|
||||||
|
@ -58,10 +58,10 @@ ifeq ($(OS),Darwin)
|
||||||
AR = libtool -static -o
|
AR = libtool -static -o
|
||||||
endif
|
endif
|
||||||
ifeq ($(origin CC), default)
|
ifeq ($(origin CC), default)
|
||||||
CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.7 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
||||||
endif
|
endif
|
||||||
ifeq ($(origin CPLUS), default)
|
ifeq ($(origin CPLUS), default)
|
||||||
CPLUS ="$(COMPILER_BIN_DIR)/clang++ -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
CPLUS ="$(COMPILER_BIN_DIR)/clang++ -std=c++11 -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.7 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
||||||
endif
|
endif
|
||||||
LINK ?= $(CPLUS)
|
LINK ?= $(CPLUS)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -32,14 +32,21 @@ INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -L. libpng12.dylib -lz -framework Carbon -framework OpenGL vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
|
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -L. libpng12.dylib -lz -framework Carbon -framework OpenGL vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
|
||||||
|
DO_CC=$(CPLUS) -std=c++11 -stdlib=libc++ $(INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
||||||
|
DO_PUBLIC_CC=$(CPLUS) -std=c++11 -stdlib=libc++ $(COMMON_INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
|
DO_COMMON_CC=$(CPLUS) -std=c++11 -stdlib=libc++ $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
|
DO_PM_SHARED_CC=$(CPLUS) -std=c++11 -stdlib=libc++ $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
else
|
else
|
||||||
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -lpng -lz -lfmod-3.75 -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 -L. libparticleMP.a
|
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -lpng -lz -lfmod-3.75 -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 -L. libparticleMP.a
|
||||||
endif
|
|
||||||
|
|
||||||
DO_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
DO_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
||||||
DO_PUBLIC_CC=$(CPLUS) $(COMMON_INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
DO_PUBLIC_CC=$(CPLUS) $(COMMON_INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
DO_COMMON_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
DO_COMMON_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
DO_PM_SHARED_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
DO_PM_SHARED_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
HL1_OBJS = \
|
HL1_OBJS = \
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <GL/gl.h>
|
//#include <GL/gl.h>
|
||||||
#include "common/triangleapi.h"
|
#include "../common/triangleapi.h"
|
||||||
#include "cl_dll/wrect.h"
|
#include "../cl_dll/wrect.h"
|
||||||
#include "cl_dll/cl_dll.h"
|
#include "../cl_dll/cl_dll.h"
|
||||||
#include "common/renderingconst.h"
|
#include "../common/renderingconst.h"
|
||||||
#include "particles/papi.h"
|
#include "papi.h"
|
||||||
|
|
||||||
// XXX #include <iostream.h>
|
// XXX #include <iostream.h>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
C++ = g++ -m32
|
C++ = g++ -std=c++11 -m32
|
||||||
|
|
||||||
GLUT_HOME =/usr/local/contrib/unmoderated
|
GLUT_HOME =/usr/local/contrib/unmoderated
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#v4.0:v100
|
|
||||||
Release|Win32|C:\Users\fabian\Downloads\NS\main\source\particles\|
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@
|
||||||
// added to an action list.
|
// added to an action list.
|
||||||
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "particles/papi.h"
|
#include "papi.h"
|
||||||
|
|
||||||
extern void _pAddActionToList(ParticleAction *S, int size);
|
extern void _pAddActionToList(ParticleAction *S, int size);
|
||||||
extern void _pCallActionList(ParticleAction *pa, int num_actions,
|
extern void _pCallActionList(ParticleAction *pa, int num_actions,
|
||||||
|
@ -33,359 +33,361 @@ void _pSendAction(ParticleAction *S, PActionEnum type, int size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PARTICLEDLL_API void pAvoid(float magnitude, float epsilon, float look_ahead,
|
extern "C" {
|
||||||
PDomainEnum dtype,
|
void pAvoid(float magnitude, float epsilon, float look_ahead,
|
||||||
float a0, float a1, float a2,
|
PDomainEnum dtype,
|
||||||
float a3, float a4, float a5,
|
float a0, float a1, float a2,
|
||||||
float a6, float a7, float a8)
|
float a3, float a4, float a5,
|
||||||
{
|
float a6, float a7, float a8)
|
||||||
PAAvoid S;
|
|
||||||
|
|
||||||
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.look_ahead = look_ahead;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAAvoidID, sizeof(PAAvoid));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pBounce(float friction, float resilience, float cutoff,
|
|
||||||
PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PABounce S;
|
|
||||||
|
|
||||||
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
S.oneMinusFriction = 1.0f - friction;
|
|
||||||
S.resilience = resilience;
|
|
||||||
S.cutoffSqr = fsqr(cutoff);
|
|
||||||
|
|
||||||
_pSendAction(&S, PABounceID, sizeof(PABounce));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pCopyVertexB(bool copy_pos, bool copy_vel)
|
|
||||||
{
|
|
||||||
PACopyVertexB S;
|
|
||||||
|
|
||||||
S.copy_pos = copy_pos;
|
|
||||||
S.copy_vel = copy_vel;
|
|
||||||
|
|
||||||
_pSendAction(&S, PACopyVertexBID, sizeof(PACopyVertexB));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pDamping(float damping_x, float damping_y, float damping_z,
|
|
||||||
float vlow, float vhigh)
|
|
||||||
{
|
|
||||||
PADamping S;
|
|
||||||
|
|
||||||
S.damping = pVector(damping_x, damping_y, damping_z);
|
|
||||||
S.vlowSqr = fsqr(vlow);
|
|
||||||
S.vhighSqr = fsqr(vhigh);
|
|
||||||
|
|
||||||
_pSendAction(&S, PADampingID, sizeof(PADamping));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pExplosion(float center_x, float center_y, float center_z, float velocity,
|
|
||||||
float magnitude, float stdev, float epsilon, float age)
|
|
||||||
{
|
|
||||||
PAExplosion S;
|
|
||||||
|
|
||||||
S.center = pVector(center_x, center_y, center_z);
|
|
||||||
S.velocity = velocity;
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.stdev = stdev;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.age = age;
|
|
||||||
|
|
||||||
if(S.epsilon < 0.0f)
|
|
||||||
S.epsilon = P_EPS;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAExplosionID, sizeof(PAExplosion));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pFollow(float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
PAFollow S;
|
|
||||||
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAFollowID, sizeof(PAFollow));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pGravitate(float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
PAGravitate S;
|
|
||||||
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAGravitateID, sizeof(PAGravitate));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pGravity(float dir_x, float dir_y, float dir_z)
|
|
||||||
{
|
|
||||||
PAGravity S;
|
|
||||||
|
|
||||||
S.direction = pVector(dir_x, dir_y, dir_z);
|
|
||||||
|
|
||||||
_pSendAction(&S, PAGravityID, sizeof(PAGravity));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pJet(float center_x, float center_y, float center_z,
|
|
||||||
float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
PAJet S;
|
|
||||||
|
|
||||||
S.center = pVector(center_x, center_y, center_z);
|
|
||||||
S.acc = _ps.Vel;
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAJetID, sizeof(PAJet));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pKillOld(float age_limit, bool kill_less_than)
|
|
||||||
{
|
|
||||||
PAKillOld S;
|
|
||||||
|
|
||||||
S.age_limit = age_limit;
|
|
||||||
S.kill_less_than = kill_less_than;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAKillOldID, sizeof(PAKillOld));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pMatchVelocity(float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
PAMatchVelocity S;
|
|
||||||
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAMatchVelocityID, sizeof(PAMatchVelocity));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pMove()
|
|
||||||
{
|
|
||||||
PAMove S;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAMoveID, sizeof(PAMove));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pOrbitLine(float p_x, float p_y, float p_z,
|
|
||||||
float axis_x, float axis_y, float axis_z,
|
|
||||||
float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
PAOrbitLine S;
|
|
||||||
|
|
||||||
S.p = pVector(p_x, p_y, p_z);
|
|
||||||
S.axis = pVector(axis_x, axis_y, axis_z);
|
|
||||||
S.axis.normalize();
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAOrbitLineID, sizeof(PAOrbitLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pOrbitPoint(float center_x, float center_y, float center_z,
|
|
||||||
float magnitude, float epsilon, float max_radius)
|
|
||||||
{
|
|
||||||
PAOrbitPoint S;
|
|
||||||
|
|
||||||
S.center = pVector(center_x, center_y, center_z);
|
|
||||||
S.magnitude = magnitude;
|
|
||||||
S.epsilon = epsilon;
|
|
||||||
S.max_radius = max_radius;
|
|
||||||
|
|
||||||
_pSendAction(&S, PAOrbitPointID, sizeof(PAOrbitPoint));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomAccel(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PARandomAccel S;
|
|
||||||
|
|
||||||
S.gen_acc = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
_pSendAction(&S, PARandomAccelID, sizeof(PARandomAccel));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomDisplace(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PARandomDisplace S;
|
|
||||||
|
|
||||||
S.gen_disp = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
_pSendAction(&S, PARandomDisplaceID, sizeof(PARandomDisplace));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomVelocity(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PARandomVelocity S;
|
|
||||||
|
|
||||||
S.gen_vel = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
_pSendAction(&S, PARandomVelocityID, sizeof(PARandomVelocity));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pRestore(float time_left)
|
|
||||||
{
|
|
||||||
PARestore S;
|
|
||||||
|
|
||||||
S.time_left = time_left;
|
|
||||||
|
|
||||||
_pSendAction(&S, PARestoreID, sizeof(PARestore));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSink(bool kill_inside, PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PASink S;
|
|
||||||
|
|
||||||
S.kill_inside = kill_inside;
|
|
||||||
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
_pSendAction(&S, PASinkID, sizeof(PASink));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSinkVelocity(bool kill_inside, PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
PASinkVelocity S;
|
|
||||||
|
|
||||||
S.kill_inside = kill_inside;
|
|
||||||
S.velocity = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
|
|
||||||
_pSendAction(&S, PASinkVelocityID, sizeof(PASinkVelocity));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSource(float particle_rate, PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
PASource S;
|
|
||||||
|
|
||||||
S.particle_rate = particle_rate;
|
|
||||||
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
S.positionB = _ps.VertexB;
|
|
||||||
S.size = _ps.Size;
|
|
||||||
S.velocity = _ps.Vel;
|
|
||||||
S.color = _ps.Color;
|
|
||||||
S.alpha = _ps.Alpha;
|
|
||||||
S.age = _ps.Age;
|
|
||||||
S.age_sigma = _ps.AgeSigma;
|
|
||||||
S.vertexB_tracks = _ps.vertexB_tracks;
|
|
||||||
|
|
||||||
_pSendAction(&S, PASourceID, sizeof(PASource));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSpeedLimit(float min_speed, float max_speed)
|
|
||||||
{
|
|
||||||
PASpeedLimit S;
|
|
||||||
|
|
||||||
S.min_speed = min_speed;
|
|
||||||
S.max_speed = max_speed;
|
|
||||||
|
|
||||||
_pSendAction(&S, PASpeedLimitID, sizeof(PASpeedLimit));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetColor(float color_x, float color_y, float color_z,
|
|
||||||
float alpha, float scale)
|
|
||||||
{
|
|
||||||
PATargetColor S;
|
|
||||||
|
|
||||||
S.color = pVector(color_x, color_y, color_z);
|
|
||||||
S.alpha = alpha;
|
|
||||||
S.scale = scale;
|
|
||||||
|
|
||||||
_pSendAction(&S, PATargetColorID, sizeof(PATargetColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetSize(float size_x, float size_y, float size_z,
|
|
||||||
float scale_x, float scale_y, float scale_z)
|
|
||||||
{
|
|
||||||
PATargetSize S;
|
|
||||||
|
|
||||||
S.size = pVector(size_x, size_y, size_z);
|
|
||||||
S.scale = pVector(scale_x, scale_y, scale_z);
|
|
||||||
|
|
||||||
_pSendAction(&S, PATargetSizeID, sizeof(PATargetSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetVelocity(float vel_x, float vel_y, float vel_z, float scale)
|
|
||||||
{
|
|
||||||
PATargetVelocity S;
|
|
||||||
|
|
||||||
S.velocity = pVector(vel_x, vel_y, vel_z);
|
|
||||||
S.scale = scale;
|
|
||||||
|
|
||||||
_pSendAction(&S, PATargetVelocityID, sizeof(PATargetVelocity));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If in immediate mode, quickly add a vertex.
|
|
||||||
// If building an action list, call pSource.
|
|
||||||
PARTICLEDLL_API void pVertex(float x, float y, float z)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
{
|
{
|
||||||
pSource(1, PDPoint, x, y, z);
|
PAAvoid S;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Immediate mode. Quickly add the vertex.
|
|
||||||
if(_ps.pgrp == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pVector pos(x, y, z);
|
|
||||||
pVector siz, vel, col, posB;
|
|
||||||
if(_ps.vertexB_tracks)
|
|
||||||
posB = pos;
|
|
||||||
else
|
|
||||||
_ps.VertexB.Generate(posB);
|
|
||||||
_ps.Size.Generate(siz);
|
|
||||||
_ps.Vel.Generate(vel);
|
|
||||||
_ps.Color.Generate(col);
|
|
||||||
_ps.pgrp->Add(pos, posB, siz, vel, col, _ps.Alpha, _ps.Age);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVortex(float center_x, float center_y, float center_z,
|
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
float axis_x, float axis_y, float axis_z,
|
S.magnitude = magnitude;
|
||||||
float magnitude, float epsilon, float max_radius)
|
S.epsilon = epsilon;
|
||||||
{
|
S.look_ahead = look_ahead;
|
||||||
PAVortex S;
|
|
||||||
|
_pSendAction(&S, PAAvoidID, sizeof(PAAvoid));
|
||||||
S.center = pVector(center_x, center_y, center_z);
|
}
|
||||||
S.axis = pVector(axis_x, axis_y, axis_z);
|
|
||||||
S.axis.normalize();
|
void pBounce(float friction, float resilience, float cutoff,
|
||||||
S.magnitude = magnitude;
|
PDomainEnum dtype,
|
||||||
S.epsilon = epsilon;
|
float a0, float a1, float a2,
|
||||||
S.max_radius = max_radius;
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
_pSendAction(&S, PAVortexID, sizeof(PAVortex));
|
{
|
||||||
}
|
PABounce S;
|
||||||
|
|
||||||
|
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
S.oneMinusFriction = 1.0f - friction;
|
||||||
|
S.resilience = resilience;
|
||||||
|
S.cutoffSqr = fsqr(cutoff);
|
||||||
|
|
||||||
|
_pSendAction(&S, PABounceID, sizeof(PABounce));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pCopyVertexB(bool copy_pos, bool copy_vel)
|
||||||
|
{
|
||||||
|
PACopyVertexB S;
|
||||||
|
|
||||||
|
S.copy_pos = copy_pos;
|
||||||
|
S.copy_vel = copy_vel;
|
||||||
|
|
||||||
|
_pSendAction(&S, PACopyVertexBID, sizeof(PACopyVertexB));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pDamping(float damping_x, float damping_y, float damping_z,
|
||||||
|
float vlow, float vhigh)
|
||||||
|
{
|
||||||
|
PADamping S;
|
||||||
|
|
||||||
|
S.damping = pVector(damping_x, damping_y, damping_z);
|
||||||
|
S.vlowSqr = fsqr(vlow);
|
||||||
|
S.vhighSqr = fsqr(vhigh);
|
||||||
|
|
||||||
|
_pSendAction(&S, PADampingID, sizeof(PADamping));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pExplosion(float center_x, float center_y, float center_z, float velocity,
|
||||||
|
float magnitude, float stdev, float epsilon, float age)
|
||||||
|
{
|
||||||
|
PAExplosion S;
|
||||||
|
|
||||||
|
S.center = pVector(center_x, center_y, center_z);
|
||||||
|
S.velocity = velocity;
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.stdev = stdev;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.age = age;
|
||||||
|
|
||||||
|
if (S.epsilon < 0.0f)
|
||||||
|
S.epsilon = P_EPS;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAExplosionID, sizeof(PAExplosion));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pFollow(float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAFollow S;
|
||||||
|
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAFollowID, sizeof(PAFollow));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pGravitate(float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAGravitate S;
|
||||||
|
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAGravitateID, sizeof(PAGravitate));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pGravity(float dir_x, float dir_y, float dir_z)
|
||||||
|
{
|
||||||
|
PAGravity S;
|
||||||
|
|
||||||
|
S.direction = pVector(dir_x, dir_y, dir_z);
|
||||||
|
|
||||||
|
_pSendAction(&S, PAGravityID, sizeof(PAGravity));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pJet(float center_x, float center_y, float center_z,
|
||||||
|
float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
PAJet S;
|
||||||
|
|
||||||
|
S.center = pVector(center_x, center_y, center_z);
|
||||||
|
S.acc = _ps.Vel;
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAJetID, sizeof(PAJet));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pKillOld(float age_limit, bool kill_less_than)
|
||||||
|
{
|
||||||
|
PAKillOld S;
|
||||||
|
|
||||||
|
S.age_limit = age_limit;
|
||||||
|
S.kill_less_than = kill_less_than;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAKillOldID, sizeof(PAKillOld));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pMatchVelocity(float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAMatchVelocity S;
|
||||||
|
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAMatchVelocityID, sizeof(PAMatchVelocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pMove()
|
||||||
|
{
|
||||||
|
PAMove S;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAMoveID, sizeof(PAMove));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pOrbitLine(float p_x, float p_y, float p_z,
|
||||||
|
float axis_x, float axis_y, float axis_z,
|
||||||
|
float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAOrbitLine S;
|
||||||
|
|
||||||
|
S.p = pVector(p_x, p_y, p_z);
|
||||||
|
S.axis = pVector(axis_x, axis_y, axis_z);
|
||||||
|
S.axis.normalize();
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAOrbitLineID, sizeof(PAOrbitLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pOrbitPoint(float center_x, float center_y, float center_z,
|
||||||
|
float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAOrbitPoint S;
|
||||||
|
|
||||||
|
S.center = pVector(center_x, center_y, center_z);
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAOrbitPointID, sizeof(PAOrbitPoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pRandomAccel(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
PARandomAccel S;
|
||||||
|
|
||||||
|
S.gen_acc = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
_pSendAction(&S, PARandomAccelID, sizeof(PARandomAccel));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pRandomDisplace(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
PARandomDisplace S;
|
||||||
|
|
||||||
|
S.gen_disp = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
_pSendAction(&S, PARandomDisplaceID, sizeof(PARandomDisplace));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pRandomVelocity(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
PARandomVelocity S;
|
||||||
|
|
||||||
|
S.gen_vel = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
_pSendAction(&S, PARandomVelocityID, sizeof(PARandomVelocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pRestore(float time_left)
|
||||||
|
{
|
||||||
|
PARestore S;
|
||||||
|
|
||||||
|
S.time_left = time_left;
|
||||||
|
|
||||||
|
_pSendAction(&S, PARestoreID, sizeof(PARestore));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSink(bool kill_inside, PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
PASink S;
|
||||||
|
|
||||||
|
S.kill_inside = kill_inside;
|
||||||
|
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
_pSendAction(&S, PASinkID, sizeof(PASink));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSinkVelocity(bool kill_inside, PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
PASinkVelocity S;
|
||||||
|
|
||||||
|
S.kill_inside = kill_inside;
|
||||||
|
S.velocity = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
|
||||||
|
_pSendAction(&S, PASinkVelocityID, sizeof(PASinkVelocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSource(float particle_rate, PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
PASource S;
|
||||||
|
|
||||||
|
S.particle_rate = particle_rate;
|
||||||
|
S.position = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
S.positionB = _ps.VertexB;
|
||||||
|
S.size = _ps.Size;
|
||||||
|
S.velocity = _ps.Vel;
|
||||||
|
S.color = _ps.Color;
|
||||||
|
S.alpha = _ps.Alpha;
|
||||||
|
S.age = _ps.Age;
|
||||||
|
S.age_sigma = _ps.AgeSigma;
|
||||||
|
S.vertexB_tracks = _ps.vertexB_tracks;
|
||||||
|
|
||||||
|
_pSendAction(&S, PASourceID, sizeof(PASource));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSpeedLimit(float min_speed, float max_speed)
|
||||||
|
{
|
||||||
|
PASpeedLimit S;
|
||||||
|
|
||||||
|
S.min_speed = min_speed;
|
||||||
|
S.max_speed = max_speed;
|
||||||
|
|
||||||
|
_pSendAction(&S, PASpeedLimitID, sizeof(PASpeedLimit));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pTargetColor(float color_x, float color_y, float color_z,
|
||||||
|
float alpha, float scale)
|
||||||
|
{
|
||||||
|
PATargetColor S;
|
||||||
|
|
||||||
|
S.color = pVector(color_x, color_y, color_z);
|
||||||
|
S.alpha = alpha;
|
||||||
|
S.scale = scale;
|
||||||
|
|
||||||
|
_pSendAction(&S, PATargetColorID, sizeof(PATargetColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pTargetSize(float size_x, float size_y, float size_z,
|
||||||
|
float scale_x, float scale_y, float scale_z)
|
||||||
|
{
|
||||||
|
PATargetSize S;
|
||||||
|
|
||||||
|
S.size = pVector(size_x, size_y, size_z);
|
||||||
|
S.scale = pVector(scale_x, scale_y, scale_z);
|
||||||
|
|
||||||
|
_pSendAction(&S, PATargetSizeID, sizeof(PATargetSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pTargetVelocity(float vel_x, float vel_y, float vel_z, float scale)
|
||||||
|
{
|
||||||
|
PATargetVelocity S;
|
||||||
|
|
||||||
|
S.velocity = pVector(vel_x, vel_y, vel_z);
|
||||||
|
S.scale = scale;
|
||||||
|
|
||||||
|
_pSendAction(&S, PATargetVelocityID, sizeof(PATargetVelocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If in immediate mode, quickly add a vertex.
|
||||||
|
// If building an action list, call pSource.
|
||||||
|
void pVertex(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
{
|
||||||
|
pSource(1, PDPoint, x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Immediate mode. Quickly add the vertex.
|
||||||
|
if (_ps.pgrp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pVector pos(x, y, z);
|
||||||
|
pVector siz, vel, col, posB;
|
||||||
|
if (_ps.vertexB_tracks)
|
||||||
|
posB = pos;
|
||||||
|
else
|
||||||
|
_ps.VertexB.Generate(posB);
|
||||||
|
_ps.Size.Generate(siz);
|
||||||
|
_ps.Vel.Generate(vel);
|
||||||
|
_ps.Color.Generate(col);
|
||||||
|
_ps.pgrp->Add(pos, posB, siz, vel, col, _ps.Alpha, _ps.Age);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pVortex(float center_x, float center_y, float center_z,
|
||||||
|
float axis_x, float axis_y, float axis_z,
|
||||||
|
float magnitude, float epsilon, float max_radius)
|
||||||
|
{
|
||||||
|
PAVortex S;
|
||||||
|
|
||||||
|
S.center = pVector(center_x, center_y, center_z);
|
||||||
|
S.axis = pVector(axis_x, axis_y, axis_z);
|
||||||
|
S.axis.normalize();
|
||||||
|
S.magnitude = magnitude;
|
||||||
|
S.epsilon = epsilon;
|
||||||
|
S.max_radius = max_radius;
|
||||||
|
|
||||||
|
_pSendAction(&S, PAVortexID, sizeof(PAVortex));
|
||||||
|
}
|
||||||
|
}
|
4
main/source/particles/cpp.hint
Normal file
4
main/source/particles/cpp.hint
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||||
|
// such as names of functions and macros.
|
||||||
|
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||||
|
#define PARTICLEDLL_API
|
|
@ -21,136 +21,139 @@
|
||||||
|
|
||||||
// XXX #include <iostream.h>
|
// XXX #include <iostream.h>
|
||||||
|
|
||||||
// Emit OpenGL calls to draw the particles. These are drawn with
|
extern "C" {
|
||||||
// whatever primitive type the user specified(GL_POINTS, for
|
|
||||||
// example). The color and radius are set per primitive, by default.
|
|
||||||
// For GL_LINES, the other vertex of the line is the velocity vector.
|
|
||||||
// XXX const_size is ignored.
|
|
||||||
PARTICLEDLL_API void pDrawGroupp(int primitive, bool const_size, bool const_color)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
// Get a pointer to the particles in gp memory
|
// Emit OpenGL calls to draw the particles. These are drawn with
|
||||||
ParticleGroup *pg = _ps.pgrp;
|
// whatever primitive type the user specified(GL_POINTS, for
|
||||||
|
// example). The color and radius are set per primitive, by default.
|
||||||
|
// For GL_LINES, the other vertex of the line is the velocity vector.
|
||||||
|
// XXX const_size is ignored.
|
||||||
|
void pDrawGroupp(int primitive, bool const_size, bool const_color)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
if(pg == NULL)
|
// Get a pointer to the particles in gp memory
|
||||||
return; // ERROR
|
ParticleGroup* pg = _ps.pgrp;
|
||||||
|
|
||||||
if(pg->p_count < 1)
|
if (pg == NULL)
|
||||||
return;
|
return; // ERROR
|
||||||
|
|
||||||
if(primitive == GL_POINTS)
|
if (pg->p_count < 1)
|
||||||
{
|
return;
|
||||||
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
if (primitive == GL_POINTS)
|
||||||
if(!const_color)
|
|
||||||
{
|
{
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
||||||
glColorPointer(4, GL_FLOAT, sizeof(Particle), &pg->list[0].color);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
}
|
if (!const_color)
|
||||||
|
|
||||||
glVertexPointer(3, GL_FLOAT, sizeof(Particle), &pg->list[0].pos);
|
|
||||||
glDrawArrays((GLenum)primitive, 0, pg->p_count);
|
|
||||||
glPopClientAttrib();
|
|
||||||
// XXX For E&S
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Assume GL_LINES
|
|
||||||
glBegin((GLenum)primitive);
|
|
||||||
|
|
||||||
if(!const_color)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < pg->p_count; i++)
|
|
||||||
{
|
{
|
||||||
Particle &m = pg->list[i];
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glColorPointer(4, GL_FLOAT, sizeof(Particle), &pg->list[0].color);
|
||||||
// Warning: this depends on alpha following color in the Particle struct.
|
|
||||||
glColor4fv((GLfloat *)&m.color);
|
|
||||||
glVertex3fv((GLfloat *)&m.pos);
|
|
||||||
|
|
||||||
// For lines, make a tail with the velocity vector's direction and
|
|
||||||
// a length of radius.
|
|
||||||
pVector tail = m.pos - m.vel;
|
|
||||||
glVertex3fv((GLfloat *)&tail);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, sizeof(Particle), &pg->list[0].pos);
|
||||||
|
glDrawArrays((GLenum)primitive, 0, pg->p_count);
|
||||||
|
glPopClientAttrib();
|
||||||
|
// XXX For E&S
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < pg->p_count; i++)
|
// Assume GL_LINES
|
||||||
|
glBegin((GLenum)primitive);
|
||||||
|
|
||||||
|
if (!const_color)
|
||||||
{
|
{
|
||||||
Particle &m = pg->list[i];
|
for (int i = 0; i < pg->p_count; i++)
|
||||||
glVertex3fv((GLfloat *)&m.pos);
|
{
|
||||||
|
Particle& m = pg->list[i];
|
||||||
// For lines, make a tail with the velocity vector's direction and
|
|
||||||
// a length of radius.
|
// Warning: this depends on alpha following color in the Particle struct.
|
||||||
pVector tail = m.pos - m.vel;
|
glColor4fv((GLfloat*)&m.color);
|
||||||
glVertex3fv((GLfloat *)&tail);
|
glVertex3fv((GLfloat*)&m.pos);
|
||||||
|
|
||||||
|
// For lines, make a tail with the velocity vector's direction and
|
||||||
|
// a length of radius.
|
||||||
|
pVector tail = m.pos - m.vel;
|
||||||
|
glVertex3fv((GLfloat*)&tail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pDrawGroupl(int dlist, bool const_size, bool const_color, bool const_rotation)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
// Get a pointer to the particles in gp memory
|
|
||||||
ParticleGroup *pg = _ps.pgrp;
|
|
||||||
if(pg == NULL)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
if(pg->p_count < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//if(const_color)
|
|
||||||
// glColor4fv((GLfloat *)&pg->list[0].color);
|
|
||||||
|
|
||||||
for(int i = 0; i < pg->p_count; i++)
|
|
||||||
{
|
|
||||||
Particle &m = pg->list[i];
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
glTranslatef(m.pos.x, m.pos.y, m.pos.z);
|
|
||||||
|
|
||||||
if(!const_size)
|
|
||||||
glScalef(m.size.x, m.size.y, m.size.z);
|
|
||||||
else
|
|
||||||
glScalef(pg->list[i].size.x, pg->list[i].size.y, pg->list[i].size.z);
|
|
||||||
|
|
||||||
// Expensive! A sqrt, cross prod and acos. Yow.
|
|
||||||
if(!const_rotation)
|
|
||||||
{
|
|
||||||
pVector vN(m.vel);
|
|
||||||
vN.normalize();
|
|
||||||
pVector voN(m.velB);
|
|
||||||
voN.normalize();
|
|
||||||
|
|
||||||
pVector biN;
|
|
||||||
if(voN.x == vN.x && voN.y == vN.y && voN.z == vN.z)
|
|
||||||
biN = pVector(0, 1, 0);
|
|
||||||
else
|
else
|
||||||
biN = vN ^ voN;
|
{
|
||||||
biN.normalize();
|
for (int i = 0; i < pg->p_count; i++)
|
||||||
|
{
|
||||||
|
Particle& m = pg->list[i];
|
||||||
|
glVertex3fv((GLfloat*)&m.pos);
|
||||||
|
|
||||||
pVector N(vN ^ biN);
|
// For lines, make a tail with the velocity vector's direction and
|
||||||
|
// a length of radius.
|
||||||
double M[16];
|
pVector tail = m.pos - m.vel;
|
||||||
M[0] = vN.x; M[4] = biN.x; M[8] = N.x; M[12] = 0;
|
glVertex3fv((GLfloat*)&tail);
|
||||||
M[1] = vN.y; M[5] = biN.y; M[9] = N.y; M[13] = 0;
|
}
|
||||||
M[2] = vN.z; M[6] = biN.z; M[10] = N.z; M[14] = 0;
|
}
|
||||||
M[3] = 0; M[7] = 0; M[11] = 0; M[15] = 1;
|
glEnd();
|
||||||
glMultMatrixd(M);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: this depends on alpha following color in the Particle struct.
|
|
||||||
if(!const_color)
|
|
||||||
glColor4fv((GLfloat *)&m.color);
|
|
||||||
|
|
||||||
glCallList(dlist);
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void pDrawGroupl(int dlist, bool const_size, bool const_color, bool const_rotation)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
// Get a pointer to the particles in gp memory
|
||||||
|
ParticleGroup* pg = _ps.pgrp;
|
||||||
|
if (pg == NULL)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
if (pg->p_count < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//if(const_color)
|
||||||
|
// glColor4fv((GLfloat *)&pg->list[0].color);
|
||||||
|
|
||||||
|
for (int i = 0; i < pg->p_count; i++)
|
||||||
|
{
|
||||||
|
Particle& m = pg->list[i];
|
||||||
|
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(m.pos.x, m.pos.y, m.pos.z);
|
||||||
|
|
||||||
|
if (!const_size)
|
||||||
|
glScalef(m.size.x, m.size.y, m.size.z);
|
||||||
|
else
|
||||||
|
glScalef(pg->list[i].size.x, pg->list[i].size.y, pg->list[i].size.z);
|
||||||
|
|
||||||
|
// Expensive! A sqrt, cross prod and acos. Yow.
|
||||||
|
if (!const_rotation)
|
||||||
|
{
|
||||||
|
pVector vN(m.vel);
|
||||||
|
vN.normalize();
|
||||||
|
pVector voN(m.velB);
|
||||||
|
voN.normalize();
|
||||||
|
|
||||||
|
pVector biN;
|
||||||
|
if (voN.x == vN.x && voN.y == vN.y && voN.z == vN.z)
|
||||||
|
biN = pVector(0, 1, 0);
|
||||||
|
else
|
||||||
|
biN = vN ^ voN;
|
||||||
|
biN.normalize();
|
||||||
|
|
||||||
|
pVector N(vN ^ biN);
|
||||||
|
|
||||||
|
double M[16];
|
||||||
|
M[0] = vN.x; M[4] = biN.x; M[8] = N.x; M[12] = 0;
|
||||||
|
M[1] = vN.y; M[5] = biN.y; M[9] = N.y; M[13] = 0;
|
||||||
|
M[2] = vN.z; M[6] = biN.z; M[10] = N.z; M[14] = 0;
|
||||||
|
M[3] = 0; M[7] = 0; M[11] = 0; M[15] = 1;
|
||||||
|
glMultMatrixd(M);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warning: this depends on alpha following color in the Particle struct.
|
||||||
|
if (!const_color)
|
||||||
|
glColor4fv((GLfloat*)&m.color);
|
||||||
|
|
||||||
|
glCallList(dlist);
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,8 +22,6 @@
|
||||||
#define drand48() (((float) rand())/((float) RAND_MAX))
|
#define drand48() (((float) rand())/((float) RAND_MAX))
|
||||||
#define srand48(x) srand(x)
|
#define srand48(x) srand(x)
|
||||||
|
|
||||||
// This is because their stupid compiler thinks it's smart.
|
|
||||||
#define inline __forceinline
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class pVector
|
class pVector
|
||||||
|
|
|
@ -14,188 +14,189 @@
|
||||||
#define P_VERSION 120
|
#define P_VERSION 120
|
||||||
|
|
||||||
// added <<< cgc >>>
|
// added <<< cgc >>>
|
||||||
#include <p_vector.h>
|
#include "p_vector.h"
|
||||||
#include <general.h>
|
#include "general.h"
|
||||||
#include <particledefs.h>
|
#include "particledefs.h"
|
||||||
|
|
||||||
// State setting calls
|
// State setting calls
|
||||||
|
|
||||||
PARTICLEDLL_API void pColor(float red, float green, float blue, float alpha = 1.0f);
|
extern "C" {
|
||||||
|
void pColor(float red, float green, float blue, float alpha = 1.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pColorD(float alpha, PDomainEnum dtype,
|
void pColorD(float alpha, PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSize(float size_x, float size_y = 1.0f, float size_z = 1.0f);
|
void pSize(float size_x, float size_y = 1.0f, float size_z = 1.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSizeD(PDomainEnum dtype,
|
void pSizeD(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pStartingAge(float age, float sigma = 1.0f);
|
void pStartingAge(float age, float sigma = 1.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pTimeStep(float new_dt);
|
void pTimeStep(float new_dt);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVelocity(float x, float y, float z);
|
void pVelocity(float x, float y, float z);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVelocityD(PDomainEnum dtype,
|
void pVelocityD(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexB(float x, float y, float z);
|
void pVertexB(float x, float y, float z);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexBD(PDomainEnum dtype,
|
void pVertexBD(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexBTracks(bool track_vertex = true);
|
void pVertexBTracks(bool track_vertex = true);
|
||||||
|
|
||||||
|
|
||||||
// Action List Calls
|
// Action List Calls
|
||||||
|
|
||||||
PARTICLEDLL_API void pCallActionList(int action_list_num);
|
void pCallActionList(int action_list_num);
|
||||||
|
|
||||||
PARTICLEDLL_API void pDeleteActionLists(int action_list_num, int action_list_count = 1);
|
void pDeleteActionLists(int action_list_num, int action_list_count = 1);
|
||||||
|
|
||||||
PARTICLEDLL_API void pEndActionList();
|
void pEndActionList();
|
||||||
|
|
||||||
PARTICLEDLL_API int pGenActionLists(int action_list_count = 1);
|
int pGenActionLists(int action_list_count = 1);
|
||||||
|
|
||||||
PARTICLEDLL_API void pNewActionList(int action_list_num);
|
void pNewActionList(int action_list_num);
|
||||||
|
|
||||||
|
|
||||||
// Particle Group Calls
|
// Particle Group Calls
|
||||||
|
|
||||||
PARTICLEDLL_API ParticleGroup* pGetParticleGroupRef(int p_group_num);
|
ParticleGroup* pGetParticleGroupRef(int p_group_num);
|
||||||
|
|
||||||
PARTICLEDLL_API void pCopyGroup(int p_src_group_num, int index = 0, int copy_count = P_MAXINT);
|
void pCopyGroup(int p_src_group_num, int index = 0, int copy_count = P_MAXINT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pCurrentGroup(int p_group_num);
|
void pCurrentGroup(int p_group_num);
|
||||||
|
|
||||||
PARTICLEDLL_API ParticleGroup* pGetCurrentGroup(void);
|
ParticleGroup* pGetCurrentGroup(void);
|
||||||
|
|
||||||
PARTICLEDLL_API void pDeleteParticleGroups(int p_group_num, int p_group_count = 1);
|
void pDeleteParticleGroups(int p_group_num, int p_group_count = 1);
|
||||||
|
|
||||||
PARTICLEDLL_API void pDrawGroupl(int dlist, bool const_size = false,
|
void pDrawGroupl(int dlist, bool const_size = false,
|
||||||
bool const_color = false, bool const_rotation = false);
|
bool const_color = false, bool const_rotation = false);
|
||||||
|
|
||||||
PARTICLEDLL_API void pDrawGroupp(int primitive, bool const_size = false,
|
void pDrawGroupp(int primitive, bool const_size = false,
|
||||||
bool const_color = false);
|
bool const_color = false);
|
||||||
|
|
||||||
// Added <<< cgc >>>
|
// Added <<< cgc >>>
|
||||||
PARTICLEDLL_API void DrawGroupTriSplat(const pVector &view, const pVector &up, float size_scale = 1.0f, bool draw_tex=false, bool const_size=false, bool const_color=false);
|
void DrawGroupTriSplat(const pVector& view, const pVector& up, float size_scale = 1.0f, bool draw_tex = false, bool const_size = false, bool const_color = false);
|
||||||
// end
|
// end
|
||||||
|
|
||||||
PARTICLEDLL_API int pGenParticleGroups(int p_group_count = 1, int max_particles = 0);
|
int pGenParticleGroups(int p_group_count = 1, int max_particles = 0);
|
||||||
|
|
||||||
PARTICLEDLL_API int pGetGroupCount();
|
int pGetGroupCount();
|
||||||
|
|
||||||
PARTICLEDLL_API int pGetParticles(int index, int count, float *position = NULL, float *color = NULL,
|
int pGetParticles(int index, int count, float* position = NULL, float* color = NULL,
|
||||||
float *vel = NULL, float *size = NULL, float *age = NULL);
|
float* vel = NULL, float* size = NULL, float* age = NULL);
|
||||||
|
|
||||||
PARTICLEDLL_API int pSetMaxParticles(int max_count);
|
int pSetMaxParticles(int max_count);
|
||||||
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
PARTICLEDLL_API void pAvoid(float magnitude, float epsilon, float look_ahead,
|
void pAvoid(float magnitude, float epsilon, float look_ahead,
|
||||||
PDomainEnum dtype,
|
PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pBounce(float friction, float resilience, float cutoff,
|
void pBounce(float friction, float resilience, float cutoff,
|
||||||
PDomainEnum dtype,
|
PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pCopyVertexB(bool copy_pos = true, bool copy_vel = false);
|
void pCopyVertexB(bool copy_pos = true, bool copy_vel = false);
|
||||||
|
|
||||||
PARTICLEDLL_API void pDamping(float damping_x, float damping_y, float damping_z,
|
void pDamping(float damping_x, float damping_y, float damping_z,
|
||||||
float vlow = 0.0f, float vhigh = P_MAXFLOAT);
|
float vlow = 0.0f, float vhigh = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pExplosion(float center_x, float center_y, float center_z, float velocity,
|
void pExplosion(float center_x, float center_y, float center_z, float velocity,
|
||||||
float magnitude, float stdev, float epsilon = P_EPS, float age = 0.0f);
|
float magnitude, float stdev, float epsilon = P_EPS, float age = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pFollow(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
void pFollow(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pGravitate(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
void pGravitate(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pGravity(float dir_x, float dir_y, float dir_z);
|
void pGravity(float dir_x, float dir_y, float dir_z);
|
||||||
|
|
||||||
PARTICLEDLL_API void pJet(float center_x, float center_y, float center_z, float magnitude = 1.0f,
|
void pJet(float center_x, float center_y, float center_z, float magnitude = 1.0f,
|
||||||
float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pKillOld(float age_limit, bool kill_less_than = false);
|
void pKillOld(float age_limit, bool kill_less_than = false);
|
||||||
|
|
||||||
PARTICLEDLL_API void pMatchVelocity(float magnitude = 1.0f, float epsilon = P_EPS,
|
void pMatchVelocity(float magnitude = 1.0f, float epsilon = P_EPS,
|
||||||
float max_radius = P_MAXFLOAT);
|
float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pMove();
|
void pMove();
|
||||||
|
|
||||||
PARTICLEDLL_API void pOrbitLine(float p_x, float p_y, float p_z,
|
void pOrbitLine(float p_x, float p_y, float p_z,
|
||||||
float axis_x, float axis_y, float axis_z, float magnitude = 1.0f,
|
float axis_x, float axis_y, float axis_z, float magnitude = 1.0f,
|
||||||
float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pOrbitPoint(float center_x, float center_y, float center_z,
|
void pOrbitPoint(float center_x, float center_y, float center_z,
|
||||||
float magnitude = 1.0f, float epsilon = P_EPS,
|
float magnitude = 1.0f, float epsilon = P_EPS,
|
||||||
float max_radius = P_MAXFLOAT);
|
float max_radius = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomAccel(PDomainEnum dtype,
|
void pRandomAccel(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomDisplace(PDomainEnum dtype,
|
void pRandomDisplace(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pRandomVelocity(PDomainEnum dtype,
|
void pRandomVelocity(PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pRestore(float time);
|
void pRestore(float time);
|
||||||
|
|
||||||
PARTICLEDLL_API void pShade(float color_x, float color_y, float color_z,
|
void pShade(float color_x, float color_y, float color_z,
|
||||||
float alpha, float scale);
|
float alpha, float scale);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSink(bool kill_inside, PDomainEnum dtype,
|
void pSink(bool kill_inside, PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSinkVelocity(bool kill_inside, PDomainEnum dtype,
|
void pSinkVelocity(bool kill_inside, PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSource(float particle_rate, PDomainEnum dtype,
|
void pSource(float particle_rate, PDomainEnum dtype,
|
||||||
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
float a0 = 0.0f, float a1 = 0.0f, float a2 = 0.0f,
|
||||||
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
float a3 = 0.0f, float a4 = 0.0f, float a5 = 0.0f,
|
||||||
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
float a6 = 0.0f, float a7 = 0.0f, float a8 = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pSpeedLimit(float min_speed, float max_speed = P_MAXFLOAT);
|
void pSpeedLimit(float min_speed, float max_speed = P_MAXFLOAT);
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetColor(float color_x, float color_y, float color_z,
|
void pTargetColor(float color_x, float color_y, float color_z,
|
||||||
float alpha, float scale);
|
float alpha, float scale);
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetSize(float size_x, float size_y, float size_z,
|
void pTargetSize(float size_x, float size_y, float size_z,
|
||||||
float scale_x = 0.0f, float scale_y = 0.0f, float scale_z = 0.0f);
|
float scale_x = 0.0f, float scale_y = 0.0f, float scale_z = 0.0f);
|
||||||
|
|
||||||
PARTICLEDLL_API void pTargetVelocity(float vel_x, float vel_y, float vel_z, float scale);
|
void pTargetVelocity(float vel_x, float vel_y, float vel_z, float scale);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertex(float x, float y, float z);
|
void pVertex(float x, float y, float z);
|
||||||
|
|
||||||
PARTICLEDLL_API void pVortex(float center_x, float center_y, float center_z,
|
|
||||||
float axis_x, float axis_y, float axis_z,
|
|
||||||
float magnitude = 1.0f, float epsilon = P_EPS,
|
|
||||||
float max_radius = P_MAXFLOAT);
|
|
||||||
|
|
||||||
|
void pVortex(float center_x, float center_y, float center_z,
|
||||||
|
float axis_x, float axis_y, float axis_z,
|
||||||
|
float magnitude = 1.0f, float epsilon = P_EPS,
|
||||||
|
float max_radius = P_MAXFLOAT);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,22 +11,6 @@
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
// removed <<< cgc >>>
|
|
||||||
//#ifdef PARTICLEDLL_EXPORTS
|
|
||||||
//#define PARTICLEDLL_API __declspec(dllexport)
|
|
||||||
//#else
|
|
||||||
//#define PARTICLEDLL_API __declspec(dllimport)
|
|
||||||
//#endif
|
|
||||||
#define PARTICLEDLL_API extern "C"
|
|
||||||
|
|
||||||
// removed <<< cgc >>>
|
|
||||||
#else
|
|
||||||
#define PARTICLEDLL_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#pragma warning (disable:4244)
|
#pragma warning (disable:4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,21 +27,22 @@
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Type codes for domains
|
// Type codes for domains
|
||||||
PARTICLEDLL_API enum PDomainEnum
|
extern "C" {
|
||||||
{
|
enum PDomainEnum
|
||||||
PDPoint = 0, // Single point
|
{
|
||||||
PDLine = 1, // Line segment
|
PDPoint = 0, // Single point
|
||||||
PDTriangle = 2, // Triangle
|
PDLine = 1, // Line segment
|
||||||
PDPlane = 3, // Arbitrarily-oriented plane
|
PDTriangle = 2, // Triangle
|
||||||
PDBox = 4, // Axis-aligned box
|
PDPlane = 3, // Arbitrarily-oriented plane
|
||||||
PDSphere = 5, // Sphere
|
PDBox = 4, // Axis-aligned box
|
||||||
PDCylinder = 6, // Cylinder
|
PDSphere = 5, // Sphere
|
||||||
PDCone = 7, // Cone
|
PDCylinder = 6, // Cylinder
|
||||||
PDBlob = 8, // Gaussian blob
|
PDCone = 7, // Cone
|
||||||
PDDisc = 9, // Arbitrarily-oriented disc
|
PDBlob = 8, // Gaussian blob
|
||||||
PDRectangle = 10 // Rhombus-shaped planar region
|
PDDisc = 9, // Arbitrarily-oriented disc
|
||||||
};
|
PDRectangle = 10 // Rhombus-shaped planar region
|
||||||
|
};
|
||||||
|
}
|
||||||
// A single particle
|
// A single particle
|
||||||
struct Particle
|
struct Particle
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,25 +12,22 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{5AADD469-7488-4B34-A9FD-01CFAC5972FD}</ProjectGuid>
|
<ProjectGuid>{5AADD469-7488-4B34-A9FD-01CFAC5972FD}</ProjectGuid>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<Keyword>ManagedCProj</Keyword>
|
<Keyword>ManagedCProj</Keyword>
|
||||||
<RootNamespace>particles</RootNamespace>
|
<RootNamespace>particles</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -44,18 +41,16 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;..;</IncludePath>
|
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../common;../public</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;.;$(VCToolsInstallDir)\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared;..;../common;../public</IncludePath>
|
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../common;../public</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -67,10 +62,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<AdditionalIncludeDirectories>$(VCInstallDir)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalUsingDirectories>$(FrameworkPathOverride)</AdditionalUsingDirectories>
|
<AdditionalUsingDirectories>$(FrameworkPathOverride)</AdditionalUsingDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -84,6 +76,7 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="cpp.hint" />
|
||||||
<None Include="Overview.txt" />
|
<None Include="Overview.txt" />
|
||||||
<None Include="PS Docs.htm">
|
<None Include="PS Docs.htm">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<None Include="PS Docs.htm" />
|
<None Include="PS Docs.htm" />
|
||||||
<None Include="Overview.txt" />
|
<None Include="Overview.txt" />
|
||||||
<None Include="Readme.txt" />
|
<None Include="Readme.txt" />
|
||||||
|
<None Include="cpp.hint" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="general.h">
|
<ClInclude Include="general.h">
|
||||||
|
|
|
@ -417,492 +417,495 @@ void _pAddActionToList(ParticleAction *S, int size)
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// State setting calls
|
// State setting calls
|
||||||
|
|
||||||
PARTICLEDLL_API void pColor(float red, float green, float blue, float alpha)
|
extern "C" {
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Alpha = alpha;
|
void pColor(float red, float green, float blue, float alpha)
|
||||||
_ps.Color = pDomain(PDPoint, red, green, blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pColorD(float alpha, PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Alpha = alpha;
|
|
||||||
_ps.Color = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVelocity(float x, float y, float z)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Vel = pDomain(PDPoint, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVelocityD(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Vel = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexB(float x, float y, float z)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.VertexB = pDomain(PDPoint, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexBD(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.VertexB = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pVertexBTracks(bool trackVertex)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.vertexB_tracks = trackVertex;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSize(float size_x, float size_y, float size_z)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Size = pDomain(PDPoint, size_x, size_y, size_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pSizeD(PDomainEnum dtype,
|
|
||||||
float a0, float a1, float a2,
|
|
||||||
float a3, float a4, float a5,
|
|
||||||
float a6, float a7, float a8)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Size = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pStartingAge(float age, float sigma)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.Age = age;
|
|
||||||
_ps.AgeSigma = sigma;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pTimeStep(float newDT)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
_ps.dt = newDT;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
|
||||||
// Action List Calls
|
|
||||||
|
|
||||||
PARTICLEDLL_API int pGenActionLists(int action_list_count)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return -1; // ERROR
|
|
||||||
|
|
||||||
_PLock();
|
|
||||||
|
|
||||||
int ind = _ps.GenerateLists(action_list_count);
|
|
||||||
|
|
||||||
for(int i=ind; i<ind+action_list_count; i++)
|
|
||||||
{
|
{
|
||||||
_ps.alist_list[i] = new PAHeader[8];
|
_ParticleState& _ps = _GetPState();
|
||||||
_ps.alist_list[i]->actions_allocated = 8;
|
|
||||||
_ps.alist_list[i]->type = PAHeaderID;
|
_ps.Alpha = alpha;
|
||||||
_ps.alist_list[i]->count = 1;
|
_ps.Color = pDomain(PDPoint, red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
_PUnLock();
|
void pColorD(float alpha, PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
return ind;
|
float a3, float a4, float a5,
|
||||||
}
|
float a6, float a7, float a8)
|
||||||
|
|
||||||
PARTICLEDLL_API void pNewActionList(int action_list_num)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_ps.pact = _ps.GetListPtr(action_list_num);
|
|
||||||
|
|
||||||
if(_ps.pact == NULL)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_ps.list_id = action_list_num;
|
|
||||||
_ps.in_new_list = true;
|
|
||||||
|
|
||||||
// Remove whatever used to be in the list.
|
|
||||||
_ps.pact->count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pEndActionList()
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(!_ps.in_new_list)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_ps.in_new_list = false;
|
|
||||||
|
|
||||||
_ps.pact = NULL;
|
|
||||||
_ps.list_id = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pDeleteActionLists(int action_list_num, int action_list_count)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
if(action_list_num < 0)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
if(action_list_num + action_list_count > _ps.alist_count)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_PLock();
|
|
||||||
|
|
||||||
for(int i = action_list_num; i < action_list_num + action_list_count; i++)
|
|
||||||
{
|
{
|
||||||
if(_ps.alist_list[i])
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Alpha = alpha;
|
||||||
|
_ps.Color = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pVelocity(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Vel = pDomain(PDPoint, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pVelocityD(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Vel = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pVertexB(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.VertexB = pDomain(PDPoint, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pVertexBD(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.VertexB = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pVertexBTracks(bool trackVertex)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.vertexB_tracks = trackVertex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSize(float size_x, float size_y, float size_z)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Size = pDomain(PDPoint, size_x, size_y, size_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pSizeD(PDomainEnum dtype,
|
||||||
|
float a0, float a1, float a2,
|
||||||
|
float a3, float a4, float a5,
|
||||||
|
float a6, float a7, float a8)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Size = pDomain(dtype, a0, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pStartingAge(float age, float sigma)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.Age = age;
|
||||||
|
_ps.AgeSigma = sigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pTimeStep(float newDT)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
_ps.dt = newDT;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// Action List Calls
|
||||||
|
|
||||||
|
int pGenActionLists(int action_list_count)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return -1; // ERROR
|
||||||
|
|
||||||
|
_PLock();
|
||||||
|
|
||||||
|
int ind = _ps.GenerateLists(action_list_count);
|
||||||
|
|
||||||
|
for (int i = ind; i < ind + action_list_count; i++)
|
||||||
{
|
{
|
||||||
delete [] _ps.alist_list[i];
|
_ps.alist_list[i] = new PAHeader[8];
|
||||||
_ps.alist_list[i] = NULL;
|
_ps.alist_list[i]->actions_allocated = 8;
|
||||||
|
_ps.alist_list[i]->type = PAHeaderID;
|
||||||
|
_ps.alist_list[i]->count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_PUnLock();
|
||||||
|
|
||||||
|
return ind;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pNewActionList(int action_list_num)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_ps.pact = _ps.GetListPtr(action_list_num);
|
||||||
|
|
||||||
|
if (_ps.pact == NULL)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_ps.list_id = action_list_num;
|
||||||
|
_ps.in_new_list = true;
|
||||||
|
|
||||||
|
// Remove whatever used to be in the list.
|
||||||
|
_ps.pact->count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pEndActionList()
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (!_ps.in_new_list)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_ps.in_new_list = false;
|
||||||
|
|
||||||
|
_ps.pact = NULL;
|
||||||
|
_ps.list_id = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pDeleteActionLists(int action_list_num, int action_list_count)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
if (action_list_num < 0)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
if (action_list_num + action_list_count > _ps.alist_count)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_PLock();
|
||||||
|
|
||||||
|
for (int i = action_list_num; i < action_list_num + action_list_count; i++)
|
||||||
|
{
|
||||||
|
if (_ps.alist_list[i])
|
||||||
|
{
|
||||||
|
delete[] _ps.alist_list[i];
|
||||||
|
_ps.alist_list[i] = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_PUnLock();
|
||||||
|
return; // ERROR
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_PUnLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pCallActionList(int action_list_num)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
{
|
||||||
|
// Add this call as an action to the current list.
|
||||||
|
// <<< cgc >>> commented out predeclaration
|
||||||
|
//void _pSendAction(ParticleAction *S, PActionEnum type, int size);
|
||||||
|
|
||||||
|
PACallActionList S;
|
||||||
|
S.action_list_num = action_list_num;
|
||||||
|
|
||||||
|
_pSendAction(&S, PACallActionListID, sizeof(PACallActionList));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Execute the specified action list.
|
||||||
|
PAHeader* pa = _ps.GetListPtr(action_list_num);
|
||||||
|
|
||||||
|
if (pa == NULL)
|
||||||
|
return; // ERRROR
|
||||||
|
|
||||||
|
// XXX A temporary hack.
|
||||||
|
pa->dt = _ps.dt;
|
||||||
|
|
||||||
|
_ps.in_call_list = true;
|
||||||
|
|
||||||
|
_pCallActionList(pa + 1, pa->count - 1, _ps.pgrp);
|
||||||
|
|
||||||
|
_ps.in_call_list = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// Particle Group Calls
|
||||||
|
|
||||||
|
// Create particle groups, each with max_particles allocated.
|
||||||
|
int pGenParticleGroups(int p_group_count, int max_particles)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return -1; // ERROR
|
||||||
|
|
||||||
|
_PLock();
|
||||||
|
// cerr << "Generating pg " << _ps.tid << " cnt= " << max_particles << endl;
|
||||||
|
|
||||||
|
int ind = _ps.GenerateGroups(p_group_count);
|
||||||
|
|
||||||
|
for (int i = ind; i < ind + p_group_count; i++)
|
||||||
|
{
|
||||||
|
_ps.group_list[i] = (ParticleGroup*)new
|
||||||
|
Particle[max_particles + 2];
|
||||||
|
_ps.group_list[i]->max_particles = max_particles;
|
||||||
|
_ps.group_list[i]->particles_allocated = max_particles;
|
||||||
|
_ps.group_list[i]->p_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_PUnLock();
|
||||||
|
|
||||||
|
return ind;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pDeleteParticleGroups(int p_group_num, int p_group_count)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (p_group_num < 0)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
if (p_group_num + p_group_count > _ps.group_count)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_PLock();
|
||||||
|
|
||||||
|
for (int i = p_group_num; i < p_group_num + p_group_count; i++)
|
||||||
|
{
|
||||||
|
if (_ps.group_list[i])
|
||||||
|
{
|
||||||
|
delete[] _ps.group_list[i];
|
||||||
|
_ps.group_list[i] = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_PUnLock();
|
||||||
|
return; // ERROR
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_PUnLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change which group is current.
|
||||||
|
void pCurrentGroup(int p_group_num)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
_ps.pgrp = _ps.GetGroupPtr(p_group_num);
|
||||||
|
if (_ps.pgrp)
|
||||||
|
_ps.group_id = p_group_num;
|
||||||
|
else
|
||||||
|
_ps.group_id = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleGroup* pGetCurrentGroup(void)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
ParticleGroup* pg = _ps.pgrp;
|
||||||
|
return pg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change the maximum number of particles in the current group.
|
||||||
|
int pSetMaxParticles(int max_count)
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return 0; // ERROR
|
||||||
|
|
||||||
|
ParticleGroup* pg = _ps.pgrp;
|
||||||
|
if (pg == NULL)
|
||||||
|
return 0; // ERROR
|
||||||
|
|
||||||
|
if (max_count < 0)
|
||||||
|
return 0; // ERROR
|
||||||
|
|
||||||
|
// Reducing max.
|
||||||
|
if (pg->particles_allocated >= max_count)
|
||||||
|
{
|
||||||
|
pg->max_particles = max_count;
|
||||||
|
|
||||||
|
// May have to kill particles.
|
||||||
|
if (pg->p_count > pg->max_particles)
|
||||||
|
pg->p_count = pg->max_particles;
|
||||||
|
|
||||||
|
return max_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
_PLock();
|
||||||
|
|
||||||
|
// Allocate particles.
|
||||||
|
ParticleGroup* pg2 = (ParticleGroup*)new Particle[max_count + 2];
|
||||||
|
if (pg2 == NULL)
|
||||||
|
{
|
||||||
|
// Not enough memory. Just give all we've got.
|
||||||
|
// ERROR
|
||||||
|
pg->max_particles = pg->particles_allocated;
|
||||||
|
|
||||||
_PUnLock();
|
_PUnLock();
|
||||||
return; // ERROR
|
|
||||||
|
return pg->max_particles;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_PUnLock();
|
memcpy(pg2, pg, (pg->p_count + 2) * sizeof(Particle));
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pCallActionList(int action_list_num)
|
delete[] pg;
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
_ps.group_list[_ps.group_id] = _ps.pgrp = pg2;
|
||||||
{
|
pg2->max_particles = max_count;
|
||||||
// Add this call as an action to the current list.
|
pg2->particles_allocated = max_count;
|
||||||
// <<< cgc >>> commented out predeclaration
|
|
||||||
//void _pSendAction(ParticleAction *S, PActionEnum type, int size);
|
|
||||||
|
|
||||||
PACallActionList S;
|
_PUnLock();
|
||||||
S.action_list_num = action_list_num;
|
|
||||||
|
|
||||||
_pSendAction(&S, PACallActionListID, sizeof(PACallActionList));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Execute the specified action list.
|
|
||||||
PAHeader *pa = _ps.GetListPtr(action_list_num);
|
|
||||||
|
|
||||||
if(pa == NULL)
|
|
||||||
return; // ERRROR
|
|
||||||
|
|
||||||
// XXX A temporary hack.
|
|
||||||
pa->dt = _ps.dt;
|
|
||||||
|
|
||||||
_ps.in_call_list = true;
|
|
||||||
|
|
||||||
_pCallActionList(pa+1, pa->count-1, _ps.pgrp);
|
|
||||||
|
|
||||||
_ps.in_call_list = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
|
||||||
// Particle Group Calls
|
|
||||||
|
|
||||||
// Create particle groups, each with max_particles allocated.
|
|
||||||
PARTICLEDLL_API int pGenParticleGroups(int p_group_count, int max_particles)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return -1; // ERROR
|
|
||||||
|
|
||||||
_PLock();
|
|
||||||
// cerr << "Generating pg " << _ps.tid << " cnt= " << max_particles << endl;
|
|
||||||
|
|
||||||
int ind = _ps.GenerateGroups(p_group_count);
|
|
||||||
|
|
||||||
for(int i=ind; i<ind+p_group_count; i++)
|
|
||||||
{
|
|
||||||
_ps.group_list[i] = (ParticleGroup *)new
|
|
||||||
Particle[max_particles + 2];
|
|
||||||
_ps.group_list[i]->max_particles = max_particles;
|
|
||||||
_ps.group_list[i]->particles_allocated = max_particles;
|
|
||||||
_ps.group_list[i]->p_count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_PUnLock();
|
|
||||||
|
|
||||||
return ind;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API void pDeleteParticleGroups(int p_group_num, int p_group_count)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(p_group_num < 0)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
if(p_group_num + p_group_count > _ps.group_count)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_PLock();
|
|
||||||
|
|
||||||
for(int i = p_group_num; i < p_group_num + p_group_count; i++)
|
|
||||||
{
|
|
||||||
if(_ps.group_list[i])
|
|
||||||
{
|
|
||||||
delete [] _ps.group_list[i];
|
|
||||||
_ps.group_list[i] = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_PUnLock();
|
|
||||||
return; // ERROR
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_PUnLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change which group is current.
|
|
||||||
PARTICLEDLL_API void pCurrentGroup(int p_group_num)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
_ps.pgrp = _ps.GetGroupPtr(p_group_num);
|
|
||||||
if(_ps.pgrp)
|
|
||||||
_ps.group_id = p_group_num;
|
|
||||||
else
|
|
||||||
_ps.group_id = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API ParticleGroup* pGetCurrentGroup(void)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
ParticleGroup *pg = _ps.pgrp;
|
|
||||||
return pg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change the maximum number of particles in the current group.
|
|
||||||
PARTICLEDLL_API int pSetMaxParticles(int max_count)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return 0; // ERROR
|
|
||||||
|
|
||||||
ParticleGroup *pg = _ps.pgrp;
|
|
||||||
if(pg == NULL)
|
|
||||||
return 0; // ERROR
|
|
||||||
|
|
||||||
if(max_count < 0)
|
|
||||||
return 0; // ERROR
|
|
||||||
|
|
||||||
// Reducing max.
|
|
||||||
if(pg->particles_allocated >= max_count)
|
|
||||||
{
|
|
||||||
pg->max_particles = max_count;
|
|
||||||
|
|
||||||
// May have to kill particles.
|
|
||||||
if(pg->p_count > pg->max_particles)
|
|
||||||
pg->p_count = pg->max_particles;
|
|
||||||
|
|
||||||
return max_count;
|
return max_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
_PLock();
|
// Copy from the specified group to the current group.
|
||||||
|
void pCopyGroup(int p_src_group_num, int index, int copy_count)
|
||||||
// Allocate particles.
|
|
||||||
ParticleGroup *pg2 =(ParticleGroup *)new Particle[max_count + 2];
|
|
||||||
if(pg2 == NULL)
|
|
||||||
{
|
{
|
||||||
// Not enough memory. Just give all we've got.
|
_ParticleState& _ps = _GetPState();
|
||||||
// ERROR
|
|
||||||
pg->max_particles = pg->particles_allocated;
|
|
||||||
|
|
||||||
_PUnLock();
|
if (_ps.in_new_list)
|
||||||
|
return; // ERROR
|
||||||
return pg->max_particles;
|
|
||||||
|
ParticleGroup* srcgrp = _ps.GetGroupPtr(p_src_group_num);
|
||||||
|
if (srcgrp == NULL)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
ParticleGroup* destgrp = _ps.pgrp;
|
||||||
|
if (destgrp == NULL)
|
||||||
|
return; // ERROR
|
||||||
|
|
||||||
|
// Find out exactly how many to copy.
|
||||||
|
int ccount = copy_count;
|
||||||
|
if (ccount > srcgrp->p_count - index)
|
||||||
|
ccount = srcgrp->p_count - index;
|
||||||
|
if (ccount > destgrp->max_particles - destgrp->p_count)
|
||||||
|
ccount = destgrp->max_particles - destgrp->p_count;
|
||||||
|
|
||||||
|
// #pragma critical
|
||||||
|
// cerr << p_src_group_num << ": " << ccount << " " << srcgrp->p_count << " " << index << endl;
|
||||||
|
|
||||||
|
if (ccount < 0)
|
||||||
|
ccount = 0;
|
||||||
|
|
||||||
|
// Directly copy the particles to the current list.
|
||||||
|
for (int i = 0; i < ccount; i++)
|
||||||
|
{
|
||||||
|
destgrp->list[destgrp->p_count + i] =
|
||||||
|
srcgrp->list[index + i];
|
||||||
|
}
|
||||||
|
destgrp->p_count += ccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pg2, pg, (pg->p_count + 2) * sizeof(Particle));
|
|
||||||
|
|
||||||
delete [] pg;
|
|
||||||
|
|
||||||
_ps.group_list[_ps.group_id] = _ps.pgrp = pg2;
|
|
||||||
pg2->max_particles = max_count;
|
|
||||||
pg2->particles_allocated = max_count;
|
|
||||||
|
|
||||||
_PUnLock();
|
ParticleGroup* pGetParticleGroupRef(int p_group_num)
|
||||||
|
|
||||||
return max_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy from the specified group to the current group.
|
|
||||||
PARTICLEDLL_API void pCopyGroup(int p_src_group_num, int index, int copy_count)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
ParticleGroup *srcgrp = _ps.GetGroupPtr(p_src_group_num);
|
|
||||||
if(srcgrp == NULL)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
ParticleGroup *destgrp = _ps.pgrp;
|
|
||||||
if(destgrp == NULL)
|
|
||||||
return; // ERROR
|
|
||||||
|
|
||||||
// Find out exactly how many to copy.
|
|
||||||
int ccount = copy_count;
|
|
||||||
if(ccount > srcgrp->p_count - index)
|
|
||||||
ccount = srcgrp->p_count - index;
|
|
||||||
if(ccount > destgrp->max_particles - destgrp->p_count)
|
|
||||||
ccount = destgrp->max_particles - destgrp->p_count;
|
|
||||||
|
|
||||||
// #pragma critical
|
|
||||||
// cerr << p_src_group_num << ": " << ccount << " " << srcgrp->p_count << " " << index << endl;
|
|
||||||
|
|
||||||
if(ccount<0)
|
|
||||||
ccount = 0;
|
|
||||||
|
|
||||||
// Directly copy the particles to the current list.
|
|
||||||
for(int i=0; i<ccount; i++)
|
|
||||||
{
|
{
|
||||||
destgrp->list[destgrp->p_count+i] =
|
ParticleGroup* theGroup = NULL;
|
||||||
srcgrp->list[index+i];
|
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
|
if (!_ps.in_new_list)
|
||||||
|
{
|
||||||
|
theGroup = _ps.GetGroupPtr(p_group_num);
|
||||||
|
}
|
||||||
|
return theGroup;
|
||||||
}
|
}
|
||||||
destgrp->p_count += ccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTICLEDLL_API ParticleGroup* pGetParticleGroupRef(int p_group_num)
|
// Copy from the current group to application memory.
|
||||||
{
|
int pGetParticles(int index, int count, float* verts,
|
||||||
ParticleGroup* theGroup = NULL;
|
float* color, float* vel, float* size, float* age)
|
||||||
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(!_ps.in_new_list)
|
|
||||||
{
|
|
||||||
theGroup = _ps.GetGroupPtr(p_group_num);
|
|
||||||
}
|
|
||||||
return theGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy from the current group to application memory.
|
|
||||||
PARTICLEDLL_API int pGetParticles(int index, int count, float *verts,
|
|
||||||
float *color, float *vel, float *size, float *age)
|
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
// XXX I should think about whether color means color3, color4, or what.
|
|
||||||
// For now, it means color4.
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
|
||||||
return -1; // ERROR
|
|
||||||
|
|
||||||
ParticleGroup *pg = _ps.pgrp;
|
|
||||||
if(pg == NULL)
|
|
||||||
return -2; // ERROR
|
|
||||||
|
|
||||||
if(index < 0 || count < 0)
|
|
||||||
return -3; // ERROR
|
|
||||||
|
|
||||||
if(index + count > pg->p_count)
|
|
||||||
{
|
|
||||||
count = pg->p_count - index;
|
|
||||||
if(count <= 0)
|
|
||||||
return -4; // ERROR index out of bounds.
|
|
||||||
}
|
|
||||||
|
|
||||||
int vi = 0, ci = 0, li = 0, si = 0, ai = 0;
|
|
||||||
|
|
||||||
// This could be optimized.
|
|
||||||
for(int i=0; i<count; i++)
|
|
||||||
{
|
{
|
||||||
Particle &m = pg->list[index + i];
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
if(verts)
|
// XXX I should think about whether color means color3, color4, or what.
|
||||||
|
// For now, it means color4.
|
||||||
|
|
||||||
|
if (_ps.in_new_list)
|
||||||
|
return -1; // ERROR
|
||||||
|
|
||||||
|
ParticleGroup* pg = _ps.pgrp;
|
||||||
|
if (pg == NULL)
|
||||||
|
return -2; // ERROR
|
||||||
|
|
||||||
|
if (index < 0 || count < 0)
|
||||||
|
return -3; // ERROR
|
||||||
|
|
||||||
|
if (index + count > pg->p_count)
|
||||||
{
|
{
|
||||||
verts[vi++] = m.pos.x;
|
count = pg->p_count - index;
|
||||||
verts[vi++] = m.pos.y;
|
if (count <= 0)
|
||||||
verts[vi++] = m.pos.z;
|
return -4; // ERROR index out of bounds.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(color)
|
int vi = 0, ci = 0, li = 0, si = 0, ai = 0;
|
||||||
|
|
||||||
|
// This could be optimized.
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
color[ci++] = m.color.x;
|
Particle& m = pg->list[index + i];
|
||||||
color[ci++] = m.color.y;
|
|
||||||
color[ci++] = m.color.z;
|
if (verts)
|
||||||
color[ci++] = m.alpha;
|
{
|
||||||
|
verts[vi++] = m.pos.x;
|
||||||
|
verts[vi++] = m.pos.y;
|
||||||
|
verts[vi++] = m.pos.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
color[ci++] = m.color.x;
|
||||||
|
color[ci++] = m.color.y;
|
||||||
|
color[ci++] = m.color.z;
|
||||||
|
color[ci++] = m.alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vel)
|
||||||
|
{
|
||||||
|
vel[li++] = m.vel.x;
|
||||||
|
vel[li++] = m.vel.y;
|
||||||
|
vel[li++] = m.vel.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
size[si++] = m.size.x;
|
||||||
|
size[si++] = m.size.y;
|
||||||
|
size[si++] = m.size.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (age)
|
||||||
|
{
|
||||||
|
age[ai++] = m.age;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vel)
|
return count;
|
||||||
{
|
|
||||||
vel[li++] = m.vel.x;
|
|
||||||
vel[li++] = m.vel.y;
|
|
||||||
vel[li++] = m.vel.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(size)
|
|
||||||
{
|
|
||||||
size[si++] = m.size.x;
|
|
||||||
size[si++] = m.size.y;
|
|
||||||
size[si++] = m.size.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(age)
|
|
||||||
{
|
|
||||||
age[ai++] = m.age;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
// Returns the number of particles currently in the group.
|
||||||
}
|
int pGetGroupCount()
|
||||||
|
{
|
||||||
|
_ParticleState& _ps = _GetPState();
|
||||||
|
|
||||||
// Returns the number of particles currently in the group.
|
if (_ps.in_new_list)
|
||||||
PARTICLEDLL_API int pGetGroupCount()
|
return 0; // ERROR
|
||||||
{
|
|
||||||
_ParticleState &_ps = _GetPState();
|
|
||||||
|
|
||||||
if(_ps.in_new_list)
|
if (_ps.pgrp == NULL)
|
||||||
return 0; // ERROR
|
return 0; // ERROR
|
||||||
|
|
||||||
if(_ps.pgrp == NULL)
|
|
||||||
return 0; // ERROR
|
|
||||||
|
|
||||||
return _ps.pgrp->p_count;
|
return _ps.pgrp->p_count;
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue