void FullbrightMaterialComponent::onRender() { if(!hasModelData()) { return; } const CameraComponent &cam = getOwner().getCameraManager().getCurrentCamera(); //const TransformComponent *camTransform = cam.getOwner()->getComponent<TransformComponent>(); TransformComponent *transform = getOwner().getComponent<TransformComponent>(); assert(transform); CaffMath::Matrix44 worldMat = transform->getWorldMatrix(); glm::mat4 wMat; memcpy(&wMat[0][0], &worldMat._11, sizeof(float) * 16); // const glm::mat4 pMat = cam.getProjMatrix(); // // CaffMath::Matrix44 viewMat = camTransform->getWorldMatrix(); // glm::mat4 vMat; // const glm::mat4 vMat2 = cam.getViewMatrix(); // // memcpy(&vMat[0][0], &viewMat._11, sizeof(float) * 16); // // //vMat = vMat._inverse(); // vMat = vMat2; const glm::mat4 wvpMat = cam.getViewProjMatrix() * wMat; CaffApp::Renderer &renderer = getOwner().getRenderer(); renderer.reset(); renderer.setShader(fullBrightShaderID); renderer.setVertexFormat(fullBrightVertexID); renderer.setTexture("diffuseTex", m_diffuseMapID); renderer.setShader2f("texScale", &m_diffuseScale.x); renderer.setShaderMatrix44f("wvpMat", &wvpMat[0][0]); renderer.setShader4f("color", &m_rgba.x); for(std::size_t i = 0; i < getModelData()->model->getNumberOfMeshes(); ++i) { renderer.setVertexBuffer(getModelData()->vertBufferIDs.at(i)); if(getModelData()->indexBufferIDs.size() < i) { renderer.setIndexBuffer(getModelData()->indexBufferIDs.at(i)); } renderer.apply(); renderer.drawArray(CaffApp::Primitive::TRIANGLES, 0, getModelData()->model->getMesh(i).getGLFaces()); } }
void BlinnPhongMaterialComponent::onRender() { if(!hasModelData()) { return; } const CameraComponent &cam = getOwner().getCameraManager().getCurrentCamera(); TransformComponent *transform = getOwner().getComponent<TransformComponent>(); assert(transform); CaffMath::Matrix44 worldMat = transform->getWorldMatrix(); glm::mat4 wMat; memcpy(&wMat[0][0], &worldMat._11, sizeof(float) * 16); const glm::mat4 wvpMat = cam.getViewProjMatrix() * wMat; const TransformComponent *camTransform = cam.getOwner().getComponent<TransformComponent>(); assert(camTransform); const glm::vec3 camPos = cam.getPosition(); CaffApp::Renderer &renderer = getOwner().getRenderer(); renderer.reset(); renderer.setShader(blinnShaderId); renderer.setVertexFormat(blinnVertexId); renderer.setTexture("diffuseTex", m_diffuseMapID); renderer.setShader2f("texScale", &m_diffuseScale.x); renderer.setShaderMatrix44f("wMat", &wMat[0][0]); renderer.setShaderMatrix44f("wvpMat", &wvpMat[0][0]); renderer.setShader3f("camPos", &camPos[0]); renderer.setShader4f("color", &m_rgba.x); LightUtils::UploadShaderInfo(renderer); for(std::size_t i = 0; i < getModelData()->model->getNumberOfMeshes(); ++i) { renderer.setVertexBuffer(getModelData()->vertBufferIDs.at(i)); if(getModelData()->indexBufferIDs.size() < i) { renderer.setIndexBuffer(getModelData()->indexBufferIDs.at(i)); } renderer.apply(); renderer.drawArray(CaffApp::Primitive::TRIANGLES, 0, getModelData()->model->getMesh(i).getGLFaces()); } }
void OptionsWindow::itemClicked( QModelIndex index ) { TreeItem* item = static_cast<TreeItem*>( index.internalPointer() ); //zisti sa ci existuju data v kliknutej polozke if ( item->data( 1 ).isValid() ) { QString data = item->data( 1 ).toString(); // pri prekliknuti je treba ulozit zmeny, ktore boli uskutocnene v predchadzajucej polozke if ( selectedItem ) { if ( selectedItem != item ) { selectedItem->replaceDataColumn( getModelData() ); selectedItem = item; } } else { selectedItem = item; } //vytvorenie modelu pre tabulku createTableModel( data ); //po prvom kliknuti sa spristupni aplikovanie zmien applyButton->setEnabled( true ); } }
void OptionsWindow::commitChanges() { Util::ApplicationConfig* appConf = Util::ApplicationConfig::get(); QString str; // ulozenie dat aktivnej polozky do struktury selectedItem->replaceDataColumn( getModelData() ); //spustenie prehladavania stromu treeSearch( treeModel->getRootItem(),str ); //ak je otvoreny graf tak sa ulozia aj zmeny urobene v typoch grafu if ( Manager::GraphManager::getInstance()->getActiveGraph() != NULL ) { saveNodeTypes( treeModel->getRootItem() ); } //ulozenie celych nastaveni appConf->saveConfig(); //reloadovanie nastaveni v ostatnych castiach aplikacie Layout::LayoutThread* thr = AppCore::Core::getInstance()->getLayoutThread(); bool running = thr->isRunning(); if ( running ) { thr->pauseAllAlg(); } viewer->reloadConfig(); cg->reloadConfig(); if ( running ) { thr->play(); } }
void ClassDiagram::addClass(OovStringRef const className, ClassGraph::eAddNodeTypes addType, int depth, bool reposition) { mClassGraph.addNode(getModelData(), className, addType, depth, reposition); }
void ClassDiagram::updateGraph(bool reposition) { mClassGraph.updateGraph(getModelData(), reposition); }