Detalhes do pacote

matrix-engine

zlatnaspirala3kMIT2.3.65

basic_timeline improved, VT func setup vide html element id with name arg.- DISABLE RAYCAST DEBUG TEST [2.3.3] Fix for GUI win desktop [2.3.0] DestrucMesh solution & loading convex objs for physics BASIC, SpriteAnimation CPU/texture solution added, Improv

opengles3, opengles, cef, webrtc

readme (leia-me)

webGL2GLMatrix2

About Matrix Engine project

Name: MATRIX-ENGINE 2.2.0 Vampire

Logo

(Join Slack-Rock opensource workspace)[https://join.slack.com/t/gameplay-rock/shared_invite/zt-ffcgl80x-CYu4s~YC0bD9Od9_bkqmzw]

STATUS

- [Integrated PWA addToHomePage/cache/] ✔

- [Integrated raycast (hit trigger detect), bvh animation] ✔

- [Basic Physics implementation based on cannon.js] ✔

- [FirstPersonController fly or classic fp / SceneController Drag and navigation scene] ✔

- [Basic's Shadows vs lights (GLSL)] ✔

- [Migrated to the opengles300] ✔

- [FBO implemented] ✔

- [FBO Shadows] ✔

- [Add cef (linux, macos) and cefSharp Visual Studio projects for building executive desktop native apps. ✔

Support: Windows, MAC, Linux ] ✔

- Texture Editor [tutorial example - from code] ✔

- MatrixEngineTexture GUI Editor [UNDERCONSTRUCTION]

- Swicthing GLSL ver - webGL1 / webGL2 ✔

- Loader/Map with collider boxs ✔

- OffScreenCanvas ✔

- Mobile optimisation ✔

Description ℹ

This is small but inspiring project. The benefits of this project is offering an overview of the entire opengles program logic, easy native implementations (hybrid app/ CEF), object structural. Not closed too much inself. Thanks to Mr.Keestu i use (gl-program-structure) new version of glmatrix (3.4.0). Push&Pop matrix just like in opengles 1.1. Also can be downgraded to openGLES 1.1. webGL Lightweight library based on glmatrix engine. For multiplayer used webRTC done with io socket. Physics done with last version of cannon.js. I use free software Blender 2.90.1 for 3d Object mesh works. MatrixEngine is Blender frendly orientend lib (I use blender 4.1). Another frendly tools comes from mixamo.com. Mixamo is great service used for creating my 3d assets. GIMP and MsPaint also used for editing images. Networking is part of matrix engine, integrated whole MultyRTC lib but this is old and deplaced in ver 2 (this old part have a server part signaling server and it is under ./networking/ folder). New networking is under ./networking2/ folder. There is no server code for server part because i use kurento/openvidu service and code. I have running service under https://maximuroullete.com:4443/ for my dev/prodc VPS server. In both cases i use webRTC protocol for stream and data flow. Used webRTC realtime protocol TCP/UDP. Powered by webGL vs webRTC tech enjoy!

Limitation ⚠

  • Basic implementation for physics (Cube, Sphere, Convex BAsic WIP).
  • From [2.3.0] Much better physics for Sphere && ConvexPolyhedron

Next Features 🔜

For npm users recommended

Live Demos

How to use it from npm services [codepen examples]

[1.7.9] Lights - Who to use matrix-engine on codepen:

Install dependencies

Matrix engine keep minimum dependency.

  • uglify-js, minify
  • browserify, watchify
  npm run install.dep
  npm i

@Note: For windows users maybe you will need to add browserify to the env PATH if you got errors on commands npm run build.*.

Help for localhost dev stage

Build Application bundle script

From [1.8.0] you can use build for develop with watch task:

npm run examples
npm run app

@Note: If you use unsecured http protocol no build needed at all just navigate to the html file who loade script with type=module. No need for this any more but you can use it.

For production/public server you will use npm run build.XXX commands. and then upload project to the usually /var/www/html/.

  • app-build.html , examples-build.html loads compiled javascript type text/javascript.

  • Build entry App.js

  npm run build.app

Now navigate to the app-build.html page.

  • Build entry App-Examples.js
  npm run build.examples

Now navigate to the examples-build.html page.

  • Build just library
  npm run build.lib
  • Build with uglify
build.app.ugly;
  • Build ALL
build.all;

After all for production is recommended to use compressed script.

  • Production Final (bash):
./compress

Switch example with url params

URL Params - code access:

const QueryString = matrixEngine.utility.QueryString;

To avoid iframe from examples.html you can use query-build.html?u=<NAME_OF_EXAMPLE> -> query-build.html?u=fbo_manipulation

List of examples:

  • Adding color cube
  • Adding color pyramyde
  • Adding color square
  • Adding tex square with raycast
  • Adding color triangle
  • Adding geometry
  • Adding multi (compose) textures
  • Adding square texture
  • Blending
  • Audion manipulation
  • Camera texture (stream texture)
  • Cube
  • Cube Geometry
  • Cube Light & texture
  • Cube light dynamic
  • Custom texture
  • First Person controller
  • Load obj files - UV maps
  • Object animation -morh sequence
  • Object animation mesh indices calculation
  • JS1Kilo examples implementation
  • Porting 2D canvas (Active textures)
  • Sphere geometry
  • Texture uv manipulation
  • Videos textures
  • Physics Cube with force on raycast trigger
  • 100 Physics Cube with [canvas2d] funny-slot
  • Physics Sphere
  • BVH loader, animation play
  • Load obj sequences
  • FPShooter example (+Sounds) [WIP]
  • specular_light_basic -> global light position test [WIP]
  • Lens effect shaders for cube [WIP]
  • Basic FBO + timeline test [WIP]
  • Matrix Video Chat - webGL vs webRTC
  • FBO manipulation - Multi FBO objects
  • Loading custom shaders from shadertoy site.
  • Loading from buildInShaders.

Features description

Camera config

In ./program/manifest.js. Access is App.camera. Note: One of params FirstPersonController or SceneController must be false.

  • FirstPersonController is classic first person view with movement WASD and mouse look.
  • SceneController use direct input WASD. To make camera angle view change press shift to enable camera angle. Middle mouse button will enable drag scene to left/right/top/down. Mouse middle wheel change work only when shift is pressed.
    camera: {
        viewAngle: 45,
        nearViewpoint: 0.1,
        farViewpoint: 5000,
        edgeMarginValue: 100,
        FirstPersonController: false,
        SceneController: false,
        sceneControllerDragAmp: 0.1,
        sceneControllerDragAmp: 0.1,
        sceneControllerEdgeCameraYawRate: 3,
        sceneControllerWASDKeysAmp: 0.1,
        speedAmp: 0.5,
        yawRate: 1,
        yawRateOnEdge: 0.2
    },

Range of matrixEngine.Events.camera.pitch in ForstPersonController is (-33 to 33).

To get access for camera use matrixEngine.Events.camera. Typically looks:

{
  "roll": 0,
  "rollRate": 0,
  "rallAmp": 0.05,
  "pitch": 0.24500000000000632,
  "pitchRate": 0,
  "yaw": -6945.400000016527,
  "yawRate": 0,
  "xPos": 5.1753983300242155,
  "yPos": 2,
  "zPos": -21.90917813969003,
  "speed": 0,
  "yawAmp": 0.05,
  "pitchAmp": 0.007
}

Light And Shadows (ME Materials) [1.7.6]

[2.2.0] Cast shadow Mixed FBO with two tex sampler attachments. There is local cast 'spot-shadow' i needed this to make little more darker draws in framebuffer.

Element who have setFBO called can cast shadows:

    App.scene.floor.setFBO({
        cameraX: 0,
        cameraY: 0,
        cameraZ: 20,
        pitch: 0,
        yaw: 0
    })
    App.scene.floor.activateShadows('spot-shadow')

Manipulate with non fbo object:

App.scene.MyCubeTex1.shadows.lightPosition = [0,1,1]

activateShadows works only for cube, square, objs for now.

world.Add('cubeLightTex', 1, 'myCube4', textuteImageSamplers);
App.scene.myCube4.activateShadows();
App.scene.myCube4.shadows.activeUpdate();
App.scene.myCube4.shadows.animatePositionY();

If you wanna color vertex but with direction and ambient light then:

// Simple direction light
world.Add('cubeLightTex', 1, 'myCube7', textuteImageSamplersTest);
App.scene.myCube7.position.setPosition(3, 3, -11);
App.scene.myCube7.geometry.colorData.SetGreenForAll(0.5);
App.scene.myCube7.geometry.colorData.SetRedForAll(0.5);
App.scene.myCube7.geometry.colorData.SetBlueForAll(0.5);
App.scene.myCube7.deactivateTex();

Make square pattern:

// Custom generic textures. Micro Drawing.
// Example for arg shema square for now only.
var options = {
  squareShema: [4, 4],
  pixels: new Uint8Array(4 * 4 * 4),
  style: {
    type: 'chessboard',
    color1: 0,
    color2: 255
  }
};

App.scene.myCube9.textures.push(App.scene.myCube9.createPixelsTex(options));

Physics

Physics based on cannon.js

Support list : 😇

  • cube
  • sphere

Example with physics and raycast hit detect:

App.camera.SceneController = true;

canvas.addEventListener('mousedown', (ev) => {
  matrixEngine.raycaster.checkingProcedure(ev);
});

window.addEventListener('ray.hit.event', (ev) => {
  console.log('You shoot the object! Nice!', ev);

  /**
   * Physics force apply
   */
  if (ev.detail.hitObject.physics.enabled == true) {
    ev.detail.hitObject.physics.currentBody.force.set(0, 0, 1000);
  }
});

var tex = {
  source: ['res/images/complex_texture_1/diffuse.png'],
  mix_operation: 'multiply'
};

// Load Physics world!
let gravityVector = [0, 0, -9.82];
let physics = world.loadPhysics(gravityVector);
// Add ground
physics.addGround(App, world, tex);
world.Add('cubeLightTex', 1, 'CUBE', tex);
var b = new CANNON.Body({
  mass: 5,
  position: new CANNON.Vec3(0, -15, 2),
  shape: new CANNON.Box(new CANNON.Vec3(1, 1, 1))
});
physics.world.addBody(b);
// Physics
App.scene.CUBE.physics.currentBody = b;
App.scene.CUBE.physics.enabled = true;

const objGenerator = (n) => {
  for (var j = 0; j < n; j++) {
    setTimeout(() => {
      world.Add('cubeLightTex', 1, 'CUBE' + j, tex);
      var b2 = new CANNON.Body({
        mass: 1,
        linearDamping: 0.01,
        position: new CANNON.Vec3(1, -14.5, 15),
        shape: new CANNON.Box(new CANNON.Vec3(1, 1, 1))
      });

      physics.world.addBody(b2);
      App.scene['CUBE' + j].physics.currentBody = b2;
      App.scene['CUBE' + j].physics.enabled = true;
    }, 1000 * j);
  }
};

objGenerator(100);

Networking

[NEW] Networking Support Methods list: ✅😇

Networking is deeply integrated no need for extra interventions (send function have own interface). Except activation.

matrixEngine.Engine.activateNet2(undefined, {
  sessionName: 'public-chat-me',
  resolution: '256x256'
});
App.scene.MyColoredSquare1.net.enable = true;
// Now MyColoredSquare1 is net replicated on others clients.
App.scene.MyColoredSquare1.position.SetZ(-8);

To receive networking data: dispatchEvent('network-data', {detail: e.data})

addEventListener('network-data' (e) => {})
  • Any scene object:

➡ position SetX() SetY() SetZ()

➡ rotation.rotateX() rotateY() rotateZ()

  • Cube, Sphere, Square

➡ geometry.setScale()

➡ geometry.setScaleByY()

➡ geometry.setScaleByZ()

➡ geometry.setScaleByZ()

➡ geometry.setTexCoordScaleFactor()

  • Pyramid

➡ geometry.setScale()

➡ geometry.setSpitz()

Networking2

New way of networking is kurento/OpenVidu service. Only web client part is present here. I have running kurento/Ov server on my VPS[maximumroulette.com:2020].

List of events:

  • onConnectionCreated
  • connectionDestroyed
  • onStreamCreated
  • videoElementDestroyed
  • streamPlaying
  • streamDestroyed
  • sessionDisconnected
  • streamCreated
  • videoElementCreated
  • videoElementDestroyed
  • setupSessionObject

Custom textures

We just override function for texture executing code. Next level is full custom opportunity, geometry, collision, networking etc.

App.scene.MySquareTexure1.custom.gl_texture = function (object, t) {
  world.GL.gl.bindTexture(world.GL.gl.TEXTURE_2D, object.textures[t]);
  world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_MAG_FILTER, world.GL.gl.LINEAR);
  world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_MIN_FILTER, world.GL.gl.LINEAR);
  world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_WRAP_S, world.GL.gl.CLAMP_TO_EDGE);
  world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_WRAP_T, world.GL.gl.CLAMP_TO_EDGE);

  world.GL.gl.texImage2D(
    world.GL.gl.TEXTURE_2D,
    0, // Level of details
    world.GL.gl.RGBA, // Format
    world.GL.gl.RGBA,
    world.GL.gl.UNSIGNED_BYTE, // Size of each channel
    object.textures[t].image
  );

  world.GL.gl.generateMipmap(world.GL.gl.TEXTURE_2D);
};

