|
TriangleOccludeMap | |
State = TriangleOccludeMap(ThisMap, TheLevel, X1, Y1, X2, Y2, X3, Y3) | |
Parameters: ThisMap = The Index of the map you wish to occlude TheLevel = The level within the map X1 = The X coordinate of Vertex 1 Y1 = The Y coordinate of Vertex 1 X2 = The X coordinate of Vertex 2 Y2 = The Y coordinate of Vertex 2 X3 = The X coordinate of Vertex 3 Y3 = The Y coordinate of Vertex 3 |
|
Returns: State = The status of occlusion function |
|
The TriangleOccludeMap() function checks if a Triangle (3 sided polygon) region is occluding the equivalent area within a map level. The TriangleOccludeMap function will clear this area on the selected map level, this helps reduce the amount of overdraw your game is performing. So the map occlusion commands help us even out the amount of rendering time our game is doing each update. For example, If we imagine a game scene with 2 or more map layers, then normally we'd draw them all over each other, regardless of what is actually visible in screen. So with three layers we're potentially drawing every pixel on the screen three times. With modern hardware, this may not be such of big deal (assuming a medium screen resolution), but what if you want your games to run older systems, or you just want to squeeze every drop of rendering performance you can ? - Well, then it's worth seeing if we can cull out any of the redundant background drawing by removing anything in the background that's being occluded by foreground graphics. We could do this by previously calculating the hard regions of the foreground. These might be stored in a list for example, then before rendering the back layers, we mask those layers with out hard foreground region, using some of the map occlusion commands. This will remove any blocks in those that layers that would have been otherwise been drawn, but not visible to the player. You could do the same thing with sprites too. It's really up to you. The key to occlusion, is that when we remove the hidden background elements, this area has to be covered by something solid in the foreground. It doesn't work if the foreground area is translucent, this breaks the illusion, as the player can see both the foreground and the missing background segment. However, we don't want to get too excited and try to implement too much occlusion, as with all optimizations, there's a fine line between getting meaningful rendering performance gain, and losing that potential gain by adding bunch of clunky calculations in there place. So remember, we're trying to remove some drawing work load from our game, not add more to it. FACTS: * TriangleOccludeMap will alter the level if any block is clearly within the bounds the commands region. If up to the user to restore this. See CopyLevel, CloneLevel |
|
Example Source: Download This Example
|
Related Info: | CircleOccludeMap | EllipseOccludeMap | QuadOccludeMap | RectOccludeMap : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |