| 228 | } |
| 229 | |
| 230 | void PlayScene::OnStartGraphics() { |
| 231 | // build shaders |
| 232 | mOurShader = new OurShader(); |
| 233 | mOurShader->Compile(); |
| 234 | mTrivialShader = new TrivialShader(); |
| 235 | mTrivialShader->Compile(); |
| 236 | |
| 237 | // build projection matrix |
| 238 | UpdateProjectionMatrix(); |
| 239 | |
| 240 | // build tunnel geometry |
| 241 | mTunnelGeom = new SimpleGeom( |
| 242 | new VertexBuf(TUNNEL_GEOM, sizeof(TUNNEL_GEOM), TUNNEL_GEOM_STRIDE), |
| 243 | new IndexBuf(TUNNEL_GEOM_INDICES, sizeof(TUNNEL_GEOM_INDICES))); |
| 244 | mTunnelGeom->vbuf->SetColorsOffset(TUNNEL_GEOM_COLOR_OFFSET); |
| 245 | mTunnelGeom->vbuf->SetTexCoordsOffset(TUNNEL_GEOM_TEXCOORD_OFFSET); |
| 246 | |
| 247 | // build cube geometry (to draw obstacles) |
| 248 | mCubeGeom = new SimpleGeom( |
| 249 | new VertexBuf(CUBE_GEOM, sizeof(CUBE_GEOM), CUBE_GEOM_STRIDE)); |
| 250 | mCubeGeom->vbuf->SetColorsOffset(CUBE_GEOM_COLOR_OFFSET); |
| 251 | mCubeGeom->vbuf->SetTexCoordsOffset(CUBE_GEOM_TEXCOORD_OFFSET); |
| 252 | |
| 253 | // make the wall texture |
| 254 | mWallTexture = new Texture(); |
| 255 | mWallTexture->InitFromRawRGB(WALL_TEXTURE_SIZE, WALL_TEXTURE_SIZE, false, |
| 256 | _gen_wall_texture()); |
| 257 | |
| 258 | // reset frame clock so the animation doesn't jump |
| 259 | mFrameClock.Reset(); |
| 260 | |
| 261 | // life icon geometry |
| 262 | mLifeGeom = AsciiArtToGeom(ART_LIFE, LIFE_ICON_SCALE); |
| 263 | |
| 264 | // create text renderer and shape renderer |
| 265 | mTextRenderer = new TextRenderer(mTrivialShader); |
| 266 | mShapeRenderer = new ShapeRenderer(mTrivialShader); |
| 267 | } |
| 268 | |
| 269 | void PlayScene::OnKillGraphics() { |
| 270 | CleanUp(&mTextRenderer); |
nothing calls this directly
no test coverage detected