Beispiel #1
0
MMSWindowClass::MMSWindowClass() {
    initAlignment();
    initDx();
    initDy();
    initWidth();
    initHeight();
    initBgColor();
    initBgImagePath();
    initBgImageName();
    initOpacity();
    initFadeIn();
    initFadeOut();
    initDebug();
    initMargin();
    initUpArrow();
    initDownArrow();
    initLeftArrow();
    initRightArrow();
    initNavigateUp();
    initNavigateDown();
    initNavigateLeft();
    initNavigateRight();
    initOwnSurface();
    initMoveIn();
    initMoveOut();
    initModal();
    initStaticZOrder();
    initAlwaysOnTop();
    initFocusable();
    initBackBuffer();
    initInitialLoad();
}
Beispiel #2
0
GraphicsDevice::GraphicsDevice( HWND p_hWnd, int p_width, int p_height, bool p_windowMode )
{
	m_width=p_width;
	m_height=p_height;
	m_windowMode = p_windowMode;
	m_wireframeMode=false;
	m_interopCanvasHandle=new Texture*;

	// 1. init hardware
	initSwapChain(p_hWnd);
	initHardware();

	// 2.  init factories
	m_viewFactory = new ViewFactory(m_device);
	m_shaderFactory = new ShaderFactory(m_device,m_deviceContext,m_featureLevel);
	m_bufferFactory = new BufferFactory(m_device,m_deviceContext);
	m_textureFactory = new TextureFactory(m_device);

	// 3. init views
	initBackBuffer();
	initGBufferAndDepthStencil();

	// 4. init shaders
	string exePathPrefix = GetExecutablePathDirectory();
	m_composeShader = m_shaderFactory->createComposeShader(exePathPrefix+"../Shaders/ComposeShader.hlsl");
	m_wireframeShader = m_shaderFactory->createMeshShader(exePathPrefix+"../Shaders/WireframeShader.hlsl");
	m_meshBaseShader = m_shaderFactory->createMeshShader(exePathPrefix + "../Shaders/MeshShader.hlsl");

	// 5. build states
	buildBlendStates();
	m_currentBlendStateType = BlendState::DEFAULT;
	m_blendMask = 0xffffffff;
	for (int i=0;i<4;i++) m_blendFactors[i]=1;

	buildRasterizerStates();
	m_currentRasterizerStateType = RasterizerState::DEFAULT;

	// 6. Create draw-quad and other built in primitives
	m_fullscreenQuad = m_bufferFactory->createFullScreenQuadBuffer();
	m_aabbLineMesh = m_bufferFactory->createLineBox(0.5f);
	m_fallbackBox = m_bufferFactory->createBoxMesh(0.5f);
	m_meshFallbackBoxList.push_back(m_fallbackBox);

	fitViewport();
}
Beispiel #3
0
LRESULT DGraphics::onSize(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (m_pSwapChain == nullptr || wParam == SIZE_MINIMIZED) {
		debug::writeLine(L"!!!");
		return 0;
	}
	debug::writef(L"WM_SIZE %d %d", LOWORD(lParam), HIWORD(lParam));

	HRESULT hr;
	m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
	m_pRenderTargetView.reset();
	hr = m_pSwapChain->ResizeBuffers(1, 0, 0, BufferFormat, SwapChainFlag);
	checkDXResult<D3DError>(hr, "IDXGISwapChain::ResizeBuffers() failed");

	initBackBuffer();

	return DefWindowProc(hWnd, msg, wParam, lParam);
}
Beispiel #4
0
void GraphicsDevice::updateResolution( int p_width, int p_height )
{
	m_width = p_width;
	m_height = p_height;

	setRenderTarget(RenderTargetSpec::RT_NONE);
	releaseBackBuffer();
	releaseGBufferAndDepthStencil();

	HRESULT hr;
	// Resize the swap chain
								   // !HACK! !IMPORTANT!
	m_deviceContext->ClearState(); // MUST DO PROPER HANDLING OF BUFFER DEALLOCATION AND THEN REALLOCATION HERE!! *****TEDIOUS!!!*****
								   // NOW WE GET THE D3D LIVE LEAKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
								   // http://msdn.microsoft.com/en-us/library/windows/desktop/bb174577(v=vs.85).aspx
	hr = m_swapChain->ResizeBuffers(0, p_width, p_height, DXGI_FORMAT_R8G8B8A8_UNORM, 0);
	if(FAILED(hr))
		throw GraphicsException(hr,__FILE__,__FUNCTION__,__LINE__);

	initBackBuffer();
	fitViewport();

	initGBufferAndDepthStencil();
}