React.js project futher implemented!
Major version reached! v1.0.0 baby!
For 0.0.27 - 0.0.28 see below vvv
This milestone marks the addition of React and Next support for pxlNav.
Before now it was purely written as an ESM module,
The separation of ESM and CJS was a bit bothersome, especially for someone who doesn't know React or Next
I just know JavaScript
I'm an environment kitty, not a framework kitty
- pxlNav now loads as a component and attempts to draw to screen in
React&NextJS - pxlNav Types and Component files added; JSX & TS with D-Types
- pxlNav is still formatted in ESM, and intended to be ran in Native JS as a Module for better dynamic loading of rooms.
- GLTF/GLB Rooms are now supported; Supported scene files - FBX, GLTF, GLB
Please note, if you are using pxlNav in React or NextJS,
Put room JS files in ./src/pxlRooms/ROOM_NAME
Put room assets in ./public/pxlRooms/ROOM_NAME/Assets
pxlNav is still formatted in ESM. I still intend for dynamic loads to be a primary strength of pxlNav to recieve server requests to load files on the fly from the server. Building for React/Next requires all script files are known and compiled together. This restricts the dynamicality of pxlNav, and some of the main reasons it was written outside of React to begin with.
If you don't need server derived loads, this doesn't pertain to you.
At that point, you'd already find what rooms are available on initial load, auth verification.
To run pxlNav in React or Next, you must agregate the room scene files before the site is compiled.
So if you get a server request to load a new, unknown, room, React will inform you the scene files can't be loaded.
Warning you that script files can't be loaded from outside of the module.
I'll do my best to test React & Next builds of pxlNav are stable with all core functionality
But please submit any bugs as issues on github should you come across 'em.
React.js & Next.js support in ./src/react-next-dev is initial pass of pxlNav as a component;
These are in development and will be moved to ./examples when working
-
FileIO.jsno longer auto applying diffuse map to emissive map -
pxlNav.jshas two new callbacks you can listen to,step&render-prep -
FileIO.jsinstances use normal of instance-to-mesh, up = cross( (0,1,0), normal ) -
FileIO.js+Room Environmenthas mesh-to-particle support set in FBX using thepSystem(bool) custom attribute
-
FileIO.jssplitloadRoomFBX()intoloadPath(),loadRoom(),loadRoomGLTF(), andloadRoomFile()
-loadRoomFile()performs all mesh + object checks in the scene file
-loadRoom()checks file extention and runs eitherloadRoomFBX()orloadRoomGLTF()
-loadPath()takes a file path and runsloadRoom() -
FileIO.jsall room loading functions take a settings[object] now, to aid with backwards compatability in the future -
FileIO.jsnow hassetLogging( bool ),getSettings(), &readSettings()
-meshIsChild(defaultfalse) is used when your GLB is optimized to split mesh + transforms, where the child of the named transform is the geometry itself.
- Not all GLB's have split mesh + transforms by default, and would be a manual step in asset development.
If you aren't manually optimizing your GLB, then leave thisfalse
-getSettings()returns -
let settingsObj = {
'fileType' : this.pxlEnums.FILE_TYPE.AUTO,
'filePath' : '',
'meshKey' : '',
'meshIsChild' : false,
'enableLogging' : false
};
- Can be used -
let loadSettings = Option.assign( {}, this.pxlFile.getSettings() );
loadSettings['filePath'] = this.sceneFile;
loadSettings['enableLogging'] = true;
let fieldFbxLoader = this.pxlFile.loadRoom( this, loadSettings );
// -- or file specific --
// `fileType` is optional, default is `AUTO`
let loadSettings = {
'filePath' : this.assetPath + "OutletEnvironment.glb",
'fileType' : this.pxlEnums.FILE_TYPE.GLB,
'meshIsChild' : true,
'enableLogging' : true
};
let fieldFbxLoader = this.pxlFile.loadRoomGLB( this, loadSettings );
FileIO.jsremoved enableLogging from the list of args to pass to loadRoomFBXFileIO.jsadded GLTF + GLB support
- Usethis.pxlFile.loadRoomGLB
- Or you can usethis.pxlFile.loadRoomno matter your file type
let loadSettings = Object.assign( {}, this.pxlFile.getSettings() );
loadSettings['fileType'] = this.pxlEnums.FILE_TYPE.GLB; // Optional; Default is 'AUTO'
loadSettings['filePath'] = this.assetPath+"OutletEnvironment.glb";
loadSettings['meshIsChild'] = true; // If your GLB has been "optimized" to split transforms & meshes
loadSettings['enableLogging'] = true;
let fieldFbxLoader = this.pxlFile.loadRoom( this, loadSettings );
-
FileIO.jsinstances use normal of instance-to-mesh, up = cross( (0,1,0), normal )
- Up isn't imported or exported by default in Three / CGI programs
- If no normals, a random vector * ( 1, 0, 1 ) is calculated -
package.jsonprepping the repo for the Next.js + React.js projects to be added -
pxlNav.js+Environment.jswere never reaching load state for pxlRoom module
- Attempt to catch errors & check for methods added mostly toEnvironment.js -
Device.jscatches failed promises / rejections; global catch for missed erroneous Promises / Async
- May error twice, but shouldn't error in the first place; saving potential heart ache.
Testing to be had still... unit test failed promises
pxlNav.jshas two new callbacks you can listen to,step&render-prep
-stepruns every frame, will return -
event = {
'time': #.# - Time since pxlNav started in seconds
'delta': #.# - Time since last `step()`,
}
- render-prep fires after shaders & animations update, but before the room step() -
event = {
'time': this.pxlTimer.runtime
}
-
File.jsno longer auto applying diffuse map to emissive map
- Was applying the diffuse map to emissive to quickly make objects brighter, but that was implemented for Antib0dy.Club, which didn't need shadows. Now it's hindering shadow influence. So it's been removed. -
File.js+room envmaterialList items can store more mesh options on*material*.meshSetting={}
-castShadow,receiveShadow,frontSided, &doubleSidedas booleans
-frontSidedtrue is 'front', false is 'back'
-doubleSidedtrue is 'double' sided, false is 'front' -
FileIO.js+Room Environmenthas mesh-to-particle support set in FBX using thepSystem(bool) custom attribute
- This will parse a geometry object to a buffer object of merged verticies
- Access it from your Room --
import { fireflyVert, fireflyFrag } from "./Shaders.js";
// Build a mesh-to-particle system for the fireflies
// Using the `fireflies_vfx` geometry from the CampfireEnvironment.fbx
// Marked with the custom property `pSystem = true`
buildFireflies(){
let nameOfSystem = "fireflies_vfx";
if( this.particleList?.hasOwnProperty( nameOfSystem ) && this.particleList[nameOfSystem].type == "BufferGeometry" ){
let fireflyUniforms = {
'atlasTexture' : { type:'t', value: null },
'atlasAlphaTexture' : { type:'t', value: null },
'noiseTexture' : { type:"t", value: null },
'pointScale' : { type: "v", value: new Vector2( 5.0, 0.0 ) },
'tint' : { type: "c", value: new Color( 1.5, 1.4, 0.6 ) }
};
fireflyUniforms.atlasTexture.value = this.pxlUtils.loadTexture( "sprite_dustAtlas_rgb.jpg", null, {'encoding':SRGBColorSpace} );
fireflyUniforms.atlasAlphaTexture.value = this.pxlUtils.loadTexture( "sprite_dustAtlas_alpha.jpg" );
// -- -- --
// Make the firefly system itself
let fireflySystem = new ParticleBase( this, "fireflySystem" );
// Build settings using the ParticleBase class's `getSettings()` method
let fireflySettings = fireflySystem.getSettings();
fireflySettings["atlasPicks"] = [
...fireflySystem.dupeArray([0.0,0.50],4), ...fireflySystem.dupeArray([0.25,0.50],4),
...fireflySystem.dupeArray([0.0,0.75],4), ...fireflySystem.dupeArray([0.25,0.75],4)
];
fireflySettings["additiveBlend"] = true;
// Assign your `userData.pSystem = true` geometry to the particle system to use
fireflySystem.setGeometry( this.particleList[ nameOfSystem ] );
// Build + Add the particle system to the scene using `ParticleBase.build( settings, uniforms, vertex shader, fragment shader )`
fireflySystem.build( fireflySettings, fireflyUniforms, fireflyVert(), fireflyFrag() );
// Optional, overwrite the `pSystem` geometry with the built particle system
this.particleList[ nameOfSystem ] = fireflySystem;
}
}
-
particles.jsnow exportingParticleBase -
ParticleBase.jsdefault behavior expects Uniform, Vertex, Fragment shaders + BufferGoemetry to use as the vertex locations to convert vertices to particles. -
EmberWisps.js+Smoke.jsparticle systems now useshaderSettings.offsetPos[Vector3], only Smoke was usingoffsetPos.xz
- Applied after all animation positioning calculated --
vec4 mvPos = modelViewMatrix * vec4( animatedPosition + offsetPos, 1.0 );
-
FloatingDust.jsclamps alpha after multiplyingFloatingDust.getSettings()['pOpacity']into the frag -
shaders.js+pxlParticlesnow export a settings objects that holds all the possible settings per Particle effect
emberWispsSettings, emberWispsVert, emberWispsFrag,
dustSettings, dustVert, dustFrag
heightMapSettings, heightMapVert, heightMapFrag
smokeSettings, smokeVert, smokeFrag
snowSettings, snowFallVert, snowFallFrag
pxlNavBridge.js+pxlNavContainer.jsxfirst passes added to allow for React & Next usage withpxlNav
- First pass added, to be updated for v0.0.29