Changeset 6654 in orxonox.OLD for branches/network/src
- Timestamp:
- Jan 23, 2006, 12:08:34 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/graphics/importer/vertex_array_model.cc
r6519 r6654 305 305 this->addColor(.125,.436,.246); ///FIXME 306 306 } 307 307 308 for (unsigned int loopNumber = 0; loopNumber <= loops; ++loopNumber) 308 309 { … … 326 327 } 327 328 } 329 328 330 for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber) 329 331 { … … 331 333 this->addIndice(segmentsPerLoop + loopSegmentNumber); 332 334 } 335 333 336 for (unsigned int loopNumber = 0; loopNumber < loops; ++loopNumber) 334 337 { -
branches/network/src/lib/network/network_manager.cc
r6341 r6654 49 49 this->netStreamList = NULL; 50 50 this->syncList = NULL; 51 this-> tmpStream = NULL;51 this->defaultSyncStream = NULL; 52 52 53 53 this->hostID = -1; … … 98 98 } 99 99 100 this-> tmpStream = new NetworkStream(ipAddress);100 this->defaultSyncStream = new NetworkStream(ipAddress); 101 101 return 1; 102 102 } … … 111 111 this->hostID = 0; 112 112 this->bGameServer = true; 113 this-> tmpStream = new NetworkStream(port);113 this->defaultSyncStream = new NetworkStream(port); 114 114 this->bGameServer = true; 115 115 SDL_Delay(20); … … 126 126 { 127 127 /* creating a new network stream, it will register itself automaticaly to the class list */ 128 this-> tmpStream = new NetworkStream(address);129 this-> tmpStream->connectSynchronizeable(sync);128 this->defaultSyncStream = new NetworkStream(address); 129 this->defaultSyncStream->connectSynchronizeable(sync); 130 130 } 131 131 … … 142 142 void NetworkManager::connectSynchronizeable(Synchronizeable& sync) 143 143 { 144 this-> tmpStream->connectSynchronizeable(sync);144 this->defaultSyncStream->connectSynchronizeable(sync); 145 145 } 146 146 -
branches/network/src/lib/network/network_manager.h
r6341 r6654 51 51 void synchronize(); 52 52 53 inline NetworkStream* getDefaultSyncStream() { return this->defaultSyncStream; } 54 55 53 56 private: 54 57 NetworkManager(); … … 59 62 const std::list<BaseObject*>* syncList; // list of synchronizeables 60 63 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 61 NetworkStream* tmpStream;//!< FIXME: this is only for testing purposes64 NetworkStream* defaultSyncStream; //!< FIXME: this is only for testing purposes 62 65 int hostID; //!< The Host-ID of the Manager 63 66 bool bGameServer; //!< true if it is a server -
branches/network/src/lib/network/synchronizeable.h
r6341 r6654 163 163 164 164 class Synchronizeable : virtual public BaseObject 165 { 165 { 166 166 167 public: 167 168 Synchronizeable(); … … 179 180 bool isOutOfSync(); 180 181 bool requestedSync(); 182 181 183 inline void setUniqueID( int id ){ uniqueID = id; } 182 inline int getUniqueID() const { return uniqueID; }; 184 inline int getUniqueID() const { return uniqueID; } 185 inline int getHostID() { return this->hostID; } 186 187 inline int getOwner(){ return owner; } 188 inline void setOwner(int owner){ this->owner = owner; } 189 190 /** @returns true if this Synchronizeable has to be synchronized over network */ 191 inline bool beSynchronized() { return this->bSynchronize; } 192 /** @param bSynchronize sets the Synchronizeable to be sunchronized or not */ 193 inline void setSynchronized(bool bSynchronize) { this->bSynchronize = bSynchronize; } 194 183 195 inline void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); } 184 196 inline int getRequestSync( void ){ if ( this->synchronizeRequests.size()>0 ){ int n = *(synchronizeRequests.begin()); synchronizeRequests.pop_front(); return n; } else { return -1; } }; 185 inline int getHostID() { return this->hostID; }186 187 inline int getOwner(){ return owner; }188 inline void setOwner(int owner){ this->owner = owner; }189 197 190 198 inline void setNetworkStream(NetworkStream* stream) { this->networkStream = stream; } 191 199 200 201 protected: 202 NetworkStream* networkStream; 203 int state; 204 205 192 206 private: 193 194 207 int uniqueID; 195 196 197 198 //static std::vector<Synchronizeable*> classList; 199 int owner; 200 int hostID; 208 int owner; 209 int hostID; 210 bool bSynchronize; 201 211 202 212 std::list<int> synchronizeRequests; 203 213 204 protected: 205 NetworkStream* networkStream; 206 int state; 207 208 }; 214 }; 209 215 #endif /* _SYNCHRONIZEABLE_H */ -
branches/network/src/world_entities/planet.cc
r6634 r6654 27 27 #include "network_game_manager.h" 28 28 #include "converter.h" 29 #include "vertex_array_model.h" 30 #include "primitive_model.h" 29 31 30 32 using namespace std; … … 44 46 45 47 this->material = new Material(); 46 this->material->setIllum(10); 48 //this->material->setIllum(20); 49 //this->material->setAmbient(0.1, 0.1, 0.1); 50 51 52 53 //st float radius, const unsigned int loops, const unsigned int segmentsPerLoop 47 54 48 55 this->loadParams(root); 56 57 // VertexArrayModel* model = new VertexArrayModel(); 58 // model->spiralSphere(this->size, 10, 10); 59 // this->setModel(model); 60 // model->debug(); 61 // 62 PrimitiveModel* model = new PrimitiveModel(PRIM_SPHERE, this->size, 50); 63 this->setModel(model); 49 64 } 50 65 … … 98 113 { 99 114 115 100 116 glMatrixMode(GL_MODELVIEW); 101 117 glPushMatrix(); 118 119 glShadeModel(GL_SMOOTH); 102 120 103 121 /* translate */ … … 109 127 this->material->select(); 110 128 111 112 Vector c; 113 double r = this->size; 114 int n = 200; 115 int method = 1; 116 double theta1 = 0; 117 double theta2 = 2 * M_PI; 118 double phi1 = -M_PI/2.0; 119 double phi2 = M_PI/2.0; 120 121 122 int i,j; 123 double jdivn,j1divn,idivn,dosdivn,unodivn=1/(double)n,ndiv2=(double)n/2,t1,t2,t3,cost1,cost2,cte1,cte3; 124 cte3 = (theta2-theta1)/n; 125 cte1 = (phi2-phi1)/ndiv2; 126 dosdivn = 2*unodivn; 127 Vector e,p,e2,p2; 128 129 130 t2=phi1; 131 cost2=cos(phi1); 132 j1divn=0; 133 for (j=0;j<ndiv2;j++) { 134 t1 = t2;//t1 = phi1 + j * cte1; 135 t2 += cte1;//t2 = phi1 + (j + 1) * cte1; 136 t3 = theta1 - cte3; 137 cost1 = cost2;//cost1=cos(t1); 138 cost2 = cos(t2); 139 e.y = sin(t1); 140 e2.y = sin(t2); 141 p.y = c.y + r * e.y; 142 p2.y = c.y + r * e2.y; 143 144 if (method == 0) 145 glBegin(GL_QUAD_STRIP); 146 else 147 glBegin(GL_TRIANGLE_STRIP); 148 149 idivn=0; 150 jdivn=j1divn; 151 j1divn+=dosdivn;//=2*(j+1)/(double)n; 152 for (i=0;i<=n;i++) { 153 //t3 = theta1 + i * (theta2 - theta1) / n; 154 t3 += cte3; 155 e.x = cost1 * cos(t3); 156 //e.y = sin(t1); 157 e.z = cost1 * sin(t3); 158 p.x = c.x + r * e.x; 159 //p.y = c.y + r * e.y; 160 p.z = c.z + r * e.z; 161 glNormal3f(e.x,e.y,e.z); 162 glTexCoord2f(idivn,jdivn); 163 glVertex3f(p.x,p.y,p.z); 164 165 166 e2.x = cost2 * cos(t3); 167 //e.y = sin(t2); 168 e2.z = cost2 * sin(t3); 169 p2.x = c.x + r * e2.x; 170 //p.y = c.y + r * e.y; 171 p2.z = c.z + r * e2.z; 172 glNormal3f(e2.x,e2.y,e2.z); 173 glTexCoord2f(idivn,j1divn); 174 glVertex3f(p2.x,p2.y,p2.z); 175 idivn += unodivn; 176 } 177 glEnd(); 178 } 129 // /WorldEntity::draw(); 130 this->getModel(0)->draw(); 131 // static_cast<VertexArrayModel*>(this->getModel(0))->debug(); 179 132 } 180 133 -
branches/network/src/world_entities/projectiles/laser.cc
r6622 r6654 26 26 #include "particle_emitter.h" 27 27 #include "sprite_particles.h" 28 29 #include "assert.h" 28 30 29 31
Note: See TracChangeset
for help on using the changeset viewer.