Added comments :D

This commit is contained in:
JonasJan2 2024-06-07 16:03:46 +02:00
parent 42f8714eb6
commit cdc86eebad
2 changed files with 16 additions and 3 deletions

View File

@ -67,7 +67,9 @@ char* models[] = {
"../obj/Zblock.obj", "../obj/Zblock.obj",
}; };
// input handler for camera movement /**
* Input handler for camera movement.
* */
void handleInputs(double deltaTime) { void handleInputs(double deltaTime) {
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) {
cameraPosition.z += deltaTime * 10; cameraPosition.z += deltaTime * 10;
@ -117,6 +119,9 @@ void keyboardHandler(GLFWwindow* window, int key, int scancode, int action, int
} }
} }
/**
* Loads textures.
*/
void loadTexture(char* textureFile, GLuint* texture) { void loadTexture(char* textureFile, GLuint* texture) {
int width, height, nrChannels; int width, height, nrChannels;
unsigned char* image = stbi_load(textureFile, &width, &height, &nrChannels, 0); unsigned char* image = stbi_load(textureFile, &width, &height, &nrChannels, 0);
@ -266,6 +271,9 @@ void updateStats() {
fflush(stdout); fflush(stdout);
} }
/**
* Main draw function.
*/
void draw(void) { void draw(void) {
// FPS Counter // FPS Counter
@ -389,12 +397,17 @@ void draw(void) {
} }
} }
// change viewport size and adjust aspect ratio when changing window size /**
* Changes viewport size and adjust aspect ratio when changing window size
*/
void framebuffer_size_callback(GLFWwindow *window, int width, int height) { void framebuffer_size_callback(GLFWwindow *window, int width, int height) {
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
aspectRatio = (float)width / height; aspectRatio = (float)width / height;
} }
/**
* Main function.
*/
int main(int argc, char **argv) { int main(int argc, char **argv) {
// initialise window // initialise window
glfwInit(); glfwInit();

View File

@ -75,7 +75,7 @@ void load_object(ObjectData* objectData) {
} }
/** /**
* Takes a string-pointer and a number of files to read. * Takes a string-pointer, a number of files to read and a number to store the added objects to
* Returns an array of objects. * Returns an array of objects.
*/ */
ObjectData* readObjFiles(char** path, int numModels, int* count) { ObjectData* readObjFiles(char** path, int numModels, int* count) {