| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>FlipMesh mesh</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- mesh - mesh handle
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Flips all the triangles in a mesh.
<br />
-
<br />
- This is useful for a couple of reasons. Firstly though, it is important to understand a little bit of the theory behind 3D graphics. A 3D triangle is represented by three points; only when these points are presented to the viewer in a clockwise-fashion is the triangle visible. So really, triangles only have one side.
<br />
-
<br />
- Normally, for example in the case of a sphere, a model's triangles face the inside of the model, so it doesn't matter that you can't see them. However, what about if you wanted to use the sphere as a huge sky for your world, i.e. so you only needed to see the inside? In this case you would just use FlipMesh.
<br />
-
<br />
- Another use for FlipMesh is to make objects two-sided, so you can see them from the inside and outside if you can't already. In this case, you can copy the original mesh using CopyEntity, specifying the original mesh as the parent, and flip it using FlipMesh. You will now have two meshes occupying the same space - this will make it double-sided, but beware, it will also double the polygon count!
<br />
-
<br />
- The above technique is worth trying when an external modelling program has exported a model in such a way that some of the triangles appear to be missing.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/FlipMesh.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; FlipMesh Example
<br />
- ; ----------------
<br />
-
<br />
- Graphics3D 640,480
<br />
- SetBuffer BackBuffer()
<br />
-
<br />
- camera=CreateCamera()
<br />
- light=CreateLight()
<br />
-
<br />
- ; Create sphere
<br />
- sphere=CreateSphere()
<br />
-
<br />
- ; Scale sphere
<br />
- ScaleEntity sphere,100,100,100
<br />
-
<br />
- ; Texture sphere with sky texture
<br />
- sky_tex=LoadTexture("media/sky.bmp")
<br />
- EntityTexture sphere,sky_tex
<br />
-
<br />
- ; Flip mesh so we can see the inside of it
<br />
- FlipMesh sphere
<br />
-
<br />
- Color 0,0,0
<br />
-
<br />
- While Not KeyDown( 1 )
<br />
- RenderWorld
<br />
- Text 0,0,"You are viewing a flipped sphere mesh - makes a great sky!"
<br />
- Flip
<br />
- Wend
<br />
-
<br />
- End
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=FlipMesh&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|