Beispiel #1
0
void PlanetMaster::addPlanet(Vector3 cam_pos) {


   // TODO perturb triangles
    random_vals_t *rv;
    Vector4 p=stochastic::position(rv,cam_pos);
    Vector4 v=stochastic::velocity(rv)/32.0;
    int r=rand();
    r=r%101;
    double rd=r/100.0f;
    rd=rd*M_PI/128.0;
    int r2=rand();
    r2=r2%101;
    double ra=r/100.0f;
    ra*=M_PI/2.0;
    int orbit=rand();
    orbit=(orbit)%101;
    double orbitd=orbit/100.0f;
    orbitd*=M_PI/16.0;
    int s=rand();
    s=s%32;
    s+=64;




    double density=(rand()%1000)/999.0;
    density=1.0;

    int texture=rand();
    texture=texture%13;
    texture+=3;

//    if (texture==1||texture==2){
//        texture=3;
//    }

    Planet* temp = new Planet();

    temp->set_velocity(v);
    temp->set_scale(getScaleMat(Vector4(s,s,s,1)));
    temp->set_radius(s);
    temp->set_trans(getTransMat(p));
    temp->set_axis_angle(ra);
    temp->set_density(density);
    Matrix4x4 rot=getRotXMat(rd);
    temp->set_rot(rot);
    temp->set_orbit_rot(getRotZMat(orbitd));
    temp->calculate_composite_transformations();
    temp->set_texture(texture);
    m_planets.append(temp);

}