MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / Light

Method Light

src/Scene/Light.cpp:10–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10Light::Light(glm::vec3 light_position, glm::vec4 light_colour, int light_type, int unknown_1, int unknown_2, int unknown_3, float unknown_4): super("Light", std::vector<glm::vec3>(), std::vector<glm::vec2>(), std::vector<glm::vec3>(), std::vector<unsigned int>(), false, light_position) {
11 std::vector<glm::vec3> verts;
12 float lightSize = 3.0f;
13 verts.emplace_back(glm::vec3(-lightSize, -lightSize, 0)); // bottom left corner
14 verts.emplace_back(glm::vec3(-lightSize, lightSize, 0)); // top left corner
15 verts.emplace_back(glm::vec3( lightSize, lightSize, 0)); // top right corner
16 verts.emplace_back(glm::vec3( lightSize, -lightSize, 0)); // bottom right corner
17 unsigned int indices[] = {0,1,2, // first triangle (bottom left - top left - top right)
18 0,2,3}; // second triangle (bottom left - top right - bottom right)
19 m_uvs.clear();
20 m_uvs.emplace_back(glm::vec2(1.0f, 1.0f));
21 m_uvs.emplace_back(glm::vec2(0.0f, 1.0f));
22 m_uvs.emplace_back(glm::vec2(0.0f, 0.0f));
23 m_uvs.emplace_back(glm::vec2(1.0f, 1.0f));
24 m_uvs.emplace_back(glm::vec2(0.0f, 0.0f));
25 m_uvs.emplace_back(glm::vec2(1.0f, 0.0f));
26
27 m_vertex_indices = std::vector<unsigned int>(indices, indices + sizeof(indices)/sizeof(indices[0]));;
28 m_vertices.clear();
29 // Unindex data and Fill unused normal buffer
30 for (unsigned int m_vertex_index : m_vertex_indices) {
31 m_vertices.push_back(verts[m_vertex_index]);
32 m_normals.emplace_back(glm::vec3(0, 0, 0));
33 }
34
35 position= light_position;
36 type = light_type;
37 colour = glm::vec4(light_colour.y/255.0f, light_colour.z/255.0f, light_colour.w/255.0f, light_colour.x/255.0f);
38
39 unknown1 = unknown_1;
40 unknown2 = unknown_2;
41 unknown3 = unknown_3;
42 unknown4 = unknown_4;
43
44 enable();
45 ASSERT(genBuffers(), "Unable to generate GL Buffers for Light");
46}
47
48
49void Light::update() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected