forked from janhsimon/openxr-vulkan-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added / tweaked some materials with new properties and blend modes. A…
…dded transparent material.
- Loading branch information
tdbe
committed
Feb 24, 2023
1 parent
32bfc35
commit 05f6d35
Showing
6 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
layout(location = 0) in vec3 normal; | ||
layout(location = 1) in vec4 color; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
|
||
void main() | ||
{ | ||
const vec3 lightDir = vec3(1.0, -1.0, -1.0); | ||
const float diffuse = clamp(dot(normal, -lightDir), 0.0, 1.0); | ||
|
||
const vec3 ambient = vec3(0.07, 0.05, 0.1); | ||
|
||
outColor = vec4(ambient + color.xyz * diffuse, color.w); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#extension GL_EXT_multiview : enable | ||
|
||
layout(binding = 0) uniform DynBufData | ||
{ | ||
mat4 worldMatrix; | ||
vec4 colorMultiplier; | ||
} dynBufData; | ||
|
||
layout(binding = 1) uniform ViewProjection | ||
{ | ||
mat4 matrices[2]; | ||
} viewProjection; | ||
|
||
layout(location = 0) in vec3 inPosition; | ||
layout(location = 1) in vec3 inNormal; | ||
layout(location = 2) in vec3 inColor; | ||
//layout(location = 3) in vec3 colorMultiplier; | ||
|
||
layout(location = 0) out vec3 normal; // In world space | ||
layout(location = 1) out vec4 color; | ||
|
||
void main() | ||
{ | ||
gl_Position = viewProjection.matrices[gl_ViewIndex] * dynBufData.worldMatrix * vec4(inPosition, 1.0); | ||
|
||
normal = normalize(vec3(dynBufData.worldMatrix * vec4(inNormal, 0.0))); | ||
color.xyz = inColor | ||
* dynBufData.colorMultiplier.xyz; | ||
color.w = dynBufData.colorMultiplier.w; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
layout(location = 0) in vec3 normal; | ||
layout(location = 1) in vec3 color; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
|
||
void main() | ||
{ | ||
const vec3 lightDir = vec3(1.0, -1.0, -1.0); | ||
const float diffuse = clamp(dot(normal, -lightDir), 0.0, 1.0); | ||
|
||
const vec3 ambient = vec3(0.07, 0.05, 0.1); | ||
|
||
outColor = vec4(ambient + color * diffuse, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#extension GL_EXT_multiview : enable | ||
|
||
layout(binding = 0) uniform World | ||
{ | ||
mat4 matrix; | ||
} world; | ||
|
||
layout(binding = 1) uniform ViewProjection | ||
{ | ||
mat4 matrices[2]; | ||
} viewProjection; | ||
|
||
layout(location = 0) in vec3 inPosition; | ||
layout(location = 1) in vec3 inNormal; | ||
layout(location = 2) in vec3 inColor; | ||
//layout(location = 3) in vec3 colorMultiplier; | ||
|
||
layout(location = 0) out vec3 normal; // In world space | ||
layout(location = 1) out vec3 color; | ||
|
||
void main() | ||
{ | ||
gl_Position = viewProjection.matrices[gl_ViewIndex] * world.matrix * vec4(inPosition, 1.0); | ||
|
||
normal = normalize(vec3(world.matrix * vec4(inNormal, 0.0))); | ||
color = inColor | ||
;//*colorMultiplier; | ||
} |