|
@@ -7,8 +7,9 @@
|
|
#include "gaming-core/utils/List.h"
|
|
#include "gaming-core/utils/List.h"
|
|
#include "gaming-core/utils/Random.h"
|
|
#include "gaming-core/utils/Random.h"
|
|
#include "gaming-core/utils/Utils.h"
|
|
#include "gaming-core/utils/Utils.h"
|
|
|
|
+#include "gaming-core/wrapper/GL.h"
|
|
|
|
|
|
-// static GLuint texture3d;
|
|
|
|
|
|
+static GLuint texture3d;
|
|
static List<Vector3, 122880> list;
|
|
static List<Vector3, 122880> list;
|
|
static float tData[16][16][16];
|
|
static float tData[16][16][16];
|
|
|
|
|
|
@@ -41,7 +42,7 @@ Game::Game(Shader& shader, Buttons& buttons, const Size& size)
|
|
front(buttons.add(GLFW_KEY_W, "front")),
|
|
front(buttons.add(GLFW_KEY_W, "front")),
|
|
back(buttons.add(GLFW_KEY_S, "back")) {
|
|
back(buttons.add(GLFW_KEY_S, "back")) {
|
|
shader.use();
|
|
shader.use();
|
|
- vertexBuffer.setAttributes(Attributes().addFloat(3));
|
|
|
|
|
|
+ // vertexBuffer.setAttributes(Attributes().addFloat(3));
|
|
|
|
|
|
Random r(0);
|
|
Random r(0);
|
|
for(int x = 0; x < 16; x++) {
|
|
for(int x = 0; x < 16; x++) {
|
|
@@ -49,13 +50,13 @@ Game::Game(Shader& shader, Buttons& buttons, const Size& size)
|
|
for(int z = 0; z < 16; z++) {
|
|
for(int z = 0; z < 16; z++) {
|
|
if(x == 0 || x == 15 || y == 0 || y == 15 || z == 0 ||
|
|
if(x == 0 || x == 15 || y == 0 || y == 15 || z == 0 ||
|
|
z == 15) {
|
|
z == 15) {
|
|
- tData[x][y][z] = 0.0f;
|
|
|
|
|
|
+ tData[z][x][y] = 0.1f;
|
|
} else {
|
|
} else {
|
|
// tData[x][y][z] = 1.0f;
|
|
// tData[x][y][z] = 1.0f;
|
|
float sinX = sinf(M_PI * x / 8.0f);
|
|
float sinX = sinf(M_PI * x / 8.0f);
|
|
float cosY = cosf(M_PI * y / 8.0f);
|
|
float cosY = cosf(M_PI * y / 8.0f);
|
|
float cosZ = cosf(M_PI * z / 8.0f);
|
|
float cosZ = cosf(M_PI * z / 8.0f);
|
|
- tData[x][y][z] = (sinX * sinX + cosY * cosY + cosZ * cosZ) *
|
|
|
|
|
|
+ tData[z][x][y] = (sinX * sinX + cosY * cosY + cosZ * cosZ) *
|
|
(1.0f / 3.0f);
|
|
(1.0f / 3.0f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -72,17 +73,17 @@ Game::Game(Shader& shader, Buttons& buttons, const Size& size)
|
|
vertexBuffer.setStaticData(sizeof(Vector3) * list.getLength(),
|
|
vertexBuffer.setStaticData(sizeof(Vector3) * list.getLength(),
|
|
list.begin());
|
|
list.begin());
|
|
|
|
|
|
- /*glGenTextures(1, &texture3d);
|
|
|
|
|
|
+ glGenTextures(1, &texture3d);
|
|
glBindTexture(GL_TEXTURE_3D, texture3d);
|
|
glBindTexture(GL_TEXTURE_3D, texture3d);
|
|
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
|
|
|
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
|
|
|
|
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
|
|
|
|
|
+ glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
|
|
|
+ glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
|
|
|
|
+ glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
|
|
|
|
|
- glTexImage3D(GL_TEXTURE_3D, 0, GL_R32F, 16, 16, 1, 0, GL_RED, GL_FLOAT,
|
|
|
|
|
|
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_R32F, 16, 16, 16, 0, GL_RED, GL_FLOAT,
|
|
tData);
|
|
tData);
|
|
- glActiveTexture(GL_TEXTURE0);*/
|
|
|
|
|
|
+ glActiveTexture(GL_TEXTURE0);
|
|
}
|
|
}
|
|
|
|
|
|
void Game::render(float lag) {
|
|
void Game::render(float lag) {
|
|
@@ -93,9 +94,15 @@ void Game::render(float lag) {
|
|
m.translate(interPos);
|
|
m.translate(interPos);
|
|
m.translateZ(-30.0f);
|
|
m.translateZ(-30.0f);
|
|
m.translateX(-8.0f);
|
|
m.translateX(-8.0f);
|
|
|
|
+
|
|
shader.setMatrix("view", m.getValues());
|
|
shader.setMatrix("view", m.getValues());
|
|
|
|
|
|
- vertexBuffer.draw(list.getLength());
|
|
|
|
|
|
+ glPointSize(10.0f);
|
|
|
|
+ // vertexBuffer.draw(list.getLength());
|
|
|
|
+ GL::checkAndPrintError("test3");
|
|
|
|
+ vertexBuffer.drawPoints(0);
|
|
|
|
+ GL::checkAndPrintError("HERE");
|
|
|
|
+ glDrawArrays(GL_POINTS, 0, 16 * 16 * 16);
|
|
}
|
|
}
|
|
|
|
|
|
void Game::tick() {
|
|
void Game::tick() {
|