Skip to content

Commit

Permalink
-house texture test
Browse files Browse the repository at this point in the history
  • Loading branch information
neuroprod committed Dec 10, 2023
1 parent 9f81b5c commit c1ad9a7
Show file tree
Hide file tree
Showing 58 changed files with 1,485 additions and 1,507 deletions.
Binary file modified frontend/public/outside.bin
Binary file not shown.
2,886 changes: 1,390 additions & 1,496 deletions frontend/public/outside.json

Large diffs are not rendered by default.

Binary file modified frontend/public/textures/bigtree_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/bigtree_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/bigtree_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/birdHouse_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/birdHouse_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/birdHouse_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/can_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/can_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/can_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/textures/door_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/textures/door_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/textures/door_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fens_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fens_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fens_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fern_AC_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fern_AC_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/fern_AC_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/flowerBase_AC_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/flowerBase_AC_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/grass_AC_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/groundFront_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/groundFront_MRA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/groundFront_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/ground_Color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/textures/ground_MRA.png
Binary file modified frontend/public/textures/ground_Normal.png
Binary file added frontend/public/textures/house_Color.png
Binary file added frontend/public/textures/house_MRA.png
Binary file added frontend/public/textures/house_Normal.png
Binary file modified frontend/public/textures/mailBox_Normal.png
Binary file modified frontend/public/textures/midGround_Color.png
Binary file modified frontend/public/textures/midGround_MRA.png
Binary file modified frontend/public/textures/midGround_Normal.png
Binary file modified frontend/public/textures/pineLeaves_AC_Color.png
Binary file modified frontend/public/textures/pineLeaves_AC_Normal.png
Binary file modified frontend/public/textures/pot_Color.png
Binary file modified frontend/public/textures/pot_MRA.png
Binary file modified frontend/public/textures/pot_Normal.png
Binary file modified frontend/public/textures/shovel_Color.png
Binary file modified frontend/public/textures/shovel_MRA.png
Binary file modified frontend/public/textures/shovel_Normal.png
Binary file modified frontend/public/textures/sky_Color.png
Binary file modified frontend/public/textures/sky_MRA.png
Binary file modified frontend/public/textures/sky_Normal.png
Binary file modified frontend/public/textures/smallPine_Color.png
Binary file modified frontend/public/textures/smallPine_MRA.png
Binary file modified frontend/public/textures/smallPine_Normal.png
12 changes: 9 additions & 3 deletions frontend/src/GameModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import mapRange = gsap.utils.mapRange;
import Trigger from "./trigers/Trigger";
import HitTrigger from "./trigers/HitTrigger";
import UI from "./lib/UI/UI";
import HitInfoTrigger from "./trigers/HitInfoTrigger";
import Texture from "./lib/textures/Texture";
import Drawing from "./drawing/Drawing";



