Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 23, 2006, 12:08:34 PM (18 years ago)
Author:
patrick
Message:

network: synchronizeable and network manager start of new concept implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/planet.cc

    r6634 r6654  
    2727#include "network_game_manager.h"
    2828#include "converter.h"
     29#include "vertex_array_model.h"
     30#include "primitive_model.h"
    2931
    3032using namespace std;
     
    4446
    4547  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
    4754
    4855  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);
    4964}
    5065
     
    98113{
    99114
     115
    100116  glMatrixMode(GL_MODELVIEW);
    101117  glPushMatrix();
     118
     119  glShadeModel(GL_SMOOTH);
    102120
    103121  /* translate */
     
    109127  this->material->select();
    110128
    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();
    179132}
    180133
Note: See TracChangeset for help on using the changeset viewer.