void RenderSystem::v_Render() { BeginScene(); UpdateScene(); XMMATRIX Model = XMMatrixIdentity(); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model)); m_Matrix.view = m_Camera.GetViewMatrix(); m_Cube.Render(m_pD3D11DeviceContext.Get(), m_Matrix.model, m_Matrix.view, m_Matrix.proj); XMFLOAT3 camPos = m_Camera.GetPos(); XMFLOAT3 modelPos; modelPos.x = 0.0f; modelPos.y = 1.5f; modelPos.z = 0.0f; // Calculate the rotation that needs to be applied to the billboard model to face the current camera position using the arc tangent function. float angle = atan2(modelPos.x - camPos.x, modelPos.z - camPos.z) * (180.0 / XM_PI); // Convert rotation into radians. float rotation = (float)angle * 0.0174532925f; // Setup the rotation the billboard at the origin using the world matrix. XMMATRIX world = XMMatrixRotationY(rotation); // Setup the translation matrix from the billboard model. XMMATRIX trans = XMMatrixTranslation(modelPos.x, modelPos.y, modelPos.z); world *= trans; XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(world)); m_Square.Render(m_pD3D11DeviceContext.Get(), m_Matrix.model, m_Matrix.view, m_Matrix.proj); DrawInfo(); EndScene(); }
void RsImplWinGL::Render() { BeginScene(); GLint defaultFBO; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO); // Clear the render target so we don't use it in the deferred rendering pass m_pCurrentRenderTarget = BtNull; // Cache the number of render targets BtU32 numRenderTargets = m_renderTargets.GetNumItems(); for( BtU32 i=0; i<numRenderTargets; i++ ) { // Cache each render target RsRenderTargetWinGL &renderTarget = m_renderTargets[i]; // Always restore the default frame buffer at the start before changing it glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO ); // render each render target renderTarget.Render(); } EndScene(); ResetRenderables(); }
void RenderSystem::v_Render() { BeginScene(); static float t = 0.0f; static ULONGLONG timeStart = 0; ULONGLONG timeCur = GetTickCount64(); if (timeStart==0) timeStart = timeCur; t = (timeCur-timeStart)/1000.0f; // Light XMMATRIX mSpin = XMMatrixRotationZ(-t); XMMATRIX mOrbit = XMMatrixRotationY(-t * 2.0f); XMMATRIX mTranslate = XMMatrixTranslation(-3.0f, 0.0f, 0.0f); XMMATRIX mScale = XMMatrixScaling(0.3f, 0.3f, 0.3f); XMMATRIX worldCube = mScale * mSpin * mTranslate * mOrbit; XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(worldCube)); m_Cube.Render(m_pD3D11DeviceContext, m_Matrix, XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f) ); XMFLOAT4 lightPos = XMFLOAT4(m_Matrix.model._14, m_Matrix.model._24, m_Matrix.model._34, 0.0f); //Object XMMATRIX rotMat = XMMatrixRotationY(t/10.0f); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(rotMat)); m_Cube.Render(m_pD3D11DeviceContext, m_Matrix, lightPos); EndScene(); }
void RenderSystem::v_Render() { BeginScene(); m_Matrix.view = m_Camera.GetViewMatrix(); DisableZbuffer(); DisableCulling(); m_Matrix.view._14 = 0.0f; m_Matrix.view._24 = 0.0f; m_Matrix.view._34 = 0.0f; m_Matrix.view._41 = 0.0f; m_Matrix.view._42 = 0.0f; m_Matrix.view._43 = 0.0f; XMMATRIX sphereWorld = XMMatrixIdentity(); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(sphereWorld)); m_Skymap.Render(m_pD3D11DeviceContext, m_Matrix); EnableCulling(); EnableZbuffer(); m_Matrix.view = m_Camera.GetViewMatrix(); XMMATRIX gridModel = XMMatrixIdentity(); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(gridModel)); m_Terrain.Render(m_pD3D11DeviceContext, m_Matrix); DrawInfo(); EndScene(); }
void DrawScene() { BeginScene(1); RenderQuad(p_logo,0,0,0,0,(480-p_logo->w)/2,(272-p_logo->h)/2,1,1,0,MAKE_RGBA_8888(255,255,255,40)); mParticleSys->Render(); EndScene(); }
// Virtual event handlers, overide them in your derived class void project1::OnDrawImage(wxPaintEvent& event) { BeginScene(&m_device, opengl::colorf(0.0f, 0.0f, 0.0f, 0.0f)); EndScene(&m_device); //event.Skip(); }
void GSDevice10::StretchRect(Texture& st, const GSVector4& sr, Texture& dt, const GSVector4& dr, ID3D10PixelShader* ps, ID3D10Buffer* ps_cb, ID3D10BlendState* bs, bool linear) { BeginScene(); // om OMSetDepthStencilState(m_convert.dss, 0); OMSetBlendState(bs, 0); OMSetRenderTargets(dt, NULL); // ia float left = dr.x * 2 / dt.GetWidth() - 1.0f; float top = 1.0f - dr.y * 2 / dt.GetHeight(); float right = dr.z * 2 / dt.GetWidth() - 1.0f; float bottom = 1.0f - dr.w * 2 / dt.GetHeight(); GSVertexPT1 vertices[] = { {GSVector4(left, top, 0.5f, 1.0f), GSVector2(sr.x, sr.y)}, {GSVector4(right, top, 0.5f, 1.0f), GSVector2(sr.z, sr.y)}, {GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)}, {GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)}, }; D3D10_BOX box = {0, 0, 0, sizeof(vertices), 1, 1}; m_dev->UpdateSubresource(m_convert.vb, 0, &box, vertices, 0, 0); IASetVertexBuffer(m_convert.vb, sizeof(vertices[0])); IASetInputLayout(m_convert.il); IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); // vs VSSetShader(m_convert.vs, NULL); // gs GSSetShader(NULL); // ps PSSetShader(ps, ps_cb); PSSetSamplerState(linear ? m_convert.ln : m_convert.pt, NULL); PSSetShaderResources(st, NULL); // rs RSSet(dt.GetWidth(), dt.GetHeight()); // DrawPrimitive(countof(vertices)); // EndScene(); }
void RenderSystem::v_Render() { BeginScene(); m_Triangle.Render(m_pD3D11DeviceContext.Get(), m_Matrix); EndScene(); }
void DeviceManDX12::Present() { if (!swapChain) { return; } EndScene(); swapChain->Present(0, 0); BeginScene(); }
void RenderSystem::v_Render() { BeginScene(); m_Triangle.Render(m_pD3D11DeviceContext, m_Matrix); EndScene(); m_Sound.Play(); }
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear) { BeginScene(); GSVector2i ds = dt->GetSize(); // om OMSetDepthStencilState(m_convert.dss, 0); OMSetBlendState(bs, 0); OMSetRenderTargets(dt, NULL); // ia float left = dr.x * 2 / ds.x - 1.0f; float top = 1.0f - dr.y * 2 / ds.y; float right = dr.z * 2 / ds.x - 1.0f; float bottom = 1.0f - dr.w * 2 / ds.y; GSVertexPT1 vertices[] = { {GSVector4(left, top, 0.5f, 1.0f), GSVector2(sr.x, sr.y)}, {GSVector4(right, top, 0.5f, 1.0f), GSVector2(sr.z, sr.y)}, {GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)}, {GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)}, }; IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices)); IASetInputLayout(m_convert.il); IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); // vs VSSetShader(m_convert.vs, NULL); // gs GSSetShader(NULL); // ps PSSetShaderResources(st, NULL); PSSetSamplerState(linear ? m_convert.ln : m_convert.pt, NULL); PSSetShader(ps, ps_cb); // DrawPrimitive(); // EndScene(); PSSetShaderResources(NULL, NULL); }
// Renders All objects void xSceneManager::RenderAll() { Clear(); BeginScene(); std::for_each(m_SceneNodes.begin(), m_SceneNodes.end(), std::mem_fun(&Impulse::Scene::xSceneNode::Render)); EndScene(); Present(); m_FrameCount++; m_TempFrameCount++; }
void DrawScene() { BeginScene(1); ImageToScreen(p_bg,0,0); DrawImage(p_logo,0,0,0,0,128,0,256,256); DrawImageMask(p_logo,0,0,0,0,0/*dx*/,0/*dy*/,128/*dw*/,128/*dh*/,logomask1); DrawImageMask(p_logo,0,0,0,0,480-128/*dx*/,272-128/*dy*/,128/*dw*/,128/*dh*/,0x7fffffff); DrawImageMask(p_logo,0,0,0,0,0/*dx*/,272-128/*dy*/,128/*dw*/,128/*dh*/,logomask2); DrawImageMask(p_logo,0,0,0,0,480-128/*dx*/,0/*dy*/,128/*dw*/,128/*dh*/,logomask2); EndScene(); }
// Drawing void mini3d::OGL20GraphicsService::Draw() { BeginScene(); mOGLWrapper.GLEnableClientState(GL_VERTEX_ARRAY); mOGLWrapper.GLEnableClientState(GL_INDEX_ARRAY); mOGLWrapper.GLDrawElements(GL_TRIANGLES, pCurrentIndexBuffer->GetIndexCount(), GL_UNSIGNED_INT, 0); mOGLWrapper.GLDisableClientState(GL_VERTEX_ARRAY); mOGLWrapper.GLDisableClientState(GL_INDEX_ARRAY); }
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1 (&iaVertices)[4], bool datm) { const GSVector2i& size = rt->GetSize(); if(GSTexture* t = CreateRenderTarget(size.x, size.y, rt->IsMSAA())) { // sfex3 (after the capcom logo), vf4 (first menu fading in), ffxii shadows, rumble roses shadows, persona4 shadows BeginScene(); ClearStencil(ds, 0); // om OMSetDepthStencilState(m_date.dss, 1); OMSetBlendState(m_date.bs, 0); OMSetRenderTargets(t, ds); // ia IASetVertexBuffer(iaVertices, sizeof(iaVertices[0]), countof(iaVertices)); IASetInputLayout(m_convert.il); IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); // vs VSSetShader(m_convert.vs, NULL); // gs GSSetShader(NULL); // ps GSTexture* rt2 = rt->IsMSAA() ? Resolve(rt) : rt; PSSetShaderResources(rt2, NULL); PSSetSamplerState(m_convert.pt, NULL); PSSetShader(m_convert.ps[datm ? 2 : 3], NULL); // DrawPrimitive(); // EndScene(); Recycle(t); if(rt2 != rt) Recycle(rt2); } }
void RenderSystem::v_Render() { BeginScene(); m_Camera.DetectInput(m_Timer.GetDeltaTime(), GetHwnd()); m_Matrix.View = m_Camera.GetViewMatrix(); m_Matrix.Proj = m_Proj; ////////////////////////////////////////////////////////////////// XMMATRIX objectModel = XMMatrixTranslation(0.0f, -1.0f, 0.0f); XMStoreFloat4x4(&m_Matrix.Model, XMMatrixTranspose(objectModel)); ObjModel.Render(m_pD3D11DeviceContext, m_Matrix.Model, m_Matrix.View, m_Matrix.Proj); m_pD3D11DeviceContext->OMSetBlendState(0, 0, 0xffffffff); if (m_Camera.GetRightMouseClicked()) CheckPick(); for (int i = 0; i != 20; ++i) { if (!bottleHit[i]) { XMFLOAT4X4 tempModel; XMMATRIX model = XMMatrixTranspose(bottleModel[i]); XMStoreFloat4x4(&tempModel, model); BottomModel.Render(m_pD3D11DeviceContext, tempModel, m_View, m_Proj); } } WCHAR scoreInfo[255]; swprintf(scoreInfo, L"Score: %d ", score); m_Font.drawText(m_pD3D11DeviceContext.Get(), scoreInfo, 22.0f, 10.0f, 100.0f, 0xff0099ff); //////////////////////////////////////////////////////// XMMATRIX sphereWorld = XMMatrixIdentity(); m_Matrix.View._14 = 0.0f; m_Matrix.View._24 = 0.0f; m_Matrix.View._34 = 0.0f; m_Matrix.View._41 = 0.0f; m_Matrix.View._42 = 0.0f; m_Matrix.View._43 = 0.0f; XMStoreFloat4x4(&m_Matrix.Model, XMMatrixTranspose(sphereWorld)); m_Skymap.Render(m_pD3D11DeviceContext.Get(), m_Matrix); /////////////////////////////////////////////////////// DrawFps(); EndScene(); }
bool DX11Render::Frame() { bool result = true; //Clear buffer BeginScene(0.5f, 0.5f, 0.5f, 1.0f); //present back buffer EndScene(); return result; }
void RenderSystem::v_Render() { BeginScene(); m_Matrix.view = m_Camera.GetViewMatrix(); m_Grid.Render(m_pD3D11DeviceContext, m_Matrix); DrawInfo(); EndScene(); }
void DrawScene() { BeginScene(1); ImageToScreen(pimage_bg,0,0); RenderQuad(pimage_box,0,0,0,0,70,185,1,1,0,maskbox); RenderQuad(pimage_box,0,0,0,0,70,5,1,1,0,maskbox); DrawImage(pimage_icon[0],0,0,0,0,-20,-37,128,128); DrawImage(pimage_icon[1],0,0,0,0,-20,143,128,128); ImageToScreen(pimage_text,0,0); EndScene(); }
// シーン描画開始 IZ_BOOL CGraphicsDevice::BeginScene( IZ_DWORD nClearFlags, IZ_COLOR nClearColor/*= 0*/, IZ_FLOAT fClearZ/*= 1.0f*/, IZ_DWORD nClearStencil/*= 0*/) { return BeginScene( IZ_NULL, 0, IZ_NULL, nClearFlags, nClearColor, fClearZ, nClearStencil); }
void CGSH_Direct3D9::PresentBackbuffer() { if(!m_device.IsEmpty()) { HRESULT result = S_OK; EndScene(); if(TestDevice()) { result = m_device->Present(NULL, NULL, NULL, NULL); assert(SUCCEEDED(result)); } BeginScene(); } }
void DrawScene() { BeginScene(1); ImageToScreen(pimage_bg,0,0); //RenderQuad(pimage_box,0,0,0,0,70,185,1,1,0,maskbox); //RenderQuad(pimage_box,0,0,0,0,70,5,1,1,0,maskbox); //DrawImage(pimage_icon[0],0,0,0,0,-20,-37,128,128); //DrawImage(pimage_icon[1],0,0,0,0,-20,143,128,128); ImageToScreen(pimage_text,0,0); //DrawEllipse(50,50,11,21,0xff0000ff,DISPLAY_PIXEL_FORMAT_8888); DrawEllipse(50,50,10,20,0xff0000ff,DISPLAY_PIXEL_FORMAT_8888); DrawEllipse(50,50,9,19,0x3f0000ff,DISPLAY_PIXEL_FORMAT_8888); EndScene(); }
void RenderSystem::v_Render() { static float rot = 0.0f; rot += m_Timer.GetDeltaTime(); BeginScene(); m_Matrix.view = m_Camera.GetViewMatrix(); m_Hill.Render(m_pD3D11DeviceContext, m_Matrix, &m_Timer); DrawInfo(); EndScene(); }
// シーン描画開始 IZ_BOOL CGraphicsDevice::BeginScene( CRenderTarget** pRT, IZ_UINT nCount, IZ_DWORD nClearFlags, IZ_COLOR nClearColor/*= 0*/, IZ_FLOAT fClearZ/*= 1.0f*/, IZ_DWORD nClearStencil/*= 0*/) { return BeginScene( pRT, nCount, IZ_NULL, nClearFlags, nClearColor, fClearZ, nClearStencil); }
void CGSH_Direct3D9::CreateDevice() { auto presentParams = CreatePresentParams(); HRESULT result = S_OK; result = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_outputWnd->m_hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &m_device); assert(SUCCEEDED(result)); OnDeviceReset(); m_sceneBegun = false; BeginScene(); }
bool RenderCore::Render() { HighResolutionTimer timer; timer.Start(); BeginScene(0.0f, 0.125f, 0.3f, 1.0f); // Scene::UpdateVertexBuffer allows us to position the Scene if (!g_Scene->UpdateVertexBuffer(0, 0, 1280, 720)) { // || !g_Scene2->UpdateVertexBuffer(100, 100, 640, 360)) { DebugOut("Scene::UpdateVertexBuffer failed!\n"); return false; } // Get Desktop Duplication frame if (g_DesktopDuplication->GetFrame()) { // && g_DesktopDuplication2->GetFrame()) { // Render Desktop Duplication frame onto our Scene g_Scene->Render(g_DesktopDuplication->GetTexture(), m_WorldMatrix, m_OrthoMatrix); //g_Scene2->Render(g_DesktopDuplication2->GetTexture(), m_WorldMatrix, m_OrthoMatrix); g_MFEncoder->WriteFrame(g_DesktopDuplication->GetTexture()); g_DesktopDuplication->FinishFrame(); //g_DesktopDuplication2->FinishFrame(); } // limit frame rate double frameTime = timer.AsMilliseconds(); while (frameTime < (MAX_FRAME_TIME)) { frameTime += 0.001f; } DebugOut("frame time: %f\n", frameTime); EndScene(); /* const vec3f eyePosition(0.f, 0.f, 0.f); const vec3f lookAt(0.f, 0.f, 1.f); const vec3f upDir(0.f, 1.f, 0.f); DirectX::XMMATRIX viewMatrix = DirectX::XMMatrixLookAtLH( DirectX::XMLoadFloat3((const DirectX::XMFLOAT3 *)&eyePosition), DirectX::XMLoadFloat3((const DirectX::XMFLOAT3 *)&lookAt), DirectX::XMLoadFloat3((const DirectX::XMFLOAT3 *)&upDir)); */ //ZBufferState(1); return true; };
void RenderSystem::v_Render() { BeginScene(); UpdateScene(); m_Matrix.view = m_Camera.GetViewMatrix(); XMMATRIX Model = XMMatrixTranslation(-1.5f, 0.0f, 0.0f); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model)); m_LightShader.Render(m_pD3D11DeviceContext.Get(), m_Matrix); m_Cube.Render(m_pD3D11DeviceContext.Get()); Model = XMMatrixTranslation(1.5f, 0.0f, 0.0f); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model)); m_AlphaShader.Render(m_pD3D11DeviceContext.Get(), m_Matrix); m_Cube.Render(m_pD3D11DeviceContext.Get()); EndScene(); }
void RenderSystem::v_Render() { BeginScene(); TurnOnAlphaBlending(); static float t = 0.0f; static ULONGLONG timeStart = 0; ULONGLONG timeCur = GetTickCount64(); if ( timeStart==0 ) timeStart = timeCur; t = ( timeCur-timeStart ) / 1000.0f; XMMATRIX Model = XMMatrixRotationY(t); XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model)); m_Cube.Render(m_pD3D11DeviceContext.Get(), m_Matrix); TurnOffAlphaBlending(); EndScene(); }
bool D3D10Renderer::Render() { D3DXMATRIX viewMatrix; BeginScene(0.1f, 0.1f, 0.1f, 1.0f); m_camera->Render(); m_camera->GetViewMatrix(viewMatrix); std::set<IntrusivePtr<Entity> > entitySet = m_scene->GetEntitySet(); Entity* ent = 0; POSITION modelPosition; DX10Model* model; for(std::set<IntrusivePtr<Entity> > ::const_iterator it = entitySet.begin(); it != entitySet.end(); ++it) { ent = it->GetPtr(); modelPosition = ent->GetPosition(); D3DXMatrixTranslation(&m_worldMatrix, modelPosition.x, modelPosition.y, modelPosition.z); model = m_modelFactory->GetModelByName(ent->GetName()); model->Render(m_device); m_colorShader->Render(m_device, model->GetIndexCount(), m_worldMatrix, viewMatrix, m_projectionMatrix); } EndScene(); return true; }
void RenderSystem::v_Render() { BeginScene(); m_Camera.DetectInput(m_Timer.GetDeltaTime(), GetHwnd()); m_Matrix.View = m_Camera.GetViewMatrix(); m_Matrix.Proj = m_Proj; ////////////////////////////////////////////////////////////////// XMMATRIX objectModel = XMMatrixTranslation(0.0f, -1.0f, 0.0f); XMStoreFloat4x4(&m_Matrix.Model, XMMatrixTranspose(objectModel)); ObjModel.Render(m_pD3D11DeviceContext, m_Matrix.Model, m_Matrix.View, m_Matrix.Proj); XMMATRIX Scale = XMMatrixScaling(0.1f, 0.1f, 0.1f); XMStoreFloat4x4(&m_Model, XMMatrixTranspose(Scale) ); md5Model.Render(m_pD3D11DeviceContext, m_Model, m_Matrix.View, m_Matrix.Proj); //////////////////////////////////////////////////////// XMMATRIX sphereWorld = XMMatrixIdentity(); m_Matrix.View._14 = 0.0f; m_Matrix.View._24 = 0.0f; m_Matrix.View._34 = 0.0f; m_Matrix.View._41 = 0.0f; m_Matrix.View._42 = 0.0f; m_Matrix.View._43 = 0.0f; XMStoreFloat4x4(&m_Matrix.Model, XMMatrixTranspose(sphereWorld)); m_Skymap.Render(m_pD3D11DeviceContext.Get(), m_Matrix); /////////////////////////////////////////////////////// DrawFps(); EndScene(); }