Opengles native cubeMap [1.8.5]

  • If you wanna custom canvasd2d draws for each cube side New tag cubeMap takes texture.source empty array.

Canvas2d Example:

/**
 * @description
 * What ever you want!
 * It is 2dCanvas context draw func.
 */
function myFace(args) {
  const {width, height} = this.cubeMap2dCtx.canvas;
  this.cubeMap2dCtx.fillStyle = args[0];
  this.cubeMap2dCtx.fillRect(0, 0, width, height);
  this.cubeMap2dCtx.font = `${width * args[2]}px sans-serif`;
  this.cubeMap2dCtx.textAlign = 'center';
  this.cubeMap2dCtx.textBaseline = 'middle';
  this.cubeMap2dCtx.fillStyle = args[1];
  this.cubeMap2dCtx.fillText(args[3], width / 2, height / 2);
}

var tex = {
  source: [],
  mix_operation: 'multiply',
  cubeMap: {
    type: '2dcanvas',
    drawFunc: myFace,
    sides: [
      // This is custom access you can edit but only must have
      // nice relation with your draw function !
      // This is example for render 2d text in middle-center manir.
      // Nice for 3d button object!
      {faceColor: '#F00', textColor: '#28F', txtSizeCoeficient: 0.8, text: 'm'},
      {faceColor: '#FF0', textColor: '#82F', txtSizeCoeficient: 0.5, text: 'a'},
      {faceColor: '#0F0', textColor: '#82F', txtSizeCoeficient: 0.5, text: 't'},
      {faceColor: '#0FF', textColor: '#802', txtSizeCoeficient: 0.5, text: 'r'},
      {faceColor: '#00F', textColor: '#8F2', txtSizeCoeficient: 0.5, text: 'i'},
      {faceColor: '#F0F', textColor: '#2F8', txtSizeCoeficient: 0.5, text: 'x'}
    ]
  }
};

