Added laser's lighting to texture shader
This commit is contained in:
parent
ea6c525d5d
commit
6490b0241f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\prima\Documents\JAVA\GRK_game_scene\Debug\grk-cw9.exe</FullPath>
|
||||
<FullPath>C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
|
@ -1,63 +1 @@
|
||||
main.cpp
|
||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(181,30): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(256,38): warning C4305: '=': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(279,16): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(327,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(396,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(426,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(440,98): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(443,68): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(504,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(536,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(565,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(574,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(597,80): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(703,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(715,108): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(723,87): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(723,223): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(726,59): warning C4305: 'argument': truncation from 'double' to 'T'
|
||||
with
|
||||
[
|
||||
T=float
|
||||
]
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(727,37): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(810,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(815,50): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(816,51): warning C4305: 'argument': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(878,21): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(880,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(903,17): warning C4101: 'data': unreferenced local variable
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(998,20): warning C4018: '<': signed/unsigned mismatch
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1055,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1056,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1057,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1081,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1082,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1083,32): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1119,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1120,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1121,28): warning C4305: 'initializing': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1297,21): warning C4305: '-=': truncation from 'double' to 'float'
|
||||
C:\Users\prima\Documents\JAVA\GRK_game_scene\cw 9\src\ex_9_1.hpp(1299,21): warning C4305: '+=': truncation from 'double' to 'float'
|
||||
Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
|
||||
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
|
||||
grk-cw9.vcxproj -> C:\Users\prima\Documents\JAVA\GRK_game_scene\Debug\grk-cw9.exe
|
||||
grk-cw9.vcxproj -> C:\Users\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
|
||||
Debug|Win32|C:\Users\prima\Documents\JAVA\GRK_game_scene\|
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionMFC=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:TargetPlatformVersion=10.0.22000.0:
|
||||
Debug|Win32|C:\Users\arciom\Desktop\GRK_game_scene_new2\|
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -15,6 +15,32 @@ uniform vec3 sunColor;
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 lightColor;
|
||||
|
||||
|
||||
uniform vec3 laserLightPos0;
|
||||
uniform vec3 laserLightPos1;
|
||||
uniform vec3 laserLightPos2;
|
||||
uniform vec3 laserLightPos3;
|
||||
uniform vec3 laserLightPos4;
|
||||
uniform vec3 laserLightPos5;
|
||||
uniform vec3 laserLightPos6;
|
||||
uniform vec3 laserLightPos7;
|
||||
uniform vec3 laserLightPos8;
|
||||
uniform vec3 laserLightPos9;
|
||||
uniform vec3 laserLightPos10;
|
||||
uniform vec3 laserLightPos11;
|
||||
uniform vec3 laserLightPos12;
|
||||
uniform vec3 laserLightPos13;
|
||||
uniform vec3 laserLightPos14;
|
||||
uniform vec3 laserLightPos15;
|
||||
uniform vec3 laserLightPos16;
|
||||
uniform vec3 laserLightPos17;
|
||||
uniform vec3 laserLightPos18;
|
||||
uniform vec3 laserLightPos19;
|
||||
|
||||
|
||||
uniform vec3 laserLightColor;
|
||||
|
||||
|
||||
uniform sampler2D colorTexture;
|
||||
in vec2 vecTex;
|
||||
|
||||
@ -130,7 +156,135 @@ void main()
|
||||
vec3 ilumination;
|
||||
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor,normal,viewDir);
|
||||
|
||||
//flashlight
|
||||
|
||||
//lasers light direction
|
||||
vec3 laserLightDir0 = normalize(laserLightPos0-worldPos);
|
||||
vec3 laserLightDir1 = normalize(laserLightPos1-worldPos);
|
||||
vec3 laserLightDir2 = normalize(laserLightPos2-worldPos);
|
||||
vec3 laserLightDir3 = normalize(laserLightPos3-worldPos);
|
||||
vec3 laserLightDir4 = normalize(laserLightPos4-worldPos);
|
||||
vec3 laserLightDir5 = normalize(laserLightPos5-worldPos);
|
||||
vec3 laserLightDir6 = normalize(laserLightPos6-worldPos);
|
||||
vec3 laserLightDir7 = normalize(laserLightPos7-worldPos);
|
||||
vec3 laserLightDir8 = normalize(laserLightPos8-worldPos);
|
||||
vec3 laserLightDir9 = normalize(laserLightPos9-worldPos);
|
||||
vec3 laserLightDir10 = normalize(laserLightPos10-worldPos);
|
||||
vec3 laserLightDir11 = normalize(laserLightPos11-worldPos);
|
||||
vec3 laserLightDir12 = normalize(laserLightPos12-worldPos);
|
||||
vec3 laserLightDir13 = normalize(laserLightPos13-worldPos);
|
||||
vec3 laserLightDir14 = normalize(laserLightPos14-worldPos);
|
||||
vec3 laserLightDir15 = normalize(laserLightPos15-worldPos);
|
||||
vec3 laserLightDir16 = normalize(laserLightPos16-worldPos);
|
||||
vec3 laserLightDir17 = normalize(laserLightPos17-worldPos);
|
||||
vec3 laserLightDir18 = normalize(laserLightPos18-worldPos);
|
||||
vec3 laserLightDir19 = normalize(laserLightPos19-worldPos);
|
||||
|
||||
|
||||
//LASERS LIGHTING
|
||||
float laserIntensity = pow(sin(time * 10.0), 2.0);
|
||||
|
||||
if((laserLightPos0.y > 0 && laserLightPos0.y < 2.2) && (laserLightPos0.z > -2.2 && laserLightPos0.z < 2.1) && (laserLightPos0.x > -1.72 && laserLightPos0.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos0-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir0,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos1.y > 0 && laserLightPos1.y < 2.2) && (laserLightPos1.z > -2.2 && laserLightPos1.z < 2.1) && (laserLightPos1.x > -1.72 && laserLightPos1.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos1-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir1,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos2.y > 0 && laserLightPos2.y < 2.2) && (laserLightPos2.z > -2.2 && laserLightPos2.z < 2.1) && (laserLightPos2.x > -1.72 && laserLightPos2.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos2-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir2,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos3.y > 0 && laserLightPos3.y < 2.2) && (laserLightPos3.z > -2.2 && laserLightPos3.z < 2.1) && (laserLightPos3.x > -1.72 && laserLightPos3.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos3-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir3,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos4.y > 0 && laserLightPos4.y < 2.2) && (laserLightPos4.z > -2.2 && laserLightPos4.z < 2.1) && (laserLightPos4.x > -1.72 && laserLightPos4.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos4-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir4,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos5.y > 0 && laserLightPos5.y < 2.2) && (laserLightPos5.z > -2.2 && laserLightPos5.z < 2.1) && (laserLightPos5.x > -1.72 && laserLightPos5.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos5-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir5,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos6.y > 0 && laserLightPos6.y < 2.2) && (laserLightPos6.z > -2.2 && laserLightPos6.z < 2.1) && (laserLightPos6.x > -1.72 && laserLightPos6.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos6-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir6,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos7.y > 0 && laserLightPos7.y < 2.2) && (laserLightPos7.z > -2.2 && laserLightPos7.z < 2.1) && (laserLightPos7.x > -1.72 && laserLightPos7.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos7-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir7,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos8.y > 0 && laserLightPos8.y < 2.2) && (laserLightPos8.z > -2.2 && laserLightPos8.z < 2.1) && (laserLightPos8.x > -1.72 && laserLightPos8.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos8-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir8,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos9.y > 0 && laserLightPos9.y < 2.2) && (laserLightPos9.z > -2.2 && laserLightPos9.z < 2.1) && (laserLightPos9.x > -1.72 && laserLightPos9.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos9-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir9,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos10.y > 0 && laserLightPos10.y < 2.2) && (laserLightPos10.z > -2.2 && laserLightPos10.z < 2.1) && (laserLightPos10.x > -1.72 && laserLightPos10.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos10-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir10,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos11.y > 0 && laserLightPos11.y < 2.2) && (laserLightPos11.z > -2.2 && laserLightPos11.z < 2.1) && (laserLightPos11.x > -1.72 && laserLightPos11.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos11-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir11,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos12.y > 0 && laserLightPos12.y < 2.2) && (laserLightPos12.z > -2.2 && laserLightPos12.z < 2.1) && (laserLightPos12.x > -1.72 && laserLightPos12.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos12-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir12,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos13.y > 0 && laserLightPos13.y < 2.2) && (laserLightPos13.z > -2.2 && laserLightPos13.z < 2.1) && (laserLightPos13.x > -1.72 && laserLightPos13.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos13-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir13,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos14.y > 0 && laserLightPos14.y < 2.2) && (laserLightPos14.z > -2.2 && laserLightPos14.z < 2.1) && (laserLightPos14.x > -1.72 && laserLightPos14.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos14-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir14,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos15.y > 0 && laserLightPos15.y < 2.2) && (laserLightPos15.z > -2.2 && laserLightPos15.z < 2.1) && (laserLightPos15.x > -1.72 && laserLightPos15.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos15-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir15,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos16.y > 0 && laserLightPos16.y < 2.2) && (laserLightPos16.z > -2.2 && laserLightPos16.z < 2.1) && (laserLightPos16.x > -1.72 && laserLightPos16.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos16-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir16,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos17.y > 0 && laserLightPos17.y < 2.2) && (laserLightPos17.z > -2.2 && laserLightPos17.z < 2.1) && (laserLightPos17.x > -1.72 && laserLightPos17.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos17-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir17,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos18.y > 0 && laserLightPos18.y < 2.2) && (laserLightPos18.z > -2.2 && laserLightPos18.z < 2.1) && (laserLightPos18.x > -1.72 && laserLightPos18.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos18-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir18,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
if((laserLightPos19.y > 0 && laserLightPos19.y < 2.2) && (laserLightPos19.z > -2.2 && laserLightPos19.z < 2.1) && (laserLightPos19.x > -1.72 && laserLightPos19.x < 1.78)){
|
||||
attenuatedlightColor = laserIntensity * laserLightColor/pow(length(laserLightPos19-worldPos),1.5);
|
||||
ilumination=ilumination+PBRLight(laserLightDir19,attenuatedlightColor,normal,viewDir);
|
||||
}
|
||||
|
||||
|
||||
//flashlight
|
||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||
vec3 spotlightDir= normalize(spotlightPos-worldPos);
|
||||
|
||||
|
@ -245,6 +245,8 @@ Core::RenderContext figureRandomContext1;
|
||||
Core::RenderContext figureRandomContext2;
|
||||
Core::RenderContext figureRandomContext3;
|
||||
|
||||
bool laserTexture = false;
|
||||
|
||||
|
||||
void updateDeltaTime(float time) {
|
||||
if (lastTime < 0) {
|
||||
@ -322,14 +324,13 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
|
||||
glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
|
||||
glUniform3f(glGetUniformLocation(program, "lightColor"), pointlightColor.x, pointlightColor.y, pointlightColor.z);
|
||||
|
||||
|
||||
//lasers light
|
||||
for (int i = 0; i < lasers.size(); i++) {
|
||||
std::string stringLaserPos = "laserLightPos";
|
||||
stringLaserPos += std::to_string(i);
|
||||
if (lasers[i].isLaserFly()) {
|
||||
glUniform3f(glGetUniformLocation(program, "laserLightColor"), laserLightColor.x, laserLightColor.y, laserLightColor.z);
|
||||
glUniform3f(glGetUniformLocation(program, stringLaserPos.c_str()), lasersLightPos[i].x, lasersLightPos[i].y, lasersLightPos[i].z);
|
||||
glUniform3f(glGetUniformLocation(programTex, "laserLightColor"), laserLightColor.x, laserLightColor.y, laserLightColor.z);
|
||||
glUniform3f(glGetUniformLocation(programTex, stringLaserPos.c_str()), lasersLightPos[i].x, lasersLightPos[i].y, lasersLightPos[i].z);
|
||||
/*glUniform3fv(glGetUniformLocation(program, "lasersLightPos"), 3, &lasersLightPos[i][0]);
|
||||
glUniform1i(glGetUniformLocation(program, "lasersLightPosArrayIndex"), i);*/
|
||||
}
|
||||
@ -806,12 +807,14 @@ void renderScene(GLFWwindow* window)
|
||||
spotlightPos = spaceShip.getSpaceShipPos() + 0.2 * spaceShip.getSpaceShipDir();
|
||||
spotlightConeDir = spaceShip.getSpaceShipDir();
|
||||
|
||||
glUseProgram(programTex);
|
||||
//draw lasers
|
||||
for (int i = 0; i < lasers.size(); i++) {
|
||||
if (lasers[i].isLaserFly()) {
|
||||
laserColor = glm::vec3(1, 0, 0);
|
||||
glUniform3f(glGetUniformLocation(programLaser, "laserColor"), laserColor.x, laserColor.y, laserColor.z);
|
||||
glUniform1f(glGetUniformLocation(program, "time"), time);
|
||||
glUniform1f(glGetUniformLocation(programTex, "time"), time);
|
||||
|
||||
drawLaser(lasers[i], lasersContexts[i], 0.1, i);
|
||||
drawLaser(lasers[i], lasersContexts[i], -0.1, i);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user