Merge branch 'master' of https://git.wmi.amu.edu.pl/s473558/grakopro
This commit is contained in:
commit
aaef2a0ea2
12590
cw_8/models/engine.obj
Normal file
12590
cw_8/models/engine.obj
Normal file
File diff suppressed because it is too large
Load Diff
129
cw_8/shaders/install.frag
Normal file
129
cw_8/shaders/install.frag
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#version 430 core
|
||||||
|
|
||||||
|
out vec4 FragColor;
|
||||||
|
|
||||||
|
|
||||||
|
in vec2 TexCoords;
|
||||||
|
in vec3 worldPos;
|
||||||
|
in vec3 Normal;
|
||||||
|
|
||||||
|
uniform vec3 cameraPos;
|
||||||
|
|
||||||
|
uniform vec3 lightPos;
|
||||||
|
uniform vec3 lightColor;
|
||||||
|
|
||||||
|
uniform sampler2D albedoMap;
|
||||||
|
uniform sampler2D normalMap;
|
||||||
|
uniform sampler2D metallicMap;
|
||||||
|
uniform sampler2D roughnessMap;
|
||||||
|
uniform sampler2D aoMap;
|
||||||
|
|
||||||
|
const float PI = 3.14159265359;
|
||||||
|
|
||||||
|
vec3 getNormalFromMap()
|
||||||
|
{
|
||||||
|
vec3 tangentNormal = texture(normalMap, TexCoords).xyz * 2.0 - 1.0;
|
||||||
|
|
||||||
|
vec3 Q1 = dFdx(worldPos);
|
||||||
|
vec3 Q2 = dFdy(worldPos);
|
||||||
|
vec2 st1 = dFdx(TexCoords);
|
||||||
|
vec2 st2 = dFdy(TexCoords);
|
||||||
|
|
||||||
|
vec3 N = normalize(Normal);
|
||||||
|
vec3 T = normalize(Q1*st2.t - Q2*st1.t);
|
||||||
|
vec3 B = -normalize(cross(N, T));
|
||||||
|
mat3 TBN = mat3(T, B, N);
|
||||||
|
|
||||||
|
return normalize(TBN * tangentNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 fresnelSchlick(float cosTheta, vec3 F0){
|
||||||
|
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float DistributionGGX(vec3 N, vec3 H, float roughness)
|
||||||
|
{
|
||||||
|
float a = roughness*roughness;
|
||||||
|
float a2 = a*a;
|
||||||
|
float NdotH = max(dot(N, H), 0.0);
|
||||||
|
float NdotH2 = NdotH*NdotH;
|
||||||
|
|
||||||
|
float num = a2;
|
||||||
|
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
||||||
|
denom = PI * denom * denom;
|
||||||
|
|
||||||
|
return num / denom;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GeometrySchlickGGX(float NdotV, float roughness)
|
||||||
|
{
|
||||||
|
float r = (roughness + 1.0);
|
||||||
|
float k = (r*r) / 8.0;
|
||||||
|
|
||||||
|
float num = NdotV;
|
||||||
|
float denom = NdotV * (1.0 - k) + k;
|
||||||
|
|
||||||
|
return num / denom;
|
||||||
|
}
|
||||||
|
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)
|
||||||
|
{
|
||||||
|
float NdotV = max(dot(N, V), 0.0);
|
||||||
|
float NdotL = max(dot(N, L), 0.0);
|
||||||
|
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
||||||
|
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
||||||
|
|
||||||
|
return ggx1 * ggx2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
|
||||||
|
vec3 albedo = pow(texture(albedoMap, TexCoords).rgb, vec3(2.2));
|
||||||
|
float metallic = texture(metallicMap, TexCoords).r;
|
||||||
|
float roughness = texture(roughnessMap, TexCoords).r;
|
||||||
|
float ao = texture(aoMap, TexCoords).r;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 N = getNormalFromMap();
|
||||||
|
vec3 V = normalize(cameraPos - worldPos);
|
||||||
|
|
||||||
|
vec3 F0 = vec3(0.04);
|
||||||
|
F0 = mix(F0, albedo, metallic);
|
||||||
|
|
||||||
|
|
||||||
|
vec3 Lo = vec3(0.0);
|
||||||
|
|
||||||
|
vec3 L = normalize(lightPos - worldPos);
|
||||||
|
vec3 H = normalize(V + L);
|
||||||
|
float distance = length(lightPos - worldPos);
|
||||||
|
float attenuation = 1.0 / (distance * distance);
|
||||||
|
vec3 radiance = lightColor * attenuation;
|
||||||
|
|
||||||
|
float NDF = DistributionGGX(N, H, roughness);
|
||||||
|
float G = GeometrySmith(N, V, L, roughness);
|
||||||
|
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
|
||||||
|
|
||||||
|
vec3 numerator = NDF * G * F;
|
||||||
|
float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001;
|
||||||
|
vec3 specular = numerator / denominator;
|
||||||
|
|
||||||
|
vec3 kS = F;
|
||||||
|
|
||||||
|
vec3 kD = vec3(1.0) - kS;
|
||||||
|
|
||||||
|
kD *= 1.0 - metallic;
|
||||||
|
|
||||||
|
float NdotL = max(dot(N, L), 0.0);
|
||||||
|
|
||||||
|
Lo += (kD * albedo / PI + specular) * radiance * NdotL;
|
||||||
|
|
||||||
|
vec3 ambient = vec3(0.03) * albedo * ao;
|
||||||
|
|
||||||
|
vec3 color = ambient + Lo;
|
||||||
|
|
||||||
|
color = color / (color + vec3(1.0));
|
||||||
|
color = pow(color, vec3(1.0/2.2));
|
||||||
|
|
||||||
|
FragColor = vec4(color, 1.0)*vec4(0.0, 0.8, 0.95, 1.0);
|
||||||
|
|
||||||
|
}
|
24
cw_8/shaders/install.vert
Normal file
24
cw_8/shaders/install.vert
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#version 430 core
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 vertexPosition;
|
||||||
|
layout(location = 1) in vec3 vertexNormal;
|
||||||
|
layout(location = 2) in vec2 vertexTexCoord;
|
||||||
|
|
||||||
|
uniform mat4 transformation;
|
||||||
|
uniform mat4 modelMatrix;
|
||||||
|
uniform vec3 cameraPos;
|
||||||
|
|
||||||
|
out vec3 Normal;
|
||||||
|
out vec3 worldPos;
|
||||||
|
out vec2 TexCoords;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
|
||||||
|
TexCoords = vertexTexCoord;
|
||||||
|
worldPos = vec3(modelMatrix * vec4(vertexPosition,1));
|
||||||
|
Normal = normalize((modelMatrix * vec4(vertexNormal,0)).xyz);
|
||||||
|
|
||||||
|
gl_Position = transformation * vec4(vertexPosition, 1.0);
|
||||||
|
|
||||||
|
}
|
@ -16,6 +16,7 @@ GLuint program;
|
|||||||
GLuint programSun;
|
GLuint programSun;
|
||||||
GLuint programParticle;
|
GLuint programParticle;
|
||||||
GLuint programSkybox;
|
GLuint programSkybox;
|
||||||
|
GLuint programInstall;
|
||||||
|
|
||||||
Core::Shader_Loader shaderLoader;
|
Core::Shader_Loader shaderLoader;
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ Core::RenderContext shipContext;
|
|||||||
Core::RenderContext sunContext;
|
Core::RenderContext sunContext;
|
||||||
Core::RenderContext planetContext;
|
Core::RenderContext planetContext;
|
||||||
Core::RenderContext stationContext;
|
Core::RenderContext stationContext;
|
||||||
|
Core::RenderContext engineContext;
|
||||||
|
|
||||||
Core::RenderContext cubeContext;
|
Core::RenderContext cubeContext;
|
||||||
|
|
||||||
@ -91,6 +93,9 @@ glm::vec3 cameraDir;
|
|||||||
glm::vec3 spaceshipPos = glm::vec3(-4.0f, 0.0f, 0.0f);
|
glm::vec3 spaceshipPos = glm::vec3(-4.0f, 0.0f, 0.0f);
|
||||||
glm::vec3 spaceshipDir = glm::vec3(1.0f, 0.0f, 0.0f);
|
glm::vec3 spaceshipDir = glm::vec3(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
glm::float1 engineIs = 0;
|
||||||
|
//glm::float1 engineInstalled = 0;
|
||||||
|
|
||||||
float lastTime = -1.f;
|
float lastTime = -1.f;
|
||||||
float deltaTime = 0.f;
|
float deltaTime = 0.f;
|
||||||
|
|
||||||
@ -117,8 +122,20 @@ void processInput(GLFWwindow* window)
|
|||||||
if (!glfwJoystickIsGamepad(GLFW_JOYSTICK_1)) {
|
if (!glfwJoystickIsGamepad(GLFW_JOYSTICK_1)) {
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
|
float cameraSpeed = 0.1f * deltaTime * 15;
|
||||||
|
|
||||||
|
|
||||||
|
//station glm::vec3(0.f, 0.4f, 4.f)
|
||||||
|
if (engineIs==1&&spaceshipPos.x > -0.7 && 0.3>spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3>spaceshipPos.z)
|
||||||
|
{
|
||||||
|
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
||||||
|
engineIs = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engineIs == 2)
|
||||||
|
cameraSpeed = cameraSpeed * 1.8;//1.5;
|
||||||
|
|
||||||
|
|
||||||
float cameraSpeed = 0.1f * deltaTime * 20;
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||||
spaceshipPos += cameraSpeed * spaceshipDir;
|
spaceshipPos += cameraSpeed * spaceshipDir;
|
||||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
||||||
@ -143,6 +160,7 @@ void processInput(GLFWwindow* window)
|
|||||||
cameraPos = spaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.05f;
|
cameraPos = spaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint albedo, GLuint normal, GLuint ao, GLuint roughness, GLuint metallic) {
|
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint albedo, GLuint normal, GLuint ao, GLuint roughness, GLuint metallic) {
|
||||||
|
|
||||||
glUseProgram(program);
|
glUseProgram(program);
|
||||||
@ -256,7 +274,49 @@ unsigned int loadCubemap()
|
|||||||
return textureID;
|
return textureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void isTouching(glm::vec3 objectPos) {
|
||||||
|
//spaceXYZ = glm::vec3(float x, float y, float z);
|
||||||
|
float xpos = spaceshipPos.x;
|
||||||
|
float zpos = spaceshipPos.z;
|
||||||
|
float xup = objectPos.x+0.2;
|
||||||
|
float xdown = objectPos.x-0.2;
|
||||||
|
float zup = objectPos.z+0.2;
|
||||||
|
float zdown = objectPos.z-0.2;
|
||||||
|
//6,0,0
|
||||||
|
if (xup > xpos&&xpos > xdown && zup > zpos &&zpos > zdown)
|
||||||
|
//if(xpos>6&&1>zpos&&zpos>-1)
|
||||||
|
engineIs = 1;
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void drawObjectToInstall(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint albedo, GLuint normal, GLuint ao, GLuint roughness, GLuint metallic) {
|
||||||
|
//dodaj shader
|
||||||
|
//zmien 'program'
|
||||||
|
glUseProgram(programInstall);
|
||||||
|
|
||||||
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
|
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(programInstall, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(programInstall, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
|
|
||||||
|
glUniform3f(glGetUniformLocation(programInstall, "lightPos"), 0, 0, 0);
|
||||||
|
glUniform3f(glGetUniformLocation(programInstall, "lightColor"), 300, 300, 300);
|
||||||
|
|
||||||
|
Core::SetActiveTexture(albedo, "albedoMap", programInstall, 0);
|
||||||
|
Core::SetActiveTexture(normal, "normalMap", programInstall, 1);
|
||||||
|
Core::SetActiveTexture(ao, "aoMap", programInstall, 2);
|
||||||
|
Core::SetActiveTexture(roughness, "roughnessMap", programInstall, 3);
|
||||||
|
Core::SetActiveTexture(metallic, "metallicMap", programInstall, 4);
|
||||||
|
//dodaæ warstwe koloru
|
||||||
|
|
||||||
|
Core::DrawContext(context);
|
||||||
|
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
||||||
|
|
||||||
void renderScene(GLFWwindow* window) {
|
void renderScene(GLFWwindow* window) {
|
||||||
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
||||||
@ -281,14 +341,60 @@ void renderScene(GLFWwindow* window) {
|
|||||||
0.,0.,0.,1.,
|
0.,0.,0.,1.,
|
||||||
});
|
});
|
||||||
|
|
||||||
drawObjectPBR(shipContext,
|
if (engineIs == 1)
|
||||||
glm::translate(spaceshipPos)
|
{
|
||||||
* spaceshipRotationMatrix
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.048f)) * glm::eulerAngleY(time / 4), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
* glm::translate(glm::vec3(0.f, -0.1f, 0.1f))
|
//drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleX(time/2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
* glm::eulerAngleX(glm::radians(80.f))
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleYZ(time / 3.f, time * 3.f), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
* glm::eulerAngleY(glm::radians(180.f))
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.052f)) * glm::eulerAngleXYZ(time / 2, time / 2, time / 2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
* glm::scale(glm::vec3(0.005f)),
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.054f)) * glm::eulerAngleX(0.5f) * glm::eulerAngleXZ(time, time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic);
|
|
||||||
|
if (spaceshipPos.x > -0.7 && 0.3 > spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3 > spaceshipPos.z)
|
||||||
|
{
|
||||||
|
drawObjectToInstall(shipContext,
|
||||||
|
glm::translate(spaceshipPos)
|
||||||
|
* spaceshipRotationMatrix
|
||||||
|
* glm::translate(glm::vec3(0.f, -0.1f, 0.1f))
|
||||||
|
* glm::eulerAngleX(glm::radians(80.f))
|
||||||
|
* glm::eulerAngleY(glm::radians(180.f))
|
||||||
|
* glm::scale(glm::vec3(0.005f)),
|
||||||
|
texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drawObjectPBR(shipContext,
|
||||||
|
glm::translate(spaceshipPos)
|
||||||
|
* spaceshipRotationMatrix
|
||||||
|
* glm::translate(glm::vec3(0.f, -0.1f, 0.1f))
|
||||||
|
* glm::eulerAngleX(glm::radians(80.f))
|
||||||
|
* glm::eulerAngleY(glm::radians(180.f))
|
||||||
|
* glm::scale(glm::vec3(0.005f)),
|
||||||
|
texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
drawObjectPBR(shipContext,
|
||||||
|
glm::translate(spaceshipPos)
|
||||||
|
* spaceshipRotationMatrix
|
||||||
|
* glm::translate(glm::vec3(0.f, -0.1f, 0.1f))
|
||||||
|
* glm::eulerAngleX(glm::radians(80.f))
|
||||||
|
* glm::eulerAngleY(glm::radians(180.f))
|
||||||
|
* glm::scale(glm::vec3(0.005f)),
|
||||||
|
texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic);
|
||||||
|
|
||||||
|
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.048f)) * glm::eulerAngleY(time / 4), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
//drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleX(time/2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleYZ(time / 3.f, time * 3.f), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.052f)) * glm::eulerAngleXYZ(time / 2, time / 2, time / 2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.054f)) * glm::eulerAngleX(0.5f) * glm::eulerAngleXZ(time, time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
isTouching(glm::vec3(4, -0.2f, -3));
|
||||||
|
if (engineIs == 0)
|
||||||
|
drawObjectPBR(engineContext, glm::translate(glm::vec3(4, -0.2f, -3)) * glm::eulerAngleY(-0.7f * time) * glm::scale(glm::vec3(0.1f)), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 4) * glm::translate(glm::vec3(6.f, 0, 0)) * glm::eulerAngleY(-0.7f * time) * glm::scale(glm::vec3(0.4f)), texture::planet_albedo, texture::planet_normal, texture::planet_ao, texture::planet_roughness, texture::planet_metallic);
|
drawObjectPBR(planetContext, glm::eulerAngleY(time / 4) * glm::translate(glm::vec3(6.f, 0, 0)) * glm::eulerAngleY(-0.7f * time) * glm::scale(glm::vec3(0.4f)), texture::planet_albedo, texture::planet_normal, texture::planet_ao, texture::planet_roughness, texture::planet_metallic);
|
||||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 5) * glm::translate(glm::vec3(-7.f, 0, 0)) * glm::eulerAngleY(-0.3f * time) * glm::scale(glm::vec3(0.2f)), texture::mars_albedo, texture::mars_normal, texture::mars_ao, texture::mars_roughness, texture::mars_metallic);
|
drawObjectPBR(planetContext, glm::eulerAngleY(time / 5) * glm::translate(glm::vec3(-7.f, 0, 0)) * glm::eulerAngleY(-0.3f * time) * glm::scale(glm::vec3(0.2f)), texture::mars_albedo, texture::mars_normal, texture::mars_ao, texture::mars_roughness, texture::mars_metallic);
|
||||||
@ -296,11 +402,6 @@ void renderScene(GLFWwindow* window) {
|
|||||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY(-1.5f * time) * glm::scale(glm::vec3(0.1f)), texture::earth_albedo, texture::earth_normal, texture::earth_ao, texture::earth_roughness, texture::earth_metallic);
|
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY(-1.5f * time) * glm::scale(glm::vec3(0.1f)), texture::earth_albedo, texture::earth_normal, texture::earth_ao, texture::earth_roughness, texture::earth_metallic);
|
||||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY( 2.f * time) * glm::translate(glm::vec3(0.4f, 0, 0.4f)) * glm::eulerAngleY(-0.5f * time) * glm::scale(glm::vec3(0.04f)), texture::moon_albedo, texture::moon_normal, texture::moon_ao, texture::moon_roughness, texture::moon_metallic);
|
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY( 2.f * time) * glm::translate(glm::vec3(0.4f, 0, 0.4f)) * glm::eulerAngleY(-0.5f * time) * glm::scale(glm::vec3(0.04f)), texture::moon_albedo, texture::moon_normal, texture::moon_ao, texture::moon_roughness, texture::moon_metallic);
|
||||||
|
|
||||||
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.048f)) * glm::eulerAngleY(time/4), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
|
||||||
//drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleX(time/2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
|
||||||
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.05f)) * glm::eulerAngleY(0.5f) * glm::eulerAngleYZ(time/3.f,time*3.f), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
|
||||||
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.052f)) * glm::eulerAngleXYZ(time/2,time/2,time/2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
|
||||||
drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.054f)) * glm::eulerAngleX(0.5f) * glm::eulerAngleXZ(time,time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
|
||||||
|
|
||||||
//desired objects end here
|
//desired objects end here
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
@ -323,6 +424,8 @@ void init(GLFWwindow* window)
|
|||||||
|
|
||||||
program = shaderLoader.CreateProgram("shaders/pbr.vert", "shaders/pbr.frag");
|
program = shaderLoader.CreateProgram("shaders/pbr.vert", "shaders/pbr.frag");
|
||||||
programSun = shaderLoader.CreateProgram("shaders/sun.vert", "shaders/sun.frag");
|
programSun = shaderLoader.CreateProgram("shaders/sun.vert", "shaders/sun.frag");
|
||||||
|
|
||||||
|
programInstall = shaderLoader.CreateProgram("shaders/install.vert", "shaders/install.frag");
|
||||||
//programParticle = shaderLoader.CreateProgram("shaders/part.vert", "shaders/part.frag");
|
//programParticle = shaderLoader.CreateProgram("shaders/part.vert", "shaders/part.frag");
|
||||||
|
|
||||||
//load models here
|
//load models here
|
||||||
@ -337,6 +440,8 @@ void init(GLFWwindow* window)
|
|||||||
|
|
||||||
loadModelToContext("./models/cube.obj", cubeContext);
|
loadModelToContext("./models/cube.obj", cubeContext);
|
||||||
|
|
||||||
|
loadModelToContext("./models/engine.obj", engineContext);
|
||||||
|
|
||||||
//load skybox here
|
//load skybox here
|
||||||
|
|
||||||
programSkybox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
programSkybox = shaderLoader.CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
|
||||||
@ -390,10 +495,10 @@ void init(GLFWwindow* window)
|
|||||||
//texture::station_metallic = Core::LoadTexture("textures/station1/metallic.jpg");
|
//texture::station_metallic = Core::LoadTexture("textures/station1/metallic.jpg");
|
||||||
|
|
||||||
|
|
||||||
texture::station_albedo = Core::LoadTexture("textures/station2/ALUM_8L2.JPG");
|
texture::station_ao = Core::LoadTexture("textures/station2/ALUM_8L2.JPG");
|
||||||
texture::station_normal = Core::LoadTexture("textures/station2/ALUM_8L4.JPG");
|
texture::station_normal = Core::LoadTexture("textures/station2/ALUM_809.JPG");
|
||||||
texture::station_roughness = Core::LoadTexture("textures/station2/ALUM_809.JPG");
|
texture::station_roughness = Core::LoadTexture("textures/station2/ALUM_8L4.JPG");
|
||||||
texture::station_ao = Core::LoadTexture("textures/station2/Alum_panel1.jpg");
|
texture::station_albedo = Core::LoadTexture("textures/station2/Alum_panel1.jpg");
|
||||||
texture::station_metallic = Core::LoadTexture("textures/station2/Aluminium6.jpg");
|
texture::station_metallic = Core::LoadTexture("textures/station2/Aluminium6.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user