Classic images:

  • If you wanna load images, see example:
world.cubeMapTextures(['res/images/cube/1.png', 'res/images/cube/2.png', 'res/images/cube/3.png', 'res/images/cube/4.png', 'res/images/cube/5.png', 'res/images/cube/6.png'], (imgs) => {
  var tex = {
    source: [...imgs],
    mix_operation: 'multiply',
    cubeMap: {
      type: 'images'
    }
  };
  world.Add('cubeMap', 1, 'myCubeMapObj', tex);
});

BVH Matrix Skeletal [1.5.0]

  • New deps pack bvh-loader. It is bvh parser created for matrix-engine but can be used for any other graphics language.
const options = {
  world: world,
  autoPlay: true,
  myFrameRate: 10,
  showOnLoad: false, // if autoPLay is true then showOnLoad is inactive.
  type: 'ANIMATION', // "TPOSE' | 'ANIMATION'
  loop: 'playInverse', // true | 'stopOnEnd' | 'playInverse' | 'stopAndReset'
  globalOffset: [-30, -180, -155],
  skeletalBoneScale: 6,
  boneNameBasePrefix: 'backWalk',
  skeletalBlend: {paramDest: 7, paramSrc: 6}, // remove arg for no blend
  boneTex: {
    source: ['res/icons/512.png'],
    mix_operation: 'multiply'
  },
  // pyramid | triangle | cube | square | squareTex | cubeLightTex | sphereLightTex'
  drawTypeBone: 'squareTex'
};

const filePath = 'https://raw.githubusercontent.com/zlatnaspirala/bvh-loader/main/javascript-bvh/example.bvh';

var myFirstBvhAnimation = new matrixEngine.MEBvhAnimation(filePath, options);

Live demo https://codepen.io/zlatnaspirala/pen/OJQdGVM

Raycast

  • cube , square, triangle, obj (ObjLoader) [1.8.4] From 1.8.4 raycast hit trigger works for obj's.

Raycast works fine also in firstPersonCamera operation. Raycast work perfect after local single rotation x, y, or z. Combination rotx and roty works , roty and rotz only with rotx = 180 for now. Bug if walk behind object then turn arround and try raycast but no work for now.

  • Usage:
canvas.addEventListener('mousedown', (ev) => {
  matrixEngine.raycaster.checkingProcedure(ev);
});

canvas.addEventListener('ray.hit.event', (ev) => {
  alert('You shoot the object! Nice');
});

First person controller:

If you activate this flag you get fly/free camera controller by default.

// In one line activate also deactivate.
App.camera.FirstPersonController = true;

Animated female droid (morph targets):

// Obj Loader
function onLoadObj(meshes) {

  // No need from [1.8.2]
  // App.meshes = meshes;
  for (const key in App.meshes) {
    matrixEngine.objLoader.initMeshBuffers(world.GL.gl, App.meshes[key]);
  }

  textuteImageSamplers2 = {
    source: ['res/images/RustPaint.jpg'],
    mix_operation: 'multiply'
  };

  setTimeout(function () {
    var animation_construct = {
      id: 'female',
      meshList: meshes, // from [1.8.2]
      sumOfAniFrames: 18,
      currentAni: 0,
      speed: 3
    };

    world.Add('obj', 1, 'female', textuteImageSamplers2, App.meshes.female, animation_construct);

    App.scene.female.position.y = -3;
    App.scene.female.rotation.rotationSpeed.z = 20;
    App.scene.female.position.z = -13;
    // App.scene.armor.mesh.setScale(5)
  }, 100);
}

// Custom list 1, 3, 5, 9
matrixEngine.objLoader.downloadMeshes(
  {
    female: 'res/3d-objects/female/female_000001.obj',
    female1: 'res/3d-objects/female/female_000003.obj',
    female2: 'res/3d-objects/female/female_000005.obj',
    female3: 'res/3d-objects/female/female_000009.obj',
    ...
  },
  onLoadObj
);

// From [1.8.2] you can use `makeObjSeqArg`
matrixEngine.objLoader.downloadMeshes(
  matrixEngine.objLoader.makeObjSeqArg(
    { id: objName,
      path: "res/bvh-skeletal-base/swat-guy/seq-walk/low/swat",
      from : 1, to: 34 }),
  onLoadObj
);

From [2.0.37] if your obj file have groups with string in name COLLIDER objLoader collect verts for group object. You can use it later for physics. There is no yet example with praticle use of group. [WIP]

From [2.1.2] You can scale mesh general with:

App.scene.armor.mesh.setScale(2)

Or by axis:

App.scene.armor.mesh.setScale({x:1,y:2,z:2})

Map loader

[2.2.0] Added MapCreator web tools New export for npm pack meMapLoader Usage: Automatic load on refresh me app. MapCreator make saves on every new field. You need just to refresh page.

    if (localStorage.getItem('map') != null) {
        var t = localStorage.getItem('map');
        t = JSON.parse(t)
        meMapLoader.load(t, physics);
    } else {
        meMapLoader.load(map, physics);
    }

If you wanna just always load map from disk/file then use:

import {map} from "../maps/map2";
...
meMapLoader.load(map, physics);

