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:
Brett Caswell 2020-07-05 11:11:06 -05:00 committed by GitHub
parent 594c4a28f1
commit 36c78acbce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 1118 additions and 1138 deletions

View file

@ -37,6 +37,7 @@ matrix:
before_script:
- export CC=clang
- export CPLUS=clang++
- export MACOSX_DEPLOYMENT_TARGET=10.10
script: cd main/source/linux && make
allow_failures:

View file

@ -14,7 +14,7 @@
<SccLocalPath />
<SccProvider />
<ProjectGuid>{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
@ -22,7 +22,7 @@
<UseOfMfc>false</UseOfMfc>
<UseOfAtl>false</UseOfAtl>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View file

@ -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 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 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->setBoundKey( (char)255 );
m_pCloseButton->setContentAlignment(Label::a_center);
Initialize();
}
@ -1100,9 +1090,6 @@ void ScorePanel::FillGrid()
}
*/
// set Player Color
//Output((to_string(thePlayerId)+ string("\n")).c_str());
//ConsolePrint((to_string(thePlayerId)+ string("\n")).c_str());
switch (theTeamNumber) {
@ -1327,13 +1314,16 @@ void ScorePanel::FillGrid()
pLabel->setFgColorAsImageColor(false);
// 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);
int theRed = (MakeIntFromString(theColor.substr(0, 1))/9.0f)*255;
int theGreen = (MakeIntFromString(theColor.substr(1, 1))/9.0f)*255;
int theBlue = (MakeIntFromString(theColor.substr(2, 1))/9.0f)*255;
//pass reference type
int theRed = (MakeIntFromString(rStr) / 9.0f) * 255;
int theGreen = (MakeIntFromString(bStr) / 9.0f) * 255;
int theBlue = (MakeIntFromString(gStr) / 9.0f) * 255;
pIcon->setColor(BuildColor(theRed, theGreen, theBlue, gHUD.GetGammaSlope()));
@ -1364,12 +1354,6 @@ void ScorePanel::FillGrid()
}
#endif
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:
if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{

Binary file not shown.

Binary file not shown.

View file

@ -26,29 +26,29 @@
<SccLocalPath />
<SccProvider />
<ProjectGuid>{BC87A180-F17B-83FC-5D7D-470FAD003ABC}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest - balance disabled|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer - release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View file

@ -49,7 +49,7 @@ ifeq ($(OS),Darwin)
endif
#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
CPP_LIB=-lstdc++ -lpthread
@ -58,10 +58,10 @@ ifeq ($(OS),Darwin)
AR = libtool -static -o
endif
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
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
LINK ?= $(CPLUS)
endif

View file

@ -32,14 +32,21 @@ INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_
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
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
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_PUBLIC_CC=$(CPLUS) $(COMMON_INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
DO_COMMON_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
DO_PM_SHARED_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
endif
#####################################################################
HL1_OBJS = \

View file

@ -8,11 +8,11 @@
#endif
//#include <GL/gl.h>
#include "common/triangleapi.h"
#include "cl_dll/wrect.h"
#include "cl_dll/cl_dll.h"
#include "common/renderingconst.h"
#include "particles/papi.h"
#include "../common/triangleapi.h"
#include "../cl_dll/wrect.h"
#include "../cl_dll/cl_dll.h"
#include "../common/renderingconst.h"
#include "papi.h"
// XXX #include <iostream.h>

View file

@ -5,7 +5,7 @@
#
######################################################################
C++ = g++ -m32
C++ = g++ -std=c++11 -m32
GLUT_HOME =/usr/local/contrib/unmoderated

View file

@ -1,2 +0,0 @@
#v4.0:v100
Release|Win32|C:\Users\fabian\Downloads\NS\main\source\particles\|

View file

@ -7,7 +7,7 @@
// added to an action list.
#include "general.h"
#include "particles/papi.h"
#include "papi.h"
extern void _pAddActionToList(ParticleAction *S, int size);
extern void _pCallActionList(ParticleAction *pa, int num_actions,
@ -33,12 +33,13 @@ void _pSendAction(ParticleAction *S, PActionEnum type, int size)
}
}
PARTICLEDLL_API void pAvoid(float magnitude, float epsilon, float look_ahead,
extern "C" {
void pAvoid(float magnitude, float epsilon, float look_ahead,
PDomainEnum dtype,
float a0, float a1, float a2,
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);
@ -47,14 +48,14 @@ PARTICLEDLL_API void pAvoid(float magnitude, float epsilon, float look_ahead,
S.look_ahead = look_ahead;
_pSendAction(&S, PAAvoidID, sizeof(PAAvoid));
}
}
PARTICLEDLL_API void pBounce(float friction, float resilience, float cutoff,
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);
@ -63,21 +64,21 @@ PARTICLEDLL_API void pBounce(float friction, float resilience, float cutoff,
S.cutoffSqr = fsqr(cutoff);
_pSendAction(&S, PABounceID, sizeof(PABounce));
}
}
PARTICLEDLL_API void pCopyVertexB(bool copy_pos, bool copy_vel)
{
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,
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);
@ -85,11 +86,11 @@ PARTICLEDLL_API void pDamping(float damping_x, float damping_y, float damping_z,
S.vhighSqr = fsqr(vhigh);
_pSendAction(&S, PADampingID, sizeof(PADamping));
}
}
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, float age)
{
{
PAExplosion S;
S.center = pVector(center_x, center_y, center_z);
@ -99,14 +100,14 @@ PARTICLEDLL_API void pExplosion(float center_x, float center_y, float center_z,
S.epsilon = epsilon;
S.age = age;
if(S.epsilon < 0.0f)
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)
{
void pFollow(float magnitude, float epsilon, float max_radius)
{
PAFollow S;
S.magnitude = magnitude;
@ -114,10 +115,10 @@ PARTICLEDLL_API void pFollow(float magnitude, float epsilon, float max_radius)
S.max_radius = max_radius;
_pSendAction(&S, PAFollowID, sizeof(PAFollow));
}
}
PARTICLEDLL_API void pGravitate(float magnitude, float epsilon, float max_radius)
{
void pGravitate(float magnitude, float epsilon, float max_radius)
{
PAGravitate S;
S.magnitude = magnitude;
@ -125,21 +126,21 @@ PARTICLEDLL_API void pGravitate(float magnitude, float epsilon, float max_radius
S.max_radius = max_radius;
_pSendAction(&S, PAGravitateID, sizeof(PAGravitate));
}
}
PARTICLEDLL_API void pGravity(float dir_x, float dir_y, float dir_z)
{
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,
void pJet(float center_x, float center_y, float center_z,
float magnitude, float epsilon, float max_radius)
{
_ParticleState &_ps = _GetPState();
{
_ParticleState& _ps = _GetPState();
PAJet S;
@ -150,20 +151,20 @@ PARTICLEDLL_API void pJet(float center_x, float center_y, float center_z,
S.max_radius = max_radius;
_pSendAction(&S, PAJetID, sizeof(PAJet));
}
}
PARTICLEDLL_API void pKillOld(float age_limit, bool kill_less_than)
{
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)
{
void pMatchVelocity(float magnitude, float epsilon, float max_radius)
{
PAMatchVelocity S;
S.magnitude = magnitude;
@ -171,19 +172,19 @@ PARTICLEDLL_API void pMatchVelocity(float magnitude, float epsilon, float max_ra
S.max_radius = max_radius;
_pSendAction(&S, PAMatchVelocityID, sizeof(PAMatchVelocity));
}
}
PARTICLEDLL_API void pMove()
{
void pMove()
{
PAMove S;
_pSendAction(&S, PAMoveID, sizeof(PAMove));
}
}
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, float epsilon, float max_radius)
{
{
PAOrbitLine S;
S.p = pVector(p_x, p_y, p_z);
@ -194,11 +195,11 @@ PARTICLEDLL_API void pOrbitLine(float p_x, float p_y, float p_z,
S.max_radius = max_radius;
_pSendAction(&S, PAOrbitLineID, sizeof(PAOrbitLine));
}
}
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, float epsilon, float max_radius)
{
{
PAOrbitPoint S;
S.center = pVector(center_x, center_y, center_z);
@ -207,85 +208,85 @@ PARTICLEDLL_API void pOrbitPoint(float center_x, float center_y, float center_z,
S.max_radius = max_radius;
_pSendAction(&S, PAOrbitPointID, sizeof(PAOrbitPoint));
}
}
PARTICLEDLL_API void pRandomAccel(PDomainEnum dtype,
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,
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,
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)
{
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,
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,
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,
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();
{
_ParticleState& _ps = _GetPState();
PASource S;
@ -301,21 +302,21 @@ PARTICLEDLL_API void pSource(float particle_rate, PDomainEnum dtype,
S.vertexB_tracks = _ps.vertexB_tracks;
_pSendAction(&S, PASourceID, sizeof(PASource));
}
}
PARTICLEDLL_API void pSpeedLimit(float min_speed, float max_speed)
{
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,
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);
@ -323,48 +324,48 @@ PARTICLEDLL_API void pTargetColor(float color_x, float color_y, float color_z,
S.scale = scale;
_pSendAction(&S, PATargetColorID, sizeof(PATargetColor));
}
}
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, 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)
{
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 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)
if (_ps.in_new_list)
{
pSource(1, PDPoint, x, y, z);
return;
}
// Immediate mode. Quickly add the vertex.
if(_ps.pgrp == NULL)
if (_ps.pgrp == NULL)
return;
pVector pos(x, y, z);
pVector siz, vel, col, posB;
if(_ps.vertexB_tracks)
if (_ps.vertexB_tracks)
posB = pos;
else
_ps.VertexB.Generate(posB);
@ -372,12 +373,12 @@ PARTICLEDLL_API void pVertex(float x, float y, float z)
_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,
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);
@ -388,4 +389,5 @@ PARTICLEDLL_API void pVortex(float center_x, float center_y, float center_z,
S.max_radius = max_radius;
_pSendAction(&S, PAVortexID, sizeof(PAVortex));
}
}

View 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

View file

@ -21,29 +21,31 @@
// XXX #include <iostream.h>
// Emit OpenGL calls to draw the particles. These are drawn with
// 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();
extern "C" {
// Emit OpenGL calls to draw the particles. These are drawn with
// 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();
// Get a pointer to the particles in gp memory
ParticleGroup *pg = _ps.pgrp;
ParticleGroup* pg = _ps.pgrp;
if(pg == NULL)
if (pg == NULL)
return; // ERROR
if(pg->p_count < 1)
if (pg->p_count < 1)
return;
if(primitive == GL_POINTS)
if (primitive == GL_POINTS)
{
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
if(!const_color)
if (!const_color)
{
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, sizeof(Particle), &pg->list[0].color);
@ -60,68 +62,68 @@ PARTICLEDLL_API void pDrawGroupp(int primitive, bool const_size, bool const_colo
// Assume GL_LINES
glBegin((GLenum)primitive);
if(!const_color)
if (!const_color)
{
for(int i = 0; i < pg->p_count; i++)
for (int i = 0; i < pg->p_count; i++)
{
Particle &m = pg->list[i];
Particle& m = pg->list[i];
// Warning: this depends on alpha following color in the Particle struct.
glColor4fv((GLfloat *)&m.color);
glVertex3fv((GLfloat *)&m.pos);
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);
glVertex3fv((GLfloat*)&tail);
}
}
else
{
for(int i = 0; i < pg->p_count; i++)
for (int i = 0; i < pg->p_count; i++)
{
Particle &m = pg->list[i];
glVertex3fv((GLfloat *)&m.pos);
Particle& m = pg->list[i];
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);
glVertex3fv((GLfloat*)&tail);
}
}
glEnd();
}
}
}
PARTICLEDLL_API void pDrawGroupl(int dlist, bool const_size, bool const_color, bool const_rotation)
{
_ParticleState &_ps = _GetPState();
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)
ParticleGroup* pg = _ps.pgrp;
if (pg == NULL)
return; // ERROR
if(pg->p_count < 1)
if (pg->p_count < 1)
return;
//if(const_color)
// glColor4fv((GLfloat *)&pg->list[0].color);
for(int i = 0; i < pg->p_count; i++)
for (int i = 0; i < pg->p_count; i++)
{
Particle &m = pg->list[i];
Particle& m = pg->list[i];
glPushMatrix();
glTranslatef(m.pos.x, m.pos.y, m.pos.z);
if(!const_size)
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)
if (!const_rotation)
{
pVector vN(m.vel);
vN.normalize();
@ -129,7 +131,7 @@ PARTICLEDLL_API void pDrawGroupl(int dlist, bool const_size, bool const_color, b
voN.normalize();
pVector biN;
if(voN.x == vN.x && voN.y == vN.y && voN.z == vN.z)
if (voN.x == vN.x && voN.y == vN.y && voN.z == vN.z)
biN = pVector(0, 1, 0);
else
biN = vN ^ voN;
@ -146,11 +148,12 @@ PARTICLEDLL_API void pDrawGroupl(int dlist, bool const_size, bool const_color, b
}
// Warning: this depends on alpha following color in the Particle struct.
if(!const_color)
glColor4fv((GLfloat *)&m.color);
if (!const_color)
glColor4fv((GLfloat*)&m.color);
glCallList(dlist);
glPopMatrix();
}
}
}