Expand Down Expand Up @@ -41,7 +44,7 @@ class GameModel {
dayNight: number = 0;
lockView: boolean =false;


public drawingByLabel: { [label: string]: Drawing } = {};
private triggers:Array<Trigger>=[]

private _hitObjectLabel: string ="";
Expand All @@ -52,7 +55,7 @@ class GameModel {
this.makeTriggers();
}
private makeTriggers() {
this.triggers.push(new HitTrigger(Scenes.ROOM, "door_HO"))
this.triggers.push(new HitInfoTrigger(Scenes.ROOM, "door_HO"))
}
update(){
for(let t of this.triggers){
Expand Down Expand Up @@ -80,14 +83,17 @@ class GameModel {
if(value == this._hitObjectLabel){
return;
}
UI.logEvent("HIT",value)


this.hitStateChange =true;
this.hitObjectLabelPrev = this._hitObjectLabel;
this._hitObjectLabel = value;
}


getDrawingByLabel(label: string) {
return this.drawingByLabel[label];
}
}

export default new GameModel()
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export default class Main {
RenderSettings.onUI();
UI.popWindow()

this.drawer.onUI();
this.drawer.onUI();

}

Expand Down
6 changes: 6 additions & 0 deletions frontend/src/PreloadData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const preloadImages = [
"desk_Color",
"desk_MRA",
"desk_Normal",
"door_Color",
"door_MRA",
"door_Normal",
"fens_Color",
"fens_MRA",
"fens_Normal",
Expand Down Expand Up @@ -96,6 +99,9 @@ export const preloadImages = [
"hamer_Color",
"hamer_MRA",
"hamer_Normal",
"house_Color",
"house_MRA",
"house_Normal",
"ivy_Color",
"ivy_MRA",
"ivy_Normal",
Expand Down
29 changes: 28 additions & 1 deletion frontend/src/drawing/Drawing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ import Quad from "../lib/meshes/Quad";
import Object3D from "../lib/core/Object3D";
import {Vector3} from "math.gl";
import ColorV from "../lib/ColorV";
import gsap from "gsap";




export default class Drawing extends Model{
public drawData: DrawData;
public numInstances: number;
public numDrawInstances: number;
public numDrawInstancesMax: number;
public firstDrawInstances: number;
private buffer: GPUBuffer;
worldParent: Object3D;
progress:number =1
start:number =0;
offset =new Vector3();
protected color: ColorV = new ColorV(1, 1, 1, 1)
position=new Vector3();
private tl:gsap.core.Timeline;

constructor(renderer:Renderer,label:string,numInstances:number=0) {
super(renderer,label);

this.numInstances =numInstances
this.numDrawInstances=numInstances
this.numDrawInstancesMax=numInstances;
Expand All @@ -46,7 +55,8 @@ export default class Drawing extends Model{
this.position.lerp(target,1.0)
this.setPosition(this.position.x,this.position.y,this.position.z);
}
this.numDrawInstances =Math.floor(this.progress*this.numDrawInstancesMax)
this.firstDrawInstances =Math.floor(this.start*this.numDrawInstancesMax);
this.numDrawInstances =Math.floor(this.progress*this.numDrawInstancesMax)- this.firstDrawInstances;
super.update()
}

Expand Down Expand Up @@ -84,4 +94,21 @@ export default class Drawing extends Model{
if(parent=="world")return;
this.worldParent = this.renderer.modelByLabel[parent];
}

show() {

if(this.tl) this.tl.clear();
this.tl =gsap.timeline();
if(this.start==0 && this.progress==1)return;
this.start=0;
this.progress=0;
this.tl.to(this,{progress:1,ease:"power2.inOut",duration:1.5},0);
}

hideDelay(delay: number) {

if(this.tl) this.tl.clear();
this.tl =gsap.timeline();
this.tl.to(this,{start:0.5,progress:0.5,ease:"power2.in",duration:0.2},delay);
}
}
6 changes: 4 additions & 2 deletions frontend/src/drawing/DrawingPreloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Renderer from "../lib/Renderer";
import PreLoader from "../lib/PreLoader";
import DrawingLoader from "./DrawingLoader";
import Drawing from "./Drawing";
import GameModel from "../GameModel";


export default class DrawingPreloader{
Expand All @@ -14,11 +15,12 @@ export default class DrawingPreloader{
load(renderer:Renderer,preloader:PreLoader) {
let drawings =["bird_birdHouse","fish_world","gooutside_door_HO","house_house","woods_world","demon_world","demonback_world","nice_world"];

for(let files of drawings){
for(let file of drawings){

let name = "drawings/"+files+".bin";
let name = "drawings/"+file+".bin";

let drawing = new DrawingLoader(renderer,preloader,name);
GameModel.drawingByLabel[file] =drawing;
this.drawings.push(drawing)
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/drawing/DrawingRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default class DrawingRenderer{
model.mesh.numIndices,
model.numDrawInstances,
0,
0
0,
model.firstDrawInstances,
);
}

Expand Down
29 changes: 29 additions & 0 deletions frontend/src/trigers/HitInfoTrigger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import HitTrigger from "./HitTrigger";
import GameModel, {Scenes} from "../GameModel";
import UI from "../lib/UI/UI";

export default class HitInfoTrigger extends HitTrigger{

constructor(scene:Scenes,objectLabel:string) {
super(scene,objectLabel);


}
public over() {
UI.logEvent("Over", this.objectLabel);
let drawing =GameModel.getDrawingByLabel("gooutside_door_HO")
drawing.show()
}

public out() {
UI.logEvent("Out", this.objectLabel);
let drawing =GameModel.getDrawingByLabel("gooutside_door_HO")
drawing.hideDelay(2);
}
public click(){

UI.logEvent("Click", this.objectLabel);

}

}
19 changes: 16 additions & 3 deletions frontend/src/trigers/HitTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import GameModel, {Scenes} from "../GameModel";
import UI from "../lib/UI/UI";

export default class HitTrigger extends Trigger{
private objectLabel: string;
protected objectLabel: string;
constructor(scene:Scenes,objectLabel:string) {
super(scene);
this.objectLabel =objectLabel;

}
check() {
if(!super.check())return false;

if(GameModel.mouseDownThisFrame){
if(GameModel.hitObjectLabel ==this.objectLabel){
this.click()
}

}


if(!GameModel.hitStateChange)return
if(GameModel.hitObjectLabel ==this.objectLabel) {
this.over()
Expand All @@ -26,11 +35,15 @@ export default class HitTrigger extends Trigger{

}

private over() {
protected over() {
//UI.logEvent("Over", this.objectLabel);
}

private out() {
protected out() {
// UI.logEvent("Out", this.objectLabel);
}

protected click() {

}
}

0 comments on commit c1ad9a7

Please sign in to comment.