00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if 0
00026
00027
00028 #include "UniverseDevelopmentKit/CMaster.h"
00029 #include "Teddy/SpaceGame/RoamInstance.h"
00030 #include "Teddy/SpaceGame/RoamSphere.h"
00031 #include "PhysicalComponents/Projection.h"
00032 #include "UniverseDevelopmentKit/CVertex.h"
00033 #include "Scenes/Camera.h"
00034 using namespace PhysicalComponents;
00035 using namespace UniverseDevelopmentKit;
00036 using namespace Scenes;
00037
00038
00039 namespace Teddy {
00040 namespace SpaceGame {
00041
00042
00043 float c_h;
00044
00045
00046 RoamInstance::RoamInstance( const char *name, Mesh *mesh ):CollisionInstance(name,mesh){
00047 }
00048
00049
00050 bool RoamInstance::collisionCheck( CollisionInstance *other ){
00051 RoamSphere *sphere = dynamic_cast<RoamSphere*>( this->mesh );
00052 if( sphere == NULL ){
00053 return false;
00054 }
00055
00056 Vector other_pos = other->getPosition();
00057 float radius = other->getClipRadius();
00058 if( sphere->collisionCheck( other_pos - this->getPosition(), radius ) ){
00059 this->applyCollision( other );
00060 other->applyCollision( this );
00061 return true;
00062 }
00063 return false;
00064 }
00065
00066 void RoamInstance::drawImmediate( Projection *p ){
00067 View *view = p->getView ();
00068 Camera *camera = p->getCamera();
00069 RoamSphere *sphere = dynamic_cast<RoamSphere*>( this->mesh );
00070 if( sphere == NULL || p==NULL ){
00071 return;
00072 }
00073
00074
00075
00076 Vector vPosition_beg = - this->getPosition() + camera->getPosition();
00077 Vector vPosition = this->rotateVector( vPosition_beg );
00078
00079 c_h = 0;
00080
00081 if( roam_update ){
00082 sphere->update( vPosition, camera );
00083 }
00084
00085
00086
00087 camera->doObjectMatrix( p, localToWorld() );
00088
00089 CVertex::Array.EnableVertexArray();
00090 CVertex::Array.EnableNormalArray();
00091 CVertex::Array.InitRender();
00092 mesh->drawImmediate( p, this->material );
00093 CVertex::Array.FinishRender();
00094 }
00095
00096
00097 };
00098 };
00099
00100
00101 #endif
00102