Commit ab90ed94 authored by Max Bebök's avatar Max Bebök

chg: added better custom texture support, removed debug logging

parent be0cf63e
......@@ -17,11 +17,11 @@ The current released and prebuilt stable version is: **2.2.0**
#36 - added a button in the launcher to open the Wiki <br/>
#dev - Clone / Add now generates a new HashId (by using the biggest one + 1) <br/>
#dev - Cloning an actor will not put the new one in focus (allows for multi-click on that button) <br/>
#dev - Adding actors (buttons on the left side in shrine/field editor) <br/>
#dev - Actor templates added (left side), allow easy creation of event systems like doors <br/>
#dev - experimental visualization of actor links in 3d-view (render-settings on the left, very slow in field editor) <br/>
#dev - Adding new actors (buttons on the left side in shrine/field editor) <br/>
#dev - Actor templates added (left side), allows easy creation of event systems like doors <br/>
#dev - experimental visualization of actor links in 3d-view (render-settings on the left, slow in field editor) <br/>
#dev - experimental support for the 4 main dungeons (aka "remains") via the shrine list or map <br/>
#dev - (WIP) special event actors have custom textures <br/>
#dev - (WIP) some special event actors now have custom textures <br/>
**Launcher** <br/>
#55 - right after starting, support for WebGL2 is checked to avoid later errors, if unsupported a message is shown <br/>
......
......@@ -38,8 +38,6 @@ module.exports = class Shrine_Editor extends Mubin_Editor
generateMubinPath(actorType)
{
const mapDir = this.mubinName.startsWith("Remains") ? "MainFieldDungeon" : "CDungeon";
console.log(this);
console.log(this.mubinDir, "Map", mapDir, this.mubinName, `${this.mubinName}_${actorType}.smubin`);
return path.join(this.mubinDir, "Map", mapDir, this.mubinName, `${this.mubinName}_${actorType}.smubin`);
}
......
......@@ -5,6 +5,7 @@
*/
const Renderer_Helpep_Texture = require("./texture.js");
const Special_Texture = require('../../mubin_editor/actor/object/special_texture');
const Base = require("./base.js");
const CUBE_COLORS = [
......@@ -27,12 +28,7 @@ module.exports = class Renderer_Helper_Model extends Base
this.helperShader = helperShader;
this.helperTexture = new Renderer_Helpep_Texture(this.THREE);
this.specialTextures = {
"default": new THREE.TextureLoader().load("assets/img/texture_grid_01.png"),
"LookTag": new THREE.TextureLoader().load("assets/img/texture_cam.png"),
"LinkTagAnd": new THREE.TextureLoader().load("assets/img/texture_and.png"),
"Area": new THREE.TextureLoader().load("assets/img/texture_area.png"),
};
this.defaultTexture = new THREE.TextureLoader().load("assets/img/texture_grid_01.png");
}
_createTexture(textureData, name)
......@@ -131,9 +127,7 @@ module.exports = class Renderer_Helper_Model extends Base
let texture = textureColor ? this._createTexture(textureColor, `${modelName}_color`) : undefined;
if(!texture)
{
return this.specialTextures[modelName]
? this.specialTextures[modelName]
: this.specialTextures.default;
return Special_Texture.get(modelName) || this.defaultTexture;
}
return texture;
}
......
......@@ -13,6 +13,7 @@ const BFRES_Container = requireGlobal('lib/bfres/container');
//const Actor_Object = require('./../actor_object'); // old
const Actor_Object = require('./object');
const Special_Texture = require('./special_texture');
const BYAML = require("byaml-lib");
const BXML = requireGlobal("lib/bxml/bxml");
......@@ -58,8 +59,13 @@ module.exports = class Actor_Object_Loader
this.actorInfo[actor.name.value] = actor;
}
for(let actorName of ["__DEFAULT_BOX", "LookTag", "LinkTagAnd"])
Special_Texture.getNames();
for(let actorName of ["__DEFAULT_BOX", ...Special_Texture.getNames()])
{
if(actorName == "Area")
continue;
const objGroup = this.mubinRenderer.renderer.createObjectGroup(actorName);
objGroup.add(await this.mubinRenderer.renderer.createInstancedBox(actorName));
objGroup.userData = {type: "actor", visible: false};
......
/**
* @copyright 2018 - Max Bebök
* @author Max Bebök
* @license GNU-GPLv3 - see the "LICENSE" file in the root directory
*/
const fs = require("fs-extra");
const path = require("path");
let textures = undefined;
/**
* handles special textures for actors such as event tags (And, Or, ...)
*/
class Special_Texture
{
static load()
{
if(!textures)
{
textures = {};
const files = fs.readdirSync(path.join(__BASE_PATH, 'assets', 'img', 'special'));
for(let file of files)
{
const fileName = file.split(".")[0];
textures[fileName] = new THREE.TextureLoader().load("assets/img/special/" + file);
}
}
}
static getNames()
{
return Object.keys(textures);
}
static get(name)
{
return textures[name];
}
};
Special_Texture.load();
module.exports = Special_Texture;
\ No newline at end of file
......@@ -74,7 +74,6 @@ module.exports = class Mubin_Renderer
}
}
}
console.log(this.shrineGroup);
}
setTerrainModel(model)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment