//------------------------------------------------------------------------------ // Constructor(s) //------------------------------------------------------------------------------ MonitorMetrics::MonitorMetrics(const Table1* redLumTbl, const Table1* greenLumTbl, const Table1* blueLumTbl, const osg::Matrix& phosphorCoordMatrix, const osg::Vec3& whiteRGB, const osg::Vec3& whiteCIE) { STANDARD_CONSTRUCTOR() redLuminance = redLumTbl; greenLuminance = greenLumTbl; blueLuminance = blueLumTbl; phosphorCoordinates = phosphorCoordMatrix; refwhiteRGB = whiteRGB; refwhiteCIE = whiteCIE; computeMatrix(); }
AmbisonicsProjector::AmbisonicsProjector(long anOrder, long aNumberOfChannels, long aVectorSize) : Ambisonics(anOrder, aVectorSize) { m_number_of_outputs = Tools::clip_min(aNumberOfChannels, m_number_of_harmonics); Cicm_Matrix_Float_Malloc(m_decoder_matrix_float, m_number_of_outputs, m_number_of_harmonics); Cicm_Matrix_Double_Malloc(m_decoder_matrix_double, m_number_of_outputs, m_number_of_harmonics); Cicm_Vector_Float_Malloc(m_vector_float_input, m_number_of_harmonics); Cicm_Vector_Float_Malloc(m_vector_float_output, m_number_of_outputs); Cicm_Vector_Double_Malloc(m_vector_double_input, m_number_of_harmonics); Cicm_Vector_Double_Malloc(m_vector_double_output, m_number_of_outputs); computeMatrix(); }
void Asteroid::render() { // Compute transformation matrix computeMatrix(); // Push matrix and set transformation and scaling glPushMatrix(); glMultMatrixf(m_transformation); glScalef(m_scale, m_scale, m_scale); if(m_mesh) { m_mesh->render(); } glPopMatrix(); }
bool MonitorMetrics::setSlotPhosphors(const List* phosphors) { LCreal listItems[6]; if ( phosphors == nullptr ) return false; if ( phosphors->entries() != 6 ) return false; if ( phosphors->getNumberList(listItems, 6) != 6 ) return false; phosphorCoordinates.set( listItems[0], listItems[1], 1-listItems[0]-listItems[1], 0, listItems[2], listItems[3], 1-listItems[2]-listItems[3], 0, listItems[4], listItems[5], 1-listItems[4]-listItems[5], 0, 0, 0, 0, 1 ); return computeMatrix(); }
Camera :: Camera ( const Camera& camera ) { zNear = camera.zNear; zFar = camera.zFar; fov = camera.fov; pos = camera.pos; viewDir = camera.viewDir; upDir = camera.upDir; rightHanded = camera.rightHanded; infinite = camera.infinite; width = camera.width; height = camera.height; aspect = camera.aspect; computeMatrix (); }
Camera::Camera( const QVector3D & pos, const QQuaternion & orientation,\ float fov, float zNear, float zFar, int width, int height ) : pos_( pos ) , dir_( DEFAULT_DIR_VEC ) , up_( DEFAULT_UP_VEC ) , side_( DEFAULT_SIDE_VEC ) , transform_() , fov_( fov ) , zNear_( zNear ) , zFar_( zFar ) , width_( width ) , height_( height ) , aspect_( 0.0f ) { computeAspect(); this->orientation( orientation ); computeMatrix(); }
Camera::Camera( const QVector3D & pos, float pitch, float yaw, float roll, float fov, \ float zNear, float zFar, int width, int height ) : pos_( pos ) , dir_( DEFAULT_DIR_VEC ) , up_( DEFAULT_UP_VEC ) , side_( DEFAULT_SIDE_VEC ) , transform_() , fov_( fov ) , zNear_( zNear ) , zFar_( zFar ) , width_( width ) , height_( height ) , aspect_( 0.0f ) { computeAspect(); orientation( pitch, yaw, roll ); computeMatrix(); }
Camera::Camera( const QVector3D & pos, const QVector3D & target, float fov,\ float zNear, float zFar, int width, int height ) : pos_( pos ) , dir_( DEFAULT_DIR_VEC ) , up_( DEFAULT_UP_VEC ) , side_( DEFAULT_SIDE_VEC ) , transform_() , fov_( fov ) , zNear_( zNear ) , zFar_( zFar ) , width_( width ) , height_( height ) , aspect_( 0.0f ) { computeAspect(); toTarget( target ); computeMatrix(); }
void PixelClassifier::setImage(const Mat &image) { // set image in class and compute its class Matrix // Image must be in HSV sourceImage = image.clone(); preprocess(); computeMatrix(); Mat terrainFiltered, goalFiltered; filterOutOfTerrain(terrainFiltered); filterGoal(goalFiltered); classMat.setTo(POUBELLE); for(int x=0; x<classMat.cols; x++) { for(int y=0; y<classMat.rows; y++) { classMat.at<char>(y,x) = goalFiltered.at<char>(y,x); if(terrainFiltered.at<char>(y,x) != POUBELLE) classMat.at<char>(y,x) = terrainFiltered.at<char>(y,x); } } }
void ASprite::render() { m_program->bind(); shaderAction(); glDepthMask(GL_FALSE); computeMatrix(); computePolygon(); GLuint * vboId = m_geometric.getVboId(); glBindBuffer(GL_ARRAY_BUFFER,vboId[0]); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vboId[1]); quintptr offset = 0; glBindTexture(GL_TEXTURE_2D, m_texId); // Tell OpenGL programmable pipeline how to locate vertex position data int vertexLocation = m_program->attributeLocation("a_position"); m_program->enableAttributeArray(vertexLocation); glVertexAttribPointer(vertexLocation,3, GL_FLOAT, GL_FALSE, sizeof(VertexData), (const void *)offset); offset += sizeof(AVector3D); // Tell OpenGL programmable pipeline how to locate vertex texture coordinate data int texcoordLocation = m_program->attributeLocation("a_texcoord"); m_program->enableAttributeArray(texcoordLocation); glVertexAttribPointer(texcoordLocation, 2, GL_FLOAT, GL_FALSE, sizeof(VertexData), (const void *)offset); m_program->setUniformValue("source",0); m_program->setUniformValue("age_Opacity",m_alpha); m_program->setUniformValue("red",m_color.red); m_program->setUniformValue("green",m_color.green); m_program->setUniformValue("blue",m_color.blue); glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, 0); glDepthMask(GL_TRUE); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); }
void AmbisonicsDecoder::setNumberOfLoudspeakers(long aNumberOfLoudspeakers) { m_number_of_outputs = Tools::clip_min(aNumberOfLoudspeakers, m_number_of_harmonics); if(m_number_of_loudspeakers != m_number_of_outputs) { if(m_decoder_matrix_float) cicm_free(m_decoder_matrix_float); if(m_decoder_matrix_double) cicm_free(m_decoder_matrix_double); if(m_vector_float_output) cicm_free(m_vector_float_output); if(m_vector_double_output) cicm_free(m_vector_double_output); m_number_of_loudspeakers = m_number_of_outputs; cicm_malloc_mat_f(m_decoder_matrix_float, m_number_of_outputs, m_number_of_harmonics); cicm_malloc_mat_d(m_decoder_matrix_double, m_number_of_outputs, m_number_of_harmonics); cicm_malloc_vec_f(m_vector_float_output, m_number_of_outputs); cicm_malloc_vec_d(m_vector_double_output, m_number_of_outputs); computeMatrix(); } }
void TriangleMesh::render() { // Compute transformation matrix computeMatrix(); // Push old transformation of the OpenGL matrix stack and // start rendering the mesh in according to the // internal transformation matrix glPushMatrix(); glMultMatrixf(m_transformation.getData()); // Render mesh for(int i = 0; i < m_numFaces; i++) { // Get position og current triangle in buffer int index = 3 * i; // Get vertex indices of triangle vertices int a = 3 * m_indexBuffer[index]; int b = 3 * m_indexBuffer[index + 1]; int c = 3 * m_indexBuffer[index + 2]; // Render wireframe model glBegin(GL_LINE_LOOP); glColor3f(1.0, 1.0, 1.0); glVertex3f(m_vertexBuffer[a], m_vertexBuffer[a + 1], m_vertexBuffer[a + 2]); glVertex3f(m_vertexBuffer[b], m_vertexBuffer[b + 1], m_vertexBuffer[b + 2]); glVertex3f(m_vertexBuffer[c], m_vertexBuffer[c + 1], m_vertexBuffer[c + 2]); glEnd(); } // Pop transformation matrix of this object // to restore the previous state of the OpenGL // matrix stack glPopMatrix(); }
void moveZ(bool invert = 0) {invert ? m_position.z -= m_translationSpeed: m_position.z += m_translationSpeed; computeMatrix();};
MainWindow::MainWindow() { // parameters input a = new QLineEdit("0.0"); b = new QLineEdit("0.0"); c = new QLineEdit("0.0"); alpha = new QLineEdit("0.0"); beta = new QLineEdit("0.0"); gamma = new QLineEdit("0.0"); QLabel *name_a = new QLabel("Length a"); QLabel *name_b = new QLabel("Length b"); QLabel *name_c = new QLabel("Length c"); QLabel *name_alph = new QLabel("Angle alpha"); QLabel *name_beta = new QLabel("Angle beta"); QLabel *name_gamm = new QLabel("Angle gamma"); // organisation with layout QGridLayout *latticeParamsLayout = new QGridLayout; latticeParamsLayout->addWidget(name_a,0,0); latticeParamsLayout->addWidget(name_b,0,1); latticeParamsLayout->addWidget(name_c,0,2); latticeParamsLayout->addWidget(a,1,0); latticeParamsLayout->addWidget(b,1,1); latticeParamsLayout->addWidget(c,1,2); latticeParamsLayout->addWidget(name_alph,2,0); latticeParamsLayout->addWidget(name_beta,2,1); latticeParamsLayout->addWidget(name_gamm,2,2); latticeParamsLayout->addWidget(alpha,3,0); latticeParamsLayout->addWidget(beta,3,1); latticeParamsLayout->addWidget(gamma,3,2); // a distinct box for storing previous things QGroupBox *latticeParamsGroup = new QGroupBox("Lattice parameters: "); latticeParamsGroup->setLayout(latticeParamsLayout); //---------------------------------------------------------------------- //output zone : matrix m1 = new QLineEdit("0.0"); m2 = new QLineEdit("0.0"); m3 = new QLineEdit("0.0"); m4 = new QLineEdit("0.0"); m5 = new QLineEdit("0.0"); m6 = new QLineEdit("0.0"); m7 = new QLineEdit("0.0"); m8 = new QLineEdit("0.0"); m9 = new QLineEdit("0.0"); // organisation with a grid layout QGridLayout *matrixLayout = new QGridLayout; matrixLayout->addWidget(m1,0,0); matrixLayout->addWidget(m2,0,1); matrixLayout->addWidget(m3,0,2); matrixLayout->addWidget(m4,1,0); matrixLayout->addWidget(m5,1,1); matrixLayout->addWidget(m6,1,2); matrixLayout->addWidget(m7,2,0); matrixLayout->addWidget(m8,2,1); matrixLayout->addWidget(m9,2,2); // a distinct box for this Matrix QGroupBox *matrixGroup = new QGroupBox("Output Matrix "); matrixGroup->setLayout(matrixLayout); //---------------------------------------------------------------------- //buttons launchButton = new QPushButton("Obtain matrix",this); resetButton = new QPushButton("Reset",this); exitButton = new QPushButton("Exit",this); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(launchButton); buttonsLayout->addWidget(resetButton); buttonsLayout->addWidget(exitButton); //---------------------------------------------------------------------- // general layout of window : we add here the previous group boxes, etc ... QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(latticeParamsGroup); mainLayout->addLayout(buttonsLayout); mainLayout->addWidget(matrixGroup); // general settings for this main window this->setLayout(mainLayout); this->setWindowTitle("Lattice param to Matrix"); this->setFixedSize(400,500); // connect buttons' signals to something else ... connect(exitButton,SIGNAL(clicked()),qApp,SLOT(quit())); connect(launchButton,SIGNAL(clicked()),this,SLOT(computeMatrix())); connect(resetButton,SIGNAL(clicked()),this,SLOT(resetAll())); }
void Camera::move( const QVector3D & delta ) { pos_ += delta; computeMatrix(); }
void Camera::pos( const QVector3D & newPos ) { pos_ = newPos; computeMatrix(); }
void Camera :: setFov ( float newFovAngle ) { fov = newFovAngle; computeMatrix (); }
bool MonitorMetrics::setSlotRed(const Table1* red) { if ( red == nullptr ) return false; redLuminance = red; return computeMatrix(); }
void Camera::fov( float newFov ) { fov_ = newFov; computeMatrix(); }
void TexturedMesh::render() { MaterialFaceLists::iterator matListIt; list<int>::iterator matFaceIt; // Compute transformation matrix computeMatrix(); glPushMatrix(); glMultMatrixf(m_transformation); for(matListIt = m_matFaceLists.begin(); matListIt != m_matFaceLists.end(); matListIt++) { // Get list for current material MaterialFaceList* matList = *matListIt; // Get material Material* mat = m_materials[matList->m_matIndex]; // Bind texture and set material properties if(mat->m_texture != 0) { mat->m_texture->bind(); } setColorMaterial(mat->m_ambient, mat->m_diffuse, mat->m_specular, mat->m_shininess); // Render face group matFaceIt = matList->m_faces.begin(); while(matFaceIt != matList->m_faces.end()) { int a = *matFaceIt; ++matFaceIt; int b = *matFaceIt; ++matFaceIt; int c = *matFaceIt; ++matFaceIt; int a_pos = a * 3; int b_pos = b * 3; int c_pos = c * 3; int ta = a * 2; int tb = b * 2; int tc = c * 2; glBegin(GL_TRIANGLES); glTexCoord2f(m_textureCoords[ta], m_textureCoords[ta + 1]); glNormal3f(m_normalBuffer[a_pos], m_normalBuffer[a_pos + 1], m_normalBuffer[a_pos + 2]); glVertex3f(m_vertexBuffer[a_pos], m_vertexBuffer[a_pos + 1], m_vertexBuffer[a_pos + 2]); glTexCoord2f(m_textureCoords[tb], m_textureCoords[tb + 1]); glNormal3f(m_normalBuffer[b_pos], m_normalBuffer[b_pos + 1], m_normalBuffer[b_pos + 2]); glVertex3f(m_vertexBuffer[b_pos], m_vertexBuffer[b_pos + 1], m_vertexBuffer[b_pos + 2]); glTexCoord2f(m_textureCoords[tc], m_textureCoords[tc + 1]); glNormal3f(m_normalBuffer[c_pos], m_normalBuffer[c_pos + 1], m_normalBuffer[c_pos + 2]); glVertex3f(m_vertexBuffer[c_pos], m_vertexBuffer[c_pos + 1], m_vertexBuffer[c_pos + 2]); glEnd(); } } glPopMatrix(); }
void SphericEmitter::innerUpdateTransform() { Emitter::innerUpdateTransform(); transformDir(tDirection,direction); computeMatrix(); }
bool MonitorMetrics::setSlotGreen(const Table1* green) { if ( green == nullptr ) return false; greenLuminance = green; return computeMatrix(); }
Camera::Camera(Vector3d projection, Vector3d lookat, Vector3d upVector){ e = projection; d = lookat; up = upVector; computeMatrix(); }
bool MonitorMetrics::setSlotBlue(const Table1* blue) { if ( blue == nullptr ) return false; blueLuminance = blue; return computeMatrix(); }