void renderScene(GLFWwindow *window, ShadowMap *shadowMap) { glUseProgram(ShadeProg); glUniform3f(h_uLightColor, 0.4, 0.4, 0.38); glUniform4f(h_uLightVec, 0.0, 1.0, 1.0, 0.0); // Render depth info from light's perspective shadowMap->BindFBO(); glClear(GL_DEPTH_BUFFER_BIT); curView = SetView(); // CHANGE TO LIGHT'S PERSPECTIVE, NOT EYE curProj = SetOrthoProjectionMatrix(); glUniform3f(h_uCamPos, 0.0, 1.0, 1.0); glfwDraw(window); // Render scene normally and draw shadowMap->UnbindFBO(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); curView = SetView(); curProj = SetProjectionMatrix(); glUniform3f(h_uCamPos, GetEye().x, GetEye().y, GetEye().z); glfwDraw(window); // Disable the shaders glUseProgram(0); glfwSwapBuffers(window); }
HRESULT displayDevice::SetPipeline( const PIPELINE_INPUT_TYPE inType, const PIPELINE_OUTPUT_TYPE outType) { HRESULT hr = S_OK; // Set input buffer UINT stride = sizeof(VERTEX); UINT offset = 0; switch (inType) { case SCENE: SetView(PERSPECTIVE); // select which vertex buffer to display devContext->IASetVertexBuffers(0, 1, &(sceneMeshBuffer.vx), &stride, &offset); devContext->PSSetShader(pxShader, 0, 0); // which index buffer devContext->IASetIndexBuffer(sceneMeshBuffer.ix, DXGI_FORMAT_R32_UINT, 0); break; case SCREEN_QUAD: // no shader SetView(NO_TRANSFORM); devContext->PSSetShader(pxShader2, 0, 0); // select which vertex buffer to display devContext->IASetVertexBuffers(0, 1, &(screenQuadBuffer.vx), &stride, &offset); // which index buffer devContext->IASetIndexBuffer(screenQuadBuffer.ix, DXGI_FORMAT_R32_UINT, 0); break; default: return S_FALSE; break; } // which primtive type we are using devContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); // Set output target switch (outType) { case TO_BACKBUFFER: // where to draw colors and depth/stencil devContext->OMSetRenderTargetsAndUnorderedAccessViews (1, &backBuffer, depthStencilView, 1, 1, &screenTextureUnorderedAccessView, NULL); break; case TO_SCREEN_QUAD: devContext->OMSetRenderTargetsAndUnorderedAccessViews (1, &screenTextureTargetView, depthStencilView, 1, 1, &screenTextureUnorderedAccessView, NULL); break; default: return S_FALSE; break; } return S_OK; }
void FramesView::UpdateFrame(FrameView* curr, FrameView* prev, int* curr_others, int num_curr_others, int* prev_others, int num_prev_others) { Iterator i; First(i); FrameView* background = (FrameView*)GetView(i); if (curr != prev) { if (prev) { if (prev != background) prev->Hide(); prev->Desensitize(); if (prev_others) { for (int np=0; np<num_prev_others; np++) { SetView(prev, i); if (prev_others[np]>0) for (int ii=0; ii<prev_others[np]; ii++) Next(i); else for (int ii=0; ii>prev_others[np]; ii--) Prev(i); if (!Done(i)) { FrameView* frame = (FrameView*)GetView(i); if (frame != background) { frame->Hide(); frame->Sensitize(); } } } } } if (curr) { if (curr != background) curr->Show(); curr->Sensitize(); if (curr_others) { for (int np=0; np<num_curr_others; np++) { SetView(curr, i); if (curr_others[np]>0) for (int ii=0; ii<curr_others[np]; ii++) Next(i); else for (int ii=0; ii>curr_others[np]; ii--) Prev(i); if (!Done(i)) { FrameView* frame = (FrameView*)GetView(i); if (frame != background) { frame->Show(); frame->Desensitize(); } } } } } } }
/* OGLCanvas::onPaint * Called when the gfx canvas has to be redrawn *******************************************************************/ void OGLCanvas::onPaint(wxPaintEvent& e) { wxPaintDC(this); if (IsShown()) { // Set context to this window #ifdef USE_SFML_RENDERWINDOW #if SFML_VERSION_MAJOR < 2 sf::RenderWindow::SetActive(); Drawing::setRenderTarget(this); SetView(sf::View(sf::FloatRect(0.0f, 0.0f, GetSize().x, GetSize().y))); #else sf::RenderWindow::setActive(); Drawing::setRenderTarget(this); setView(sf::View(sf::FloatRect(0.0f, 0.0f, GetSize().x, GetSize().y))); #endif//SFML_VERSION_MAJOR #else setContext(); #endif//USE_SFML_RENDERWINDOW // Init if needed if (!init_done) init(); // Draw content draw(); } }
Camera::Camera( glm::vec3& position, glm::vec3& target, glm::vec3& up, GLfloat near, GLfloat far, GLfloat fieldOfView, unsigned int windowWidth, unsigned int windowHeight, const char* cameraName) : m_vCameraPosition(position), m_vCameraTarget(target), m_vCameraUp(up), m_fNearClippingPlane(near), m_fFarClippingPlane(far), m_fFOV(fieldOfView) { m_fHorizontalAngle = 0.0f; m_fVerticalAngle = 0.0f; CameraName = new char[strlen(cameraName) + 1]; strcpy_s(CameraName, strlen(cameraName) + 1, cameraName); // Debug std::cout<<CameraName<<std::endl; SetView(); SetProjection(m_fFOV, WINDOW_WIDTH, WINDOW_HEIGHT, m_fNearClippingPlane, m_fFarClippingPlane); // Set mouse position to the center of the screen glfwSetCursorPos(Core::Window, (double)WINDOW_WIDTH / 2, (double)WINDOW_HEIGHT / 2); }
//-- SetDefaults -------------------------------------------------------------- // //----------------------------------------------------------------------------- void Renderer::SetDefaults() { for (;g_matrixStackLevel > 0; g_matrixStackLevel--) { g_matrixStack->Pop(); } g_matrixStack->LoadIdentity(); // Renderstates m_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE); // d3dSetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); m_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL); m_pD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); m_pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER); m_pD3DDevice->SetRenderState(D3DRS_ALPHAREF, 0); m_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); m_pD3DDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); for (int i = 0; i < 4; i++) { m_pD3DDevice->SetSamplerState( i, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP); m_pD3DDevice->SetSamplerState( i, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP); m_pD3DDevice->SetSamplerState( i, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); m_pD3DDevice->SetSamplerState( i, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); m_pD3DDevice->SetTexture(i, NULL); } CurrentTextureStageMode = TSM_TEXTURE; g_envMapSet = false; g_textureSet = false; // Globals g_colour = 0xffffffff; g_fColour = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f); g_aspect = g_defaultAspect; g_aspectValue = 1.0f; SetDrawMode3d(); D3DXMATRIX matView; D3DXMatrixIdentity( &matView ); SetView( matView ); SetBlendMode( BLEND_OFF ); // m_pD3DDevice->SetVertexDeclaration( g_pVertexDeclaration ); } // SetDefaults
CPixelVisibilityQuery::CPixelVisibilityQuery() { CMatRenderContextPtr pRenderContext( materials ); SetView( 0xFFFF ); m_queryHandle = pRenderContext->CreateOcclusionQueryObject(); m_queryHandleCount = pRenderContext->CreateOcclusionQueryObject(); }
////////////////////////////////////////////// // Definitions for the CContainOutput class CContainOutput::CContainOutput() { SetView(m_ViewOutput); SetDockCaption (_T("Output View - Docking container")); SetTabText(_T("Output")); SetTabIcon(IDI_TEXT); }
CMDIChildText::CMDIChildText() { HINSTANCE hResource = GetApp()->GetResourceHandle(); HMENU hChildMenu = LoadMenu(hResource, _T("MdiMenuText")); SetHandles(hChildMenu, NULL); SetView(m_TextView); }
ScrollBarTest::ScrollBarTest() : Test("ScrollBar", NULL), fScrollBar(new BScrollBar("scroll bar", NULL, 0, 100, B_HORIZONTAL)), fOrientationRadioGroup(NULL) { SetView(fScrollBar); }
void Pi::RequestTimeAccel(int s) { if (currentView == gameMenuView) { SetView(worldView); } requestedTimeAccelIdx = s; }
void CDeviceUI::Remove(CDeviceView *pView) { if (pView == NULL) return; int i = GetViewIndex(pView); if (i < 0 || i >= GetNumViews()) { assert(0); return; } if (pView == m_pCurView) m_pCurView = NULL; if (m_arpView[i] != NULL) { m_arpView[i]->RemoveAll(); delete m_arpView[i]; } m_arpView[i] = NULL; m_arpView.RemoveAt(i); if (m_arpView.GetSize() < 1) RequireAtLeastOneView(); else if (m_pCurView == NULL) { SetView(0); NumViewsChanged(); } }
void TwoFieldDatePickerDialog::Init( /* [in] */ IContext* context, /* [in] */ Int32 theme, /* [in] */ OnValueSetListener* callBack, /* [in] */ Int32 year, /* [in] */ Int32 positionInYear, /* [in] */ Double minValue, /* [in] */ Double maxValue) { AlertDialog::constructor(context, theme); mCallBack = callBack; AutoPtr<ICharSequence> setText; context->GetText( R::string::date_picker_dialog_set, (ICharSequence**)&setText); SetButton(BUTTON_POSITIVE, setText, this); AutoPtr<ICharSequence> cancelText; context->GetText(Elastos::Droid::R::string::cancel, (ICharSequence**)&cancelText); SetButton(BUTTON_NEGATIVE, cancelText, (IDialogInterfaceOnClickListener*) NULL); SetIcon(0); mPicker = CreatePicker(context, minValue, maxValue); SetView(IView::Probe(mPicker)); mPicker->Init(year, positionInYear, this); }
/// 월드좌표계의 *pv값의 위치로 카메라를 이동한다. D3DXMATRIXA16* ZCamera::MoveTo( D3DXVECTOR3* pv ) { D3DXVECTOR3 dv = *pv - m_vEye; m_vEye = *pv; m_vLookat += dv; return SetView( &m_vEye, &m_vLookat, &m_vUp ); }
void QSFcanvas::OnUpdate() { gamePadEvent(); if(leftPressed) emit turnLeft(); if(rightPressed) emit turnRight(); Clear(); SetView(view); carte.afficher(*this,"inf"); DM.display(AM,*this); }
void Camera::ResetView(bool update_far_sight_field /*= true*/) { if (IsInitialized() && GetOwner()->GetObjectGuid() == m_sourceGuid) return; SetView(&m_owner, update_far_sight_field); }
/* Main display function */ void Draw (void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Start our shader glUseProgram(ShadeProg); SetModelI(); /* Set up the projection and view matrices */ SetProjectionMatrix(); SetView(); /* Set up the light's direction and color */ glUniform3f(h_uLightColor, sunShade.x, sunShade.y, sunShade.z); glUniform3f(h_uSun, sunDir.x, sunDir.y, sunDir.z); // set the normal flag glUniform1i(h_uShadeType, g_shadeType); // ======================== draw square stuff ========================= drawModel(&bunnyModel); // ================== end of bird stuff ==================== //clean up safe_glDisableVertexAttribArray(h_aPosition); safe_glDisableVertexAttribArray(h_aNormal); //disable the shader glUseProgram(0); }
CMainFrame::CMainFrame() { SetView(m_MainView); // Set the registry key name, and load the initial window position // Use a registry key name like "CompanyName\\Application" LoadRegistrySettings(_T("Win32++\\Splitter Sample")); }
////////////////////////////////////////////// // Definitions for the CDockOutput class CDockOutput::CDockOutput() { // Set the view window to our edit control SetView(m_View); // Set the width of the splitter bar SetBarWidth(8); }
Camera::Camera(const Vector3f &position, const Vector3f &target, const Vector3f &up, float fov, float aspect_ratio, float near, float far) : view_(Matrix4f::Identity()), perspective_projection_(Matrix4f::Identity()) { SetView(position, target, up); SetPerspective(fov, aspect_ratio, near, far); }
void MapEditorCanvas::OnUpdate() { if (_canvasEnabled != true) return; SetView(*_view); eventHandler(); updateScreenPos(); }
void Camera::MoveLocalZ(float dist){ Vector3 newEye = m_Eye; Vector3 newDst = m_Lookat; Vector3 direction = Normalized(m_View); direction *= dist; newEye += direction; newDst += direction; SetView(newEye, newDst, m_Up); }
// 생성자 ZCamera::ZCamera() { D3DXVECTOR3 eye(0.0f,0.0f,0.0f); D3DXVECTOR3 lookat(0.0f,0.0f,-1.0f); D3DXVECTOR3 up(0.0f,1.0f,0.0f); D3DXMatrixIdentity( &m_matView ); D3DXMatrixIdentity( &m_matBill ); SetView( &eye, &lookat, &up ); }
SceneView3D ::SceneView3D(Context* context, SceneEditor3D *sceneEditor) : UIView3D(context), yaw_(0.0f), pitch_(0.0f), mouseLeftDown_(false), mouseMoved_(false), enabled_(true) { sceneEditor_ = sceneEditor; ResourceCache* cache = GetSubsystem<ResourceCache>(); scene_ = sceneEditor->GetScene(); debugRenderer_ = scene_->GetComponent<DebugRenderer>(); if (debugRenderer_.Null()) { debugRenderer_ = scene_->CreateComponent<DebugRenderer>(); } octree_ = scene_->GetComponent<Octree>(); if (octree_.Null()) { LOGWARNING("Scene without an octree loaded"); octree_ = scene_->CreateComponent<Octree>(); } cameraNode_ = scene_->CreateChild("Camera"); cameraNode_->SetTemporary(true); camera_ = cameraNode_->CreateComponent<Camera>(); debugRenderer_ = scene_->GetComponent<DebugRenderer>(); assert(debugRenderer_.NotNull()); octree_ = scene_->GetComponent<Octree>(); assert(octree_.NotNull()); cameraNode_->SetPosition(Vector3(0, 0, -10)); SetView(scene_, camera_); SetAutoUpdate(false); SubscribeToEvent(E_UPDATE, HANDLER(SceneView3D, HandleUpdate)); SubscribeToEvent(E_EDITORACTIVENODECHANGE, HANDLER(SceneView3D, HandleEditorActiveNodeChange)); SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(SceneView3D, HandlePostRenderUpdate)); // TODO: generate this event properly VariantMap eventData; eventData[EditorActiveSceneChange::P_SCENE] = scene_; SendEvent(E_EDITORACTIVESCENECHANGE, eventData); delegate_->SetIsFocusable(true); }
CMainFrame::CMainFrame() : m_pLeftPane(0), m_ShowHidden(FALSE) { // Set m_MainView as the view window of the frame SetView(m_RightPane); // Set the registry key name, and load the initial window position // Use a registry key name like "CompanyName\\Application" LoadRegistrySettings(_T("Win32++\\Explorer Sample")); }
// Definitions for the CMainFrame class CMainFrame::CMainFrame() : m_pLastActiveDocker(0) { // Constructor for CMainFrame. Its called after CFrame's constructor //Set m_DockTabbedMDI as the view window of the frame SetView(m_DockTabbedMDI); // Set the registry key name, and load the initial window position // Use a registry key name like "CompanyName\\Application" LoadRegistrySettings(_T("Win32++\\TabbedMDI Docking")); }
void Camera::SetLookDirection(DirectX::XMFLOAT3 direction) { DirectX::XMFLOAT3 lookAt; lookAt.x = eyeDirection.x + direction.x; lookAt.y = eyeDirection.y + direction.y; lookAt.z = eyeDirection.z + direction.z; SetView(eyeDirection, lookAt, upDirection); }
//////////////////////////////////////////////////////////// /// Called after the window has been created //////////////////////////////////////////////////////////// void RenderWindow::OnCreate() { // Set the default rendering states SetRenderStates(); // Setup the default view myDefaultView.SetFromRect(FloatRect(0, 0, static_cast<float>(GetWidth()), static_cast<float>(GetHeight()))); SetView(myDefaultView); }
// Definitions for the CMainFrame class CMainFrame::CMainFrame() { // Constructor for CMainFrame. Its called after CFrame's constructor //Set m_View as the view window of the frame SetView(m_View); // Set the registry key name, and load the initial window position // Use a registry key name like "CompanyName\\Application" LoadRegistrySettings(_T("Win32++\\Frame")); }
void Pi::StartGame() { Pi::player->onDock.connect(sigc::ptr_fun(&OnPlayerDockOrUndock)); Pi::player->onUndock.connect(sigc::ptr_fun(&OnPlayerDockOrUndock)); Pi::player->m_equipment.onChange.connect(sigc::ptr_fun(&OnPlayerChangeEquipment)); cpan->ShowAll(); OnPlayerChangeEquipment(); SetView(worldView); Pi::isGameStarted = true; }