Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #include "tier0/platform.h"
  7. #include "mathlib/mathlib.h"
  8. #include "mathlib/ssemath.h"
  9. #include "particles.h"
  10. #include "tier2/tier2.h"
  11. #include "tier0/memdbgon.h"
  12. void main(int argc,char **argv)
  13. {
  14. InitCommandLineProgram( argc, argv );
  15. // test sse noise
  16. FourVectors start;
  17. start.LoadAndSwizzle(Vector(-1,4,3),Vector(0,7,8),Vector(8,1,2),Vector(0,0,0));
  18. FourVectors delta;
  19. delta.LoadAndSwizzle(Vector(.1,-.1,.05),Vector(.1,.1,.1),Vector(0,-.1,0),Vector(.1,0,0));
  20. #ifdef TIME_IT
  21. float start_time=Plat_FloatTime();
  22. for(int sim=0;sim<1000*1000*10;sim++)
  23. {
  24. __m128 n=SSENoise( start );
  25. start+=delta;
  26. }
  27. printf("n/s=%f\n",(4*1000*1000*10.0)/(Plat_FloatTime()-start_time));
  28. #endif
  29. for(int i=0;i<130;i++)
  30. {
  31. __m128 noise=SSENoise( start );
  32. // printf(" noise(x=%f)=%f\t%f\t%f\t%f\n",
  33. printf(" %f,%f,%f,%f,%f\n",
  34. start.X(0),noise.m128_f32[0],
  35. noise.m128_f32[1],
  36. noise.m128_f32[2],
  37. noise.m128_f32[3]);
  38. start+=delta;
  39. }
  40. #if 0
  41. ReadParticleConfigFile("particles.cfg");
  42. ParticleCollection lots_o_particles( "fireball" );
  43. lots_o_particles.SetNActiveParticles( 1000000 );
  44. // kick the particles up into the air
  45. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_XCOORD, 0.0 );
  46. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_YCOORD, 0.0 );
  47. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_ZCOORD, 10.0 );
  48. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_XCOORD, 0.0 );
  49. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_YCOORD, 0.0 );
  50. lots_o_particles.FillAttributeWithConstant( PARTICLE_ATTRIBUTE_PREV_ZCOORD, 0.0 );
  51. float start=Plat_FloatTime();
  52. for(int sim=0;sim<1000;sim++)
  53. lots_o_particles.Simulate( 0.01 );
  54. printf("p/s=%f\n",(100.0*1000000)/(Plat_FloatTime()-start));
  55. #endif
  56. }