Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
{
"imports": {
"three": "./build/Scripts/Libs/three.module.min.js",
"three/examples/jsm/loaders/GLTFLoader": "./build/Scripts/Libs/examples/jsm/loaders/GLTFLoader.js"
"three/webgpu": "./build/Scripts/Libs/three.webgpu.min.js",
"three/tsl": "./build/Scripts/Libs/three.tsl.min.js"
}
}
</script>
Expand Down
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

app.commandLine.appendSwitch('enable-unsafe-webgpu', 'true');
app.commandLine.appendSwitch('high-dpi-support', 'true');
app.commandLine.appendSwitch('force-device-scale-factor', '1');

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { MapObject, Player } from '../Core';
import { Common, Core, Data, EventCommand, Graphic, Main, Manager, Model, Scene } from '../index';

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Mathf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';

/**
* Static math utilities used across the engine.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Autotiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Manager } from '../index';
import { Autotile } from './Autotile';
import { CustomGeometry } from './CustomGeometry';
Expand Down
19 changes: 9 additions & 10 deletions src/Core/Battler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import { MeshPhongMaterial } from 'three';
import * as THREE from 'three/webgpu';
import { uniform } from 'three/tsl';
import {
ALIGN,
ALIGN_VERTICAL,
Expand Down Expand Up @@ -165,8 +165,8 @@ export class Battler {
const material = Manager.GL.createMaterial({
texture: copiedTexture,
uniforms: {
colorD: { type: 'v4', value: Manager.GL.screenTone.clone() },
offset: { type: 'v2', value: this.animationOffset },
colorD: uniform(Manager.GL.screenTone.clone()),
offset: uniform(this.animationOffset),
},
});
const { width, height } = Manager.GL.getMaterialTextureSize(material);
Expand All @@ -178,7 +178,6 @@ export class Battler {
this.mesh.position.set(this.position.x, this.position.y, this.position.z);
this.mesh.receiveShadow = true;
this.mesh.castShadow = true;
this.mesh.customDepthMaterial = material.userData.customDepthMaterial;
this.topLeftPosition = new THREE.Vector3(
this.position.x - (this.width / 2) * Data.Systems.SQUARE_SIZE,
this.position.y + this.height * Data.Systems.SQUARE_SIZE,
Expand Down Expand Up @@ -211,7 +210,7 @@ export class Battler {
* Initialize UV mapping for the battler mesh.
* */
initializeTexture(): void {
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as MeshPhongMaterial);
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as THREE.MeshPhongNodeMaterial);
const w = (this.width * Data.Systems.SQUARE_SIZE) / width;
const h = (this.height * Data.Systems.SQUARE_SIZE) / height;
const texA = new THREE.Vector2();
Expand Down Expand Up @@ -239,7 +238,7 @@ export class Battler {
frame = this.frame.value;
break;
}
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as MeshPhongMaterial);
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as THREE.MeshPhongNodeMaterial);
const w = (this.width * Data.Systems.SQUARE_SIZE) / width;
const h = (this.height * Data.Systems.SQUARE_SIZE) / height;
const x = frame * w;
Expand Down Expand Up @@ -277,11 +276,11 @@ export class Battler {
*/
setActive(active: boolean) {
this.active = active;
const material = this.mesh.material as THREE.MeshPhongMaterial;
const material = this.mesh.material as THREE.MeshPhongNodeMaterial;
if (active) {
material.userData.uniforms.colorD.value.copy(Manager.GL.screenTone);
material.userData.uniforms.colorD = uniform(Manager.GL.screenTone);
} else {
material.userData.uniforms.colorD.value.copy(Manager.GL.screenTone.clone().subScalar(0.3));
material.userData.uniforms.colorD = uniform(Manager.GL.screenTone.clone().subScalar(0.3));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Mathf, ORIENTATION, ScreenResolution } from '../Common';
import { Data, Manager, Model, Scene } from '../index';
import { MapObject } from './MapObject';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/CustomGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Mathf } from '../Common';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Core/CustomGeometryFace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Mathf } from '../Common';
import { CustomGeometry } from './CustomGeometry';

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { CHARACTER_KIND, GROUP_KIND, ITEM_KIND, Paths, Platform, Utils } from '../Common';
import { Data, Manager, Model, Scene } from '../index';
import { Chrono } from './Chrono';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Land.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Mathf, Utils } from '../Common';
import { Data } from '../index';
import { CollisionSquare } from './CollisionSquare';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/MapElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Utils } from '../Common';
import { CollisionSquare } from './CollisionSquare';
import { Position } from './Position';
Expand Down
7 changes: 3 additions & 4 deletions src/Core/MapObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import {
ELEMENT_MAP_KIND,
Mathf,
Expand Down Expand Up @@ -59,7 +59,7 @@ class MapObject {
public isHero: boolean;
public movingState: Record<string, any>;
public previousPosition: THREE.Vector3;
public mesh: THREE.Mesh<CustomGeometry, THREE.MeshPhongMaterial>;
public mesh: THREE.Mesh<CustomGeometry, THREE.MeshPhongNodeMaterial>;
public meshBoundingBox: THREE.Mesh<CustomGeometry, THREE.Material | THREE.Material[]>[];
public currentBoundingBox: THREE.Mesh<CustomGeometry, THREE.Material | THREE.Material[]>;
public boundingBoxSettings: Record<string, any>;
Expand Down Expand Up @@ -658,7 +658,6 @@ class MapObject {
if (Scene.Map.current.mapProperties.isSunLight) {
this.mesh.receiveShadow = true;
this.mesh.castShadow = true;
this.mesh.customDepthMaterial = material.userData.customDepthMaterial;
}
this.mesh.position.set(this.position.x, this.position.y, this.position.z);
this.mesh.renderOrder = 1;
Expand Down Expand Up @@ -1519,7 +1518,7 @@ class MapObject {
!this.isNone() &&
this.currentStateInstance.graphicKind !== ELEMENT_MAP_KIND.OBJECT_3D
) {
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as THREE.MeshPhongMaterial);
const { width, height } = Manager.GL.getMaterialTextureSize(this.mesh.material as THREE.MeshPhongNodeMaterial);
let w: number, h: number, x: number, y: number;
if (this.currentStateInstance.graphicID === 0) {
w = (this.width * Data.Systems.SQUARE_SIZE) / width;
Expand Down
13 changes: 3 additions & 10 deletions src/Core/MapPortion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Constants, CUSTOM_SHAPE_KIND, ELEMENT_MAP_KIND, SHAPE_KIND } from '../Common';
import { Data, Manager, Model, Scene } from '../index';
import { Autotile } from './Autotile';
Expand Down Expand Up @@ -204,7 +204,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
this.staticFloorsMesh.receiveShadow = true;
this.staticFloorsMesh.castShadow = true;
this.staticFloorsMesh.customDepthMaterial = material.userData.customDepthMaterial;
}
Scene.Map.current.scene.add(this.staticFloorsMesh);
}
Expand All @@ -216,7 +215,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
autotiles.mesh.receiveShadow = true;
autotiles.mesh.castShadow = true;
autotiles.mesh.customDepthMaterial = autotiles.bundle.material.userData.customDepthMaterial;
}
Scene.Map.current.scene.add(autotiles.mesh);
}
Expand Down Expand Up @@ -294,7 +292,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
this.staticSpritesMesh.receiveShadow = true;
this.staticSpritesMesh.castShadow = true;
this.staticSpritesMesh.customDepthMaterial = material.userData.customDepthMaterial;
}
Scene.Map.current.scene.add(this.staticSpritesMesh);
}
Expand All @@ -305,7 +302,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
this.faceSpritesMesh.castShadow = true;
this.faceSpritesMesh.receiveShadow = true;
this.faceSpritesMesh.customDepthMaterial = material.userData.customDepthMaterial;
}
Scene.Map.current.scene.add(this.faceSpritesMesh);
}
Expand All @@ -327,7 +323,7 @@ class MapPortion {
}
// Constructing the geometry
let obj = hash.get(sprite.id);
let material: THREE.MeshPhongMaterial;
let material: THREE.MeshPhongNodeMaterial;
let geometry: CustomGeometry;
let count: number;
if (obj) {
Expand Down Expand Up @@ -363,7 +359,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
mesh.receiveShadow = true;
mesh.castShadow = true;
mesh.customDepthMaterial = obj.material.userData.customDepthMaterial;
}
mesh.layers.enable(1);
this.staticWallsList.push(mesh);
Expand Down Expand Up @@ -418,7 +413,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
mountains.mesh.receiveShadow = true;
mountains.mesh.castShadow = true;
mountains.mesh.customDepthMaterial = mountains.bundle.material.userData.customDepthMaterial;
}
mountains.mesh.layers.enable(1);
Scene.Map.current.scene.add(mountains.mesh);
Expand Down Expand Up @@ -491,7 +485,7 @@ class MapPortion {

// Constructing the geometry
let obj = hash.get(pictureID);
let material: THREE.MeshPhongMaterial;
let material: THREE.MeshPhongNodeMaterial;
let geometry: CustomGeometry;
let count: number;
if (obj) {
Expand Down Expand Up @@ -536,7 +530,6 @@ class MapPortion {
if (Scene.Map.current.mapProperties.isSunLight) {
mesh.receiveShadow = true;
mesh.castShadow = true;
mesh.customDepthMaterial = obj.material.userData.customDepthMaterial;
}
mesh.layers.enable(1);
Scene.Map.current.scene.add(mesh);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Mountain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Utils } from '../Common';
import { Data, Model } from '../index';
import { CustomGeometry } from './CustomGeometry';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Mountains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Manager } from '../index';
import { CustomGeometry } from './CustomGeometry';
import { StructMapElementCollision } from './MapElement';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Object3D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Model } from '..';
import { CustomGeometry } from './CustomGeometry';
import { MapElement, StructMapElementCollision } from './MapElement';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Object3DBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Mathf, OBJECT_COLLISION_KIND } from '../Common';
import { Data, Model } from '../index';
import { CustomGeometry } from './CustomGeometry';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Object3DCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { CUSTOM_SHAPE_KIND, Mathf, OBJECT_COLLISION_KIND } from '../Common';
import { Data, Model } from '../index';
import { CustomGeometry } from './CustomGeometry';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Portion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Constants } from '../Common';
import { Data } from '../index';

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Constants, Mathf } from '../Common';
import { Data } from '../index';
import { Portion } from './Portion';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { ELEMENT_MAP_KIND, Mathf, Utils } from '../Common';
import { Core, Data, Scene } from '../index';
import { CustomGeometry } from './CustomGeometry';
Expand Down
2 changes: 1 addition & 1 deletion src/Core/SpriteWall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { PICTURE_KIND } from '../Common';
import { Data } from '../index';
import { CustomGeometry } from './CustomGeometry';
Expand Down
4 changes: 2 additions & 2 deletions src/Core/TextureBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
http://rpg-paper-maker.com/index.php/eula.
*/

import * as THREE from 'three';
import * as THREE from 'three/webgpu';
import { Rectangle } from './Rectangle';

/** @class
* Several textures in a single file.
*/
class TextureBundle {
public list: any[][];
public material: THREE.MeshPhongMaterial;
public material: THREE.MeshPhongNodeMaterial;
public beginID: number;
public beginPoint: number[];
public endID: number;
Expand Down
Loading