-
Notifications
You must be signed in to change notification settings - Fork 0
ExampleMesh2D
da772 edited this page May 5, 2020
·
3 revisions
Meshes are flat 3D planes which give them a 2 dimensional look. The meshes can be seen from the front and back, but the sides are too narrow to show anything. This gives the meshes the appearance of a flat 2D plane while still having 3 dimensions. This third dimension, along with the ability to be affected by a camera is what separates meshes from GUI elements. Meshes are components which are attached to actors. When creating a large amount of the same mesh instanced meshes can be used which greatly help with performance.
@Override
public void OnBegin() {
Actor myActor = new Actor("myActor"); // Creates new actor called my actor on this scene, takes in identifier string
MeshQuad myQuad = new MeshQuad(
"testMesh", // Unique Identifier
new Transform(), // Transform
ShaderLib.Shader_2DQuad, // Shader
"Image/blankTexture.png", // Texture
new Vector4f(1f), // Color
cam.GetCamera()); // Camera
myActor.AddComponent(myQuad );
}
@Override
public void OnBegin() {
Actor myActor = new Actor("myActor"); // Creates new actor called my actor on this scene, takes in identifier string
MeshInstancedQuad myInstancedQuad = new MeshInstancedQuad("meshInstanced", // Unique identifier
new Transform(), // Transform
ShaderLib.Shader_2DQuadInstanced, // Shader
"Images/blankTexture.png", // Texture
new Vector4f(1f), // Color
20, // Amount to render
new Vector3f(0,0,0), // Offset of each item rendered
cam.GetCamera());// Camera
myActor.AddComponent(myInstancedQuad);
}