Skip to content

Commit

Permalink
restructuring tube-traveller
Browse files Browse the repository at this point in the history
  • Loading branch information
themattinthehatt committed Dec 4, 2016
1 parent 5f63e03 commit 4bcb94c
Show file tree
Hide file tree
Showing 28 changed files with 389 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*.idea*

# textures
textures/*
data/textures/*

# old code
old_code/*
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ set(SOURCE_FILES
core/loaders/loadObj.cpp
core/loaders/loadObjIndexed.cpp
tube-traveller/TubeTraveller.cpp
tube-traveller/CubeTube.cpp
tube-traveller/TubeCylinder.cpp
tube-traveller/PathGenerator.h
tube-traveller/PathCircle.cpp
tube-traveller/PathUserInput.cpp
tube-traveller/PathRandom.cpp
tube-traveller/path-generators/PathCircle.cpp
tube-traveller/path-generators/PathUserInput.cpp
tube-traveller/path-generators/PathRandom.cpp
tube-traveller/tube-generators/SimpleShapes.cpp
tube-traveller/tube-generators/TextureCylinder.cpp
physic-spheres/PhysicSpheres.cpp )


Expand Down
4 changes: 2 additions & 2 deletions core/Skybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Skybox::Skybox(std::vector<const GLchar*> files_, GLfloat multiplier_) :
texture = Skybox::loadCubemap(files_);

// create and compile shader programs for skybox
shaderID = loadShaders("shaders/SkyboxTextureShader.vert",
"shaders/SkyboxTextureShader.frag");
shaderID = loadShaders("core/SkyboxTextureShader.vert",
"core/SkyboxTextureShader.frag");

// get a handle for our "skyboxSampler" uniform
textureID = glGetUniformLocation(shaderID, "skyboxSampler");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
190 changes: 190 additions & 0 deletions doc/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
% 12/03/16
- (DONE) make cylinder tube option
- map images to inside of cylinder
- put lighting ball in tube
- dynamically change origin in radial direction
+ user input
+ smoothed random walk
- make grided cylinder tube option in prep for music (send in synthetic power
spectra first?) - make an abstraction such that a 2D bitmap image can be
used as a texture on the inside of the cylinder. Features to consider:
+ maybe start w/ a single map that gets mapped to all cylinders (a nice
pattern could look cool)
+ different textures get mapped to different cylinders. Start w/
blank/solid/static textures on all but current cylinder -> play with
binary counting?
+ move to more dynamic maps; for instance, a single bit flowing down the
tube to increase the binary number by 1 at some [time interval] -> need to
figure this out more
- add a single bit in a random place
- move to a sandpile model? current map is rgb, pixels with random rgb
values flow down pipe, w/ at least one pixel value > some threshold
(to ensure bright, visible pixels) as soon as a pixel surpases white,
it unloads its rgb values (clip at 1?) to 2 neighboring pixels (random
redistribution?)
- with increasing amplitude in a bin/freq band:
+ change height of square
+ change color
+ change opacity (0 amp = clear)

%-------------------------------------------------------------------------------
% 08/19/2016
-(DONE) Instancing
-(DONE) Infinite generation
Once these are done I can fly through space infinitely!!!
(- camera - begin to use it in different ways
- free mode
- tethered to user (which should also be an oriented object) (hotkeys
for exiting back to free mode)
- this should also have two modes - first person and third person.
first person you're actually moving through the tubes.
Third person you are located a fixed distance from the player
and a fixed angle as well (user able to change?) so that the
sketch stays static in the screen while moving through different
parameter combos
- special functionality (in tubes, always moving forward, but can
move radially or circumferentially, etc.))
- to start, make lrud keys dictate movement within the tube, and
aswd keys move through parameter space (aswd keys set position in
parameter space, which is used to update x and y values of the
player (NO! player position should be set, and parameters are updated
with this info.) The camera then uses these x and y vals to reposition itelf
(- tube movement - different generation mechanisms
- straight (to begin with)
- follow a random walk (how to smooth? need to do bezier curves?)
- **be a physics object orbiting around attractors
- randomly placed (and obeying their own physics??) would look
completely different than attractors with masses located
on a grid that oscillate in mass (itself generated by what?
random walk through its own parameter space? oscillations?)
oscillations are probably sufficient for both cases, as I think
if each object had its own random frequency this would
introduce sufficient randomoness in movement to not be
detectable.
- for the last two objects, directions are going to have to be
calculated ahead of time to accurately render tube curvature
- then - detach camera from player!! Can zoom out and watch the random
behavior from a third person point of view (should do this with
the straight tube, before mucking about with physics objects and
complicated tube trajectory calculations. See if the effect is cool enough.
- what started the whole thing: It would be cool to find a sketch with
interesting combinations of parameters combos (2 or 3) and replicated
the sketch many times, once for each set of parameters combos on a
lattice. Then you can move around thet space and see all of them at one
go. BUT - only the parameter combos nearest you are generated, and you
are free to move around. THEN do the same as before, detach the camera
from the player. Perhaps use hte random walk script from before to
generate player movements, or have user do that while camera follows a
predefined track, which may or may not be tied to the movement of the user.
- need to abstract the automatic player movement. Make some sort of interface
common to all so that the movement generator can act with any sort of
sketch that is infinitely generated (maybe just restricted to tunnel-like
sketches for now). Then I can develop the physics movements completely
separately from vertex generation and camera updates. There should be
a larger class that coordinates the player updates (which can also be
user input-driven), content generation and actual camera movements. So,
player movement should be most important. The camera will inherit these
movements (through the tethered mode) and render accordingly. The sketch
generation should also be abstracted so that the player coordinates from
any such sketch can be used as input to content generation (and thus
indirectly tied to keyboard input, so these should stay as separate as
possible for now). (player should have a cube and color attributes to
make visualization easier for debugging purposes (mostly - also probably
looks cool in its own right)).
- Larger class
- pointer to key state arrays
- pointer to sketch (cube array)
- pointer to player object
- simiar to camera class, or just a struct? can the player physics
handle all necessary manipulation of player? Maybe best to have
player and camera class both be oriented objects; they have the
optioni to be manipulated with keyboard input, but it is up to
the larger application to call their "selfUpdate" method or use
its own position manipulation methods. The, for example, when
ahe camera is tehtered player updates are made somehow, and the
setCamera method is called rather than Camera.selfUpdate.
- pointer to player physics (own class? how to do this?)
- user input
- random walk
- attractors (also need attractor objects?)

%-------------------------------------------------------------------------------

Player/Camera
- separate, so that collision detection can be placed on user?
(can probably be two instantiations of the same class, since
both will need location, heading, etc; perhaps player can
inherit from camera, and add physical appearance data)

IO class
- separate keyboard/mouse inputs from overall IO class structure,
so that, eg, VR handsets can be used?

Game states (use enumerator?)
- predefined (intro, modules)
- active
- paused
- menu (+paused)
- map
- controls
- other?

Portal objects
- control transition points of tubeworld
- control of gameplay is transferred to them upon passing through
their defined space; they then alter the gamestate and load
modules
- keep a dynamic list of portal objects? That way the player can
move around and we don't have to keep track of every single
portal - each portal has a (automatically generated?) list of
neighbors

color channels?
render objects with different resolutions based on dist to cam

Overall organization:
To ask Matt:
- use of (non-const) global variables? (camera object?)
- anything to keep in mind to make this easier to port to VR?
gol3d
utymap thing
google video game file structures or some such thing
opengl project structures

terrain generation
optimizations:
quad trees - http://www.shamusyoung.com/twentysidedtale/?p=142
triangle fans - http://www.shamusyoung.com/twentysidedtale/?p=144
sending terrain in sections


use std::bitset!!


%-------------------------------------------------------------------------------
tubeworld additions:
backstory (white world, black bubble, slow color death of tubeworld)
white color explores black space, adds a blue buffer zone
living sculptures of color are under the creative direction of
whatever intelligence lives in the white space
intro (white screen, white pixels peel away and zoom by until most is
black; camera spins 180, white chunks have split into blue backround
and copper pieces spelling tubeworld (in mesh?) with tube going thru
the o
black silhouttes of shape outlines (DNA, boats) that have the thick
outlines deep dreamed
watching a screen == moving through pixel space
deep dream/filter distortion: small mirrors placed atop pixels that
can redirect their light
infrastructure
separate camera and player - player has collision detection
make some places in tubeworld loadable modules (esp if music is involved)
make it possible to enter some of the structures??


%-------------------------------------------------------------------------------
Possible tracks:
Extrawelt - Die Welt ist nicht genug
Dauwd
Younger Brother
Einmusik - I.D.C.
18 changes: 6 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ int main() {
// Set up scene
// -------------------------------------------------------------------------
// set up skybox; +x, -x, +y, -y, +z, -z
// std::vector<const char*> files ={"textures/box3/right.bmp",
// "textures/box3/right.bmp",
// "textures/box3/right.bmp",
// "textures/box3/right.bmp",
// "textures/box3/right.bmp",
// "textures/box3/right.bmp"};
std::vector<const char*> files ={"textures/box3/front.bmp",
"textures/box3/back.bmp",
"textures/box3/left.bmp",
"textures/box3/right.bmp",
"textures/box3/up.bmp",
"textures/box3/down.bmp"};
std::vector<const char*> files ={"data/textures/box3/front.bmp",
"data/textures/box3/back.bmp",
"data/textures/box3/left.bmp",
"data/textures/box3/right.bmp",
"data/textures/box3/up.bmp",
"data/textures/box3/down.bmp"};
Skybox skybox = Skybox(files, 1000.0f);

// set up tube
Expand Down
38 changes: 25 additions & 13 deletions tube-traveller/TubeTraveller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
//

#include "TubeTraveller.h"
#include "PathCircle.h"
#include "PathUserInput.h"
#include "PathRandom.h"
#include "TubeCylinder.h"
#include "path-generators/PathCircle.h"
#include "path-generators/PathUserInput.h"
#include "path-generators/PathRandom.h"
#include "tube-generators/SimpleShapes.h"
#include "tube-generators/TextureCylinder.h"

TubeTraveller::TubeTraveller(GLint numCenters) : io(IOHandler::getInstance()){

Expand All @@ -20,41 +21,52 @@ TubeTraveller::TubeTraveller(GLint numCenters) : io(IOHandler::getInstance()){
TUBE_CUBES_SQ,
TUBE_CUBES_CIRC,
TUBE_CYLINDER,
TUBE_TEXTURE_CYLINDER,
MAX_NUM_TUBES
};
enum TextureType {
TEXTURE_SOLID,
TEXTURE_RAINBOW,
MAX_NUM_TEXTURES
};

PathGeneratorType pathType = PATH_RANDOM;
TubeType tubeType = TUBE_CYLINDER;
TubeType tubeType = TUBE_TEXTURE_CYLINDER;
GLfloat centerSpacing = 20.f;

// select path type
switch (pathType) {
case PATH_CIRCLE:
path = new PathCircle(numCenters);
path = new PathCircle(numCenters, centerSpacing);
break;
case PATH_USER:
path = new PathUserInput(numCenters);
path = new PathUserInput(numCenters, centerSpacing);
break;
case PATH_RANDOM:
path = new PathRandom(numCenters);
path = new PathRandom(numCenters, centerSpacing);
break;
default:
path = new PathRandom(numCenters);
path = new PathRandom(numCenters, centerSpacing);
}

// select tube type
switch (tubeType) {
case TUBE_CUBES_SQ:
tube = new CubeTube(numCenters, CubeTube::SQUARE_OF_SQUARES);
tube = new SimpleShapes(numCenters, SimpleShapes::SQUARE_OF_SQUARES);
break;
case TUBE_CUBES_CIRC:
tube = new CubeTube(numCenters, CubeTube::CIRCLE_OF_SQUARES);
tube = new SimpleShapes(numCenters, SimpleShapes::CIRCLE_OF_SQUARES);
break;
case TUBE_CYLINDER:
tube = new CubeTube(numCenters, CubeTube::CYLINDER);
tube = new SimpleShapes(numCenters, SimpleShapes::CYLINDER);
break;
case TUBE_TEXTURE_CYLINDER:
tube = new TextureCylinder(numCenters, TextureCylinder::CYLINDER);
break;
default:
tube = new CubeTube(numCenters, CubeTube::CIRCLE_OF_SQUARES);
tube = new SimpleShapes(numCenters, SimpleShapes::CIRCLE_OF_SQUARES);
}

}

void TubeTraveller::update(Camera &cam, Player &player) {
Expand Down
16 changes: 12 additions & 4 deletions tube-traveller/TubeTraveller.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
// use the standard vertex attributes for data per vertex and use the instanced
// array for storing data that is unique per instance.

// TODO
// TextureGenerator class
// single image repeated init example
// ROYGBIV init example for variable number of textures
// 1/f noise?
// figure out how to incorporate lighting into the TubeGenerator class (perhaps
// leave out of TubeSimpleShape for simplicity - can always go back later)

#ifndef TUBEWORLD_TUBETRAVELLER_H
#define TUBEWORLD_TUBETRAVELLER_H


#include <GL/glew.h>
#include <glm/glm.hpp>
#include "CubeTube.h"
#include "PathGenerator.h"
#include "path-generators/PathGenerator.h"
#include "tube-generators/TubeGenerator.h"

class TubeTraveller {
private:
Expand All @@ -20,7 +28,7 @@ class TubeTraveller {
public:

PathGenerator *path;
CubeTube *tube;
TubeGenerator *tube;

IOHandler &io;

Expand All @@ -45,4 +53,4 @@ class TubeTraveller {
};


#endif //TUBEWORLD_CUBEARRAYRING_H
#endif //TUBEWORLD_TUBETRAVELLER_H
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

#include "PathCircle.h"

PathCircle::PathCircle(GLint numCenters_) : io(IOHandler::getInstance()){
PathCircle::PathCircle(GLint numCenters_, GLfloat spacing_)
:
io(IOHandler::getInstance()){

// number of slices
numCenters = numCenters_;

// distance between slice centers
spacing = 20.0f;
spacing = spacing_;

// radius of circle
radius = 100.f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PathCircle : public PathGenerator {
IOHandler &io;

// constructor
PathCircle(GLint numCenters);
PathCircle(GLint numCenters, GLfloat spacinig);
// update dynamics of tube positions
void update(Player &player);
// clean up dynamically allocated memory
Expand Down
Loading

0 comments on commit 4bcb94c

Please sign in to comment.