Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
plane.h
1#ifndef OE_SCENE_PRIMITIVE_PLANE_H
2#define OE_SCENE_PRIMITIVE_PLANE_H
3
4#include "../mesh.h"
5
7{
13 class Plane : public Mesh
14 {
15 public:
20 {
21 /*
22 Vertices are layed like this :
23 (view from above)
24
25 ^
26 X
27 0 1
28 2 3
29 O Z >
30
31 We will draw the plane as 2 triangles 021 and 123
32 */
33
34 _vertices =
35 {
36 {.position = glm::vec3( 0.5f, 0.f, -0.5f), .tex_coords = glm::vec2(0.f, 0.f), .normal = glm::vec3( 0.f, 1.f, 0.f)},
37 {.position = glm::vec3( 0.5f, 0.f, 0.5f), .tex_coords = glm::vec2(1.f, 0.f), .normal = glm::vec3( 0.f, 1.f, 0.f)},
38 {.position = glm::vec3(-0.5f, 0.f, -0.5f), .tex_coords = glm::vec2(0.f, 1.f), .normal = glm::vec3( 0.f, 1.f, 0.f)},
39 {.position = glm::vec3(-0.5f, 0.f, 0.5f), .tex_coords = glm::vec2(1.f, 1.f), .normal = glm::vec3( 0.f, 1.f, 0.f)},
40 };
41
42 _indices = {{
43 0, 2, 1, // Up-left triangle
44 1, 2, 3 // lower-right triangle
45 }};
46
47 // Use a flat bounding box
48 _aabb = {glm::vec3(-0.5f, 0.f, -0.5f), glm::vec3(0.5f, 0.f, 0.5f)};
49
51 }
52 };
53}
54
55#endif
void generateTangents()
Generate tangents from texture coordinates.
Definition mesh.h:220
Definition mesh.h:333
A plane mesh from (-0.5f, -0.5f) to (0.5f, 0.5f) facing Y upward so you can use it as a simple floor.
Definition plane.h:14
Plane()
Definition plane.h:19
Standard mesh primitives (Cube, Plane, Teapot, etc...)
Definition cube.h:8