To make map goto public\tools\map-creator.html

Blending:

// Use it
App.scene.female.glBlend.blendEnabled = true;
App.scene.female.glBlend.blendParamSrc = ENUMERATORS.glBlend.param[4];
App.scene.female.glBlend.blendParamDest = ENUMERATORS.glBlend.param[4];
  • Load Obj with UV map (Blender export tested):

For more details dee this example script: load_obj_file.js

Video texture:

New way: There is no prefix for path any more. Fixed autoplay on AFTRE FIRST CLICK. Multi textures loading. Video texture corespond with direction & ambient light. Important it is direct pass from video to webgl textures. No canvad2d context. NOT WORKING with shadows for now.

App.scene.outsideBox.streamTextures = new VT('res/video-texture/lava1.mkv');

TODO: Add arg { mixWithCanvas2d }

Old way [still present]:

world.Add('cubeLightTex', 1, 'TV', textuteImageSamplers, App.meshes.TV);
App.scene.TV.streamTextures = new VIDEO_TEXTURE('Galactic Expansion Fractal Morph [Official Video]');

Camera texture:

App.scene.TV.streamTextures = new ACCESS_CAMERA('webcam_beta');

MatrixBVHCharacter (MEBvhAnimation)

MatrixBVHCharacter feature use class matrixEngine.MEBvhAnimation. Its load primitives for bvh skeletal. MatrixBVHCharacter is proccess where we load pre defined skelatal obj parts(head, neck, legs...) .

@Note Human character failed for now but func works.

Nice for primitive obj mesh bur rig must have nice description of position/rotation. In maximo skeletal bones simple not fit. If you pripare bones you can get nice bvh obj adaptation for animations. mocap set of assets looks better for this operation.

Example Code:

const options = {
  world: world, // [Required]
  autoPlay: true, // [Optimal]
  showOnLoad: false, // [Optimal] if autoPLay is true then showOnLoad is inactive.
  type: 'ANIMATION', // [Optimal] 'ANIMATION' | "TPOSE'
  loop: 'playInverse', // [Optimal] true | 'stopOnEnd' | 'playInverse' | 'stopAndReset'
  globalOffset: [-30, -180, -155], // [Optimal]  for 1.5 diff from obj seq anim
  skeletalBoneScale: 2, // [Optimal]
  /*skeletalBlend: {               // [Optimal] remove arg for no blend
      paramDest: 4,
      paramSrc: 4
    },*/
  boneTex: {
    source: ['res/images/default/default-pink.png'],
    mix_operation: 'multiply'
  },
  drawTypeBone: 'matrixSkeletal',
  matrixSkeletal: 'res/bvh-skeletal-base/y-bot/matrix-skeletal/',
  objList: ['spine', 'hips', 'head'],

  matrixSkeletalObjScale: 80, // [Optimal]

  // Can be predefined `MatrixSkeletal` prepared skeletal obj parts/bones.
  // Can be primitives:
  // pyramid | triangle | cube | square | squareTex | cubeLightTex | sphereLightTex

  // New optimal arg
  // Sometime we need more optimisation
  ignoreList: ['spine1'],
  ifNotExistDrawType: 'triangle'
};

const filePath = 'res/bvh/Female1_B04_StandToWalkBack.bvh';
var myFirstBvhAnimation = new matrixEngine.MEBvhAnimation(filePath, options);

This is folder for obj parts (head arm legs ...) Filenames are simplefield like head.obj , arm.obj without any prefix from constructor...

matrixSkeletal: "res/bvh-skeletal-base/y-bot/matrix-skeletal/",

Take a look example: matrix_skeletal.js.

Character (ObjLoader/morph targets)

This good in runtime bad for loading procedure.

How to update character animation? Maximo -> download dea or fbx -> import intro blender Import multi or one animation. -> blender export -> obj (animation)

This is new feature from [1.8.2]. Take a look at : load_obj_sequence.js

For now engine use objLoader to load all morphs.

matrixEngine.objLoader.downloadMeshes(
  matrixEngine.objLoader.makeObjSeqArg({
    id: objName,
    path: 'res/bvh-skeletal-base/swat-guy/anims/swat-multi',
    from: 1,
    to: 61
  }),
  onLoadObj
);

In onLoadObj callback function:

var animArg = {
  id: objName,
  meshList: meshes,
  // sumOfAniFrames: 61, No need if `animations` exist!
  currentAni: 0,
  // speed: 3, No need if `animations` exist!
  // upgrade - optimal
  animations: {
    active: 'walk',
    walk: {
      from: 0,
      to: 35,
      speed: 3
    },
    walkPistol: {
      from: 36,
      to: 60,
      speed: 3
    }
  }
};

FirstPersonShooter examples [WIP]

  • Just like in eu4 shooter we dont need whole character mesh for FPSHooter view. I cut off no hands vertices in blender to make optimised flow.
  • Added basic Jumping with physics

From [1.8.15]

  • 'hit.keyDown' && 'hit.keyUp' dispatch events added. See FPS Example.
  • Added basic JUMP with physics / not calibrated.
addEventListener('hit.keyDown', (e) => {
  // console.log('Bring to the top level', e.detail.keyCode);
});

Feature [1.8.12] App.events Access. Take a look at the apps\fps_player_controller.js example.

App.events.CALCULATE_TOUCH_DOWN_OR_MOUSE_DOWN = (ev, mouse) => {
  // From [1.8.12]
  // checkingProcedure gets secound optimal argument
  // for custom ray origin target.
  // mouse
  console.log(mouse.BUTTON);
  if (mouse.BUTTON_PRESSED == 'RIGHT') {
    // Zoom
  } else {
    // This call represent `SHOOT` Action.
    // And it is center of screen
    matrixEngine.raycaster.checkingProcedure(ev, {
      clientX: ev.target.width / 2,
      clientY: ev.target.height / 2
    });
  }
};

WIP calculating for fixing FPS camera view.

[1.8.11] New 3dObject property isHUD. If you setup this to the true value object will escape world rotation/translation. Only local translation is active. This is good for HUD Menu in 3d space.

Texture editor (runtime):

App.scene.outsideBox.streamTextures = new Vjs3('./2DTextureEditor/actual.html', 'actualTexture');
  • Build meta images resource with:
npm run res.tex.editor
or
node ./2DTextureEditor/res.js
  • Running Editor Tool
npm run run.tex.editor
// or
npm run te

After creating 2d texture direct on page at the end run:

npm run build.tex.editor

to make build final pack.

  • Imports note we can use any canvas 2d app [anyCanvas] .

In examples:

  • porting2d.js [Old VJS] Example of anyCanvas
  • porting_text.js [Vjs3]
  • porting2d_particle.js [Vjs3]

It is very powerfull tool!

Research Vjs3 source examples at: https://github.com/zlatnaspirala/visualjs

Simple Planetarium:

