Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
neuroprod committed Apr 30, 2024
1 parent 8cf0675 commit 0b0698e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
4 changes: 3 additions & 1 deletion frontend/public/GameModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import Sit from "../src/transitions/Sit";
import Pants3D from "../src/extras/Pants3D";
import TextInfoLock from "../src/transitions/TextInfoLock";
import Clock from "../src/extras/Clock";
import ColorV from "../src/lib/ColorV";

export enum StateGold {
START,
Expand Down Expand Up @@ -277,8 +278,9 @@ class GameModel {
private stopCount: number = 0;
offsetY: number =0;
clock: Clock;
temp1 =new Vector3(-21,0,0)
temp1 =new Vector3(0,0,0)
temp2 =new Vector3()
tempC: ColorV =new ColorV(1,0,0,1);

constructor() {

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,7 @@ export default class Main {
// UI.LFloatSlider(GameModel,"offsetY",-5,1)
//UI.LFloatSlider(GameModel,"sceneHeight",2,5)
//GameModel.textHandler.onUI()
UI.LVector("temp1",GameModel.temp1)
UI.LVector("temp2",GameModel.temp2)

this.canvasRenderPass.onUI();
let speed = UI.LBool("Go fast", GameModel.devSpeed);
if (speed != GameModel.devSpeed) {
Expand All @@ -601,6 +600,9 @@ export default class Main {
localStorage.removeItem("devData");
UI.clearLocalData();
}
UI.LVector("temp1",GameModel.temp1);
UI.LVector("temp2",GameModel.temp2);
UI.LColor("tempC",GameModel.tempC);
UI.separator("Windows");

UIData.performance = (UI.LBool("Preformance", UIData.performance));
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/extras/ParticlesGold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {BlendFactor, BlendOperation} from "../lib/WebGPUConstants";
import Timer from "../lib/Timer";
import gsap from "gsap";
import GameModel from "../../public/GameModel";
import renderSettings from "../RenderSettings";
export default class ParticlesGold{
private renderer: Renderer;
public model:Model
Expand All @@ -18,7 +19,7 @@ export default class ParticlesGold{
this.model.mesh = new Plane(this.renderer)
this.model.material =new Material(renderer,"partGoldMat",new ParticlesGoldShader(renderer,"partGoldShader"))
this.model.material.depthWrite =true
this.model.numInstances =200;
this.model.numInstances =100;
this.model.setEuler(Math.PI/2,0,0)
this.model.visible =false;
let data =new Float32Array( this.model.numInstances*4)
Expand Down Expand Up @@ -54,7 +55,7 @@ export default class ParticlesGold{

color: {
srcFactor: BlendFactor.One,
dstFactor: BlendFactor.One,
dstFactor: BlendFactor.OneMinusSrcAlpha,
operation: BlendOperation.Add,
},
alpha: {
Expand All @@ -70,6 +71,8 @@ export default class ParticlesGold{
if(!this.model.visible)return;
this.model.material.uniforms.setUniform("time",Timer.time)
this.model.material.uniforms.setUniform("fade",this.fade);
// this.model.material.uniforms.setUniform("color",GameModel.tempC);
//this.model.material.uniforms.setUniform("sett",GameModel.temp1);
this.model.setPosition(-25.10,-0.125,-2.05)
// this.model.setEuler(Math.random()*6,Math.random()*6,Math.random()*6)
}
Expand Down
18 changes: 11 additions & 7 deletions frontend/src/extras/ParticlesGoldShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Shader from "../lib/core/Shader";
import {ShaderType} from "../lib/core/ShaderTypes";
import Camera from "../lib/Camera";
import ModelTransform from "../lib/model/ModelTransform";
import {Vector4} from "math.gl";
import MathArray from "@math.gl/core/src/classes/base/math-array";


export default class ParticlesGoldShader extends Shader{
Expand All @@ -16,12 +18,14 @@ export default class ParticlesGoldShader extends Shader{
this.addAttribute("aUV0", ShaderType.vec2);
this.addAttribute("instanceData", ShaderType.vec4,1,"instance");
}
this.addUniform("sett", new Vector4(0.04,0.18,-0.00) as MathArray);
this.addUniform("color", new Vector4(1,1,0.67,1) as MathArray);
this.addUniform("time", 0);
this.addUniform("fade", 0);

this.needsTransform =true;
this.needsCamera=true;
this.logShaderCode =true;

}
getShaderCode(): string {
return /* wgsl */ `
Expand Down Expand Up @@ -70,8 +74,8 @@ fn mainVertex( ${this.getShaderAttributes()} ) -> VertexOutput
{
var output : VertexOutput;
var pos = aPos;
pos.x *=0.005;
pos.z*=0.2;
pos.x *=uniforms.sett.x/10.0;
pos.z*=uniforms.sett.y;
let off = (instanceData.x +uniforms.time*instanceData.z)%1.0;
pos.z +=off;
output.al =vec2(1.0-off,instanceData.w);
Expand All @@ -94,16 +98,16 @@ fn mainFragment(@location(0) uv0: vec2f,@location(1) al: vec2f) -> GBufferOutput
if(a<0.9) {
discard;
}
a*=0.9;
output.color =vec4(a,a,a,a);
output.color =uniforms.color;
output.normal =vec4(0.0,0.0,1.0,1.0);
output.mra =vec4(0.0,1.0,1.0,0.0);
output.mra =vec4(0.0,1.0,1.0,uniforms.sett.z);
return output;
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/transitions/DigGrave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export default class DigGrave extends Transition {

RenderSettings.fadeToBlack(1, 2)
setTimeout(() => {
RenderSettings.dof_Settings.z =1;
RenderSettings.onChange()
this.pantsAnime();
}, 5000);
}
Expand All @@ -59,11 +61,11 @@ export default class DigGrave extends Transition {
GameModel.renderer.modelByLabel["skeletonPants"].visible = true
GameModel.characterHandler.face.lookGold();
GameModel.characterHandler.setAnimationOnce("goldPants", 0, () => {
GameModel.outside.particlesGold.show(0.0);
GameModel.textHandler.showHitTrigger("digGraveDone",true,-1)
GameModel.outside.particlesGold.show(0.0);
GameModel.textHandler.showHitTrigger("digGraveDone",true,-1)
GameModel.gameUI.cursor.show(CURSOR.NEXT)
this.state=2
/* */

});
}

Expand Down

0 comments on commit 0b0698e

Please sign in to comment.