Gravity struct
Unions are the devil's work, but now there's GravityWell, Directed and DirectedField structs implemented in PhysicsStructs
This commit is contained in:
parent
c740bd5935
commit
855860d454
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
By: SSP - Content mirror.F@F-PC at: 2013.12.12 08:52:31 W. Europe Standard Time
|
||||
ftp://loopaware.com/ta/stortspel/gfxcontent_mirror
|
|
@ -0,0 +1,8 @@
|
|||
newmtl matCrateSG
|
||||
illum 4
|
||||
Kd 0.00 0.00 0.00
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
map_Kd tex_crate.png
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
|
@ -0,0 +1,233 @@
|
|||
# This file uses centimeters as units for non-parametric coordinates.
|
||||
|
||||
mtllib crate.mtl
|
||||
g default
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v -0.479379 0.522314 0.479379
|
||||
v 0.479379 0.522314 0.479379
|
||||
v 0.479379 0.522314 -0.479379
|
||||
v -0.479379 0.522314 -0.479379
|
||||
v -0.470939 -0.528599 -0.470939
|
||||
v 0.470939 -0.528599 -0.470939
|
||||
v 0.470939 -0.528599 0.470939
|
||||
v -0.470939 -0.528599 0.470939
|
||||
v 0.520103 -0.460610 -0.460610
|
||||
v 0.520103 -0.460610 0.460610
|
||||
v 0.520103 0.460610 -0.460610
|
||||
v 0.520103 0.460610 0.460610
|
||||
v -0.522559 -0.464751 -0.464751
|
||||
v -0.522559 -0.464751 0.464751
|
||||
v -0.522559 0.464751 0.464751
|
||||
v -0.522559 0.464751 -0.464751
|
||||
v -0.460954 -0.460954 0.522335
|
||||
v 0.460954 -0.460954 0.522335
|
||||
v 0.460954 0.460954 0.522335
|
||||
v -0.460954 0.460954 0.522335
|
||||
v -0.466507 0.466507 -0.525017
|
||||
v 0.466507 0.466507 -0.525017
|
||||
v 0.466507 -0.466507 -0.525017
|
||||
v -0.466507 -0.466507 -0.525017
|
||||
vt 0.995838 0.004695
|
||||
vt 0.999640 -0.003712
|
||||
vt 0.003809 -0.000160
|
||||
vt -0.000796 1.000526
|
||||
vt 0.003809 0.003892
|
||||
vt 0.999640 0.995671
|
||||
vt 0.003809 0.007944
|
||||
vt 0.999640 0.999723
|
||||
vt 0.003809 1.003774
|
||||
vt 0.999640 1.003774
|
||||
vt 0.995035 0.004695
|
||||
vt 0.995035 1.000526
|
||||
vt 0.000007 0.004695
|
||||
vt 0.000007 1.000526
|
||||
vt 0.999640 0.007944
|
||||
vt -0.000796 0.004695
|
||||
vt 0.003809 0.999723
|
||||
vt 0.003809 -0.003712
|
||||
vt 0.999640 0.003892
|
||||
vt 0.003809 0.995671
|
||||
vt 0.999640 0.992119
|
||||
vt 0.999640 -0.000160
|
||||
vt 0.003809 0.992119
|
||||
vt 0.995838 1.000526
|
||||
vt 0.003809 -0.003712
|
||||
vt 0.999640 -0.003712
|
||||
vt 0.999640 0.992119
|
||||
vt 0.003809 0.992119
|
||||
vt 0.003809 -0.000160
|
||||
vt 0.999640 -0.000160
|
||||
vt 0.999640 0.995671
|
||||
vt 0.003809 0.995671
|
||||
vt 0.003809 0.003892
|
||||
vt 0.999640 0.003892
|
||||
vt 0.999640 0.999723
|
||||
vt 0.003809 0.999723
|
||||
vt 0.003809 0.007944
|
||||
vt 0.999640 0.007944
|
||||
vt 0.999640 1.003774
|
||||
vt 0.003809 1.003774
|
||||
vt -0.000796 0.004695
|
||||
vt 0.995035 0.004695
|
||||
vt 0.995035 1.000526
|
||||
vt -0.000796 1.000526
|
||||
vt 0.000007 0.004695
|
||||
vt 0.995838 0.004695
|
||||
vt 0.995838 1.000526
|
||||
vt 0.000007 1.000526
|
||||
vt 0.003809 -0.000160
|
||||
vt 0.999640 -0.000160
|
||||
vt 0.999640 0.995671
|
||||
vt 0.003809 0.995671
|
||||
vt 0.003809 0.007944
|
||||
vt 0.999640 0.007944
|
||||
vt 0.999640 1.003774
|
||||
vt 0.003809 1.003774
|
||||
vt -0.000796 0.004695
|
||||
vt 0.995035 0.004695
|
||||
vt 0.995035 1.000526
|
||||
vt -0.000796 1.000526
|
||||
vt 0.000007 0.004695
|
||||
vt 0.995838 0.004695
|
||||
vt 0.995838 1.000526
|
||||
vt 0.000007 1.000526
|
||||
vt 0.003809 -0.003712
|
||||
vt 0.999640 -0.003712
|
||||
vt 0.999640 0.992119
|
||||
vt 0.003809 0.992119
|
||||
vt 0.003809 0.003892
|
||||
vt 0.999640 0.003892
|
||||
vt 0.999640 0.999723
|
||||
vt 0.003809 0.999723
|
||||
vn -0.031209 -0.033799 0.998941
|
||||
vn 0.033799 -0.031209 0.998941
|
||||
vn -0.033799 0.031209 0.998941
|
||||
vn 0.031209 0.033799 0.998941
|
||||
vn -0.030245 0.999045 0.031527
|
||||
vn 0.031527 0.999045 0.030245
|
||||
vn -0.031527 0.999045 -0.030245
|
||||
vn 0.030245 0.999045 -0.031527
|
||||
vn -0.034614 0.037052 -0.998714
|
||||
vn 0.037051 0.034614 -0.998714
|
||||
vn -0.037051 -0.034614 -0.998714
|
||||
vn 0.034614 -0.037052 -0.998714
|
||||
vn -0.038824 -0.998397 -0.041174
|
||||
vn 0.041174 -0.998397 -0.038824
|
||||
vn -0.041174 -0.998397 0.038824
|
||||
vn 0.038824 -0.998397 0.041174
|
||||
vn 0.999134 -0.030589 0.028224
|
||||
vn 0.999134 -0.028224 -0.030589
|
||||
vn 0.999134 0.028224 0.030589
|
||||
vn 0.999134 0.030589 -0.028224
|
||||
vn -0.998933 -0.033811 -0.031470
|
||||
vn -0.998933 -0.031470 0.033811
|
||||
vn -0.998933 0.031470 -0.033811
|
||||
vn -0.998933 0.033811 0.031470
|
||||
vn 0.577350 0.577350 -0.577350
|
||||
vn 0.577350 -0.577350 -0.577350
|
||||
vn -0.577350 0.577350 -0.577350
|
||||
vn -0.577350 -0.577350 -0.577350
|
||||
vn 0.577350 -0.577350 0.577350
|
||||
vn -0.577350 -0.577350 0.577350
|
||||
vn 0.577350 0.577350 0.577350
|
||||
vn -0.577350 0.577350 0.577350
|
||||
vn -0.608285 0.469952 0.639637
|
||||
vn 0.633500 0.454555 0.626145
|
||||
vn 0.657522 0.474071 -0.585595
|
||||
vn -0.626276 0.491669 -0.605013
|
||||
vn -0.608373 -0.534484 -0.586694
|
||||
vn 0.635292 -0.520408 -0.570596
|
||||
vn 0.616200 -0.500955 0.607735
|
||||
vn -0.589957 -0.516183 0.620891
|
||||
s 1
|
||||
g meshCrate
|
||||
usemtl matCrateSG
|
||||
f 33/65/1 34/66/2 36/68/3
|
||||
f 36/68/3 34/66/2 35/67/4
|
||||
f 17/49/5 18/50/6 20/52/7
|
||||
f 20/52/7 18/50/6 19/51/8
|
||||
f 37/69/9 38/70/10 40/72/11
|
||||
f 40/72/11 38/70/10 39/71/12
|
||||
f 21/53/13 22/54/14 24/56/15
|
||||
f 24/56/15 22/54/14 23/55/16
|
||||
f 26/57/17 25/58/18 28/60/19
|
||||
f 28/60/19 25/58/18 27/59/20
|
||||
f 29/61/21 30/62/22 32/64/23
|
||||
f 32/64/23 30/62/22 31/63/24
|
||||
s 7
|
||||
f 1/25/25 3/28/26 2/26/27
|
||||
f 2/26/27 3/28/26 4/27/28
|
||||
f 3/29/26 5/32/29 4/30/28
|
||||
f 4/30/28 5/32/29 6/31/30
|
||||
f 5/33/29 7/36/31 6/34/30
|
||||
f 6/34/30 7/36/31 8/35/32
|
||||
f 7/37/31 1/40/25 8/38/32
|
||||
f 8/38/32 1/40/25 2/39/27
|
||||
f 2/41/27 4/44/28 8/42/32
|
||||
f 8/42/32 4/44/28 6/43/30
|
||||
f 7/45/31 5/48/29 1/46/25
|
||||
f 1/46/25 5/48/29 3/47/26
|
||||
s 1
|
||||
f 12/3/33 11/22/34 17/49/5
|
||||
f 17/49/5 11/22/34 18/50/6
|
||||
f 11/22/34 13/6/35 18/50/6
|
||||
f 18/50/6 13/6/35 19/51/8
|
||||
f 13/6/35 14/20/36 19/51/8
|
||||
f 19/51/8 14/20/36 20/52/7
|
||||
f 14/20/36 12/3/33 20/52/7
|
||||
f 20/52/7 12/3/33 17/49/5
|
||||
f 16/7/37 15/15/38 21/53/13
|
||||
f 21/53/13 15/15/38 22/54/14
|
||||
f 15/15/38 10/10/39 22/54/14
|
||||
f 22/54/14 10/10/39 23/55/16
|
||||
f 10/10/39 9/9/40 23/55/16
|
||||
f 23/55/16 9/9/40 24/56/15
|
||||
f 9/9/40 16/7/37 24/56/15
|
||||
f 24/56/15 16/7/37 21/53/13
|
||||
f 10/16/39 15/11/38 26/57/17
|
||||
f 26/57/17 15/11/38 25/58/18
|
||||
f 15/11/38 13/12/35 25/58/18
|
||||
f 25/58/18 13/12/35 27/59/20
|
||||
f 13/12/35 11/4/34 27/59/20
|
||||
f 27/59/20 11/4/34 28/60/19
|
||||
f 11/4/34 10/16/39 28/60/19
|
||||
f 28/60/19 10/16/39 26/57/17
|
||||
f 16/13/37 9/1/40 29/61/21
|
||||
f 29/61/21 9/1/40 30/62/22
|
||||
f 9/1/40 12/24/33 30/62/22
|
||||
f 30/62/22 12/24/33 31/63/24
|
||||
f 12/24/33 14/14/36 31/63/24
|
||||
f 31/63/24 14/14/36 32/64/23
|
||||
f 14/14/36 16/13/37 32/64/23
|
||||
f 32/64/23 16/13/37 29/61/21
|
||||
f 9/18/40 10/2/39 33/65/1
|
||||
f 33/65/1 10/2/39 34/66/2
|
||||
f 10/2/39 11/21/34 34/66/2
|
||||
f 34/66/2 11/21/34 35/67/4
|
||||
f 11/21/34 12/23/33 35/67/4
|
||||
f 35/67/4 12/23/33 36/68/3
|
||||
f 12/23/33 9/18/40 36/68/3
|
||||
f 36/68/3 9/18/40 33/65/1
|
||||
f 14/5/36 13/19/35 37/69/9
|
||||
f 37/69/9 13/19/35 38/70/10
|
||||
f 13/19/35 15/8/38 38/70/10
|
||||
f 38/70/10 15/8/38 39/71/12
|
||||
f 15/8/38 16/17/37 39/71/12
|
||||
f 39/71/12 16/17/37 40/72/11
|
||||
f 16/17/37 14/5/36 40/72/11
|
||||
f 40/72/11 14/5/36 37/69/9
|
Binary file not shown.
|
@ -0,0 +1,27 @@
|
|||
newmtl blinn1SG
|
||||
illum 4
|
||||
Kd 0.00 0.00 0.00
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
map_Kd orca_skin_6_c_2_diffuse.jpg
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
newmtl blinn2SG
|
||||
illum 4
|
||||
Kd 0.69 0.84 0.90
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
||||
newmtl defaultMat
|
||||
illum 4
|
||||
Kd 0.80 0.80 0.80
|
||||
Ka 0.40 0.40 0.40
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
||||
newmtl orca_skin_6_c_2_high_defaultMat
|
||||
illum 4
|
||||
Kd 0.80 0.80 0.80
|
||||
Ka 0.40 0.40 0.40
|
||||
Tf 1.00 1.00 1.00
|
||||
Ni 1.00
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 197 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
|
@ -0,0 +1,8 @@
|
|||
newmtl matWorldSG
|
||||
illum 4
|
||||
Kd 0.00 0.00 0.00
|
||||
Ka 0.00 0.00 0.00
|
||||
Tf 1.00 1.00 1.00
|
||||
map_Kd tex_worldDummy.jpg
|
||||
Ni 1.00
|
||||
Ks 0.50 0.50 0.50
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,8 +3,10 @@
|
|||
|
||||
#include "PhysicsStructs.h"
|
||||
|
||||
namespace Oyster { namespace Physics
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Physics
|
||||
{
|
||||
namespace Struct
|
||||
{
|
||||
inline SimpleBodyDescription::SimpleBodyDescription()
|
||||
|
@ -111,7 +113,112 @@ namespace Oyster { namespace Physics
|
|||
{
|
||||
return this->isDisturbed;
|
||||
}
|
||||
|
||||
inline GravityWell::GravityWell( )
|
||||
{
|
||||
this->position = ::Oyster::Math::Float3::null;
|
||||
this->mass = 0.0f;
|
||||
}
|
||||
} }
|
||||
|
||||
inline GravityWell::GravityWell( const GravityWell& gravityWell )
|
||||
{
|
||||
this->position = gravityWell.position;
|
||||
this->mass = gravityWell.mass;
|
||||
}
|
||||
|
||||
GravityWell& GravityWell::operator=( const GravityWell& gravityWell )
|
||||
{
|
||||
this->position = gravityWell.position;
|
||||
this->mass = gravityWell.mass;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline GravityDirected::GravityDirected( )
|
||||
{
|
||||
this->impulse = ::Oyster::Math::Float3::null;
|
||||
}
|
||||
|
||||
inline GravityDirected::GravityDirected( const GravityDirected& gravityDirected )
|
||||
{
|
||||
this->impulse = gravityDirected.impulse;
|
||||
}
|
||||
|
||||
inline GravityDirected& GravityDirected::operator=( const GravityDirected& gravityDirected )
|
||||
{
|
||||
this->impulse = gravityDirected.impulse;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline GravityDirectedField::GravityDirectedField( )
|
||||
{
|
||||
this->normalizedDirection = ::Oyster::Math::Float3::null;
|
||||
this->mass = 0.0f;
|
||||
this->magnitude = 0.0f;
|
||||
}
|
||||
|
||||
inline GravityDirectedField::GravityDirectedField( const GravityDirectedField& gravityDirectedField )
|
||||
{
|
||||
this->normalizedDirection = gravityDirectedField.normalizedDirection;
|
||||
this->mass = gravityDirectedField.mass;
|
||||
this->magnitude = gravityDirectedField.magnitude;
|
||||
}
|
||||
inline GravityDirectedField& GravityDirectedField::operator=( const GravityDirectedField& gravityDirectedField )
|
||||
{
|
||||
this->normalizedDirection = gravityDirectedField.normalizedDirection;
|
||||
this->mass = gravityDirectedField.mass;
|
||||
this->magnitude = gravityDirectedField.magnitude;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Gravity::Gravity()
|
||||
{
|
||||
this->gravityType = GravityType_Undefined;
|
||||
}
|
||||
|
||||
inline Gravity::Gravity( const Gravity& gravity )
|
||||
{
|
||||
switch(gravity.gravityType)
|
||||
{
|
||||
case GravityType_Well:
|
||||
this->well.position = gravity.well.position;
|
||||
this->well.mass = gravity.well.mass;
|
||||
break;
|
||||
case GravityType_Directed:
|
||||
this->directed.impulse = gravity.directed.impulse;
|
||||
break;
|
||||
case GravityType_DirectedField:
|
||||
this->directedField.normalizedDirection = gravity.directedField.normalizedDirection;
|
||||
this->directedField.magnitude = gravity.directedField.magnitude;
|
||||
this->directedField.mass = gravity.directedField.mass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline Gravity& Gravity::operator=( const Gravity& gravity )
|
||||
{
|
||||
switch(gravity.gravityType)
|
||||
{
|
||||
case GravityType_Well:
|
||||
this->well.position = gravity.well.position;
|
||||
this->well.mass = gravity.well.mass;
|
||||
break;
|
||||
case GravityType_Directed:
|
||||
this->directed.impulse = gravity.directed.impulse;
|
||||
break;
|
||||
case GravityType_DirectedField:
|
||||
this->directedField.normalizedDirection = gravity.directedField.normalizedDirection;
|
||||
this->directedField.magnitude = gravity.directedField.magnitude;
|
||||
this->directedField.mass = gravity.directedField.mass;
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -62,9 +62,79 @@ namespace Oyster { namespace Physics
|
|||
|
||||
bool isSpatiallyAltered, isDisturbed;
|
||||
};
|
||||
|
||||
/**
|
||||
###############################################################################
|
||||
Can't define structs inside structs in a union therefor they are declared here.
|
||||
###############################################################################
|
||||
*/
|
||||
struct GravityWell
|
||||
{
|
||||
::Oyster::Math::Float3 position;
|
||||
::Oyster::Math::Float mass;
|
||||
|
||||
GravityWell( );
|
||||
GravityWell( const GravityWell& gravityWell );
|
||||
GravityWell& operator=( const GravityWell& gravityWell );
|
||||
};
|
||||
|
||||
struct GravityDirected
|
||||
{
|
||||
::Oyster::Math::Float3 impulse;
|
||||
|
||||
GravityDirected( );
|
||||
GravityDirected( const GravityDirected& gravityDirected );
|
||||
GravityDirected& operator=( const GravityDirected& gravityDirected );
|
||||
};
|
||||
|
||||
struct GravityDirectedField
|
||||
{
|
||||
::Oyster::Math::Float3 normalizedDirection;
|
||||
::Oyster::Math::Float mass;
|
||||
::Oyster::Math::Float magnitude;
|
||||
|
||||
GravityDirectedField( );
|
||||
GravityDirectedField( const GravityDirectedField& gravityDirectedField );
|
||||
GravityDirectedField& operator=( const GravityDirectedField& gravityDirectedField );
|
||||
};
|
||||
|
||||
struct Gravity
|
||||
{
|
||||
enum GravityType
|
||||
{
|
||||
GravityType_Undefined = -1,
|
||||
GravityType_Well = 0,
|
||||
GravityType_Directed = 1,
|
||||
GravityType_DirectedField = 2,
|
||||
} gravityType;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
GravityWell well;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
GravityDirected directed;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
GravityDirectedField directedField;
|
||||
};
|
||||
};
|
||||
|
||||
Gravity( );
|
||||
Gravity( const Gravity& gravity );
|
||||
Gravity& operator=( const Gravity& gravity );
|
||||
|
||||
};
|
||||
}
|
||||
} }
|
||||
|
||||
|
||||
#include "PhysicsStructs-Impl.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram />
|
Loading…
Reference in New Issue