void HNode::change_parameters(GLfloat atx, GLfloat aty, GLfloat atz, GLfloat arx, GLfloat ary, GLfloat arz){ tx = atx; ty = aty; tz = atz; rx = arx; ry = ary; rz = arz; update_matrices(); }
void CglicScene::display() { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_CULL_FACE); if(pcv->profile.globalScale){ for(int i = 0 ; i < listObject.size() ; i++){ listObject[i]->setScaleFactor(globalScale); } } update_matrices(); applyTransformation(); for (int i = 0; i < listGroup.size(); i++) listGroup[i]->compute(); for (int iObj = 0; iObj < listObject.size(); iObj++) listObject[iObj]->applyTransformation(); axis->applyTransformation(); axis->display(); for (int iObj = 0; iObj < listObject.size(); iObj++) if(!listObject[iObj]->isHidden()) listObject[iObj]->shadowsDisplay(); for (int iObj = 0; iObj < listObject.size(); iObj++) if(listObject[iObj]->isHidden()) listObject[iObj]->shadowsDisplay(); //Display de l'ensemble des artefacts for (int iObj = 0; iObj < listObject.size(); iObj++) listObject[iObj]->artifactsDisplay(); //Display des meshes for (int iObj = 0; iObj < listObject.size(); iObj++) if(!listObject[iObj]->isHidden()) listObject[iObj]->display(); for (int iObj = 0; iObj < listObject.size(); iObj++) if(listObject[iObj]->isHidden()) listObject[iObj]->display(); glClear(GL_DEPTH_BUFFER_BIT); debug(); }
bool Mob::update_position(float timedelta){ btTransform transform; motion_state->getWorldTransform(transform); position[0] = transform.getOrigin().getX(); position[1] = transform.getOrigin().getY(); position[2] = transform.getOrigin().getZ(); //std::cout << "pos: " << position[0] << " : " << position[2] << std::endl; if ( SDL_GetTicks() > last_move + move_duration && SDL_GetTicks() < last_move + (2*move_duration)) { velocity[0] = 0; velocity[2] = 0; } else if(SDL_GetTicks() > last_move + (2*move_duration)){ velocity[0] = rand()%3 - 1; velocity[2] = rand()%3 - 1; last_move = SDL_GetTicks(); move_duration = rand()%1000; if(glm::length(velocity)){ velocity = glm::normalize(velocity); direction = velocity; velocity *= speed * timedelta; } } last_pos = position; collision_body->setLinearVelocity(btVector3(velocity.x,velocity.y,velocity.z)); if (!update_matrices()) { std::cout << __FILE__ << ":" << __LINE__ << ": " << "ERROR: Failed to update mob model matrix!" << std::endl; errorlogger("ERROR: Failed to update mob model matrix!"); return false; } return true; }
EngineBrute(Star **&stars, const int &stars_count_, const float &gravity_constant){ stars_count = stars_count_; init_matrices(); update_matrices(stars, gravity_constant); }
void HNode::dec_rz(){ rz--; update_matrices(); }
void HNode::dec_ry(){ ry--; update_matrices(); }
void HNode::dec_rx(){ rx--; update_matrices(); }
void HNode::inc_rz(){ rz++; update_matrices(); }
void HNode::inc_ry(){ ry++; update_matrices(); }
void HNode::inc_rx(){ rx++; update_matrices(); }
HNode::HNode(HNode* a_parent, GLuint num_v, glm::vec4* a_vertices, glm::vec4* a_colours,glm::vec4* a_normals,glm::vec2* a_textures, std::size_t v_size, std::size_t c_size,std::size_t n_size,std::size_t t_size, GLuint NuseTexture, std::string texFileName,std::vector<int> texFileSize){ num_vertices = num_v; vertex_buffer_size = v_size; color_buffer_size = c_size; normal_buffer_size = n_size; texture_buffer_size = t_size; use_texture=NuseTexture; // initialize vao and vbo of the object; tex=LoadTexture(texFileName.c_str(),texFileSize[0],texFileSize[1]); //Ask GL for a Vertex Attribute Objects (vao) glGenVertexArrays (1, &vao); //Ask GL for aVertex Buffer Object (vbo) glGenBuffers (1, &vbo); //bind them glBindVertexArray (vao); glBindBuffer (GL_ARRAY_BUFFER, vbo); glBufferData (GL_ARRAY_BUFFER, vertex_buffer_size + color_buffer_size+normal_buffer_size+texture_buffer_size, NULL, GL_STATIC_DRAW); glBufferSubData( GL_ARRAY_BUFFER, 0, vertex_buffer_size, a_vertices ); glBufferSubData( GL_ARRAY_BUFFER, vertex_buffer_size, color_buffer_size, a_colours ); glBufferSubData( GL_ARRAY_BUFFER, vertex_buffer_size+color_buffer_size, normal_buffer_size, a_normals ); //if(NuseTexture==1) glBufferSubData( GL_ARRAY_BUFFER, vertex_buffer_size+color_buffer_size+normal_buffer_size, texture_buffer_size, a_textures ); //setup the vertex array as per the shader glEnableVertexAttribArray( vPosition ); glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); glEnableVertexAttribArray( vColor ); glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(vertex_buffer_size)); glEnableVertexAttribArray( vNormal ); glVertexAttribPointer( vNormal, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(vertex_buffer_size+color_buffer_size)); //if(NuseTexture==1) //{ glEnableVertexAttribArray( vTexture ); glVertexAttribPointer( vTexture, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(vertex_buffer_size+color_buffer_size+normal_buffer_size)); //} // set parent if(a_parent == NULL){ parent = NULL; } else{ parent = a_parent; parent->add_child(this); } //initial parameters are set to 0; tx=ty=tz=rx=ry=rz=0; update_matrices(); }
void Camera::change_phi(float addition) { eye_spheric.z += addition; check_coord_bounds(); update_matrices(); }
void Camera::set_up_direction(float x, float y, float z, bool update_mx) { up = D3DXVECTOR3(x, y, z); if( update_mx ) update_matrices(); }
void Camera::set_at_position(float x, float y, float z, bool update_mx) { at = D3DXVECTOR3(x, y, z); if( update_mx ) update_matrices(); }
void Camera::set_position(float rho, float theta, float phi, bool update_mx) { eye_spheric = D3DXVECTOR3(rho, theta, phi); if( update_mx ) update_matrices(); }