mass generating blue orbs progress

This commit is contained in:
ad044 2020-09-21 20:50:40 +04:00
parent c5fdf65e17
commit 7752314d9e
10 changed files with 246 additions and 65 deletions

View file

@ -9,6 +9,8 @@ import SSkn from "../../static/sprites/SSkn.png";
import SSKnActive from "../../static/sprites/SSkn_active.png"; import SSKnActive from "../../static/sprites/SSkn_active.png";
import Tda from "../../static/sprites/Tda.png"; import Tda from "../../static/sprites/Tda.png";
import TdaActive from "../../static/sprites/Tda_active.png"; import TdaActive from "../../static/sprites/Tda_active.png";
import GaTE from "../../static/sprites/GaTE.png";
import GaTEActive from "../../static/sprites/GaTE_active.png";
type BlueOrbContructorProps = { type BlueOrbContructorProps = {
sprite: string; sprite: string;
@ -33,6 +35,7 @@ const BlueOrb = memo((props: BlueOrbContructorProps) => {
Tda: [Tda, TdaActive], Tda: [Tda, TdaActive],
SSkn: [SSkn, SSKnActive], SSkn: [SSkn, SSKnActive],
Cou: [Cou, CouActive], Cou: [Cou, CouActive],
GaTE: [GaTE, GaTEActive],
} as SpriteToPath)[sprite]; } as SpriteToPath)[sprite];
}; };

View file

@ -44,33 +44,34 @@ const GrayPlanes = memo(() => {
}); });
return ( return (
<a.group // separate wrapper group to make it rotate around [0,0,0]
position={[0.1, 0, -2]} <a.group rotation-y={grayPlaneState.grayPlaneRotY}>
position-y={grayPlaneState.grayPlanePosY} <a.group
rotation={[0, 0, 0]} position={[0.1, 0, -2]}
rotation-y={grayPlaneState.grayPlaneRotY} position-y={grayPlaneState.grayPlanePosY}
ref={grayPlaneGroupRef} ref={grayPlaneGroupRef}
visible={grayPlanesVisible} visible={grayPlanesVisible}
> >
{grayPlaneRefs.map((ref, idx: number) => { {grayPlaneRefs.map((ref, idx: number) => {
return ( return (
<mesh <mesh
scale={[0.04, 10, 0.04]} scale={[0.04, 10, 0.04]}
position={grayPlanePoses[idx] as [number, number, number]} position={grayPlanePoses[idx] as [number, number, number]}
ref={ref} ref={ref}
key={idx} key={idx}
> >
<planeBufferGeometry attach="geometry" /> <planeBufferGeometry attach="geometry" />
<meshBasicMaterial <meshBasicMaterial
attach="material" attach="material"
color={0xd3d3d3} color={0xd3d3d3}
opacity={0.2} opacity={0.2}
transparent={true} transparent={true}
side={THREE.DoubleSide} side={THREE.DoubleSide}
/> />
</mesh> </mesh>
); );
})} })}
</a.group>
</a.group> </a.group>
); );
}); });

View file