On NPM Service npm i visual-js , matrix engine already have visual-js , visual-js-server editor backend part.

To show/hide iframe use: App.scene.outsideBox - is any object who have streamTextures LOADED with 2DCANVAS.

App.scene.outsideBox.streamTextures.showTextureEditor();
E('HOLDER_STREAMS').style.display = 'none';

Access to the [any] canvas2d program: anyCanvas(path-of-html,name-of-canvas)

App.scene.outsideBox.streamTextures = new anyCanvas('./apps/funny-slot/', 'HELLO_WORLD');

Live editor [actual.js predefined]

Texture-Editor

Old VJS loading with anyCanvas()

Texture-Editor

Old Live demo: Video and webcam works at: https://maximumroulette.com/webgl2/examples.html

Sounds

From 1.8.13 you can add audios:

Create single audio object:

App.sounds.createAudio('shoot', 'res/music/single-gunshot.mp3');

Create multi clone audio objects:

App.sounds.createAudio('shoot', 'res/music/single-gunshot.mp3', 5);

This is in case that you need to play same audio many times [simultaneously].

Events

How to detect colliding between two objects:

physicsObject.addEventListener("collide",function(e) {
    var relativeVelocity = e.contact.getImpactVelocityAlongNormal();
    if(Math.abs(relativeVelocity) > 10){
        // More energy
    } else {
        // Less energy
    }
});

OffScreenCanvas [Turbo super power speed]

  • Control from manifest App.offScreenCanvas | Boolean Default true. This feature means that your render will work event in inactive mode / hidden tab mode.

  • Other easy way for activating: Put in url param next data query-build.html?u=fbo_manipulation&offScreen=true&offScreenSpeed=10 Max render speed is [1]: query-build.html?u=fbo_manipulation&offScreen=true&offScreenSpeed=1 Optimal is ~ 15.

Scene Timeline

  • Basic implementation

Init : matrixEngine.matrixWorld.world.useAnimationLine({sequenceSize: 200, totalSequence: 10});

[1.9.58]

New args for timeline feature: matrixEngine.matrixWorld.world.useAnimationLine({sequenceSize: 200, totalSequence: 10}); New example script for this feature basic_timeline.js

Add command for execute every time on sequence (for this example at index 1) reached :

         matrixEngine.matrixWorld.world.addCommandAtSeqIndex(
        function() {
            console.log("WHAT EVER HERE")
        } , 1
    )

Commands index begin from first frame from seq 1.

From [2.3.63] Run on frame100 only in seq3. Definition: world.addSubCommand = function(COMMAND, INDEX, onlyForSeq) Defautl values for onlyForSeq, onlyForPeriod is null means call command for every seq

    matrixEngine.matrixWorld.world.addSubCommand(
        function () {
            console.log("do it for only 100 frame on 3 seq FRAMEID!")
        } , 100 , 3
    )

FBO camera

[1.9.38] Implemented multi FBO objects with own camera targets! See example -> public/query-build.html?u=fbo_manipulation

App.scene.myMirrorUP.setFBO({
  cameraX: 0,
  cameraY: 0,
  cameraZ: 2,
  pitch: 0,
  yaw: 1
});

Multiplatform parts

⚠ You need to have msbuild.exe on you computer.

msbuild.exe typically does not come pre-installed with Windows. It is part of the Microsoft Build Tools, which are usually installed along with Visual Studio or the .NET SDK. Here's a summary of the ways to get msbuild.exe:

  • Visual Studio: When you install Visual Studio, MSBuild is included as part of the installation. You can choose to install just the build tools if you don't need the full IDE.

  • .NET SDK: Installing the .NET SDK also includes MSBuild. This option is useful if you're working primarily with .NET Core or .NET 5+ projects.

  • Microsoft Build Tools: You can install the standalone Microsoft Build Tools package, which includes MSBuild without the full Visual Studio IDE. This is useful for build servers or CI/CD pipelines.

For building windows exe file use desktop-build.bat

  • This script will install latest version of nuget.exe in folder "multiplatform\win\cef-sharp"
  • Install cef deps for cef in package folder (cef 118.6.80)
  • Build exe file with msbuild.exe

After running desktop-build.bat goto folder multiplatform\win\cef-sharp\bin\Release and you can find matrix-engine.exe builded.

PWA Fully runned

Integrated Add to Home page and regular html5 page options. In same time fixed all autoplay audio and video context construction. It is good to consult pwa test on page. Best way is to keep it on 100% pass. pwa-powered

Secured 🛡

No Dependabot alerts opened.

Optimisation

When i write code in fly i usually use timers for some set up vars. This kill perfomance in matrix-engine. It is ok for simple and low resources project but not for big projects.

Example:

BAD CODE:
setInterval(function () {
  App.scene.MySquareTexure1.geometry.texCoordsPoints.right_top.x += 0.001;
  App.scene.MySquareTexure1.geometry.texCoordsPoints.left_bottom.x += 0.001;
  App.scene.MySquareTexure1.geometry.texCoordsPoints.left_top.x += 0.001;
  App.scene.MySquareTexure1.geometry.texCoordsPoints.right_bottom.x += 0.001;
}, 20);
 GOOD CODE:
var myFUNC = {
  UPDATE: function () {
    App.scene.MySquareTexure1.geometry.texCoordsPoints.right_top.x += 0.001;
    App.scene.MySquareTexure1.geometry.texCoordsPoints.left_bottom.x += 0.001;
    App.scene.MySquareTexure1.geometry.texCoordsPoints.left_top.x += 0.001;
    App.scene.MySquareTexure1.geometry.texCoordsPoints.right_bottom.x += 0.001;
  }
};
App.updateBeforeDraw.push(myFUNC);

Credits && Licence:

changelog (log de mudanças)

---------------------------------

Matrix Engine [CHANGES]

2.3.0 - Physics for ConvexPolyhedron implemented BASIC. query-build.html?u=custom_geometry query-build.html?u=destruct_cube

2.2.12 Return for audios.play() func - return promise

2.2.10 SpriteAnimation CPU level/program

2.2.3 Just error log for non trianbulate faces error in raycast func.

2.2.2 HOT FIX PRAGMATIC

Unknown squareTex raycaster bug.

    try {
        const [v0, v1, v2] = triangle;
    } catch(e) {
        console.log('bug "rayIntersectsTriangle" ', e)
        return false;
    }

[2.2.0] Cast shadow Mixed FBO with two tex sampler attachments.

There is local cast 'spot-shadow' i needed this to make little more darker draws in framebuffer.

Element who have setFBO called can cast shadows:

    App.scene.floor.setFBO({
        cameraX: 0,
        cameraY: 0,
        cameraZ: 20,
        pitch: 0,
        yaw: 0
    })
    App.scene.floor.activateShadows('spot-shadow')

Manipulate with non fbo object:

App.scene.MyCubeTex1.shadows.lightPosition = [0,1,1]

[2.1.15] Fix custom textures for obj mesh

...
    if(object.custom.gl_texture == null) {
...

[2.1.14] Fix MEBvhAnimation callback

[2.1.13] BVH improved : playAnimationFromKeyframes

[2.1.12] BVH playInverse improved/fixed.

[2.1.8] playInverseAndStop added new type of BVHAnimation class.

[2.1.7] Scale by axis new feature for MEBvhAnimation class. See example matrix_skeletal.js

[2.1.6] Added map creator from starter project.

[2.1.1] Just added example how to load maps and detect groups vertices.

[2.1.0] Added MapCreator web tools New export for npm pack meMapLoader Usage: Automatic load on refresh me app. MapCreator make saves on every new field. You need just to refresh page.

    if (localStorage.getItem('map') != null) {
        var t = localStorage.getItem('map');
        t = JSON.parse(t)
        meMapLoader.load(t, physics);
    } else {
        meMapLoader.load(map, physics);
    }

If you wanna just always load map from disk/file then use:

import {map} from "../maps/map2";

...

meMapLoader.load(map, physics);

To make map goto public\tools\map-creator.html

[2.1.4] draObj DRAW

object.instancedDraws.overrideDrawArraysInstance(object);

objObject.instancedDraws = {
  numberOfInstance: 10,
  array_of_local_offset: [0, 0, 0],
  overrideDrawArraysInstance: function (object_) {}
};

[2.1.3] Prevent error [render file]

else if(local.physics.currentBody.shapeOrientations.length > 1) {
                    // Check
                    if (local.subObjs) for(var x = 0;x < local.subObjs.length;x++) {

[2.1.2]You can scale mesh general with:

App.scene.armor.mesh.setScale(2);

Or by axis:

App.scene.armor.mesh.setScale({x: 1, y: 2, z: 2});

[2.1.1] testTrimesh added , visual OK , physics need more updated. Cannonjs collision not work for this type of custom geo object...

world.Add('generatorLightTex', 1, 'floorAngle', tex, {
  radius: 1,
  custom_type: 'testTrimesh',
  custom_geometry: new CANNON.Trimesh(vertices, indices)
});

[2.1.0] Much better physics for cube Line:

var AXIS = vec3.fromValues(-parseFloat(object.rotation.axisSystem[0].x.toFixed(2)), parseFloat(object.rotation.axisSystem[0].z.toFixed(2)), parseFloat(object.rotation.axisSystem[0].y.toFixed(2)));

[2.0.38] Full custom geometry inject cannonjs shape object for for CANNON.ConvexPolyhedron. Example of usage:

world.Add('generatorLightTex', 1, 'outsideBox2', tex, {
  radius: 1,
  custom_type: 'testConvex',
  custom_geometry: createTetra()
});

[2.0.34] New App flag: App.printDevicesInfo: false

[2.0.31] Simplify SET_STREAM for ACCESS CAMERA

[2.0.30] For FirstPersonController added move in left or right by side... UPDATE IN setCamera func:

// For FirstPersonController
camera.setCamera = function (object) {
  if (keyboardPress.getKeyStatus(65) || App.camera.leftEdge == true) {
    /* A */
    camera.yawRate = App.camera.yawRate;
    if (App.camera.leftEdge == true) {
      camera.yawRate = App.camera.yawRateOnEdge;
    }
  } else if (keyboardPress.getKeyStatus(68) || App.camera.rightEdge == true) {
    /* D */
    camera.yawRate = -App.camera.yawRate;
    if (App.camera.rightEdge == true) {
      camera.yawRate = -App.camera.yawRateOnEdge;
    }
  } else if (keyboardPress.getKeyStatus(32)) {
    /* Right Key or SPACE */
    if (this.virtualJumpActive != true) {
      this.virtualJumpActive = true;
    }
  }

  if (keyboardPress.getKeyStatus(37)) {
    /* Left Key  || App.camera.leftEdge == true*/
    camera.moveLeft = true;
    camera.speed = App.camera.speedAmp;
  } else if (keyboardPress.getKeyStatus(39)) {
    /* Right Key || App.camera.rightEdge == true */
    camera.moveRight = true;
    camera.speed = App.camera.speedAmp;
  } else if (keyboardPress.getKeyStatus(38) || keyboardPress.getKeyStatus(87)) {
    /* Up Key or W */
    camera.speed = App.camera.speedAmp;
  } else if (keyboardPress.getKeyStatus(40) || keyboardPress.getKeyStatus(83)) {
    /* Down Key or S */
    camera.speed = -App.camera.speedAmp;
  } else {
    // if(camera.preventSpeedZero == false) camera.speed = 0;
  }

  /* Calculate yaw, pitch and roll(x,y,z) */
  if (camera.speed != 0 && camera.moveLeft == false && camera.moveRight == false) {
    camera.xPos -= Math.sin(degToRad(camera.yaw)) * camera.speed;
    if (camera.fly == true) {
      // Fly regime
      camera.yPos += Math.sin(degToRad(camera.pitch)) * camera.speed;
    } else {
      // usually for fpshooter regime
      // camera.yPos = this.virtualJumpY;
      // camera.yPos = 0;
      // leave it zero by default lets dirigent from top
    }
    camera.zPos -= Math.cos(degToRad(camera.yaw)) * camera.speed;
  } else if (camera.moveLeft == true) {
    // by side move left
    camera.xPos -= Math.sin(degToRad(camera.yaw + 90)) * camera.speed;
    camera.zPos -= Math.cos(degToRad(camera.yaw + 90)) * camera.speed;
  } else if (camera.moveRight == true) {
    // by side move rigth
    camera.xPos -= Math.sin(degToRad(camera.yaw - 90)) * camera.speed;
    camera.zPos -= Math.cos(degToRad(camera.yaw - 90)) * camera.speed;
  }

  camera.yaw += camera.yawRate * camera.yawAmp;
  camera.pitch += camera.pitchRate * camera.pitchAmp;

  mat4.rotate(object.mvMatrix, object.mvMatrix, degToRad(-camera.pitch), [1, 0, 0]);
  mat4.rotate(object.mvMatrix, object.mvMatrix, degToRad(-camera.yaw), [0, 1, 0]);
  mat4.translate(object.mvMatrix, object.mvMatrix, [-camera.xPos, -camera.yPos, -camera.zPos]);

  camera.yawRate = 0;
  camera.pitchRate = 0;
  // update
  camera.moveLeft = false;
  camera.moveRight = false;
  if (camera.preventSpeedZero == false) camera.speed = 0;
};

[2.0.27] Added for CustomGeometry object entity:

customObject.net = {
  enabled: false
};

[2.2.15]

  • BIG FIX FOR MOBILE OBJ RENDER
  • // DEPLACED world.disableUnusedAttr

[2.0.26] FIX CHECK NET ACTIVE FLAG FOR SCALE PROCEDURE

[2.0.25] FIX FOR MOBILE RENDER MATERIAL/ TEXTURE - Bug with white surface

// world.disableUnusedAttr(world.GL.gl, localLooper);
world.disableUnusedAttr(world.GL.gl, 4);

[2.0.24] New prop in App.camera (manifest)

`App.camera.yawRateOnEdge`
camera.setCamera = function(object) {
    if(keyboardPress.getKeyStatus(37) || keyboardPress.getKeyStatus(65) || App.camera.leftEdge == true) {
        /* Left Key  or A */
        camera.yawRate = App.camera.yawRate;
        if(App.camera.leftEdge == true) {
            camera.yawRate = App.camera.yawRateOnEdge;
        }
    } else if(keyboardPress.getKeyStatus(39) || keyboardPress.getKeyStatus(68) || App.camera.rightEdge == true) {
        /* Right Key or D */
        camera.yawRate = -App.camera.yawRate;
        if(App.camera.rightEdge == true) {
            camera.yawRate = -App.camera.yawRateOnEdge;
        }
    }

[2.0.23] New line in EVENTS About WASD FPController Reason - adaptation for mobile FPController if (camera.preventSpeedZero == false) camera.speed = 0;

/* Up Key or W */
if (keyboardPress.getKeyStatus(38) || keyboardPress.getKeyStatus(87)) {
  camera.speed = App.camera.speedAmp;
} else if (keyboardPress.getKeyStatus(40) || keyboardPress.getKeyStatus(83)) {
  /* Down Key or S */
  camera.speed = -App.camera.speedAmp;
} else {
  if (camera.preventSpeedZero == false) camera.speed = 0;
}

[2.0.17 version Vampir] Objective

  • Deplace old networking and put kurento/OV web client code.
  • Mobile device ready
  • GUI Editor (win) basic version ready

[2.0.17] New event from core net updater. dispatchEvent('network-data', {detail: e.data}) For better customisation.

update(e) {
            e.data = JSON.parse(e.data);
            dispatchEvent('network-data', {detail: e.data})
            // console.log('INFO UPDATE', e);
            if(e.data.netPos) {
                if(App.scene[e.data.netObjId]) {
                    if(e.data.netPos.x) App.scene[e.data.netObjId].position.SetX(e.data.netPos.x, 'noemit');
                    if(e.data.netPos.y) App.scene[e.data.netObjId].position.SetY(e.data.netPos.y, 'noemit');
                    if(e.data.netPos.z) App.scene[e.data.netObjId].position.SetZ(e.data.netPos.z, 'noemit');
                }
            } else if(e.data.netRot) {

[2.0.16] Added to the Base Class Position xNetOffset yNetOffset zNetOffset Nice for calibration. [2.0.14] For obj sequency animation objObject.scaleAll

---------------------------------

[1.9.58] New args for timeline feature: matrixEngine.matrixWorld.world.useAnimationLine({sequenceSize: 200, totalSequence: 10}); New example script for this feature basic_timeline.js

Add command for execute every time on sequence (for this example at index 1) reached : js matrixEngine.matrixWorld.world.addCommandAtSeqIndex( function() { console.log("WHAT EVER HERE") } , 1 ) Commands index begin from 1.

[1.9.56] Improved FPS example - added item ARMOR first item feature Improved selfDestroy function [in case of simultaneous calls] isHUD added rotateion also in draw func.

[1.9.54] Added custom shaders also glsl files from zlatnaspirala/GLSLShaders Add new example apps/shaders.js.

[1.9.53]

  • Added shaders from https://iquilezles.org/ MIT LICENCE only.

  • scriptManager.loadGLSL('./path/myshader.glsl') returns literal string (shader).

var promiseMyShader = scriptManager.loadGLSL('../lib/optimizer/custom-shaders/circle.glsl');
promiseMyShader.then((d) => {
  scriptManager.LOAD(d, 'custom-toy1-shader-fs', 'x-shader/x-fragment', 'shaders', () => {
    App.scene.ToyShader.shaderProgram = world.initShaders(world.GL.gl, 'custom-toy1' + '-shader-fs', 'cubeLightTex' + '-shader-vs');
  });
});

[1.9.45+] All examples now works on android devices[android 13 tested]!

  • Improved ACCESS_CAMERA for android devices!
  • Improved SET_STREAM function [adapting for mobile devices - android]
  • http on emulator android from LAN - no workers [browser related/ security reason]!
  • Change main file for GUI instance.

mobile optimisation ios fix web_cam visibility

supportsTouch added for better detecting isMobile()

[1.9.44] Correction for cube physics Internal note: rotx + 90

[1.9.40 - 1.9.43] First version with both support opengles11/2 and opengles300

  • Default : 1.3/opengles300
  • Switch with URL param GLSL=1.3 for opengle300 and GLSL=1.1 for opengles1.1/2
  • Implemented URL param for examples-build.html?GLSL=1.1 [Affect after first demo choose.]

[1.9.39] OffScreenCanvas [Turbo super power speed]

  • Control from manifest App.offScreenCanvas | Boolean Default true. This feature means that your render will work event in inactive mode / hidden tab mode.

  • Other easy way for activating: Put in url param next data query-build.html?u=fbo_manipulation&offScreen=true&offScreenSpeed=10 Max render speed is [1]: query-build.html?u=fbo_manipulation&offScreen=true&offScreenSpeed=1 Optimal is ~ 15.

[1.9.38] Implemented multi FBO objects with own camera targets! See example -> public/query-build.html?u=fbo_manipulation

  App.scene.myMirrorUP.setFBO({
    cameraX: 0,
    cameraY: 0,
    cameraZ: 2,
    pitch: 0,
    yaw: 1
  });

[1.9.37] Add dev tool for configs paths. Node.js tool install-paths.js For ./2DTextureEditor folder. Setup absolute paths intro config.js and editor.js .

[1.9.35] Add simple http server for GUI new part. npm run host-for-gui It is host of ./2DTextureEditor folder.

[1.9.30] App.offScreenCanvas new feature, implementing hacker-timer.js worker library.

QueryString is urlParam.

if (App.offScreenCanvas == true && (QueryString.offScreen == null || Boolean(QueryString.offScreen) == true)) {
  console.log('App.offScreenCanvas =>', App.offScreenCanvas);
  scriptManager.LOAD('./hacker-timer/hack-timer.js');
} else {
  App.offScreenCanvas = false;
}

[1.9.29] Fix export let activateNet = (CustomConfig) => { In matrix-engine-starter for project matrix-roulette there is a example for injecting custom config.

[1.9.27] For npm users , it is possible to inject custom client config for networking. activateNet = (CustomConfig) => {

Catch possible undefined state. if(root.injector) root.injector

[1.9.25] Position net send branch only for net.enable == true

[1.9.22-23-24] Just remove some console logs.

[1.9.21]

  • Added raycast enabled flag
  • Improved render physics related - draw subObjs eg. cannonjs multi shapes one body

[1.9.20] Added basic physics for torus Render exception:

if (world.contentList[physicsLooper].custom_type && world.contentList[physicsLooper].custom_type == 'torus') {
  world.contentList[physicsLooper].rotation.rotx = radToDeg(local.physics.currentBody.quaternion.toAxisAngle()[1]) + 90;
} else {
  world.contentList[physicsLooper].rotation.rotx = radToDeg(local.physics.currentBody.quaternion.toAxisAngle()[1]);
}

[1.9.19] Improved raycaster code :

    if (rayIntersectsTriangle(myRayOrigin, ray, triangle, intersectionPoint, object.position)) {
      if (object.raycast.enabled == false) return;
      rayHitEvent = new CustomEvent('ray.hit.event', ...

[1.9.18]

  • Implemented torus geometry with 'generatorLightTex' flag type. support for stream textures but not physics and net for generatorLightTex
world.Add('generatorLightTex', 1, 'outsideBox2', tex, {
  custom_type: 'torus',
  slices: 8,
  loops: 20,
  inner_rad: 1.5,
  outerRad: 2
});

[1.9.17] Added new net example script - video chat.

  • added new branch [asyn nature od stream video dom element ready...]
 if(App.scene[e.data.netObjId])

[1.9.16]

  • New custom event net.new-user to make easy detect on top level used direct for new example video chat matrix.

  • New access point for broadcaster/networking

net = new Broadcaster(t);
App.network = net;

[1.9.14] New optimal arg2 for defineWorld (arg1, arg2)

Related wwith FBO render func, Can be undefined in that place engine use full FBO render, With arg2 = 'simply' tooks simplyRender func.

if (typeof renderType === 'undefined') {
  exports.reDraw = reDraw = _manifest.default.operation.reDrawGlobal;
} else if (renderType == 'simply') {
  exports.reDraw = reDraw = _manifest.default.operation.simplyRender;
}

[1.9.7] Small hotfix for stremasTextures for squareTex obj in draw func.

[1.9.6] FBO example + Scene global Timeline function with visual dom preview.

matrixEngine.matrixWorld.world.useAnimationLine({sequenceSize: 500});

Idea about timeline is to simple count redraws. Nothig other comes from timeline. In app level you need to write logic to use matrixEngine.matrixWorld.world.globalAnimCounter and matrixEngine.matrixWorld.world.globalAnimCurSequence

globalAnimCurSequence exist only to reduce number of redraws. You can setup sequenceSize.

[1.9.5] Added local shadows for obj mesh.

[1.9.1 Thunder BETA 2023]

  • Improved FPShooter controller
  • FBO implemented BASIC
  • Migrated to the opengles300 GLSL version
  • Add cef and cefSharp Visual Studio projects for building executive native apps. Support:
    • Windows
    • MAC
    • Linux
  • GUI Texture editor based on Visualjs3 in background. Make gui fast tex editor running - wip

New scene object functions (Cube and square): - setTexCoordScaleXFactor - setTexCoordScaleYFactor

  • Improvements for visual-js game engine

GLSL Note: Note: This extension is only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. The constant in WebGL2 is gl.UNSIGNED_INT_24_8.

From [1.8.15] Improved camera

  • 'hit.keyDown' && 'hit.keyUp' dispatch events added. See FPS Example.
  • Added basic JUMP with physics / not calibrated.
addEventListener('hit.keyDown', (e) => {
  // console.log('Bring to the top level', e.detail.keyCode);
});

From [1.8.14] Html's Every static file / resource moved to the new folder ./public

Improved FPShooter example , added collision box for player.

From [1.8.13] MatrixSounds

Access object App.sounds.

Usage:

// Play source audio [single instance].
App.sounds.createAudio('music', 'res/music/background-music.mp3');
// Play simultanius same source audio.
App.sounds.createAudio('shoot', 'res/music/single-gunshot.mp3', 5);

From [1.8.12]

Draw scene list swap items options must be done!

From [1.8.0]

Added watchify. We have support for real time connections based on webRTC. You must work on https protocol even in localhost. Change in program/manifest net = false if you dont wanna use networking.

Node.js Multiplayer Server based on webRTC. Take a look at the folder ./netwotking.

Run it:

cd networking
node matrix.server.js

If you wanna in terminal popup then run (bash/work on win also if you have bash) dedicated.sh./ or dedicated.bat.

[1.8.6] Improve of cubeMap

[1.8.5] Added new scene type of object "cubeMap" with Opengles native 'uniform samplerCube' sampler:

var tex = {source: [], mix_operation: 'multiply'};
world.Add('cubeMap', 1, 'myCubeMapObj', tex);

For now it is predefinited inside engine. It is canvas2d with center-middle text position. Index is 0,1,2,3,4,5 for all six faces of cube geometry.

App.scene.myCubeMapObj.cubeMap2dCanvasSet[index];

[1.8.4] From 1.8.4 raycast hit trigger works for obj's.

[1.8.3] Improve of MEBvhAnimation (MAtrixBVHSkeletal principe).

[1.8.2] Obj sequence range animation and play (animationName) func.

[1.8.1] makeObjSeqArg for animation obj sequence mesh loader, selfDestroy(aftermsec?) added for all scene object types.

[1.8.0] Networking added for position , rotation and scale. Watch task build added.

[1.7.13] From now loading init shaders from code no need to loading shaders.html any more + HOTFIX swap out of prototype of array.

[1.7.10] Shadows VS Lights (Local SpotLight implementation) , improvments for GLSL part.

[1.7.5] Added modifier to the Array.swap Added Array.prototype.swap used for obj loader initial orientation control.

[1.7.0] Test basic [cube] physics cannon.js implementation , improved SceneController.

[1.6.0] Removed old Vjs added new version of Vjs3 (npm-service).

[1.5.4] Fix sphereObject size/scale input.

[1.5.0] Comes with bvh loader and skeletal basic bone system draws . Added passive:false for mobile events because e.preventDefault call, Added isMobile func, fix roty i roty with rotx=180 make raycast fully works. ray fixed for rx and ry, Raycast fixed for one of rx,ry,rz local rotation, setScale implemented for obj loaded meshes, Raycast basic for triangle implemented, auto cache update ref by cache version var ,auto update position translate operation, added translate operation on base class Position, remove esmify to dev dep, added set Solid bg vertex color for cube shema .Fix missing setScaleByY , setScaleByX for square geometry. Added 2 type of resize system. Fixed demo links, Fixed pwa initial status installed or not.Added Adding uglify-js build options, Improve import export adding bundle build options with browserify, PWA Fully powered with static/dynamic cache , add to home page in same time fixed autoplay audio/video context construction.