mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: spaced armor in space caught shell
This commit is contained in:
1 parent
fe0fdc0964
commit
647c9240a5
4 files changed
+103
-7
No files matched your search
@@ -15,6 +15,7 @@ interface ArmorMeshProps extends MeshProps {
|
||||
canSplash: boolean;
|
||||
ricochet?: number;
|
||||
normalization?: number;
|
||||
isAffectedBySpaced: boolean;
|
||||
}
|
||||
|
||||
// shader split: https://github.com/FarazzShaikh/THREE-CustomShaderMaterial/issues/48
|
||||
@@ -26,6 +27,7 @@ export function ArmorMesh({
|
||||
canRicochet,
|
||||
ricochet,
|
||||
canSplash,
|
||||
isAffectedBySpaced,
|
||||
normalization,
|
||||
spaced = false,
|
||||
...props
|
||||
@@ -62,6 +64,7 @@ export function ArmorMesh({
|
||||
spaced: { value: spaced ?? false },
|
||||
canRicochet: { value: canRicochet },
|
||||
canSplash: { value: canSplash },
|
||||
isAffectedBySpaced: { value: isAffectedBySpaced },
|
||||
}}
|
||||
vertexShader={vertex}
|
||||
fragmentShader={opaqueArmor && !spaced ? fragmentOpaque : fragment}
|
||||
|
||||
@@ -9,6 +9,7 @@ uniform float normalization;
|
||||
uniform bool spaced;
|
||||
uniform bool canRichochet;
|
||||
uniform bool canSplash;
|
||||
uniform bool isAffectedBySpaced;
|
||||
|
||||
void main() {
|
||||
vec3 normalizedNormal = normalize(vNormal);
|
||||
@@ -45,14 +46,22 @@ void main() {
|
||||
|
||||
if (canSplash) {
|
||||
if (spaced) {
|
||||
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
||||
if (isAffectedBySpaced) {
|
||||
csm_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
|
||||
} else {
|
||||
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
||||
}
|
||||
} else {
|
||||
// color taken directly from the game
|
||||
csm_FragColor = vec4(1.0, 0.392, 0.0, alpha);
|
||||
}
|
||||
} else {
|
||||
if (spaced) {
|
||||
csm_FragColor = vec4(0.0, 0.0, 1.0, alpha);
|
||||
if (isAffectedBySpaced) {
|
||||
csm_FragColor = vec4(0.0, 0.0, 1.0, 0.5);
|
||||
} else {
|
||||
csm_FragColor = vec4(0.0, 0.0, 1.0, alpha);
|
||||
}
|
||||
} else {
|
||||
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user