PaintEntity vs. PaintMesh???
Blitz3D Forums/Blitz3D Beginners Area/PaintEntity vs. PaintMesh???
| ||
Hi all, What is the difference between them? By replacing "PaintMesh" with "PaintEntity" of official example code of b3d, I could not see any difference. Any ideas? Thanks in advance. ; PaintMesh Example ; ----------------- Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 cube=CreateCube() PositionEntity cube,0,0,5 ; Load texture tex=LoadTexture("media/b3dlogo.jpg") ; Create brush brush=CreateBrush() ; Apply texture to brush BrushTexture brush,tex ; And some other effects BrushColor brush,0,0,255 BrushShininess brush,1 ; Paint mesh with brush PaintMesh cube,brush ;<-- try to replace with "paintentity" While Not KeyDown( 1 ) pitch#=0 yaw#=0 roll#=0 If KeyDown( 208 )=True Then pitch#=-1 If KeyDown( 200 )=True Then pitch#=1 If KeyDown( 203 )=True Then yaw#=-1 If KeyDown( 205 )=True Then yaw#=1 If KeyDown( 45 )=True Then roll#=-1 If KeyDown( 44 )=True Then roll#=1 TurnEntity cube,pitch#,yaw#,roll# RenderWorld Flip Wend End |
| ||
An entity could comprise many meshes, while a mesh cannot be comprised of many entities. |
| ||
@Matty: Thanks. I searched for old posts http://www.blitzbasic.com/Community/posts.php?topic=70255#785862 According to "bbEntityClass$ ( entity ) " Entity include "Pivot", "Light","Camera", "Mirror", "Listener", "Sprite", "Terrain", "Plane", "Mesh", "MD2" and "BSP" It seems logically that I could use PaintEntity on "Terrain", "Plane", "Mesh", "MD2" and "BSP". In that case, when to use "PaintEntity" and when to "PaintMesh"??? If they perform the same functions, why two commands are necessary? |
| ||
You may have an entity which is made up of two (or more) meshes in which case you may not want to paint both meshes with the same brush. You could use brush A for one mesh and brush B for another mesh in the same entity by using paintmesh. If you use paintentity both meshes would be tarred with the same brush. |
| ||
I see. But how could we create an entity that is made up of two (or more) meshes? With createCube or whatever, it only create single cube only. or, do you mean createPivot? Thanks in advance |
| ||
Am 3DS object, for example, can have many meshes inside a single 3DS object. You can use AddMesh function to group many cubes, espheres, etc. |
| ||
Often when creating a model in a 3d modeling program it is comprised of multiple meshes, yet when it is exported usually the root node (entity) is a pivot to which all the other meshes are children of. That is one instance where you would see a difference between paintentity and paintmesh. You may have the legs/arms/head/body all separate meshes but linked to a pivot (which is the parent). Paint mesh will allow you to specify the arms as separate from the legs in the example given. Paint entity would apply the same brush to all the meshes. |
| ||
Got it! Thank you, Matty and AI Meyer. :D |