View file

@ -22,8 +22,6 @@
#define drand48() (((float) rand())/((float) RAND_MAX))
#define srand48(x) srand(x)
// This is because their stupid compiler thinks it's smart.
#define inline __forceinline
#endif
class pVector

View file

@ -14,188 +14,189 @@
#define P_VERSION 120
// added <<< cgc >>>
#include <p_vector.h>
#include <general.h>
#include <particledefs.h>
#include "p_vector.h"
#include "general.h"
#include "particledefs.h"
// 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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);
PARTICLEDLL_API void pDrawGroupp(int primitive, bool const_size = false,
void pDrawGroupp(int primitive, bool const_size = false,
bool const_color = false);
// 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);
// end
// Added <<< cgc >>>
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
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,
float *vel = NULL, float *size = NULL, float *age = NULL);
int pGetParticles(int index, int count, float* position = NULL, float* color = 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,
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 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,
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 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);
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);
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);
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);
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 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 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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);
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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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 a3 = 0.0f, float a4 = 0.0f, float a5 = 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);
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);
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,
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

View file

@ -11,22 +11,6 @@
#ifdef WIN32
#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)
#endif
@ -43,8 +27,9 @@
//////////////////////////////////////////////////////////////////////
// Type codes for domains
PARTICLEDLL_API enum PDomainEnum
{
extern "C" {
enum PDomainEnum
{
PDPoint = 0, // Single point
PDLine = 1, // Line segment
PDTriangle = 2, // Triangle
@ -56,8 +41,8 @@ PARTICLEDLL_API enum PDomainEnum
PDBlob = 8, // Gaussian blob
PDDisc = 9, // Arbitrarily-oriented disc
PDRectangle = 10 // Rhombus-shaped planar region
};
};
}
// A single particle
struct Particle
{

View file

@ -12,25 +12,22 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5AADD469-7488-4B34-A9FD-01CFAC5972FD}</ProjectGuid>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>particles</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -44,18 +41,16 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;..;</IncludePath>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../common;../public</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<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>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -67,10 +62,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(VCInstallDir)</AdditionalIncludeDirectories>
<AdditionalUsingDirectories>$(FrameworkPathOverride)</AdditionalUsingDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -84,6 +76,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
<None Include="Overview.txt" />
<None Include="PS Docs.htm">
<DeploymentContent>true</DeploymentContent>

