|
1 | 1 | #include <algorithm> |
2 | 2 | #include <vector> |
| 3 | +#include <memory> |
3 | 4 |
|
4 | 5 | #include "projectM-opengl.h" |
5 | 6 |
|
@@ -84,52 +85,52 @@ TextureManager::TextureManager(const std::string _presetsURL, const int texsizeX |
84 | 85 | blurTextures.push_back(textureBlur); |
85 | 86 | } |
86 | 87 |
|
87 | | - PerlinNoise noise; |
| 88 | + std::unique_ptr<PerlinNoise> noise(new PerlinNoise()); |
88 | 89 |
|
89 | 90 | GLuint noise_texture_lq_lite; |
90 | 91 | glGenTextures(1, &noise_texture_lq_lite); |
91 | 92 | glBindTexture(GL_TEXTURE_2D, noise_texture_lq_lite); |
92 | | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGB, GL_FLOAT, noise.noise_lq_lite); |
| 93 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGB, GL_FLOAT, noise->noise_lq_lite); |
93 | 94 | Texture * textureNoise_lq_lite = new Texture("noise_lq_lite", noise_texture_lq_lite, GL_TEXTURE_2D, 32, 32, false); |
94 | 95 | textureNoise_lq_lite->getSampler(GL_REPEAT, GL_LINEAR); |
95 | 96 | textures["noise_lq_lite"] = textureNoise_lq_lite; |
96 | 97 |
|
97 | 98 | GLuint noise_texture_lq; |
98 | 99 | glGenTextures(1, &noise_texture_lq); |
99 | 100 | glBindTexture(GL_TEXTURE_2D, noise_texture_lq); |
100 | | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise.noise_lq); |
| 101 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise->noise_lq); |
101 | 102 | Texture * textureNoise_lq = new Texture("noise_lq", noise_texture_lq, GL_TEXTURE_2D, 256, 256, false); |
102 | 103 | textureNoise_lq->getSampler(GL_REPEAT, GL_LINEAR); |
103 | 104 | textures["noise_lq"] = textureNoise_lq; |
104 | 105 |
|
105 | 106 | GLuint noise_texture_mq; |
106 | 107 | glGenTextures(1, &noise_texture_mq); |
107 | 108 | glBindTexture(GL_TEXTURE_2D, noise_texture_mq); |
108 | | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise.noise_mq); |
| 109 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise->noise_mq); |
109 | 110 | Texture * textureNoise_mq = new Texture("noise_mq", noise_texture_mq, GL_TEXTURE_2D, 256, 256, false); |
110 | 111 | textureNoise_mq->getSampler(GL_REPEAT, GL_LINEAR); |
111 | 112 | textures["noise_mq"] = textureNoise_mq; |
112 | 113 |
|
113 | 114 | GLuint noise_texture_hq; |
114 | 115 | glGenTextures(1, &noise_texture_hq); |
115 | 116 | glBindTexture(GL_TEXTURE_2D, noise_texture_hq); |
116 | | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise.noise_hq); |
| 117 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGB, GL_FLOAT, noise->noise_hq); |
117 | 118 | Texture * textureNoise_hq = new Texture("noise_hq", noise_texture_hq, GL_TEXTURE_2D, 256, 256, false); |
118 | 119 | textureNoise_hq->getSampler(GL_REPEAT, GL_LINEAR); |
119 | 120 | textures["noise_hq"] = textureNoise_hq; |
120 | 121 |
|
121 | 122 | GLuint noise_texture_lq_vol; |
122 | 123 | glGenTextures( 1, &noise_texture_lq_vol ); |
123 | 124 | glBindTexture( GL_TEXTURE_3D, noise_texture_lq_vol ); |
124 | | - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 32 ,32 ,32 ,0 ,GL_RGB ,GL_FLOAT ,noise.noise_lq_vol); |
| 125 | + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 32 ,32 ,32 ,0 ,GL_RGB ,GL_FLOAT ,noise->noise_lq_vol); |
125 | 126 | Texture * textureNoise_lq_vol = new Texture("noisevol_lq", noise_texture_lq_vol, GL_TEXTURE_3D, 32, 32, false); |
126 | 127 | textureNoise_lq_vol->getSampler(GL_REPEAT, GL_LINEAR); |
127 | 128 | textures["noisevol_lq"] = textureNoise_lq_vol; |
128 | 129 |
|
129 | 130 | GLuint noise_texture_hq_vol; |
130 | 131 | glGenTextures( 1, &noise_texture_hq_vol ); |
131 | 132 | glBindTexture( GL_TEXTURE_3D, noise_texture_hq_vol ); |
132 | | - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 32, 32, 32, 0, GL_RGB, GL_FLOAT, noise.noise_hq_vol); |
| 133 | + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 32, 32, 32, 0, GL_RGB, GL_FLOAT, noise->noise_hq_vol); |
133 | 134 | Texture * textureNoise_hq_vol = new Texture("noisevol_hq", noise_texture_hq_vol, GL_TEXTURE_3D, 32, 32, false); |
134 | 135 | textureNoise_hq_vol->getSampler(GL_REPEAT, GL_LINEAR); |
135 | 136 | textures["noisevol_hq"] = textureNoise_hq_vol; |
|
0 commit comments