diff --git a/RuntimeLib/bbgraphics.cpp b/RuntimeLib/bbgraphics.cpp
index 9bb0210..3696633 100644
--- a/RuntimeLib/bbgraphics.cpp
+++ b/RuntimeLib/bbgraphics.cpp
@@ -31,7 +31,7 @@ private:
};
//degrees to radians
-static const float dtor = 0.0174532925199432957692369076848861f;
+static const float s_degreesToRadians = 0.0174532925199432957692369076848861f;
static int gx_driver; //current graphics driver
@@ -992,7 +992,7 @@ void bbResizeImage(bbImage *i, float w, float h) {
void bbRotateImage(bbImage *i, float d) {
debugImage(i);
- d *= -dtor;
+ d *= -s_degreesToRadians;
bbTFormImage(i, cos(d), -sin(d), sin(d), cos(d));
}
diff --git a/RuntimeLib/bbmath.cpp b/RuntimeLib/bbmath.cpp
index 46adc7f..8ad32d6 100644
--- a/RuntimeLib/bbmath.cpp
+++ b/RuntimeLib/bbmath.cpp
@@ -8,16 +8,16 @@ static const int RND_M=2147483647;
static const int RND_Q=44488;
static const int RND_R=3399;
-static const float dtor=0.0174532925199432957692369076848861f;
-static const float rtod=57.2957795130823208767981548141052f;
+static const float s_degreesToRadians=0.0174532925199432957692369076848861f;
+static const float s_radiansToDegrees=57.2957795130823208767981548141052f;
-float bbSin( float n ){ return (float)sin(n*dtor); }
-float bbCos( float n ){ return (float)cos(n*dtor); }
-float bbTan( float n ){ return (float)tan(n*dtor); }
-float bbASin( float n ){ return (float)asin(n)*rtod; }
-float bbACos( float n ){ return (float)acos(n)*rtod; }
-float bbATan( float n ){ return (float)atan(n)*rtod; }
-float bbATan2( float n,float t ){ return (float)atan2(n,t)*rtod; }
+float bbSin( float n ){ return (float)sin(n*s_degreesToRadians); }
+float bbCos( float n ){ return (float)cos(n*s_degreesToRadians); }
+float bbTan( float n ){ return (float)tan(n*s_degreesToRadians); }
+float bbASin( float n ){ return (float)asin(n)*s_radiansToDegrees; }
+float bbACos( float n ){ return (float)acos(n)*s_radiansToDegrees; }
+float bbATan( float n ){ return (float)atan(n)*s_radiansToDegrees; }
+float bbATan2( float n,float t ){ return (float)atan2(n,t)*s_radiansToDegrees; }
float bbSqr( float n ){ return (float)sqrt(n); }
float bbFloor( float n ){ return (float)floor(n); }
float bbCeil( float n ){ return (float)ceil(n); }
diff --git a/blitz3d/animator.cpp b/blitz3d/animator.cpp
index 36fc29e..0990f25 100644
--- a/blitz3d/animator.cpp
+++ b/blitz3d/animator.cpp
@@ -35,7 +35,7 @@ void Animator::reset(){
void Animator::addObjs( Object *obj ){
_objs.push_back( obj );
- for( Entity *e=obj->children();e;e=e->successor() ){
+ for( Entity *e=obj->GetChildren();e;e=e->GetSuccessor() ){
addObjs( e->getObject() );
}
}
@@ -87,13 +87,13 @@ void Animator::updateAnim(){
const Animation &keys=_anims[k].keys[_seq];
if( keys.numPositionKeys() ){
- obj->setLocalPosition( keys.getPosition( _time ) );
+ obj->SetLocalPosition( keys.getPosition( _time ) );
}
if( keys.numScaleKeys() ){
- obj->setLocalScale( keys.getScale( _time ) );
+ obj->SetLocalScale( keys.getScale( _time ) );
}
if( keys.numRotationKeys() ){
- obj->setLocalRotation( keys.getRotation( _time ) );
+ obj->SetLocalRotation( keys.getRotation( _time ) );
}
}
}
@@ -105,9 +105,9 @@ void Animator::updateTrans(){
Object *obj=_objs[k];
const Anim &anim=_anims[k];
- if( anim.pos ) obj->setLocalPosition( (anim.dest_pos-anim.src_pos)*_trans_time+anim.src_pos );
- if( anim.scl ) obj->setLocalScale( (anim.dest_scl-anim.src_scl)*_trans_time+anim.src_scl );
- if( anim.rot ) obj->setLocalRotation( anim.src_rot.slerpTo( anim.dest_rot,_trans_time ) );
+ if( anim.pos ) obj->SetLocalPosition( (anim.dest_pos-anim.src_pos)*_trans_time+anim.src_pos );
+ if( anim.scl ) obj->SetLocalScale( (anim.dest_scl-anim.src_scl)*_trans_time+anim.src_scl );
+ if( anim.rot ) obj->SetLocalRotation( anim.src_rot.slerpTo( anim.dest_rot,_trans_time ) );
}
}
@@ -120,15 +120,15 @@ void Animator::beginTrans(){
const Animation &keys=_anims[k].keys[_seq];
if( anim.pos=!!keys.numPositionKeys() ){
- anim.src_pos=obj->getLocalPosition();
+ anim.src_pos=obj->GetLocalPosition();
anim.dest_pos=keys.getPosition( _time );
}
if( anim.scl=!!keys.numScaleKeys() ){
- anim.src_scl=obj->getLocalScale();
+ anim.src_scl=obj->GetLocalScale();
anim.dest_scl=keys.getScale( _time );
}
if( anim.rot=!!keys.numRotationKeys() ){
- anim.src_rot=obj->getLocalRotation();
+ anim.src_rot=obj->GetLocalRotation();
anim.dest_rot=keys.getRotation( _time );
}
}
diff --git a/blitz3d/blitz3d.vcxproj b/blitz3d/blitz3d.vcxproj
index 693bb4d..5b7d47e 100644
--- a/blitz3d/blitz3d.vcxproj
+++ b/blitz3d/blitz3d.vcxproj
@@ -9,6 +9,10 @@
Release
Win32
+
+ RelWithDebInfo
+ Win32
+
@@ -19,7 +23,7 @@
StaticLibrary
- v140
+ v140_xp
false
MultiByte
@@ -28,6 +32,13 @@
v140
false
MultiByte
+ true
+
+
+ StaticLibrary
+ v140_xp
+ false
+ MultiByte
@@ -40,22 +51,80 @@
+
+
+
+
..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
false
- $(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);
- $(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86
+ C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)
+ C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)
+
+
+ ..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
+ ..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
+ false
+ C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)
+ C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)
..\#Build\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
..\#Intermediate\$(ProjectName)\$(Configuration)-$(PlatformTarget)\
true
- $(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);
- $(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86
+ C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;$(IncludePath)
+ C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86;$(LibraryPath)
+
+ MultiThreadedDLL
+ false
+ true
+ Level3
+ _CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)
+ true
+ false
+ $(IntDir)vc$(PlatformToolsetVersion).pdb
+ StdCall
+ Async
+ false
+ Full
+ AnySuitable
+ true
+ Speed
+ true
+ true
+ 4Bytes
+ false
+ true
+ StreamingSIMDExtensions2
+ Fast
+ false
+ ProgramDatabase
+ false
+
+
+ false
+ true
+
+
+ 0x0409
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ true
+ .\Release\blitz3d.bsc
+
+
+ true
+ $(OutDir)$(TargetName)$(TargetExt)
+ MachineX86
+ true
+
+
+
MultiThreadedDLL
false
@@ -127,7 +196,9 @@
-
+
+ true
+
@@ -145,7 +216,9 @@
Create
+ Create
std.h
+ std.h
diff --git a/blitz3d/blitz3d.vcxproj.filters b/blitz3d/blitz3d.vcxproj.filters
index 7b85dea..ef6af85 100644
--- a/blitz3d/blitz3d.vcxproj.filters
+++ b/blitz3d/blitz3d.vcxproj.filters
@@ -50,9 +50,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -116,6 +113,9 @@
Source Files
+
+ Source Files
+
diff --git a/blitz3d/entity.cpp b/blitz3d/entity.cpp
index a69a027..c28add9 100644
--- a/blitz3d/entity.cpp
+++ b/blitz3d/entity.cpp
@@ -4,194 +4,194 @@
//#include "stats.h"
-Entity *Entity::_orphans,*Entity::_last_orphan;
+Entity *Entity::_orphans, *Entity::_last_orphan;
-enum{
- INVALID_LOCALTFORM=1,
- INVALID_WORLDTFORM=2
+enum {
+ INVALID_LOCALTFORM = 1,
+ INVALID_WORLDTFORM = 2
};
-void Entity::remove(){
- if( _parent ){
- if( _parent->_children==this ) _parent->_children=_succ;
- if( _parent->_last_child==this ) _parent->_last_child=_pred;
- }else{
- if( _orphans==this ) _orphans=_succ;
- if( _last_orphan==this ) _last_orphan=_pred;
+void Entity::RemoveParent() {
+ if (m_parent) {
+ if (m_parent->m_children == this) m_parent->m_children = m_listNext;
+ if (m_parent->m_last_child == this) m_parent->m_last_child = m_listPrev;
+ } else {
+ if (_orphans == this) _orphans = m_listNext;
+ if (_last_orphan == this) _last_orphan = m_listPrev;
}
- if( _succ ) _succ->_pred=_pred;
- if( _pred ) _pred->_succ=_succ;
+ if (m_listNext) m_listNext->m_listPrev = m_listPrev;
+ if (m_listPrev) m_listPrev->m_listNext = m_listNext;
}
-void Entity::insert(){
- _succ=0;
- if( _parent ){
- if( _pred=_parent->_last_child ) _pred->_succ=this;
- else _parent->_children=this;
- _parent->_last_child=this;
- }else{
- if( _pred=_last_orphan ) _pred->_succ=this;
- else _orphans=this;
- _last_orphan=this;
+void Entity::InsertChildToParent() {
+ m_listNext = 0;
+ if (m_parent) {
+ if (m_listPrev = m_parent->m_last_child) m_listPrev->m_listNext = this;
+ else m_parent->m_children = this;
+ m_parent->m_last_child = this;
+ } else {
+ if (m_listPrev = _last_orphan) m_listPrev->m_listNext = this;
+ else _orphans = this;
+ _last_orphan = this;
}
}
-Entity::Entity():
-_succ(0),_pred(0),_parent(0),_children(0),_last_child(0),
-_visible(true),_enabled(true),
-local_scl(1,1,1),
-invalid(0){
- insert();
+Entity::Entity() :
+ m_listNext(0), m_listPrev(0), m_parent(0), m_children(0), m_last_child(0),
+ m_isVisible(true), m_isEnabled(true),
+ m_localScale(1, 1, 1),
+ invalid(0) {
+ InsertChildToParent();
}
-Entity::Entity( const Entity &e ):
-_succ(0),_pred(0),_parent(0),_children(0),_last_child(0),
-_name(e._name),_visible(e._visible),_enabled(e._enabled),
-local_pos(e.local_pos),
-local_scl(e.local_scl),
-local_rot(e.local_rot),
-invalid( INVALID_LOCALTFORM|INVALID_WORLDTFORM ){
- insert();
+Entity::Entity(const Entity &e) :
+ m_listNext(0), m_listPrev(0), m_parent(0), m_children(0), m_last_child(0),
+ m_name(e.m_name), m_isVisible(e.m_isVisible), m_isEnabled(e.m_isEnabled),
+ m_localPosition(e.m_localPosition),
+ m_localScale(e.m_localScale),
+ m_localRotation(e.m_localRotation),
+ invalid(INVALID_LOCALTFORM | INVALID_WORLDTFORM) {
+ InsertChildToParent();
}
-Entity::~Entity(){
- while( children() ) delete children();
- remove();
+Entity::~Entity() {
+ while (GetChildren()) delete GetChildren();
+ RemoveParent();
}
-void Entity::invalidateWorld(){
- if( invalid & INVALID_WORLDTFORM ) return;
- invalid|=INVALID_WORLDTFORM;
- for( Entity *e=_children;e;e=e->_succ ){
- e->invalidateWorld();
+void Entity::InvalidateWorldTransform() {
+ if (invalid & INVALID_WORLDTFORM) return;
+ invalid |= INVALID_WORLDTFORM;
+ for (Entity *e = m_children; e; e = e->m_listNext) {
+ e->InvalidateWorldTransform();
}
}
-void Entity::invalidateLocal(){
- invalid|=INVALID_LOCALTFORM;
- invalidateWorld();
+void Entity::invalidateLocal() {
+ invalid |= INVALID_LOCALTFORM;
+ InvalidateWorldTransform();
}
-const Transform &Entity::getLocalTform()const{
- if( invalid&INVALID_LOCALTFORM ){
- local_tform.m=Matrix( local_rot );
- local_tform.m.i*=local_scl.x;
- local_tform.m.j*=local_scl.y;
- local_tform.m.k*=local_scl.z;
- local_tform.v=local_pos;
- invalid&=~INVALID_LOCALTFORM;
+const Transform &Entity::GetLocalTransform()const {
+ if (invalid&INVALID_LOCALTFORM) {
+ m_localTransform.m = Matrix(m_localRotation);
+ m_localTransform.m.i *= m_localScale.x;
+ m_localTransform.m.j *= m_localScale.y;
+ m_localTransform.m.k *= m_localScale.z;
+ m_localTransform.v = m_localPosition;
+ invalid &= ~INVALID_LOCALTFORM;
}
- return local_tform;
+ return m_localTransform;
}
-const Transform &Entity::getWorldTform()const{
- if( invalid&INVALID_WORLDTFORM ){
- world_tform=_parent ? _parent->getWorldTform() * getLocalTform() : getLocalTform();
- invalid&=~INVALID_WORLDTFORM;
+const Transform &Entity::GetWorldTransform()const {
+ if (invalid&INVALID_WORLDTFORM) {
+ m_worldTransform = m_parent ? m_parent->GetWorldTransform() * GetLocalTransform() : GetLocalTransform();
+ invalid &= ~INVALID_WORLDTFORM;
}
- return world_tform;
+ return m_worldTransform;
}
-void Entity::setParent( Entity *p ){
- if( _parent==p ) return;
+void Entity::SetParent(Entity *p) {
+ if (m_parent == p) return;
- remove();
+ RemoveParent();
- _parent=p;
+ m_parent = p;
- insert();
+ InsertChildToParent();
- invalidateWorld();
+ InvalidateWorldTransform();
}
-void Entity::setName( const string &t ){
- _name=t;
+void Entity::SetName(const string &t) {
+ m_name = t;
}
-void Entity::setVisible( bool visible ){
- _visible=visible;
+void Entity::SetVisible(bool visible) {
+ m_isVisible = visible;
}
-void Entity::setEnabled( bool enabled ){
- _enabled=enabled;
+void Entity::SetEnabled(bool enabled) {
+ m_isEnabled = enabled;
}
-void Entity::enumVisible( vector