Using the color of the lights for the flame color.
This commit is contained in:
parent
f5fd73fd1d
commit
53557b80c4
@ -72,8 +72,8 @@
|
||||
<yOffset>2</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<rColour>1.0</rColour>
|
||||
<gColour>1.0</gColour>
|
||||
<bColour>1.0</bColour>
|
||||
<gColour>0.9</gColour>
|
||||
<bColour>0.3</bColour>
|
||||
<intensity>4.0</intensity>
|
||||
<flameOffset>-1.5</flameOffset>
|
||||
</light>
|
||||
|
@ -1,7 +1,10 @@
|
||||
#version 150
|
||||
|
||||
in vec3 fColor;
|
||||
|
||||
out vec4 oColor;
|
||||
|
||||
|
||||
void main() {
|
||||
oColor = vec4(1.0, 0.0, 0.0, 0.5);
|
||||
oColor = vec4(fColor, 0.5);
|
||||
}
|
||||
|
@ -6,7 +6,10 @@ uniform bool bottom;
|
||||
uniform bool left;
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 256) out;
|
||||
layout(triangle_strip, max_vertices = 146) out;
|
||||
|
||||
in vec3 Color[];
|
||||
out vec3 fColor;
|
||||
|
||||
const float PI = 3.1415926;
|
||||
const float transition_point = 1.178097;
|
||||
@ -27,6 +30,8 @@ float radiusFunction(float x) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
fColor = Color[0];
|
||||
|
||||
float resolution = 8.0;
|
||||
float step = abs(end-begin)/resolution/2.0;
|
||||
float i = 0.0;
|
||||
|
@ -3,7 +3,11 @@
|
||||
uniform mat4 viewProjectionMatrix;
|
||||
|
||||
in vec3 aPosition;
|
||||
in vec3 aColor;
|
||||
|
||||
out vec3 Color;
|
||||
|
||||
void main () {
|
||||
Color = aColor;
|
||||
gl_Position = viewProjectionMatrix * vec4(aPosition, 1.0);
|
||||
}
|
||||
|
17
graphics.cc
17
graphics.cc
@ -59,6 +59,7 @@ void Graphics::init(Level* level) {
|
||||
|
||||
flame_positions_ab = SharedArrayBuffer(new ArrayBuffer());
|
||||
flame_positions_ab->defineAttribute("aPosition", GL_FLOAT, 3);
|
||||
flame_positions_ab->defineAttribute("aColor", GL_FLOAT, 3);
|
||||
flame_positions = SharedVertexArrayObject(new VertexArrayObject());
|
||||
flame_positions->setMode(GL_POINTS);
|
||||
flame_positions->attachAllAttributes(flame_positions_ab);
|
||||
@ -314,17 +315,21 @@ void Graphics::updateLights() {
|
||||
lightingShader->setUniform("directionalIntensity",
|
||||
level->getDirectionalLight()->getIntensity());
|
||||
}
|
||||
float flamePositionsData[closestLights.size() * 3] = {};
|
||||
float flameData[closestLights.size() * 6] = {};
|
||||
int flameIndex = 0;
|
||||
for (unsigned int i = 0; i<closestLights.size(); i++) {
|
||||
if (closestLights.at(i).getFlameYOffset() != 0.0f) {
|
||||
flamePositionsData[flameIndex + 0] = closestLights.at(i).getPosition().x;
|
||||
flamePositionsData[flameIndex + 1] = closestLights.at(i).getPosition().y + closestLights.at(i).getFlameYOffset();
|
||||
flamePositionsData[flameIndex + 2] = closestLights.at(i).getPosition().z;
|
||||
flameIndex+=3;
|
||||
flameData[flameIndex + 0] = closestLights.at(i).getPosition().x;
|
||||
flameData[flameIndex + 1] = closestLights.at(i).getPosition().y + closestLights.at(i).getFlameYOffset();
|
||||
flameData[flameIndex + 2] = closestLights.at(i).getPosition().z;
|
||||
flameData[flameIndex + 3] = closestLights.at(i).getColour().r;
|
||||
flameData[flameIndex + 3] = closestLights.at(i).getColour().r;
|
||||
flameData[flameIndex + 4] = closestLights.at(i).getColour().g;
|
||||
flameData[flameIndex + 5] = closestLights.at(i).getColour().b;
|
||||
flameIndex+=6;
|
||||
}
|
||||
}
|
||||
flame_positions_ab->setDataElements(flameIndex, flamePositionsData);
|
||||
flame_positions_ab->setDataElements(flameIndex, flameData);
|
||||
}
|
||||
|
||||
void Graphics::resize(glm::uvec2 windowSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user