Configuration Properties | Path |
---|---|
C/C++ > General > Additional Include Directories | $(SolutionDir)External_lib/GLEW/include $(SolutionDir)External_lib/GLFW/include $(SolutionDir)External_lib/GLM |
Linker > General > Additional Library Directories Dependencies | $(SolutionDir)External_lib/GLEW/lib/Release/Win32 $(SolutionDir)External_lib/GLFW/lib-vc2015 |
Linker > Input > Additional Dependencies | opengl32.lib glfw3.lib glew32.lib |
GL/glew.h
, GLFW/glfw3.h
, glm/glm.hpp
, glm/gtc/matrix_transform.hpp
access | type | name | purpose |
---|---|---|---|
private |
glm::vec3 |
position | Current position of camera |
private |
glm::vec3 |
front | Direction vector indicating the direction player is facing |
private |
glm::vec3 |
up | Direction vector indicating the top of the player |
private |
glm::vec3 |
right | Direction vector indicating the right of the player |
private |
glm::vec3 |
worldUp | Direction vector of where the top of the world is |
private |
GLfloat |
yaw | Rotation of camera about the z axis |
private |
GLfloat |
pitch | Rotation of camera about the y axis |
private |
GLfloat |
moveSpeed | Movement speed |
private |
GLfloat |
turnSpeed | Turning speedo |
parameter | purpose |
---|---|
void |
Default constructor |
glm::vec3 startPositionglm::vec3 startUpGLfloat startYawGLfloat startPitchGLfloat startMoveSpeedGLfloat startTurnSpeed |
Comprehensive constructor which initialises variables |
private
return type | name | parameter | purpose |
---|---|---|---|
void |
update | void |
Update front based on yaw & pitch Update right based on front & worldUp Update up based on right & front |
public
return type | name | parameter | purpose |
---|---|---|---|
void |
keyControl | bool* keysGLfloat deltaTime |
Set events based on keys. Move player based on deltaTime |
void |
mouseControl | GLfloat xChangeGLfloat yChange |
Change pitch and yaw based on mouse movement |
glm::mat4 |
calculateViewMatrix | void |
Using glm::lookAt , calculate view matrixbased on position , position + front & up |
parameter | purpose |
---|---|
void |
Default destructor |
GL/glew.h
access | type | name | purpose |
---|---|---|---|
private |
GLuint |
VAO | Vertex Array Object. Stores information of a complete render object |
private |
GLuint |
VBO | Vertex Buffer Object. Memory buffer to hold |
private |
GLuint |
IBO | Index Buffer Object. Store indexes of render object |
parameter | purpose |
---|---|
void |
Default constructor |
public
return type | name | parameter | purpose |
---|---|---|---|
void |
create | unsigned int numOfVerticesGLfloat* verticesunsigned int numOfIndicesunsigned int* indices |
Generates VAO, IBO & VBO. Assign vertices and indices data to buffers. Sets Vertex Attribute Poitner. |
void |
render | void |
Binds VAO and IBO and draws object. |
void |
clear | void |
Deletes buffer and VAO, and set them to 0. |
parameter | purpose |
---|---|
void |
Default destructor |
stdio.h
, string
, fstream
, GL/glew.h
access | type | name | purpose |
---|---|---|---|
private |
GLuint |
ID | ID of shader program. |
private |
GLuint |
uniformProjection | Location of projection matrix in shader. |
private |
GLuint |
uniformModel | Location of model matrix in shader. |
private |
GLuint |
uniformView | Location of view matrix in shader. |
parameter | purpose |
---|---|
void |
Default constructor |
private
return type | name | parameter | purpose |
---|---|---|---|
void |
addShader | GLuint programconst char* codeGLenum type |
Create shader of type. Attach the source code. Compile. Attach to program. |
void |
compileShaders | const char* vertexCodeconst char* fragmentCode |
Create program. Add shaders. Link program. Validate program. Get location of matrices. |
std::string |
fileContents | const char* file |
Returns content of file . |
public
return type | name | parameter | purpose |
---|---|---|---|
void |
create | const char* vertexFileconst char* fragmentFile |
Gets code from files and compiles them. |
GLuint |
getProjectionLocation | void |
Returns uniformProjection . |
GLuint |
getModelLocation | void |
Returns uniformModel . |
GLuint |
getViewLocation | void |
Returns uniformView . |
void |
use | void |
Uses this program. |
void |
clear | void |
Deletes program and sets variables to 0. |
parameter | purpose |
---|---|
void |
Default destructor |
stdio.h
, GL/glew.h
, GLFW/glfw3.h
access | type | name | purpose |
---|---|---|---|
private |
GLFWwindow* |
main | Main window. |
private |
GLint |
width | Width of window. |
private |
GLint |
height | Height of window. |
private |
GLint |
bufferWidth | Buffer width of window. |
private |
GLint |
bufferHeight | Buffer height of window. |
private |
bool [1024] |
keys | State of keys. |
private |
GLfloat |
lastX | Last X position of mouse. |
private |
GLfloat |
lastY | Last Y position of mouse. |
private |
GLfloat |
xChange | X difference from lastX and current X. |
private |
GLfloat |
yChange | Y difference from lastY and current Y. |
private |
bool |
mouseFirstMoved | Indicates if this is mouse first position. |
parameter | purpose |
---|---|
void |
Default constructor |
GLint wGLint h |
Initialise width & height |
private
return type | name | parameter | purpose |
---|---|---|---|
void |
createCallbacks | void |
Sets key an cursor position callbacks. |
void |
static handleKeys |
GLFWwindow* wint keyint codeint actionint mode |
Set keys to true based on which are pressed. |
void |
static handleMouse |
GLFWwindow* wdouble xPosdouble yPos |
Set xChange and yChange based on mouse movmements. |
public
return type | name | parameter | purpose |
---|---|---|---|
void |
create | const char* vertexFileconst char* fragmentFile |
Gets code from files and compiles them. |
parameter | purpose |
---|---|
void |
Default destructor |