add shininess and extra camera perspective
This commit is contained in:
parent
5426a084b0
commit
f71b33bb47
|
@ -24,7 +24,11 @@ $ make run
|
|||
Bedienung über Keyboard :D
|
||||
- WASD
|
||||
- R & F für Hoch & Runter
|
||||
- 1,2,3,4,5 für Verschiedene Kamerapositionen
|
||||
- 1,2,3,4,5,6 für Verschiedene Kamerapositionen
|
||||
- 1: Vor den Tafeln
|
||||
- 2-4: Verschiedene Sitzplätze
|
||||
- 5: Vogelperspektive
|
||||
- 6: Close-Up vom Normal Map Demo Cube
|
||||
|
||||
|
||||
## TODO LIST
|
||||
|
|
|
@ -47,6 +47,7 @@ model 11
|
|||
file ../obj/cube/cube.obj
|
||||
texture ../texture/crate/texture.jpg
|
||||
normal ../texture/crate/normal.jpg
|
||||
shininess 100
|
||||
|
||||
# Reihe 1 #
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ void handleInputs(double deltaTime) {
|
|||
if (glfwGetKey(window, GLFW_KEY_5) == GLFW_PRESS) {
|
||||
cameraPosition = (vec3){-10.6f, 22.1f, -4.5f};
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_6) == GLFW_PRESS) {
|
||||
cameraPosition = (vec3){3.574698f, 0.966039f, 3.852249f};
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) {
|
||||
cameraPosition.z += deltaTime * 10;
|
||||
}
|
||||
|
@ -144,7 +147,7 @@ void renderNode(SceneNode* node) {
|
|||
glUniformMatrix3fv(glGetUniformLocation(program, "normalModelView"), 1, GL_FALSE, (GLfloat*)&normalModelView);
|
||||
|
||||
// SET MATERIAL DATA
|
||||
glUniform1f(glGetUniformLocation(program, "shininess"), 60.0f * 4.0f);
|
||||
glUniform1f(glGetUniformLocation(program, "shininess"), node->model->shininess * 4.0f);
|
||||
|
||||
|
||||
// BIND TEXTURES
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define KEYWORD_DEFINE_TEXTURE_FILE "texture"
|
||||
#define KEYWORD_DEFINE_SECONDARY_TEXTURE_FILE "texture2"
|
||||
#define KEYWORD_DEFINE_NORMAL_MAP_FILE "normal"
|
||||
#define KEYWORD_DEFINE_SHININESS "shininess"
|
||||
|
||||
#define KEYWORD_USE_MODEL "use"
|
||||
#define KEYWORD_DEFINE_PARENT "parent"
|
||||
|
@ -202,6 +203,7 @@ SceneNode* loadSceneGraphFromFile(char* path) {
|
|||
models[currentModel].texture = -1;
|
||||
models[currentModel].secondaryTexture = -1;
|
||||
models[currentModel].normalMap = -1;
|
||||
models[currentModel].shininess = 10.0f;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(keyword, KEYWORD_DEFINE_OBJ_FILE) == 0) {
|
||||
|
@ -224,6 +226,10 @@ SceneNode* loadSceneGraphFromFile(char* path) {
|
|||
loadTexture(filepathBuffer, &models[currentModel].normalMap);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(keyword, KEYWORD_DEFINE_SHININESS) == 0) {
|
||||
sscanf(buf, KEYWORD_DEFINE_SHININESS " %f", &models[currentModel].shininess);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(keyword, KEYWORD_DEFINE_NODE) == 0) {
|
||||
|
|
|
@ -16,6 +16,7 @@ typedef struct {
|
|||
GLuint texture;
|
||||
GLuint secondaryTexture;
|
||||
GLuint normalMap;
|
||||
GLfloat shininess;
|
||||
} Model;
|
||||
|
||||
struct SceneNode {
|
||||
|
|
Loading…
Reference in New Issue