@ -62,8 +62,9 @@ const GrayRing = memo((props: GrayRingProps) => {
vec4 color(vec2 vUv, int quadnum, bool textureexists, int thinperiod, int quadlen, float step) { vec4 color(vec2 vUv, int quadnum, bool textureexists, int thinperiod, int quadlen, float step) {
if (!textureexists) { if (!textureexists) {
return vec4(0.259,0.259,0.322, 1); return vec4(0.259,0.259,0.322, 1);
} else if (quadnum % 2 == 1) { } else if (uint(quadnum) % uint(2) == uint(1)) {
return texture2D(hole, vec2(tolocal(vUv.x, quadlen-thinperiod, step), vUv.y)); return texture2D(hole, vec2(tolocal(vUv.x, quadlen-thinperiod, step), vUv.y));
// return vec4(tolocal(vUv.x, quadlen-thinperiod, step), 0, 0, 1);
} else if (quadnum == 0) { } else if (quadnum == 0) {
return texture2D(lof, vec2(tolocal(vUv.x, quadlen-thinperiod, step), vUv.y)); return texture2D(lof, vec2(tolocal(vUv.x, quadlen-thinperiod, step), vUv.y));
} else { } else {
@ -84,18 +85,18 @@ const GrayRing = memo((props: GrayRingProps) => {
int quadlen = int(step)/4; int quadlen = int(step)/4;
// segment within circle's quad // segment within circle's quad
int quadel = int(segment) % quadlen; uint quadel = uint(segment) % uint(quadlen);
// which quad // which quad
int quadnum = int(segment) / quadlen; int quadnum = int(uint(segment) / uint(quadlen));
// how big thin part is // how big thin part is
int thinperiod = 8; int thinperiod = 8;
if (quadel < thinperiod && isheight(vUv.y, thin)) { if (quadel < uint(thinperiod) && isheight(vUv.y, thin)) {
// thin line // thin line
gl_FragColor = color(vUv, quadnum, false, thinperiod, quadlen, step); gl_FragColor = color(vUv, quadnum, false, thinperiod, quadlen, step);
} else if (quadel == thinperiod) { } else if (quadel == uint(thinperiod)) {
// slope up // slope up
float dist = tolocal(vUv.x, 1, step); float dist = tolocal(vUv.x, 1, step);
if (vUv.y > slope(1.0-dist, thin) && vUv.y < 1.0-slope(1.0-dist, thin)) { if (vUv.y > slope(1.0-dist, thin) && vUv.y < 1.0-slope(1.0-dist, thin)) {
@ -103,7 +104,7 @@ const GrayRing = memo((props: GrayRingProps) => {
} else { } else {
gl_FragColor = vec4(0, 0, 0, 0); gl_FragColor = vec4(0, 0, 0, 0);
} }
} else if (quadel == quadlen-1) { } else if (quadel == uint(quadlen-1)) {
// slope down // slope down
float dist = tolocal(vUv.x, 1, step); float dist = tolocal(vUv.x, 1, step);
if (vUv.y > slope(dist, thin) && vUv.y < 1.0-slope(dist, thin)) { if (vUv.y > slope(dist, thin) && vUv.y < 1.0-slope(dist, thin)) {
@ -111,7 +112,7 @@ const GrayRing = memo((props: GrayRingProps) => {
} else { } else {
gl_FragColor = vec4(0, 0, 0, 0); gl_FragColor = vec4(0, 0, 0, 0);
} }
} else if (quadel > thinperiod) { } else if (quadel > uint(thinperiod)) {
gl_FragColor = color(vUv, quadnum, true, thinperiod, quadlen, step); gl_FragColor = color(vUv, quadnum, true, thinperiod, quadlen, step);
} else { } else {
// transparent // transparent

View file

@ -11,8 +11,6 @@ import { a, useSpring } from "@react-spring/three";
import { useRecoilValue } from "recoil"; import { useRecoilValue } from "recoil";
import { hudActiveAtom } from "./HUDElementAtom"; import { hudActiveAtom } from "./HUDElementAtom";
import { currentHUDAtom } from "./HUDElementAtom"; import { currentHUDAtom } from "./HUDElementAtom";
import level_y_values from "../../resources/level_y_values.json";
import { currentBlueOrbAtom } from "../BlueOrb/CurrentBlueOrbAtom";
export type HUDElementProps = { export type HUDElementProps = {
hudVisibility: boolean; hudVisibility: boolean;
@ -38,11 +36,10 @@ export type BlueOrbHuds = {
type LevelYValues = { type LevelYValues = {
[level: string]: number; [level: string]: number;
}; };
const HUDElement = memo((props: HUDElementProps) => { const HUDElement = memo((props: HUDElementProps) => {
const currentBlueOrbHUD = useRecoilValue(currentHUDAtom); const currentBlueOrbHUD = useRecoilValue(currentHUDAtom);
const currentBlueOrb = useRecoilValue(currentBlueOrbAtom);
const hudActive = useRecoilValue(hudActiveAtom); const hudActive = useRecoilValue(hudActiveAtom);
const { bigHUDPositionX } = useSpring({ const { bigHUDPositionX } = useSpring({

View file

@ -7,7 +7,7 @@ export const camPosYAtom = atom({
export const camRotYAtom = atom({ export const camRotYAtom = atom({
key: "camRotYAtom", key: "camRotYAtom",
default: -0.55, default: 2.75,
}); });
// export const camPosYAtom = atom({ // export const camPosYAtom = atom({

View file

@ -88,18 +88,18 @@ const PurpleRing = memo((props: PurpleRingProps) => {
float thick = 1.0; float thick = 1.0;
float slopefactor = 1.0; float slopefactor = 1.0;
int halfc = int(step)/2; uint halfc = uint(step)/uint(2);
// segment within circle // segment within circle
int segment = int(floor(vUv.x * step)); uint segment = uint(floor(vUv.x * step));
int thinperiod = halfc-8; uint thinperiod = halfc-uint(8);
int halfel = segment % halfc; uint halfel = segment % halfc;
if (halfel < thinperiod-1 && istop(vUv.y, thin)) { if (halfel < thinperiod-uint(1) && istop(vUv.y, thin)) {
// thin line top // thin line top
gl_FragColor = color(vUv, step, false); gl_FragColor = color(vUv, step, false);
} else if (halfel == thinperiod - 1) { } else if (halfel == thinperiod - uint(1)) {
// thin line and corner // thin line and corner
float dist = tolocal(vUv.x, 1, step); float dist = tolocal(vUv.x, 1, step);
float val = 1.0-slope(1.0-dist, thin); float val = 1.0-slope(1.0-dist, thin);
@ -117,10 +117,10 @@ const PurpleRing = memo((props: PurpleRingProps) => {
} else { } else {
gl_FragColor = vec4(0, 0, 0, 0); gl_FragColor = vec4(0, 0, 0, 0);
} }
} else if (halfel == thinperiod+1 && isbottom(vUv.y, thin)) { } else if (halfel == thinperiod+uint(1) && isbottom(vUv.y, thin)) {
// thin line bottom // thin line bottom
gl_FragColor = vec4(0.325,0.325,0.698, 1); gl_FragColor = vec4(0.325,0.325,0.698, 1);
} else if (halfel == thinperiod + 2) { } else if (halfel == thinperiod + uint(2)) {
// slope up // slope up
float dist = tolocal(vUv.x, 1, step); float dist = tolocal(vUv.x, 1, step);
float val = 1.0-slope(1.0-dist, thin); float val = 1.0-slope(1.0-dist, thin);
@ -129,10 +129,10 @@ const PurpleRing = memo((props: PurpleRingProps) => {
} else { } else {
gl_FragColor = vec4(0, 0, 0, 0); gl_FragColor = vec4(0, 0, 0, 0);
} }
} else if (halfel > thinperiod + 2 && halfel < thinperiod+7) { } else if (halfel > thinperiod + uint(2) && halfel < thinperiod+uint(7)) {
// thick part // thick part
gl_FragColor = color(vUv, step, true); gl_FragColor = color(vUv, step, true);
} else if (halfel == thinperiod+7) { } else if (halfel == thinperiod+uint(7)) {
// slope up // slope up
float dist = tolocal(vUv.x, 1, step); float dist = tolocal(vUv.x, 1, step);
float val = slope(dist, thin); float val = slope(dist, thin);

View file

@ -33,7 +33,7 @@
"up": "", "up": "",
"down": "", "down": "",
"left": "0506", "left": "0506",
"right": "" "right": "+0520"
}, },
"0515": { "0515": {
"up": "", "up": "",
@ -47,10 +47,16 @@
"left": "+0517", "left": "+0517",
"right": "" "right": ""
}, },
"0500": { "0517": {
"up": "0508", "up": "",
"down": "", "down": "",
"left": "+0517", "left": "+0500",
"right": ""
},
"0500": {
"up": "",
"down": "",
"left": "0510",
"right": "" "right": ""
} }
} }

View file

@ -161,22 +161,62 @@
}, },
"17": { "17": {
"long": { "long": {
"position": [-0.45, 0.15, -8.6], "position": [0.85, 0.15, -8.6],
"scale": [1, 0.03, 1], "scale": [1, 0.03, 1],
"type": "normal", "type": "mirrored",
"initial_position": [-1.45, 0.15, -8.6] "initial_position": [1.45, 0.15, -8.6]
}, },
"boring": { "boring": {
"position": [0.48, 0.174, -8.6], "position": [-0.1, 0.174, -8.6],
"scale": [1, 0.03, 1], "scale": [1, 0.03, 1],
"type": "normal", "type": "mirrored",
"initial_position": [1.48, 0.174, -8.6] "initial_position": [-1.48, 0.174, -8.6]
}, },
"big": { "big": {
"position": [0.36, 0.13, -8.6], "position": [-0.35, 0.13, -8.6],
"scale": [0.5, 0.06, 1],
"type": "mirrored",
"initial_position": [-1.36, 0.13, -8.6]
}
},
"10": {
"long": {
"position": [-0.45, -0.09, -8.6],
"scale": [1, 0.03, 1],
"type": "normal",
"initial_position": [-1.45, -0.09, -8.6]
},
"boring": {
"position": [0.5, -0.07, -8.6],
"scale": [1, 0.03, 1],
"type": "normal",
"initial_position": [1.48, -0.07, -8.6]
},
"big": {
"position": [0.35, -0.12, -8.6],
"scale": [0.5, 0.06, 1], "scale": [0.5, 0.06, 1],
"type": "normal", "type": "normal",
"initial_position": [1.36, 0.13, -8.6] "initial_position": [1.36, -0.12, -8.6]
}
},
"20": {
"long": {
"position": [0.85, 0.15, -8.6],
"scale": [1, 0.03, 1],
"type": "mirrored",
"initial_position": [1.45, 0.15, -8.6]
},
"boring": {
"position": [-0.1, 0.174, -8.6],
"scale": [1, 0.03, 1],
"type": "mirrored",
"initial_position": [-1.48, 0.174, -8.6]
},
"big": {
"position": [-0.35, 0.13, -8.6],
"scale": [0.5, 0.06, 1],
"type": "mirrored",
"initial_position": [-1.36, 0.13, -8.6]
} }
} }
} }

View file

@ -0,0 +1,98 @@
{
"05": {
"position": [0.4, -0.25, 1.3],
"rotation": [0, 0.2, 0]
},
"14": {
"position": [-0.35, 0, 1.3],
"rotation": [0, -0.15, 0]
},
"22": {
"position": [-0.35, 0.3, 1.3],
"rotation": [0, -0.15, 0]
},
"06": {
"position": [-0.35, -0.25, 1.3],
"rotation": [0, -0.25, 0]
},
"13": {
"position": [0.4, 0, 1.3],
"rotation": [0, 0.27, 0]
},
"15": {
"position": [-1, 0, 0.95],
"rotation": [0, -0.9, 0]
},
"08": {
"position": [-1.3, 0, 0.3],
"rotation": [0, -1.4, 0]
},
"00": {
"position": [-1.3, -0.25, 0.3],
"rotation": [0, -1.4, 0]
},
"10": {
"position": [-0.85, 0, -1.05],
"rotation": [0, -2.45, 0]
},
"16": {
"position": [-1.3, 0.3, 0.3],
"rotation": [0, -1.4, 0]
},
"17": {
"position": [-1.25, 0.3, -0.5],
"rotation": [0, -1.85, 0]
},
"20": {
"position": [1, 0.3, 0.9],
"rotation": [0, 0.69, 0]
},
"12": {
"position": [1, 0, 0.9],
"rotation": [0, 0.69, 0]
},
"4": {
"position": [1, -0.25, 0.9],
"rotation": [0, 0.69, 0]
},
"21": {
"position": [0.4, 0.3, 1.3],
"rotation": [0, 0.27, 0]
},
"23": {
"position": [-1, 0.3, 0.95],
"rotation": [0, -0.9, 0]
},
"07": {
"position": [-1, -0.25, 0.95],
"rotation": [0, -0.9, 0]
},
"09": {
"position": [-1.25, 0, -0.5],
"rotation": [0, -1.85, 0]
},
"01": {
"position": [-1.25, -0.25, -0.5],
"rotation": [0, -1.85, 0]
},
"18": {
"position": [-0.85, 0.3, -1.05],
"rotation": [0, -2.45, 0]
},
"02": {
"position": [-0.85, -0.25, -1.05],
"rotation": [0, -2.45, 0]
},
"03": {
"position": [-0.15, -0.25, -1.3],
"scale": [0.25, 0.15, 0.25]
},
"11": {
"position": [-0.15, 0, -1.3],
"scale": [0.25, 0.15, 0.25]
},
"19": {
"position": [-0.15, 0.3, -1.3],
"scale": [0.25, 0.15, 0.25]
}
}

View file

@ -37,14 +37,14 @@
"5": { "5": {
"position": [0.4, 1.87, 1.3], "position": [0.4, 1.87, 1.3],
"scale": [0.25, 0.15, 0.25], "scale": [0.25, 0.15, 0.25],
"rotation": [0, 0.09, 0], "rotation": [0, 0.27, 0],
"sprite": "Dc", "sprite": "Dc",
"id": "0513" "id": "0513"
}, },
"6": { "6": {
"position": [-1, 1.87, 0.95], "position": [-1, 1.87, 0.95],
"scale": [0.25, 0.15, 0.25], "scale": [0.25, 0.15, 0.25],
"rotation": [0, -0.8, 0], "rotation": [0, -0.9, 0],
"sprite": "Tda", "sprite": "Tda",
"id": "0515" "id": "0515"
}, },
@ -70,10 +70,45 @@
"id": "0517" "id": "0517"
}, },
"10": { "10": {
"position": [-1.25, 2.17, -0.5], "position": [-0.85, 1.87, -1.05],
"scale": [0.25, 0.15, 0.25],
"rotation": [0, -2.45, 0],
"sprite": "Cou",
"id": "0510"
},
"11": {
"position": [1, 2.17, 0.9],
"scale": [0.25, 0.15, 0.25],
"rotation": [0, 0.69, 0],
"sprite": "Cou",
"id": "0520"
},
"12": {
"position": [-1.3, 0.3, 0.3],
"scale": [0.25, 0.15, 0.25],
"rotation": [0, -1.4, 0],
"sprite": "Cou",
"id": "0416"
},
"13": {
"position": [-1.25, 0.3, -0.5],
"scale": [0.25, 0.15, 0.25], "scale": [0.25, 0.15, 0.25],
"rotation": [0, -1.85, 0], "rotation": [0, -1.85, 0],
"sprite": "GaTE",
"id": "0417"
},
"14": {
"position": [1, 0.3, 0.9],
"scale": [0.25, 0.15, 0.25],
"rotation": [0, 0.69, 0],
"sprite": "Tda", "sprite": "Tda",
"id": "0510" "id": "0420"
},
"15": {
"position": [-0.15, 1.61, -1.3],
"scale": [0.25, 0.15, 0.25],
"rotation": [0, -2.85, 0],
"sprite": "Cou",
"id": "0603"
} }
} }