Commit 9de041b5 authored by Dario Seyb's avatar Dario Seyb

improved performance, by, like, a lot

parent 266f3f65
......@@ -3,6 +3,7 @@
"target_fps": 60,
"fullscreen": false,
"quality": "high",
"ssao": false,
"available_planet_prefabs": [
"earth",
"mars",
......
This diff is collapsed.
......@@ -11,6 +11,9 @@ uniform sampler2D uNormalMap;
uniform bool uHasSpecularSmoothnessMap;
uniform sampler2D uSpecularSmoothnessMap;
uniform bool uHasEmissiveMap;
uniform sampler2D uEmissiveMap;
uniform vec4 uEmissiveColor;
uniform vec4 uTintColor;
uniform float uTime;
......
......@@ -14,12 +14,15 @@ vec4 color() {
}
vec4 emissive() {
if(uHasEmissiveMap) {
return texture(uEmissiveMap, vTexCoord);
}
return uEmissiveColor;
}
vec3 normal() {
if(false && uHasNormalMap) {
vec3 tangentNormal = unpackNormal(texture(uNormalMap, vTexCoord));
vec3 tangentNormal = -normalize(texture(uNormalMap, vTexCoord).xyz * 2 - vec3(1.0));
vec3 Q1 = dFdx(vPosition);
vec3 Q2 = dFdy(vPosition);
......@@ -33,7 +36,7 @@ vec3 normal() {
mat3 TBN = mat3(T, B, vNormal);
// transform the normal to eye space
return tangentNormal*TBN;
return normalize(tangentNormal*TBN);
}
return vNormal;
}
......
......@@ -110,6 +110,21 @@ float snoise_3d(vec3 v)
float hash( float n ) { return fract(sin(n)*753.5453123); }
float hash_noise( in vec3 x )
{
vec3 p = floor(x);
vec3 f = fract(x);
f = f*f*(3.0-2.0*f);
float n = p.x + p.y*157.0 + 113.0*p.z;
return mix(mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),
mix( hash(n+157.0), hash(n+158.0),f.x),f.y),
mix(mix( hash(n+113.0), hash(n+114.0),f.x),
mix( hash(n+270.0), hash(n+271.0),f.x),f.y),f.z) * 2.0 - 1.0;
}
//================================
// function based on:
// https://github.com/ashima/webgl-noise/blob/master/demo/common/noisedemoMain.frag
......@@ -124,7 +139,7 @@ float fbm_3d(vec3 coords, int numberOfOcts, float freq){
float fValue = 0.0;
float weight = .5;
for(int i = 0; i < numberOfOcts; i++){
fValue += snoise_3d(freq * coords) * weight;
fValue += hash_noise(freq * coords) * weight;
weight *= 0.5;
freq *= 2.0;
}
......
#pragma import "../../noise/noise3d.glsl"
#pragma import "../../Utils.glsl"
uniform sampler2D uTexture;
#pragma import "mars_texture.glsl"
#pragma import "../../terrain/dispMapping_tesh.glsl"
const float SC = 250.0;
// value noise, and its analytical derivatives
/*
vec3 noised( in vec3 xIn )
{
//return vec3(1, 1, 1);
float omega = acos(xIn.z);
float phi = atan(xIn.y/xIn.x);
vec3 x = xIn;
vec2 p = floor(x);
vec2 f = fract(x);
vec2 u = f*f*(3.0-2.0*f);
float a = texture(uTexture,(p+vec2(0.5,0.5))/256.0,-100.0).x;
float b = texture(uTexture,(p+vec2(1.5,0.5))/256.0,-100.0).x;
float c = texture(uTexture,(p+vec2(0.5,1.5))/256.0,-100.0).x;
float d = texture(uTexture,(p+vec2(1.5,1.5))/256.0,-100.0).x;
return vec3(a+(b-a)*u.x+(c-a)*u.y+(a-b-c+d)*u.x*u.y,
float terrainH( in vec2 x )
{
vec2 p = x*0.003/SC;
float a = 0.0;
float b = 1.0;
vec2 d = vec2(0.0);
for( int i=0; i<15; i++ )
{
vec3 n = noised(p);
d += n.yz;
a += b*n.x/(1.0+dot(d,d));
b *= 0.5;
p = m2*p*2.0;
}
return SC*100.0*a;
}*/
float fbm(vec3 coords, int numberOfOcts, float freq){
float fValue = 0.0;
float weight = .5;
for(int i = 0; i < numberOfOcts; i++){
fValue += hash_noise(freq * coords) * weight;
weight *= 0.5;
freq *= 2.0;
}
return fValue;
}
float getContinentHeightNoise(vec3 normalizedPosInModelspace) {
return smoothstep(sin(4*(fbm_3d(normalizedPosInModelspace , 1, 1.25))), -1, 0);
return 2*(fbm(normalizedPosInModelspace , 2, 1.25));
}
float getRidgedHeightNoise(vec3 normalizedPosInModelspace) {
return (.75 - abs(fbm_3d( normalizedPosInModelspace , 2, 40.)))/2.;
return (.75 - abs(fbm( normalizedPosInModelspace , 2, 40.)))/2.;
}
float getDetailHeightNoise(vec3 normalizedPosInModelspace) {
return pow(fbm_3d( normalizedPosInModelspace , 3, 50.)/1.4, 2) * 3;
return fbm( normalizedPosInModelspace , 2, 160.)/8.;
}
float getRidgedDetailsHeightNoise(vec3 normalizedPosInModelspace) {
return (.75 - abs(fbm_3d( normalizedPosInModelspace , 4, 8*640.)));
return (.75 - abs(fbm( normalizedPosInModelspace , 4, 8*640.)))/256.;
//return 0.;
}
float getHeightNoise(vec3 normalizedPosInModelspace) {
return (0.2 + getRidgedHeightNoise(normalizedPosInModelspace) * 0.1 + getContinentHeightNoise(normalizedPosInModelspace)
+ getDetailHeightNoise(normalizedPosInModelspace))
* 2.;
return (getContinentHeightNoise(normalizedPosInModelspace)
+ getRidgedHeightNoise(normalizedPosInModelspace)
+ getDetailHeightNoise(normalizedPosInModelspace)
+ getRidgedDetailsHeightNoise(normalizedPosInModelspace)) * 1.25 - 1.0;
}
#define SNOW_LEVEL .5
#define ROCK_LEVEL .3
#define PLANT_LEVEL .03
......@@ -34,10 +91,14 @@ vec4 texture_getColor(vec3 texCoord3d, vec3 upVectorNormalized, vec3 normalNorma
noiseOct1 = snoise_3d(32.*128. * texCoord3d);
noiseOct2 = snoise_3d(64.*128. * texCoord3d);
noiseOct3 = snoise_3d(128.*128. * texCoord3d);
float heightPertubation = 1./2.*noiseOct1 + 1./4.*noiseOct2 + 1./8.*noiseOct3;
vec4 color = vec4(1., 1., 1., 1.);
float height =getHeightNoise(texCoord3d)/2.*.9 + heightPertubation * .1;
float dt = dot(normalNormalized, upVectorNormalized);
......@@ -50,13 +111,13 @@ vec4 texture_getColor(vec3 texCoord3d, vec3 upVectorNormalized, vec3 normalNorma
if (height> SNOW_LEVEL && phiPert <= ROCK_SLOPE) {
color = vec4(1., 0., 0., 1.);
color = vec4(1., 1., 1., 1.);
} else if (height> ROCK_LEVEL || phiPert > ROCK_SLOPE) {
color = vec4(.1, .1, .1, 1.);
} else if (height> PLANT_LEVEL) {
color = vec4(.9, .3,.15, 1.);
color = vec4(.2, .5,.15, 1.);
}else { //"sand""
color = vec4(1., .8, .55, 1.);
}
......@@ -71,6 +132,7 @@ float texture_getFinalHeight(vec3 normalizedPosInModelspace){
return 0.008 * getHeightNoise(normalizedPosInModelspace);
}
vec3 texture_getDisplacedPosition_modelspace(vec3 normalizedPosInModelspace, vec3 normalizedNormal) {
vec3 newPosition = normalizedPosInModelspace + normalizedNormal * texture_getFinalHeight(normalizedPosInModelspace);
return newPosition;
......
......@@ -36,40 +36,48 @@ float linearizeDepth(float depth) {
return (2.0 * uNear) / (uFar + uNear - depth * (uFar - uNear)); // convert to linear values
}
vec4 unpackKernel(vec4 kern) {
return kern * vec4(2, 2, 1, 1) - vec4(1.0, 1.0, 0.0, 0.0);
}
void main() {
float originDepth = texture(uSamplerDepth, vTexCoord).r;
vec3 origin = unpackWorldPosition(originDepth);
float originDepth = texture(uSamplerDepth, vTexCoord).r;
vec3 origin = unpackWorldPosition(originDepth);
vec3 normal = unpackNormal(texture(uSamplerNormalMotion, vTexCoord));
normal = normalize( (transpose(uViewInverseMatrix) * vec4(normal, 0)).xyz );
vec3 normal = unpackNormal(texture(uSamplerNormalMotion, vTexCoord));
normal = normalize( (transpose(uViewInverseMatrix) * vec4(normal, 0)).xyz );
vec3 rvec = texture(uSamplerNoise, vTexCoord * uNoiseScale).xyz * 2.0 - 1.0;
vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
vec3 bitangent = cross(normal, tangent);
mat3 tbn = mat3(tangent, bitangent, normal);
float occlusion = 0.0;
for (int i = 0; i < uSampleKernelSize; ++i) {
vec3 sample = tbn * texture(uSamplerKernel, vec2(float(i)/uSampleKernelSize, 0)).xyz;
sample = sample * uRadius + origin;
// project sample position:
vec4 offset = vec4(sample, 1.0);
offset = uViewProjectionMatrix * offset;
offset.xy /= offset.w;
offset.xy = offset.xy * 0.5 + 0.5;
// get sample depth:
float sampleDepth = texture(uSamplerDepth, offset.xy).r;
vec3 samplePos = unpackWorldPosition(sampleDepth);
vec3 rvec = unpackKernel(texture(uSamplerNoise, vTexCoord * uNoiseScale)).xyz * 2.0 - 1.0;
vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
vec3 bitangent = cross(normal, tangent);
mat3 tbn = mat3(tangent, bitangent, normal);
float occlusion = 0.0;
for (int i = 0; i < uSampleKernelSize; ++i) {
vec3 sample = tbn * unpackKernel(texture(uSamplerKernel, vec2(float(i)/uSampleKernelSize, 0))).xyz;
sample = sample * uRadius + origin;
// project sample position:
vec4 offset = vec4(sample, 1.0);
offset = uViewProjectionMatrix * offset;
offset.xy /= offset.w;
offset.xy = offset.xy * 0.5 + 0.5;
//oColor.r = length(offset.xy - vTexCoord) * 10 ; return;
// get sample depth:
float sampleDepth = texture(uSamplerDepth, offset.xy).r;
vec3 samplePos = unpackWorldPosition(sampleDepth);
// range check & accumulate:
float rangeCheck= length(samplePos-origin) < uRadius ? 1.0 : 0.0;
//oColor.r = samplePos.x; return;
occlusion += ( length(origin) >= length(samplePos) ? 1.0 : 0.0) * rangeCheck;
}
// range check & accumulate:
float rangeCheck= length(samplePos-origin) < uRadius ? 1.0 : 0.0;
occlusion += ( length(origin) >= length(samplePos) ? 1.0 : 0.0) * rangeCheck;
}
occlusion = 1.0 - (occlusion / uSampleKernelSize);
occlusion = 1.0 - (occlusion / uSampleKernelSize);
oColor.r = occlusion;
oColor.r = occlusion;
}
#version 410 core
uniform sampler2D uTexture;
layout(vertices = 3) out;
in vec3 vNormal[];
......
#version 410 core
//#pragma import "noise/noise3d.glsl"
//#pragma import "terrain/sphereUV.glsl"
//#pragma import "../terrain/mountainTexture.glsl"
......
This diff is collapsed.
......@@ -33,7 +33,8 @@ private:
glm::ivec2 m_resolution;
QualitySetting m_qualitySetting;
bool m_fullscreen;
uint64_t m_targetFps;
bool m_ssaoEnabled;
uint64_t m_targetFps;
std::string m_defaultScene;
std::string m_defaultPlanetType;
......@@ -55,6 +56,7 @@ public:
inline std::string getFullSoundPath() const { return m_resourcePath + m_soundPath; }
inline glm::ivec2 getResolution() const { return m_resolution; }
inline bool getFullscreen() const { return m_fullscreen; }
inline bool ssaoEnabled() const { return m_ssaoEnabled; }
inline uint64_t getTargetFps() const { return m_targetFps; }
inline QualitySetting getQualitySetting() const { return m_qualitySetting; }
inline std::string getDefaultScene() const { return m_defaultScene; }
......
......@@ -12,6 +12,7 @@ struct Material {
ConstSharedTextureBase mainTexture;
ConstSharedTextureBase normalTexture;
ConstSharedTextureBase specularSmoothnessTexture;
ConstSharedTextureBase emissiveTexture;
SharedShaderProgram prog;
bool castShadow;
RenderQueue queue;
......
......@@ -77,6 +77,7 @@ private:
SharedTexture2D m_ssaoNoise;
SharedTexture2D m_ssaoKernel;
ACGL::OpenGL::SharedFrameBufferObject m_ssaoTarget;
ACGL::OpenGL::SharedFrameBufferObject m_gBufferObject;
......
......@@ -37,6 +37,7 @@ private:
std::vector<Entity> trajectories;
glm::dvec3 applyKepler(Planet::Handle planet, float dt);
SharedTexture2D m_terrainNoise;
public:
CONSTRUCT_SYSTEM(OrbitalSimulationSystem) {}
......
......@@ -105,6 +105,9 @@ bool SettingsSystem::startup() {
} else if (i.first == "fullscreen") {
VALIDATE_TYPE(i, bool);
m_fullscreen = i.second.get<bool>();
} else if (i.first == "ssao") {
VALIDATE_TYPE(i, bool);
m_ssaoEnabled = i.second.get<bool>();
} else if (i.first == "target_fps") {
VALIDATE_TYPE(i, int64_t);
m_targetFps = i.second.get<int64_t>();
......
......@@ -49,10 +49,12 @@ bool RendererSystem::startup() {
fx->startup();
}
// Set up framebuffer for deferred shading
auto windowSize = m_window->getSize();
glViewport(0, 0, windowSize.x, windowSize.y);
auto currentGBufferSize = G_BUFFER_SIZE[(int)m_quality];
m_colorBuffer = createScreenspaceTexture(currentGBufferSize, GL_RGBA16F);
......@@ -194,6 +196,8 @@ bool RendererSystem::startup() {
scale = glm::lerp(0.1f, 1.0f, scale * scale);
kern *= scale;
kern = (kern + glm::vec4(1.0, 1.0, 0, 0)) * glm::vec4(0.5, 0.5, 1.0, 1.0);
pixel[0] = (GLubyte)(kern.r * 255);
pixel[1] = (GLubyte)(kern.g * 255);
pixel[2] = (GLubyte)(kern.b * 255);
......@@ -208,7 +212,6 @@ bool RendererSystem::startup() {
kernelData->setFormat(GL_RGBA);
kernelData->setType(GL_UNSIGNED_BYTE);
m_ssaoKernel = std::make_shared<Texture2D>(GL_RGBA);
m_ssaoKernel->setMinFilter(GL_NEAREST);
m_ssaoKernel->setMagFilter(GL_NEAREST);
......@@ -222,7 +225,8 @@ bool RendererSystem::startup() {
auto nos = glm::vec4(random(-1.0f, 1.0f), random(-1.0f, 1.0f), 0.0f, 0);
nos = glm::normalize(nos);
nos = (nos + glm::vec4(1.0, 1.0, 0, 0)) * glm::vec4(0.5, 0.5, 1.0, 1.0);
pixel[0] = (GLubyte)(nos.r * 255);
pixel[1] = (GLubyte)(nos.g * 255);
pixel[2] = (GLubyte)(nos.b * 255);
......@@ -428,6 +432,13 @@ void RendererSystem::render(RenderPass& pass, double interp, double totalTime) {
drawCall.material.prog->setUniform("uHasSpecularSmoothnessMap", false);
}
if (drawCall.material.emissiveTexture) {
drawCall.material.prog->setTexture("uEmissiveMap", drawCall.material.emissiveTexture, 3);
drawCall.material.prog->setUniform("uHasEmissiveMap", true);
} else {
drawCall.material.prog->setUniform("uHasEmissiveMap", false);
}
drawCall.material.prog->setUniform("uFar", cam->far);
drawCall.material.prog->setUniform("uTime", (float)totalTime);
drawCall.material.prog->setUniform("uTintColor", drawCall.material.tintColor);
......
......@@ -40,6 +40,7 @@ bool OrbitalSimulationSystem::startup() {
// Debug lines
auto vaoCircle = VertexArrayObjectCreator("circle2.obj").create();
m_terrainNoise = Texture2DFileManager::the()->get(Texture2DCreator("noise.png"));
orbitTorus = { vaoCircle };
orbitTorus.vao->setMode(GL_LINES);
......@@ -79,7 +80,8 @@ bool OrbitalSimulationSystem::startup() {
planetMaterials[planet.name] = {glm::vec4(1, 1, 1, 1),
glm::vec4(0, 0, 0, 1),
texture,
m_terrainNoise,
nullptr,
nullptr,
nullptr,
planetShader,
......@@ -104,6 +106,7 @@ bool OrbitalSimulationSystem::startup() {
texture,
nullptr,
nullptr,
nullptr,
moonShader,
1,
RenderQueue::OPAQUE,
......@@ -114,6 +117,7 @@ bool OrbitalSimulationSystem::startup() {
texture,
nullptr,
nullptr,
nullptr,
testShader,
0,
RenderQueue::OPAQUE,
......@@ -124,9 +128,10 @@ bool OrbitalSimulationSystem::startup() {
texture,
nullptr,
nullptr,
nullptr,
atmosphereShader,
0,
RenderQueue::TRANSPARENT,
RenderQueue::TRANSPARENT,
GL_FRONT};
waterMat = {glm::vec4(0, 0.2, 0.8, 1),
......@@ -134,30 +139,33 @@ bool OrbitalSimulationSystem::startup() {
texture,
nullptr,
nullptr,
nullptr,
waterShader,
0,
RenderQueue::OPAQUE,
GL_BACK};
minimapItemMaterial = { glm::vec4{ 0.0, 0.0, 0.0, 1.0 },
glm::vec4{ 1.0, 0.0, 0.0, 1.0 },
texture,
nullptr,
nullptr,
itemShader,
false,
RenderQueue::OPAQUE,
GL_BACK };
playerIconMaterial = { glm::vec4{ 0.0, 0.0, 0.1, 1.0 },
glm::vec4{ 0.0, 0.0, 1.0, 1.0 },
texture,
nullptr,
nullptr,
playerIconShader,
false,
RenderQueue::OPAQUE,
GL_BACK };
minimapItemMaterial = {glm::vec4{0.0, 0.0, 0.0, 1.0},
glm::vec4{1.0, 0.0, 0.0, 1.0},
texture,
nullptr,
nullptr,
nullptr,
itemShader,
false,
RenderQueue::OPAQUE,
GL_BACK};
playerIconMaterial = {glm::vec4{0.0, 0.0, 0.1, 1.0},
glm::vec4{0.0, 0.0, 1.0, 1.0},
texture,
nullptr,
nullptr,
nullptr,
playerIconShader,
false,
RenderQueue::OPAQUE,
GL_BACK};
return true;
}
......
......@@ -81,7 +81,7 @@ bool AtmosphereTestScene::startup() {
m_renderer->setRenderPassActive("Skybox"_sh, false);
m_renderer->setRenderPassActive("Minimap"_sh, false);
m_renderer->setRenderPassSSAO("Cockpit"_sh, false);
m_renderer->setRenderPassSSAO("Cockpit"_sh, m_settings->getQualitySetting() == QualitySetting::High && m_settings->ssaoEnabled());
m_renderer->addRenderPass(consoleCamera, "Console"_sh, ScreenSpaceSize::HALF);
......@@ -102,7 +102,7 @@ bool AtmosphereTestScene::startup() {
loadingText = m_sceneGraph->create();
loadingText.assign<Drawable>(textGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 } * 10,
textTexture, nullptr, nullptr, textShader,
textTexture, nullptr, nullptr, nullptr, textShader,
false, RenderQueue::OPAQUE, GL_BACK },
0, m_renderer->getRenderPassId("Console"_sh));
......@@ -308,7 +308,7 @@ void AtmosphereTestScene::switchToMainScene() {
console.assign<Drawable>(
consoleGeom,
Material{glm::vec4{1, 1, 1, 1}, glm::vec4{1, 1, 1, 1},
m_renderer->getRenderPassTarget("Console"_sh), nullptr, nullptr,
m_renderer->getRenderPassTarget("Console"_sh), nullptr, nullptr, nullptr,
skyboxMaterial.prog, false, RenderQueue::OPAQUE, GL_NONE},
0, cockpitPassId);
auto consoleTransform = console.assign<Transform>();
......@@ -321,7 +321,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleFrontLeft.assign<Drawable>(
consoleFrontLeftGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
outOfOrderTexture, nullptr, nullptr,
outOfOrderTexture, nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleFrontLeft.assign<Transform>();
......@@ -330,7 +330,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleFrontRight.assign<Drawable>(
consoleFrontRightGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
outOfOrderTexture, nullptr, nullptr,
outOfOrderTexture, nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleFrontRight.assign<Transform>();
......@@ -339,7 +339,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleBackLeft.assign<Drawable>(
consoleBackLeftGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
m_renderer->getRenderPassTarget("Minimap"_sh), nullptr, nullptr,
m_renderer->getRenderPassTarget("Minimap"_sh), nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleBackLeft.assign<Transform>();
......@@ -348,7 +348,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleBackRight.assign<Drawable>(
consoleBackRightGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
outOfOrderTexture, nullptr, nullptr,
outOfOrderTexture, nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleBackRight.assign<Transform>();
......@@ -358,7 +358,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleMiddleLeft.assign<Drawable>(
consoleMiddleLeftGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
outOfOrderTexture, nullptr, nullptr,
outOfOrderTexture, nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleMiddleLeft.assign<Transform>()->scale = { -1, 1, 1 };
......@@ -367,7 +367,7 @@ void AtmosphereTestScene::switchToMainScene() {
consoleMiddleRight.assign<Drawable>(
consoleMiddleRightGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
outOfOrderTexture, nullptr, nullptr,
outOfOrderTexture, nullptr, nullptr, nullptr,
skyboxMaterial.prog, true, RenderQueue::OPAQUE, GL_NONE },
0, cockpitPassId);
consoleMiddleRight.assign<Transform>()->scale = { -1, 1, 1 };
......@@ -404,6 +404,7 @@ void AtmosphereTestScene::loadMainSceneResources() {
skyboxTexture,
nullptr,
nullptr,
nullptr,
skyboxShader,
false,
RenderQueue::OPAQUE,
......@@ -427,6 +428,7 @@ void AtmosphereTestScene::loadMainSceneResources() {
checkboardTexture,
nullptr,
nullptr,
nullptr,
sunShader,
false,
RenderQueue::OPAQUE,
......@@ -449,6 +451,8 @@ void AtmosphereTestScene::loadMainSceneResources() {
Texture2DCreator("cockpit_v2/cockpit_v2_outer_DefaultMaterial_Normal.png")),
Texture2DFileManager::the()->get(Texture2DCreator(
"cockpit_v2/cockpit_v2_outer_DefaultMaterial_SpecularSmoothness.png")),
Texture2DFileManager::the()->get(
Texture2DCreator("cockpit_v2/cockpit_v2_outer_DefaultMaterial_Emission.png")),
cockpitShader, true, RenderQueue::OPAQUE, GL_NONE };
cockpitGeometry = {vaoCockpit};
......@@ -457,7 +461,7 @@ void AtmosphereTestScene::loadMainSceneResources() {
Texture2DFileManager::the()->get(Texture2DCreator(
"cockpit_v2/"
"windshield_DefaultMaterial_AlbedoTransparency.png")),
nullptr, nullptr, cockpitShader, false,
nullptr, nullptr, nullptr, cockpitShader, false,
RenderQueue::OPAQUE, GL_NONE };
consoleGeom = Geometry{ VertexArrayObjectCreator("cockpit/cockpit_v2_maindisplay.obj").create() };
......
......@@ -42,7 +42,7 @@ void Console::startup() {
background = m_sceneGraph->create();
backgroundDrawable = background.assign<Drawable>(backgroundGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 } * 0.05,
textTexture, nullptr, nullptr, backgroundShader,
textTexture, nullptr, nullptr, nullptr, backgroundShader,
false, RenderQueue::OPAQUE, GL_BACK },
0, consolePassId);
......@@ -60,7 +60,7 @@ void Console::startup() {
text = m_sceneGraph->create();
textDrawable = text.assign<Drawable>(textGeom,
Material{glm::vec4{1, 1, 1, 1}, glm::vec4{1, 1, 1, 1},
textTexture, nullptr, nullptr, textShader,
textTexture, nullptr, nullptr, nullptr, textShader,
false, RenderQueue::OPAQUE, GL_BACK},
0, consolePassId);
......@@ -73,7 +73,7 @@ void Console::startup() {
auto letterA = m_sceneGraph->create();
letterADrawable = letterA.assign<Drawable>(aGeom,
Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
textTexture, nullptr, nullptr, textShader,
textTexture, nullptr, nullptr, nullptr, textShader,
false, RenderQueue::OPAQUE, GL_BACK },
0, consolePassId);
......@@ -90,7 +90,7 @@ void Console::startup() {
shotGeom = Geometry{ VertexArrayObjectCreator("intro_shot.obj").create() };
shotMaterial = Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
textTexture, nullptr, nullptr, textShader,
textTexture, nullptr, nullptr, nullptr, textShader,
false, RenderQueue::OPAQUE, GL_BACK };
for (char& c : enemyOrder) {
......@@ -107,7 +107,7 @@ void Console::startup() {
}
enemyMaterial = Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4(3, .4, .2, 1),
textTexture, nullptr, nullptr, textShader,
textTexture, nullptr, nullptr, nullptr, textShader,
false, RenderQueue::OPAQUE, GL_BACK };
}
......
......@@ -59,8 +59,8 @@ bool OrbitsScene::startup() {
Geometry geom2 = { vaoTeapot };
// Create a material that uses the loaded shader program
Material sunMaterial = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 2, 2, 1, 1 }, checkboardTexture, nullptr, nullptr, pbrShader, false, RenderQueue::OPAQUE, GL_BACK };
Material transparentMat = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 0, 0, 0, 1 }, testTransparencyTexture, nullptr, nullptr, pbrShader, false, RenderQueue::TRANSPARENT, GL_BACK };
Material sunMaterial = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 2, 2, 1, 1 }, checkboardTexture, nullptr, nullptr, nullptr, pbrShader, false, RenderQueue::OPAQUE, GL_BACK };
Material transparentMat = { glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 0, 0, 0, 1 }, testTransparencyTexture, nullptr, nullptr, nullptr, pbrShader, false, RenderQueue::TRANSPARENT, GL_BACK };
// Let's create a placeholder sun
auto scene = m_sceneGraph->create();
......