diff options
Diffstat (limited to 'utils/particle_test')
| -rw-r--r-- | utils/particle_test/particle_test.cpp | 62 | ||||
| -rw-r--r-- | utils/particle_test/particle_test.vcproj | 177 | ||||
| -rw-r--r-- | utils/particle_test/particles.cfg | 48 |
3 files changed, 287 insertions, 0 deletions
diff --git a/utils/particle_test/particle_test.cpp b/utils/particle_test/particle_test.cpp new file mode 100644 index 0000000..ce1f236 --- /dev/null +++ b/utils/particle_test/particle_test.cpp @@ -0,0 +1,62 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//===========================================================================// + +#include "tier0/platform.h" +#include "mathlib/mathlib.h" +#include "mathlib/ssemath.h" +#include "particles.h" +#include "tier2/tier2.h" +#include "tier0/memdbgon.h" + +void main(int argc,char **argv) +{ + InitCommandLineProgram( argc, argv ); + + + // test sse noise + FourVectors start; + start.LoadAndSwizzle(Vector(-1,4,3),Vector(0,7,8),Vector(8,1,2),Vector(0,0,0)); + FourVectors delta; + delta.LoadAndSwizzle(Vector(.1,-.1,.05),Vector(.1,.1,.1),Vector(0,-.1,0),Vector(.1,0,0)); +#ifdef TIME_IT + float start_time=Plat_FloatTime(); + for(int sim=0;sim<1000*1000*10;sim++) + { + __m128 n=SSENoise( start ); + start+=delta; + } + printf("n/s=%f\n",(4*1000*1000*10.0)/(Plat_FloatTime()-start_time)); +#endif + for(int i=0;i<130;i++) + { + __m128 noise=SSENoise( start ); +// printf(" noise(x=%f)=%f\t%f\t%f\t%f\n", + printf(" %f,%f,%f,%f,%f\n", + start.X(0),noise.m128_f32[0], + noise.m128_f32[1], + noise.m128_f32[2], + noise.m128_f32[3]); + start+=delta; + } + +#if 0 + ReadParticleConfigFile("particles.cfg"); + ParticleCollection lots_o_particles( "fireball" ); + lots_o_particles.SetNActiveParticles( 1000000 ); + // kick the particles up into the air + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_XCOORD, 0.0 ); + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_YCOORD, 0.0 ); + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_ZCOORD, 10.0 ); + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_XCOORD, 0.0 ); + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_YCOORD, 0.0 ); + lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_ZCOORD, 0.0 ); + float start=Plat_FloatTime(); + for(int sim=0;sim<1000;sim++) + lots_o_particles.Simulate( 0.01 ); + printf("p/s=%f\n",(100.0*1000000)/(Plat_FloatTime()-start)); +#endif + +} diff --git a/utils/particle_test/particle_test.vcproj b/utils/particle_test/particle_test.vcproj new file mode 100644 index 0000000..46f07dd --- /dev/null +++ b/utils/particle_test/particle_test.vcproj @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="particle_test" + ProjectGUID="{FC47D86C-97D1-470D-A26B-6BC2B6484B86}" + RootNamespace="particle_test" + Keyword="ManagedCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\..\..\game\bin" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + ManagedExtensions="FALSE" + WholeProgramOptimization="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + GlobalOptimizations="TRUE" + EnableIntrinsicFunctions="TRUE" + FavorSizeOrSpeed="1" + OmitFramePointers="TRUE" + OptimizeForProcessor="3" + AdditionalIncludeDirectories="..\..\public;..\..\public\tier1;..\common" + PreprocessorDefinitions="_WIN32;_DEBUG" + MinimalRebuild="FALSE" + ExceptionHandling="FALSE" + BasicRuntimeChecks="0" + RuntimeLibrary="1" + BufferSecurityCheck="FALSE" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + CallingConvention="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="2" + IgnoreDefaultLibraryNames="libcd,libc,libcmt" + GenerateDebugInformation="TRUE" + AssemblyDebug="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool" + CommandLine="if exist ..\..\..\game\bin\particle_test.exe attrib -r ..\..\..\game\bin\particle_test.exe +if exist ..\..\..\game\bin\particle_test.pdb attrib -r ..\..\..\game\bin\particle_test.pdb + +"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\..\..\game\bin" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + ManagedExtensions="FALSE" + WholeProgramOptimization="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + GlobalOptimizations="TRUE" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="TRUE" + ImproveFloatingPointConsistency="FALSE" + FavorSizeOrSpeed="1" + OmitFramePointers="FALSE" + OptimizeForProcessor="3" + AdditionalIncludeDirectories="..\..\public;..\..\public\tier1;..\common" + PreprocessorDefinitions="_WIN32;NDEBUG" + MinimalRebuild="FALSE" + ExceptionHandling="FALSE" + RuntimeLibrary="0" + BufferSecurityCheck="FALSE" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + CallingConvention="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + IgnoreDefaultLibraryNames="libc;libcd;libcmtd" + GenerateDebugInformation="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool" + CommandLine="if exist ..\..\..\game\bin\particle_test.exe attrib -r ..\..\..\game\bin\particle_test.exe +if exist ..\..\..\game\bin\particle_test.pdb attrib -r ..\..\..\game\bin\particle_test.pdb + +"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + <AssemblyReference + RelativePath="mscorlib.dll"/> + <AssemblyReference + RelativePath="System.dll"/> + <AssemblyReference + RelativePath="System.Data.dll"/> + </References> + <Files> + <Filter + Name="Linker Libraries" + Filter=""> + <File + RelativePath="..\..\lib\public\bitmap.lib"> + </File> + <File + RelativePath="..\..\lib\public\mathlib.lib"> + </File> + <File + RelativePath="..\..\lib\public\raytrace.lib"> + </File> + <File + RelativePath="..\..\lib\public\tier0.lib"> + </File> + <File + RelativePath="..\..\lib\public\tier1.lib"> + </File> + <File + RelativePath="..\..\lib\public\tier2.lib"> + </File> + <File + RelativePath="..\..\lib\public\vstdlib.lib"> + </File> + </Filter> + <File + RelativePath="particle_test.cpp"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/utils/particle_test/particles.cfg b/utils/particle_test/particles.cfg new file mode 100644 index 0000000..eea85c1 --- /dev/null +++ b/utils/particle_test/particles.cfg @@ -0,0 +1,48 @@ +sheets +{ + sheet1 + { + spark + { + coords "0 0 10 10" + } + + } +} + +particles +{ + spark + { + sheet sheet1 + sprite spark + } +} + +psystems +{ + fireball + { + max_particles 1000000 + material effects/firesprite + ptype spark + initializers + { + emit_from_point + { + init_particles 100 + spawn_radius 10 + particle_lifetime "100 200" // range + } + } + operators + { + basic_movement + { + gravity "0 -10 0" + drag 0.001 + } + } + } +} + |