Changeset 293


Ignore:
Timestamp:
Jan 26, 2011, 3:49:44 PM (8 years ago)
Author:
sam
Message:

Add pseudorandom functions for floats.

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r292 r293  
    112112    {
    113113        int id = 110 + 20 * (rand() % 7);
    114         Float3 pos(rand() % 500, rand() % 500, 20);
    115         Float3 vel(1.e-3f * (rand() % 100 - 50),
    116                    1.e-3f * (rand() % 50 + 50), 0);
     114        Float3 pos(RandF(500.0f), RandF(500.0f), 8.0f);
     115        Float3 vel(RandF(-0.1, 0.1f), RandF(0.05f, 0.1f), 0.0f);
    117116        data->emitter->AddParticle(id, pos, vel);
    118117    }
  • trunk/src/Makefile.am

    r288 r293  
    99    profiler.cpp profiler.h input.h input.cpp world.cpp world.h \
    1010    sample.cpp sample.h sampler.cpp sampler.h text.cpp text.h \
    11     emitter.cpp emitter.h \
     11    emitter.cpp emitter.h numeric.h \
    1212    \
    1313    sdlinput.cpp sdlinput.h \
  • trunk/src/core.h

    r288 r293  
    1919// Base types
    2020#include "matrix.h"
     21#include "numeric.h"
    2122#include "timer.h"
    2223
  • trunk/src/matrix.h

    r270 r293  
    141141GLOBALS(3)
    142142
    143 /* A few utility functions */
    144 template <typename T> static inline T PotUp(T val)
    145 {
    146     val = val - 1;
    147     //if (sizeof(val) > 8) val = val | (val >> 64);
    148     //if (sizeof(val) > 4) val = val | (val >> 32);
    149     if (sizeof(val) > 2) val = val | (val >> 16);
    150     if (sizeof(val) > 1) val = val | (val >> 8);
    151     val = val | (val >> 4);
    152     val = val | (val >> 2);
    153     val = val | (val >> 1);
    154     return val + 1;
    155 }
    156 
    157143#endif // __DH_MATRIX_H__
    158144
  • trunk/win32/deushax.vcxproj

    r288 r293  
    3030    <ClInclude Include="..\src\map.h" />
    3131    <ClInclude Include="..\src\matrix.h" />
     32    <ClInclude Include="..\src\numeric.h" />
    3233    <ClInclude Include="..\src\profiler.h" />
    3334    <ClInclude Include="..\src\sample.h" />
  • trunk/win32/deushax.vcxproj.filters

    r288 r293  
    5050    </ClInclude>
    5151    <ClInclude Include="..\src\matrix.h">
     52      <Filter>lolengine</Filter>
     53    </ClInclude>
     54    <ClInclude Include="..\src\numeric.h">
    5255      <Filter>lolengine</Filter>
    5356    </ClInclude>
  • trunk/win32/monsterz.vcxproj

    r288 r293  
    3333    <ClInclude Include="..\src\map.h" />
    3434    <ClInclude Include="..\src\matrix.h" />
     35    <ClInclude Include="..\src\numeric.h" />
    3536    <ClInclude Include="..\src\profiler.h" />
    3637    <ClInclude Include="..\src\sample.h" />
  • trunk/win32/monsterz.vcxproj.filters

    r288 r293  
    5050    </ClInclude>
    5151    <ClInclude Include="..\src\matrix.h">
     52      <Filter>lolengine</Filter>
     53    </ClInclude>
     54    <ClInclude Include="..\src\numeric.h">
    5255      <Filter>lolengine</Filter>
    5356    </ClInclude>
Note: See TracChangeset for help on using the changeset viewer.