Mesh Entity Question
Blitz3D Forums/Blitz3D Beginners Area/Mesh Entity Question
| ||
Hello B3D Ppl, How are you all? Fine? Good. Is a Mesh Handle an Entity Handle? And Conversly is an Entity Handle a Mesh Handle? PS I Assume that Texture, Brush and Surface Handles arent Entities Either, But In that I might be wrong |
| ||
Dunno. A mesh doesn't potentially have the same catagories of data as an entity at the point of its creation. EDIT: As far as I can see, the handles are not classed as the same. |
| ||
As far as I can see, the handles are not classed as the same. Thats what I thought, but.. bbEntityClass$ ( entity ) This seems to imply that A mesh is an entity. Arguments entity a valid entity handle Description Returns a string containing the class of the specified entity. Possible return values are "Pivot", "Light","Camera", "Mirror", "Listener", "Sprite", "Terrain", "Plane", "Mesh", "MD2" and "BSP". Note that bbEntityClass function will fail if a valid entity handle is not supplied and will not just return an empty string. |
| ||
Meshes appear to have different prefixes to entities in their ID: entity=CreateCube() entity2=CreateCube() mesh=CreateMesh() mesh2=CreateMesh() Print entity Print entity2 Print mesh Print mesh2 WaitKey End EDIT: Actually, this is not consistent: entity=CreateCube() entity2=CreateSphere() entity3=CreateCone() entity4=CreateCube() mesh=CreateMesh() mesh2=CreateMesh() Print entity Print entity2 Print entity3 Print entity4 Print mesh Print mesh2 WaitKey End |
| ||
By that reasoning a camera is a meshentity=CreateCube() entity2=CreateCube() Cam1=CreateCamera() Cam2=CreateCamera() mesh=CreateMesh() mesh2=CreateMesh() Print entity Print entity2 Print Cam Print Cam2 Print mesh Print mesh2 WaitKey End |
| ||
By that reasoning a camera is a mesh Nope, I edited my post - Blitz3D seems to create these a bit nilly, willy. |
| ||
You stinky editor of posts you. ;) So.... Conclution is, We dont know. |
| ||
I love you. |
| ||
When something is created by various create commands a certain portion of memory is reserved for various bits and pieces. The number returned by those create commands is nothing more than a pointer to that particular memory location. It can be a real pointer pointing to exact memory location or it can be an index into an internal pointer table but no matter how we call it it differentiates between different objects we create. And the clever bit in Blitz is that everything is an entity. So when you create a mesh, a cube (which is also a mesh) or a camera (which is not a mesh), you are creating entities so you can easily use a single set of commands and functions to do something with them. It's much easier to use this: MoveEntity camera, 1, 0, 0 MoveEntity cube, 2, 3, 0 MoveEntity mesh1, 3, 3, 3 than this: MoveCamera camera, 1, 0, 0 MoveCube cube, 2, 3, 0 MoveMesh mesh1, 3, 3, 3 Just remember that almost everything is an entity or object if it's easier to think of entities in terms of objects. And to do something with objects i.e. entities you use various entity commands. Simple. Isn't it? Barney |
| ||
Simple. Isn't it? Yep too simple. The reason I wanted to know, is that I am wrapping the SDK commands, so that I do get commands more like the second example Mycamera.Move 1,0,0 MyCude.Move 2,3,0 MyMesh.Move 3,3,3 Now I want the Intellisence popup to know the difference between a cube entity and a camera Entity (for example). So I wanted to know if The Entity commands should popup when I accesed a Mesh, and should the Mesh commands popup when I accessed an Entity. I have decided that a mesh Is entitity, because as I was setting it up for the other "Entities", I found that it was just a cut and paste opperation, do that I could afford to get it wrong. |
| ||
I always thought that a mesh is just the 3D-data of an object (the vertex-data and triangle-data which make up a model, thus the model itself), while an entity is basically the same, but with added data about it's position and rotation in the 3D-world. So when you load a 3D-model into a 3D-world, it transforms itself into an entity, because it automatically gets data assigned to it about it's position and rotation in the 3D-world. I think this can be correct, because when you load a 3D-model, you use LoadMesh (or LoadAnimMesh), which only holds data about the 3D-model, but when imported into the world, you position it with PositionEntity, so your mesh becomes an entity after importing. |
| ||
I think you are right. In DX7, you draw the vertices from a vertex buffer, that is an array of triangles&vertices. First, you select the material, (with the SetMaterial command) and then you draw the triangles to the screen that use this material. So I think that the actual mesh data is stored in the surfaces. This would explain for example why the VertexX/Y/Z commands need a 'surface' parameter. The Entity structure holds all the data, such as the transformation matrix (=entity position/rotation/scale), the surfaces and the child entities. Just before the mesh data is drawn to the screen, the data is transformed by the transformation matrix. I think in Blitz, this matrix is represented by the entity. So I think in Blitz, the 'mesh' is more or less just a concept used for operations that ignore the tform matrix. Because LoadMesh doesn't load Entity position/scale/rotation, the command is named LoadMesh to avoid confusion. It only loads mesh data and returns an entity handle. And however the LoadAnimMesh command does load transformations (as animation frames) the entity itself is still located at 0,0,0 and not rotated or scaled when it is loaded. |
| ||
I believe the difference between a Mesh and an Entity., is that a Mesh is a technical description of how the 3d object is constructed (ie triangles and vertices), while the Entity command controls how it is displayed in the context of your 3d world. If you resize an entity, the original mesh is not affected, just how it appears and relates spacially to other entities in your 3d world. But, if you resize the mesh, then the 3d mesh itself is altered. |