Browse Source

Moved headers to include and removed terrain gen

testing
= 6 years ago
parent
commit
6087d8a8cf
  1. 2
      CMakeLists.txt
  2. 0
      include/bitmap.h
  3. 0
      include/camera.h
  4. 0
      include/chunk.h
  5. 0
      include/chunkrenderer.h
  6. 0
      include/config.h
  7. 0
      include/game.h
  8. 0
      include/graphics/drawable.h
  9. 0
      include/graphics/mesh.h
  10. 0
      include/graphics/shader.h
  11. 2
      include/graphics/skybox.h
  12. 0
      include/inputhandler.h
  13. 0
      include/loadShader.h
  14. 0
      include/mathfuncs.h
  15. 0
      include/mathplus.h
  16. 0
      include/nano_signal_slot.hpp
  17. 0
      include/scene.h
  18. 4
      include/terraingen.h
  19. 0
      include/tilemap.h
  20. 0
      include/tileset.h
  21. 0
      include/voxelinfo.h
  22. 0
      include/voxelmath.h
  23. 0
      include/voxelutils.h
  24. 0
      include/window.h
  25. 0
      include/world.h
  26. 47
      src/customnoise/gradientnoise.cpp
  27. 43
      src/customnoise/gradientnoise.h
  28. 40
      src/customnoise/yturbulence.cpp
  29. 43
      src/customnoise/yturbulence.h
  30. 4
      src/graphics/skybox.cpp
  31. 14
      src/scenes/testscene.cpp
  32. 10
      src/scenes/testscene.h
  33. 21
      src/terraingen.cpp
  34. 2
      todo.txt

2
CMakeLists.txt

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.6)
project ("voxeltronik")
file (GLOB_RECURSE SOURCES "src/*.cpp")
include_directories("include")
include_directories("./include")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
add_executable(vtk ${SOURCES})

0
src/bitmap.h → include/bitmap.h

0
src/camera.h → include/camera.h

0
src/chunk.h → include/chunk.h

0
src/chunkrenderer.h → include/chunkrenderer.h

0
src/config.h → include/config.h

0
src/game.h → include/game.h

0
src/graphics/drawable.h → include/graphics/drawable.h

0
src/graphics/mesh.h → include/graphics/mesh.h

0
src/graphics/shader.h → include/graphics/shader.h