View file

@ -18,6 +18,7 @@
<None Include="PS Docs.htm" />
<None Include="Overview.txt" />
<None Include="Readme.txt" />
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="general.h">

View file

@ -417,114 +417,116 @@ void _pAddActionToList(ParticleAction *S, int size)
////////////////////////////////////////////////////////
// State setting calls
PARTICLEDLL_API void pColor(float red, float green, float blue, float alpha)
{
_ParticleState &_ps = _GetPState();
extern "C" {
void pColor(float red, float green, float blue, float alpha)
{
_ParticleState& _ps = _GetPState();
_ps.Alpha = alpha;
_ps.Color = pDomain(PDPoint, red, green, blue);
}
}
PARTICLEDLL_API void pColorD(float alpha, PDomainEnum dtype,
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();
{
_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();
void pVelocity(float x, float y, float z)
{
_ParticleState& _ps = _GetPState();
_ps.Vel = pDomain(PDPoint, x, y, z);
}
}
PARTICLEDLL_API void pVelocityD(PDomainEnum dtype,
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();
{
_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();
void pVertexB(float x, float y, float z)
{
_ParticleState& _ps = _GetPState();
_ps.VertexB = pDomain(PDPoint, x, y, z);
}
}
PARTICLEDLL_API void pVertexBD(PDomainEnum dtype,
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();
{
_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();
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();
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,
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();
{
_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();
void pStartingAge(float age, float sigma)
{
_ParticleState& _ps = _GetPState();
_ps.Age = age;
_ps.AgeSigma = sigma;
}
}
PARTICLEDLL_API void pTimeStep(float newDT)
{
_ParticleState &_ps = _GetPState();
void pTimeStep(float newDT)
{
_ParticleState& _ps = _GetPState();
_ps.dt = newDT;
}
}
////////////////////////////////////////////////////////
// Action List Calls
////////////////////////////////////////////////////////
// Action List Calls
PARTICLEDLL_API int pGenActionLists(int action_list_count)
{
_ParticleState &_ps = _GetPState();
int pGenActionLists(int action_list_count)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
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++)
for (int i = ind; i < ind + action_list_count; i++)
{
_ps.alist_list[i] = new PAHeader[8];
_ps.alist_list[i]->actions_allocated = 8;
@ -535,18 +537,18 @@ PARTICLEDLL_API int pGenActionLists(int action_list_count)
_PUnLock();
return ind;
}
}
PARTICLEDLL_API void pNewActionList(int action_list_num)
{
_ParticleState &_ps = _GetPState();
void pNewActionList(int action_list_num)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return; // ERROR
_ps.pact = _ps.GetListPtr(action_list_num);
if(_ps.pact == NULL)
if (_ps.pact == NULL)
return; // ERROR
_ps.list_id = action_list_num;
@ -554,41 +556,41 @@ PARTICLEDLL_API void pNewActionList(int action_list_num)
// Remove whatever used to be in the list.
_ps.pact->count = 1;
}
}
PARTICLEDLL_API void pEndActionList()
{
_ParticleState &_ps = _GetPState();
void pEndActionList()
{
_ParticleState& _ps = _GetPState();
if(!_ps.in_new_list)
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();
void pDeleteActionLists(int action_list_num, int action_list_count)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return; // ERROR
if(action_list_num < 0)
if (action_list_num < 0)
return; // ERROR
if(action_list_num + action_list_count > _ps.alist_count)
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++)
for (int i = action_list_num; i < action_list_num + action_list_count; i++)
{
if(_ps.alist_list[i])
if (_ps.alist_list[i])
{
delete [] _ps.alist_list[i];
delete[] _ps.alist_list[i];
_ps.alist_list[i] = NULL;
}
else
@ -599,13 +601,13 @@ PARTICLEDLL_API void pDeleteActionLists(int action_list_num, int action_list_cou
}
_PUnLock();
}
}
PARTICLEDLL_API void pCallActionList(int action_list_num)
{
_ParticleState &_ps = _GetPState();
void pCallActionList(int action_list_num)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
{
// Add this call as an action to the current list.
// <<< cgc >>> commented out predeclaration
@ -619,9 +621,9 @@ PARTICLEDLL_API void pCallActionList(int action_list_num)
else
{
// Execute the specified action list.
PAHeader *pa = _ps.GetListPtr(action_list_num);
PAHeader* pa = _ps.GetListPtr(action_list_num);
if(pa == NULL)
if (pa == NULL)
return; // ERRROR
// XXX A temporary hack.
@ -629,21 +631,21 @@ PARTICLEDLL_API void pCallActionList(int action_list_num)
_ps.in_call_list = true;
_pCallActionList(pa+1, pa->count-1, _ps.pgrp);
_pCallActionList(pa + 1, pa->count - 1, _ps.pgrp);
_ps.in_call_list = false;
}
}
}
////////////////////////////////////////////////////////
// Particle Group Calls
////////////////////////////////////////////////////////
// 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();
// 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)
if (_ps.in_new_list)
return -1; // ERROR
_PLock();
@ -651,9 +653,9 @@ PARTICLEDLL_API int pGenParticleGroups(int p_group_count, int max_particles)
int ind = _ps.GenerateGroups(p_group_count);
for(int i=ind; i<ind+p_group_count; i++)
for (int i = ind; i < ind + p_group_count; i++)
{
_ps.group_list[i] = (ParticleGroup *)new
_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;
@ -663,25 +665,25 @@ PARTICLEDLL_API int pGenParticleGroups(int p_group_count, int max_particles)
_PUnLock();
return ind;
}
}
PARTICLEDLL_API void pDeleteParticleGroups(int p_group_num, int p_group_count)
{
_ParticleState &_ps = _GetPState();
void pDeleteParticleGroups(int p_group_num, int p_group_count)
{
_ParticleState& _ps = _GetPState();
if(p_group_num < 0)
if (p_group_num < 0)
return; // ERROR
if(p_group_num + p_group_count > _ps.group_count)
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++)
for (int i = p_group_num; i < p_group_num + p_group_count; i++)
{
if(_ps.group_list[i])
if (_ps.group_list[i])
{
delete [] _ps.group_list[i];
delete[] _ps.group_list[i];
_ps.group_list[i] = NULL;
}
else
@ -692,52 +694,52 @@ PARTICLEDLL_API void pDeleteParticleGroups(int p_group_num, int p_group_count)
}
_PUnLock();
}
}
// Change which group is current.
PARTICLEDLL_API void pCurrentGroup(int p_group_num)
{
_ParticleState &_ps = _GetPState();
// Change which group is current.
void pCurrentGroup(int p_group_num)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return; // ERROR
_ps.pgrp = _ps.GetGroupPtr(p_group_num);
if(_ps.pgrp)
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;
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();
// Change the maximum number of particles in the current group.
int pSetMaxParticles(int max_count)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return 0; // ERROR
ParticleGroup *pg = _ps.pgrp;
if(pg == NULL)
ParticleGroup* pg = _ps.pgrp;
if (pg == NULL)
return 0; // ERROR
if(max_count < 0)
if (max_count < 0)
return 0; // ERROR
// Reducing max.
if(pg->particles_allocated >= max_count)
if (pg->particles_allocated >= max_count)
{
pg->max_particles = max_count;
// May have to kill particles.
if(pg->p_count > pg->max_particles)
if (pg->p_count > pg->max_particles)
pg->p_count = pg->max_particles;
return max_count;
@ -746,8 +748,8 @@ PARTICLEDLL_API int pSetMaxParticles(int max_count)
_PLock();
// Allocate particles.
ParticleGroup *pg2 =(ParticleGroup *)new Particle[max_count + 2];
if(pg2 == NULL)
ParticleGroup* pg2 = (ParticleGroup*)new Particle[max_count + 2];
if (pg2 == NULL)
{
// Not enough memory. Just give all we've got.
// ERROR
@ -760,7 +762,7 @@ PARTICLEDLL_API int pSetMaxParticles(int max_count)
memcpy(pg2, pg, (pg->p_count + 2) * sizeof(Particle));
delete [] pg;
delete[] pg;
_ps.group_list[_ps.group_id] = _ps.pgrp = pg2;
pg2->max_particles = max_count;
@ -769,100 +771,100 @@ PARTICLEDLL_API int pSetMaxParticles(int max_count)
_PUnLock();
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();
// Copy from the specified group to the current group.
void pCopyGroup(int p_src_group_num, int index, int copy_count)
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return; // ERROR
ParticleGroup *srcgrp = _ps.GetGroupPtr(p_src_group_num);
if(srcgrp == NULL)
ParticleGroup* srcgrp = _ps.GetGroupPtr(p_src_group_num);
if (srcgrp == NULL)
return; // ERROR
ParticleGroup *destgrp = _ps.pgrp;
if(destgrp == NULL)
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)
if (ccount > srcgrp->p_count - index)
ccount = srcgrp->p_count - index;
if(ccount > destgrp->max_particles - destgrp->p_count)
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)
if (ccount < 0)
ccount = 0;
// Directly copy the particles to the current list.
for(int i=0; i<ccount; i++)
for (int i = 0; i < ccount; i++)
{
destgrp->list[destgrp->p_count+i] =
srcgrp->list[index+i];
destgrp->list[destgrp->p_count + i] =
srcgrp->list[index + i];
}
destgrp->p_count += ccount;
}
}
PARTICLEDLL_API ParticleGroup* pGetParticleGroupRef(int p_group_num)
{
ParticleGroup* pGetParticleGroupRef(int p_group_num)
{
ParticleGroup* theGroup = NULL;
_ParticleState &_ps = _GetPState();
_ParticleState& _ps = _GetPState();
if(!_ps.in_new_list)
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();
// Copy from the current group to application memory.
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)
if (_ps.in_new_list)
return -1; // ERROR
ParticleGroup *pg = _ps.pgrp;
if(pg == NULL)
ParticleGroup* pg = _ps.pgrp;
if (pg == NULL)
return -2; // ERROR
if(index < 0 || count < 0)
if (index < 0 || count < 0)
return -3; // ERROR
if(index + count > pg->p_count)
if (index + count > pg->p_count)
{
count = pg->p_count - index;
if(count <= 0)
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++)
for (int i = 0; i < count; i++)
{
Particle &m = pg->list[index + i];
Particle& m = pg->list[index + i];
if(verts)
if (verts)
{
verts[vi++] = m.pos.x;
verts[vi++] = m.pos.y;
verts[vi++] = m.pos.z;
}
if(color)
if (color)
{
color[ci++] = m.color.x;
color[ci++] = m.color.y;
@ -870,39 +872,40 @@ PARTICLEDLL_API int pGetParticles(int index, int count, float *verts,
color[ci++] = m.alpha;
}
if(vel)
if (vel)
{
vel[li++] = m.vel.x;
vel[li++] = m.vel.y;
vel[li++] = m.vel.z;
}
if(size)
if (size)
{
size[si++] = m.size.x;
size[si++] = m.size.y;
size[si++] = m.size.z;
}
if(age)
if (age)
{
age[ai++] = m.age;
}
}
return count;
}
}
// Returns the number of particles currently in the group.
PARTICLEDLL_API int pGetGroupCount()
{
_ParticleState &_ps = _GetPState();
// Returns the number of particles currently in the group.
int pGetGroupCount()
{
_ParticleState& _ps = _GetPState();
if(_ps.in_new_list)
if (_ps.in_new_list)
return 0; // ERROR
if(_ps.pgrp == NULL)
if (_ps.pgrp == NULL)
return 0; // ERROR
return _ps.pgrp->p_count;
}
}