MCPcopy Create free account
hub / github.com/assimp/assimp / RenderPatternBG

Method RenderPatternBG

tools/assimp_view/Display.cpp:2095–2194  ·  view source on GitHub ↗

-------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2093}
2094//-------------------------------------------------------------------------------
2095int CDisplay::RenderPatternBG()
2096{
2097 if (!g_piPatternEffect)
2098 {
2099 // the pattern effect won't work on ps_2_0 cards
2100 if (g_sCaps.PixelShaderVersion >= D3DPS_VERSION(3,0))
2101 {
2102 // seems we have not yet compiled this shader.
2103 // and NOW is the best time to do that ...
2104 ID3DXBuffer* piBuffer = nullptr;
2105 if(FAILED( D3DXCreateEffect(g_piDevice,
2106 g_szCheckerBackgroundShader.c_str(),
2107 (UINT)g_szCheckerBackgroundShader.length(),
2108 nullptr,
2109 nullptr,
2110 D3DXSHADER_USE_LEGACY_D3DX9_31_DLL,
2111 nullptr,
2112 &g_piPatternEffect,&piBuffer)))
2113 {
2114 if( piBuffer)
2115 {
2116 MessageBox(g_hDlg,(LPCSTR)piBuffer->GetBufferPointer(),"HLSL",MB_OK);
2117 piBuffer->Release();
2118 }
2119 return 0;
2120 }
2121 if( piBuffer)
2122 {
2123 piBuffer->Release();
2124 piBuffer = nullptr;
2125 }
2126 }
2127 else
2128 {
2129 // clear the color buffer in magenta
2130 // (hopefully this is ugly enough that every ps_2_0 cards owner
2131 // runs to the next shop to buy himself a new card ...)
2132 g_piDevice->Clear(0,nullptr,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
2133 D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
2134 return 1;
2135 }
2136 }
2137
2138 // clear the depth buffer only
2139 g_piDevice->Clear(0,nullptr,D3DCLEAR_ZBUFFER,
2140 D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
2141
2142 // setup the colors to be used ...
2143 g_piPatternEffect->SetVector("COLOR_ONE",&m_avCheckerColors[0]);
2144 g_piPatternEffect->SetVector("COLOR_TWO",&m_avCheckerColors[1]);
2145
2146 // setup the shader
2147 UINT dw;
2148 g_piPatternEffect->Begin(&dw,0);
2149 g_piPatternEffect->BeginPass(0);
2150
2151 RECT sRect;
2152 GetWindowRect(GetDlgItem(g_hDlg,IDC_RT),&sRect);

Callers

nothing calls this directly

Calls 7

GetBufferPointerMethod · 0.80
GetFVFMethod · 0.80
ReleaseMethod · 0.45
ClearMethod · 0.45
SetVectorMethod · 0.45
BeginMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected