void OnDraw(DEVICEINSTANCE *device) { device->d3dDevice->BeginScene(); device->d3dDevice->SetRenderState(D3DRS_LIGHTING, 0); setCameraMatrix(device->d3dDevice); D3DXMATRIX calcedMatrix, rotateMatrix, scaleMatrix, transMatrix; D3DXMatrixScaling(&scaleMatrix, 3, 3, 3); D3DXMatrixTranslation(&transMatrix, cameraPos.x, -50, cameraPos.z); calcedMatrix = scaleMatrix * transMatrix; device->d3dDevice->SetTransform(D3DTS_WORLD, &calcedMatrix); device->d3dDevice->SetTexture(0, texture); skybox->DrawSubset(0); device->d3dDevice->SetTexture(0, nullptr); D3DXMatrixScaling(&scaleMatrix, 20, 20, 20); D3DXMatrixTranslation(&transMatrix, 0, 30, 0); calcedMatrix = scaleMatrix * transMatrix; device->d3dDevice->SetTransform(D3DTS_WORLD, &calcedMatrix); device->d3dDevice->SetTexture(0, 0); teapot->DrawSubset(0); device->d3dDevice->EndScene(); }
void OnDraw(DEVICEINSTANCE *device) { device->d3dDevice->BeginScene(); device->d3dDevice->SetRenderState(D3DRS_LIGHTING, 0); setCameraMatrix(device->d3dDevice); D3DXMATRIX calcedMatrix, rotateMatrix, scaleMatrix, transMatrix; D3DXMatrixScaling(&scaleMatrix, 10, 10, 10); D3DXMatrixTranslation(&transMatrix, cameraPos.x, -200, cameraPos.z); calcedMatrix = scaleMatrix * transMatrix; device->d3dDevice->SetTransform(D3DTS_WORLD, &calcedMatrix); device->d3dDevice->SetTexture(0, texture); skybox->DrawSubset(0); device->d3dDevice->SetTexture(0, nullptr); device->d3dDevice->SetFVF(TerrainVertex::Terrain_FVF); device->d3dDevice->SetTexture(0, heightMapTexture); D3DXMatrixScaling(&scaleMatrix, 1, 1, 1); D3DXMatrixTranslation(&transMatrix, 0, -200, 0); calcedMatrix = scaleMatrix * transMatrix; device->d3dDevice->SetTransform(D3DTS_WORLD, &calcedMatrix); device->d3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, numOfVertices, numOfIndices / 3, terrainIndices, D3DFMT_INDEX32, terrainVertices, sizeof(TerrainVertex)); device->d3dDevice->EndScene(); }
void margModule::updateSettings() { if(bAddressSet) { setBlobFinder(*blobMinArea, *blobMaxArea, *blobNConsidered, blobFindThreshMin, blobFindThreshMax); setCameraMatrix(correctFX, correctFY, correctCX, correctCY); setDistCoeffs(correctRdX, correctRdY, correctTgX, correctTgY); setInterpolator(*blobPairMaxDist, *blobPairMaxAreaDiff, *blobPairMaxUnfitness); setTrailMaker(*trailExpConst, *trailFadeConst, *trailBlurLevel); setMode(*modMode, *modDrawBlobs, *modDrawWhichBlobs, *modAdjQuad, *modAdjWhichQuad); } }
bool Camera::loadCalibrationData(const char *filename) { FileStorage fs(filename, FileStorage::READ); if (!fs.isOpened()) { OPENCV_ASSERT(false,"Camera.loadCalibrationData","Cannot load calibration data!"); return false; } Mat camMat = Mat::eye(3, 3, CV_64F); Mat dCoeffs = Mat::zeros(8, 1, CV_64F); fs["Camera_Matrix"] >> camMat; fs["Distortion_Coefficients"] >> dCoeffs; setCameraMatrix(camMat); setDistortionCoeffs(dCoeffs); fs.release(); isCalibrated=true; return true; }
HelpScreen::HelpScreen(void) : Level(LEVEL_MENU, UserInterface()) { int windowWidth = GameApp::getInstance()->getWindowWidth(); int windowHeight = GameApp::getInstance()->getWindowHeight(); setProjectionMatrix(Matrix4::Perspective(1.0f, -100.0f, 1280.0f / 720.0f, 45.0f)); setCameraMatrix(Matrix4::Translation(Vector3(0, 0, 0))); Texture *bgTexture = Texture::getOrCreate("InstructionsBg", "resources/images/HeXcape Instructions.png"); ImageItem *background = new ImageItem(Vector2(), 0, Vector2((float) (windowWidth), (float) (windowHeight)), bgTexture); userInterface->addItem(background, "BackgroundHelp"); // Create the menu buttons ButtonItem *backButton = new ButtonItem(Vector2(900, 840), 0, Vector2(800, 120), "MenuButton", "resources/images/MenuButton.png", "resources/images/MenuButtonHov.png", "resources/images/MenuButtonPress.png", "resources/images/MenuButtonPress.png"); // Draw some text over the buttons background TextItem *backText = new TextItem(Vector2(1020, 860), 0, "Back To Menu", 72); backText->setFont("resources/fonts/Neuropol.ttf"); actionAfterFade = 0; // Set the ambience music Music *music = Music::getOrCreate("resources/audio/Doors.mp3", "MenuMusic"); userInterface->addItem(backButton, "ZBackButton"); userInterface->addItem(backText, "ZBackText"); }