2
src/graphics/skybox.h → include/graphics/skybox.h

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
#include <GL/glew.h>
#include <GL/gl.h>
#include "../camera.h"
#include "camera.h"
namespace vtk {

0
src/inputhandler.h → include/inputhandler.h

0
src/loadShader.h → include/loadShader.h

0
src/mathfuncs.h → include/mathfuncs.h

0
src/mathplus.h → include/mathplus.h

0
src/nano_signal_slot.hpp → include/nano_signal_slot.hpp

0
src/scene.h → include/scene.h

4
src/terraingen.h → include/terraingen.h

@ -22,8 +22,6 @@ @@ -22,8 +22,6 @@
#include <map>
#include <utility>
#include "customnoise/gradientnoise.h"
#include "customnoise/yturbulence.h"
namespace vtk {
@ -40,9 +38,7 @@ public: @@ -40,9 +38,7 @@ public:
noise::module::Const const1Mod;
noise::module::Const const0Mod;
noise::module::Const constNeg1Mod;
YTurbulence terrainTurb;
noise::module::Perlin terrainShape;
GradientNoise gradientMod;
//variables (replace by config)
double terrainScale;

0
src/tilemap.h → include/tilemap.h

0
src/tileset.h → include/tileset.h

0
src/voxelinfo.h → include/voxelinfo.h

0
src/voxelmath.h → include/voxelmath.h

0
src/voxelutils.h → include/voxelutils.h

0
src/window.h → include/window.h

0
src/world.h → include/world.h

47
src/customnoise/gradientnoise.cpp

@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
/*
* =====================================================================================
*
* Filename: gradientnoise.cpp
*
* Description:
*
* Version: 1.0
* Created: 05/10/2014 03:47:54 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include "gradientnoise.h"
namespace vtk {
GradientNoise::GradientNoise() : Module(GetSourceModuleCount()){
}
int GradientNoise::GetSourceModuleCount() const {
return 0;
}
double GradientNoise::GetValue(double x, double y, double z) const {
//We don't need x and z, so we suppress the warnings about it
(void)x;
(void)z;
if (y <= stop0) return -1.0;
if (y >= stop1) return 1.0;
return ((y - stop0) / (stop1 - stop0)) * 2 - 1;
}
void GradientNoise::setStop(const int& index, const double& value) {
if (index == 0) stop0 = value;
else if (index == 1) stop1 = value;
}
}

43
src/customnoise/gradientnoise.h

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
/*
* =====================================================================================
*
* Filename: gradientnoise.h
*
* Description: Produces a vertical gradient
*
* Version: 1.0
* Created: 05/10/2014 03:42:45 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#pragma once
#include <noise/noise.h>
//TODO: Add support for more than 2 stops
namespace vtk {
class GradientNoise : public noise::module::Module {
public:
GradientNoise();
virtual int GetSourceModuleCount() const;
virtual double GetValue(double x, double y, double z) const;
void setStop(const int& index, const double& value);
protected:
double stop0;
double stop1;
};
}

40
src/customnoise/yturbulence.cpp

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
/*
* =====================================================================================
*
* Filename: yturbulence.cpp
*
* Description:
*
* Version: 1.0
* Created: 05/10/2014 06:17:38 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include "yturbulence.h"
namespace vtk {
YTurbulence::YTurbulence() : Module(GetSourceModuleCount()){
}
int YTurbulence::GetSourceModuleCount() const {
return 1;
}
double YTurbulence::GetValue(double x, double y, double z) const {
double xOff, yOff, zOff;
xOff = x + (12414.0 / 65536.0);
yOff = y + (65124.0 / 65536.0);
zOff = z + (31337.0 / 65536.0);
double distortion = y + (yNoise.GetValue(xOff, yOff, zOff) * power);
return m_pSourceModule[0]->GetValue(x, distortion, z);
}
}

43
src/customnoise/yturbulence.h

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
/*
* =====================================================================================
*
* Filename: yturbulence.h
*
* Description: Y axis turbulence using perlin,
* Basically just normal turbulence, but only on Y.
*
* Version: 1.0
* Created: 05/10/2014 06:11:09 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#pragma once
#include <noise/noise.h>
//TODO: Add support for more than 2 stops
namespace vtk {
class YTurbulence : public noise::module::Module {
public:
YTurbulence();
virtual int GetSourceModuleCount() const;
virtual double GetValue(double x, double y, double z) const;
noise::module::Perlin yNoise;
double power;
protected:
};
}

4
src/graphics/skybox.cpp

@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/transform.hpp>
#include "../loadShader.h"
#include "loadShader.h"
#include "skybox.h"
#include "graphics/skybox.h"
namespace vtk {

14
src/scenes/testscene.cpp

@ -16,11 +16,11 @@ @@ -16,11 +16,11 @@
* =====================================================================================
*/
#include "testscene.h"
#include "../loadShader.h"
#include "../game.h"
#include "../tileset.h"
#include "../world.h"
#include "../mathplus.h"
#include "loadShader.h"
#include "game.h"
#include "tileset.h"
#include "world.h"
#include "mathplus.h"
#include <GL/glew.h>
@ -124,9 +124,9 @@ void TestScene::init() { @@ -124,9 +124,9 @@ void TestScene::init() {
std::cout << std::endl;
int chunkCount = 1;
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 10; k++) {
for (int k = 0; k < 30; k++) {
std::cout << "\rGenerating chunks (" << chunkCount << "/" << 8*8*8 << ")" << std::flush;
world.generateChunk(i,j,k);
chunkCount++;

10
src/scenes/testscene.h

@ -19,11 +19,11 @@ @@ -19,11 +19,11 @@
#pragma once
#include "../scene.h"
#include "../camera.h"
#include "../inputhandler.h"
#include "../world.h"
#include "../graphics/skybox.h"
#include "scene.h"
#include "camera.h"
#include "inputhandler.h"
#include "world.h"
#include "graphics/skybox.h"
#include <SDL2/SDL.h>

21
src/terraingen.cpp

@ -27,25 +27,6 @@ @@ -27,25 +27,6 @@
namespace vtk {
TerrainGen::TerrainGen() {
const1Mod.SetConstValue(1.0);
const0Mod.SetConstValue(0.0);
constNeg1Mod.SetConstValue(-1.0);
gradientMod.setStop(0, 0.0);
gradientMod.setStop(1, 1.0);
terrainTurb.SetSourceModule(0, gradientMod);
terrainTurb.power = .3;
terrainTurb.yNoise.SetOctaveCount(3);
terrainTurb.yNoise.SetFrequency(1.5);
terrainTurb.yNoise.SetSeed(time(0));
selectorMod.SetControlModule(terrainTurb);
selectorMod.SetSourceModule(0, constNeg1Mod);
selectorMod.SetSourceModule(1, const1Mod);
selectorMod.SetBounds(0.0, 1000.0);
terrainScale = 1.0 / 128.0;
}
void TerrainGen::generateChunk(Chunk* chunk) {
@ -53,6 +34,7 @@ void TerrainGen::generateChunk(Chunk* chunk) { @@ -53,6 +34,7 @@ void TerrainGen::generateChunk(Chunk* chunk) {
for (int i = 0; i < 16; i++) { //x
for (int j = 0; j < 16; j++) { //y
for (int k = 0; k < 16; k++) { //z
/*
glm::dvec3 pos((double)(chunk->chunkPos.x * 16 + i) * terrainScale,
(double)(chunk->chunkPos.y * 16 + j) * terrainScale,
(double)(chunk->chunkPos.z * 16 + k) * terrainScale);
@ -63,6 +45,7 @@ void TerrainGen::generateChunk(Chunk* chunk) { @@ -63,6 +45,7 @@ void TerrainGen::generateChunk(Chunk* chunk) {
chunk->setVoxelType(i,j,k,1);
}
}
*/
}
}
}

2
todo.txt

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
REFACTOR:
Make real scene graph
Convert to smart pointers
Doxygen docs and comment source
Document what I've got
Input handling

Loading…
Cancel
Save