mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
Source/model tweaks for updated revision.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 MiB After Width: | Height: | Size: 5.2 MiB |
BIN
resources/objects/planet/mars.png
Normal file
BIN
resources/objects/planet/mars.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
@@ -1,13 +1,13 @@
|
||||
# Blender MTL
|
||||
# Blender MTL File: 'None'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material.001
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
newmtl Mars
|
||||
Ns 96.078443
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.087302 0.087302 0.087302
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.0 0.0 0.0
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd planet_Quom1200.png
|
||||
map_Bump planet_Quom1200.png
|
||||
map_Kd mars.png
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB |
2
resources/objects/planet/source.txt
Normal file
2
resources/objects/planet/source.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
From TurboSquid, by Gerhald3D: https://www.turbosquid.com/3d-models/realistic-mars-photorealistic-2k-3d-1277433
|
||||
Slightly modified by Joey de Vries: keep only planet layer, assign diffuse texture to material slot, desaturated texture somewhat.
|
||||
@@ -9,5 +9,4 @@ Ks 0.007937 0.007937 0.007937
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd rock.png
|
||||
map_Bump rock.png
|
||||
|
||||
BIN
resources/textures/container2_specular_colored.png
Normal file
BIN
resources/textures/container2_specular_colored.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 55.0f));
|
||||
|
||||
@@ -19,8 +19,8 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 155.0f));
|
||||
|
||||
@@ -19,8 +19,8 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -248,7 +248,7 @@ int main()
|
||||
// vegetation
|
||||
glBindVertexArray(transparentVAO);
|
||||
glBindTexture(GL_TEXTURE_2D, transparentTexture);
|
||||
for (GLuint i = 0; i < vegetation.size(); i++)
|
||||
for (unsigned int i = 0; i < vegetation.size(); i++)
|
||||
{
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, vegetation[i]);
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -182,7 +182,7 @@ int main()
|
||||
|
||||
// load textures
|
||||
// -------------
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/marble.jpg").c_str());
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/container.jpg").c_str());
|
||||
unsigned int floorTexture = loadTexture(FileSystem::getPath("resources/textures/metal.png").c_str());
|
||||
|
||||
// shader configuration
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -182,7 +182,7 @@ int main()
|
||||
|
||||
// load textures
|
||||
// -------------
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/marble.jpg").c_str());
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/container.jpg").c_str());
|
||||
unsigned int floorTexture = loadTexture(FileSystem::getPath("resources/textures/metal.png").c_str());
|
||||
|
||||
// shader configuration
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
unsigned int loadCubemap(vector<std::string> faces);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -195,7 +195,7 @@ int main()
|
||||
|
||||
// load textures
|
||||
// -------------
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/marble.jpg").c_str());
|
||||
unsigned int cubeTexture = loadTexture(FileSystem::getPath("resources/textures/container.jpg").c_str());
|
||||
|
||||
vector<std::string> faces
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
unsigned int loadCubemap(vector<std::string> faces);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -18,8 +18,8 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -19,8 +19,8 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -81,7 +81,8 @@ int main()
|
||||
|
||||
// load models
|
||||
// -----------
|
||||
Model nanosuit(FileSystem::getPath("resources/objects/nanosuit/nanosuit.obj"));
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
Model backpack(FileSystem::getPath("resources/objects/backpack/backpack.obj"));
|
||||
|
||||
// render loop
|
||||
// -----------
|
||||
@@ -112,7 +113,7 @@ int main()
|
||||
shader.setMat4("model", model);
|
||||
|
||||
// draw model as usual
|
||||
nanosuit.Draw(shader);
|
||||
backpack.Draw(shader);
|
||||
|
||||
// then draw model with normal visualizing geometry shader
|
||||
normalShader.use();
|
||||
@@ -120,7 +121,7 @@ int main()
|
||||
normalShader.setMat4("view", view);
|
||||
normalShader.setMat4("model", model);
|
||||
|
||||
nanosuit.Draw(normalShader);
|
||||
backpack.Draw(normalShader);
|
||||
|
||||
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool blinn = false;
|
||||
bool blinnKeyPressed = false;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ void processInput(GLFWwindow *window);
|
||||
unsigned int loadTexture(const char *path, bool gammaCorrection);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool gammaEnabled = false;
|
||||
bool gammaKeyPressed = false;
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ void renderCube();
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -23,8 +23,8 @@ void renderCube();
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -23,8 +23,8 @@ void renderCube();
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -22,8 +22,8 @@ void renderScene(const Shader &shader);
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool shadows = true;
|
||||
bool shadowsKeyPressed = false;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ void renderScene(const Shader &shader);
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool shadows = true;
|
||||
bool shadowsKeyPressed = false;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
float heightScale = 0.1;
|
||||
|
||||
// camera
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
float heightScale = 0.1;
|
||||
|
||||
// camera
|
||||
|
||||
@@ -21,8 +21,8 @@ unsigned int loadTexture(const char *path);
|
||||
void renderQuad();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
float heightScale = 0.1;
|
||||
|
||||
// camera
|
||||
|
||||
@@ -22,8 +22,8 @@ void renderQuad();
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool hdr = true;
|
||||
bool hdrKeyPressed = false;
|
||||
float exposure = 1.0f;
|
||||
|
||||
@@ -22,8 +22,8 @@ void renderQuad();
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
bool bloom = true;
|
||||
bool bloomKeyPressed = false;
|
||||
float exposure = 1.0f;
|
||||
|
||||
@@ -21,8 +21,8 @@ void renderQuad();
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 880;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 5.0f));
|
||||
|
||||
@@ -21,8 +21,8 @@ void renderQuad();
|
||||
void renderCube();
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 5.0f));
|
||||
|
||||
@@ -15,8 +15,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
|
||||
GLenum glCheckError_(const char *file, int line)
|
||||
|
||||
Reference in New Issue
Block a user