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

Method Sound

src/Scene/Sound.cpp:8–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "Sound.h"
7
8Sound::Sound(glm::vec3 sound_position, uint32_t sound_type) : super("Sound", std::vector<glm::vec3>(), std::vector<glm::vec2>(), std::vector<glm::vec3>(), std::vector<unsigned int>(), false, sound_position) {
9 // TODO: Redo all of this to make sense
10 std::vector<glm::vec3> verts;
11 verts.push_back(glm::vec3(-0.5, -0.5, 0)); // bottom left corner
12 verts.push_back(glm::vec3(-0.5, 0.5, 0)); // top left corner
13 verts.push_back(glm::vec3( 0.5, 0.5, 0)); // top right corner
14 verts.push_back(glm::vec3( 0.5, -0.5, 0)); // bottom right corner
15 unsigned int indices[] = {0,1,2, // first triangle (bottom left - top left - top right)
16 0,2,3}; // second triangle (bottom left - top right - bottom right)
17 m_uvs.clear();
18 m_uvs.push_back(glm::vec2(0.0f, 1.0f));
19 m_uvs.push_back(glm::vec2(1.0f, 0.0f));
20 m_uvs.push_back(glm::vec2(1.0f, 1.0f));
21 m_uvs.push_back(glm::vec2(0.0f, 1.0f));
22 m_uvs.push_back(glm::vec2(1.0f, 1.0f));
23 m_uvs.push_back(glm::vec2(0.0f, 1.0f));
24
25 m_vertex_indices = std::vector<unsigned int>(indices, indices + sizeof(indices)/sizeof(indices[0]));;
26 m_vertices.clear();
27 // Unindex data and Fill unused normal buffer
28 for (unsigned int m_vertex_index : m_vertex_indices) {
29 m_vertices.push_back(verts[m_vertex_index]);
30 m_normals.push_back(glm::vec3(0, 0, 0));
31 }
32
33 position= sound_position;
34 type = sound_type;
35
36 enable();
37 ASSERT(genBuffers(), "Unable to generate GL Buffers for Sound");
38}
39
40void Sound::update() {
41 orientation_vec = glm::vec3(0,0,0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected