-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTree.h
More file actions
29 lines (25 loc) · 910 Bytes
/
Tree.h
File metadata and controls
29 lines (25 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <GL/glew.h>
#include <vector>
#include <glm/glm.hpp>
#include "Cylinder.h"
#include "Leaves.h"
#include "ShaderProgram.h"
class Scene;
class TreeInstance {
public:
TreeInstance();
TreeInstance(Scene *scene, Cylinder *cyl, Leaves *leaves, const glm::vec3 &pos);
void draw(const ShaderProgram& p, const glm::mat4& P, const glm::mat4& V, bool shadow) const;
void drawLeaves(const ShaderProgram& p, const glm::mat4& P, const glm::mat4& V) const;
void setUniformLocations(GLint KdUniformLoc, GLint KsUniformLoc, GLint NsUniformLoc);
const glm::mat4& getM() { return m_cyls.front().getM(); }
bool collides(const Sphere& s) const;
private:
void addBranch(Cylinder *cyl, const glm::vec3& pos, float h, float theta);
std::vector<CylinderInstance> m_cyls;
std::vector<glm::mat4> m_leafMats;
GLint m_KdUniformLoc, m_KsUniformLoc, m_NsUniformLoc;
Scene* m_scene;
Leaves* m_leaves;
};