-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
map class and bamboo generation (w/o normal distribution)
- Loading branch information
Showing
17 changed files
with
105 additions
and
66 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
#pragma once | ||
#include "Entity.h" | ||
#include <vector> | ||
|
||
class BambooStick : public Entity{ | ||
private: | ||
static const int leafness; //denominator in chance of leaf in each segment (where numerator is 1) | ||
static const float botTopFraction; | ||
static const float botHeightFraction; | ||
|
||
Position position; | ||
float baseSegmentHeight; | ||
|
||
struct Segment { | ||
float botRadius; | ||
float topRadius; | ||
float height; | ||
bool leaf; | ||
}; | ||
|
||
float width, height; | ||
GLUquadricObj *qobj; | ||
std::vector<Segment *> * segments; | ||
|
||
void generate(); | ||
Segment * generateSegment(); | ||
|
||
public: | ||
BambooStick(); | ||
BambooStick(GLUquadric * q, float x, float y, float z); | ||
~BambooStick(); | ||
|
||
void render(); | ||
void generate(); | ||
Segment * getSegment(int x); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "Map.h" | ||
|
||
|
||
Map::Map() { | ||
entities = new std::vector<Entity *>(); | ||
|
||
qobj = gluNewQuadric(); | ||
Entity * e; | ||
e = new Floor(-2.f, 0.f, -30.f, 100.f, 100.f); | ||
entities->push_back(e); | ||
|
||
for (int x = -5; x < 5; x++) { | ||
for (int z = -8; z < 2; z++) { | ||
if ((z + 8) % 2) | ||
e = new BambooStick(qobj, 10 * x + 5, 0, 10 * z); | ||
else | ||
e = new BambooStick(qobj, 10 * x, 0, 10 * z); | ||
|
||
entities->push_back(e); | ||
} | ||
} | ||
} | ||
|
||
|
||
Map::~Map() { | ||
} | ||
|
||
void Map::render() { | ||
for (int i = 0; i < entities->size(); i++) | ||
(*entities)[i]->render(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
#include "Entity.h" | ||
#include "BambooStick.h" | ||
#include "Floor.h" | ||
|
||
class Map { | ||
private: | ||
std::vector<Entity *> * entities; | ||
GLUquadric * qobj; | ||
public: | ||
Map(); | ||
~Map(); | ||
|
||
void render(); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters