Skip to content

Instantly share code, notes, and snippets.

View xeolabs's full-sized avatar
🏋️‍♂️
Developing http://xeokit.io

Lindsay Kay xeolabs

🏋️‍♂️
Developing http://xeokit.io
View GitHub Profile
@xeolabs
xeolabs / arraysForVectors.js
Created May 13, 2014 15:48
Arrays for vectors
myNode.addNode({
type: "material",
color: [1,0,0] // Red
});
myNode.addNode({
type: "scale",
scale: [.1,.2,.3]
});
@xeolabs
xeolabs / njn-preview.js
Created May 21, 2014 13:11
Preview of usage of new SceneJS-based 3D engine
// Create an engine
var engine = Njn.createEngine({});
//-----------------------------------------------------------------------
// Logging
//-----------------------------------------------------------------------
engine.log.info("All is well");
engine.log.warn("Something looks dodgy");
@xeolabs
xeolabs / vertex-winding-hacks.txt
Created May 22, 2014 21:36
Vertex winding hacks
The "hacks" section may be included on a module JSONs to specify engine
hacks that are to be applied to work around content errors.
Two flags are provided for working around the "vertex winding" bug in meshes exported by the bridge, where the triangles have inconsistent vertex ordering, which is what WebGL depends on to identify backfaces, which should culled on transparent objects.
Ordinarily, the engine would show backfaces on opaque objects, in order for inner surfaces to be visible when using the cross-section tool, and hide them on transparent objects, in order that they don't blend erroneously with front-faces and create the blotchy white artifacting.
1. To force backfaces to ALWAYS be shown on condition meshes, regardless of whether objects are opaque or transparent:
"hacks" : {
@xeolabs
xeolabs / scenejs-cube-map-experiment.js
Last active August 29, 2015 14:02
Cube Map Experiment
<!DOCTYPE html>
<html lang="en">
<head>
<title>SceneJS Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0;
@xeolabs
xeolabs / beta-new-texture-nodes.js
Created June 17, 2014 13:21
SceneJS enhancement idea - Texture node for each map
<!DOCTYPE html>
<html lang="en">
<head>
<title>SceneJS V3 Texture Layers</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0;
@xeolabs
xeolabs / no-redirect.md
Created July 14, 2014 17:14
Preventing Human redirect to error page
@xeolabs
xeolabs / scenejs-multipass.js
Last active August 29, 2015 14:04
Multipass rendering with SceneJS
// Demonstrates multi-pass rendering in SceneJS.
// The scene graph below performs two passes to render its 3D view - one to render the scene objects
// to a color target (ie. a render buffer), and a second to apply that color target as a texture to
// a quad, while using a custom shader that applies a post-effect.
// Point SceneJS to the bundled plugins
SceneJS.setConfigs({
pluginPath: "../api/latest/plugins"
});
// Create a scene graph
@xeolabs
xeolabs / scenejs-depth-of-field.js
Last active August 29, 2015 14:04
SceneJS depth-of-field node
// To add depth-of-field blur to your scene, just wrap
// your nodes in a "effects/dof" node, like this:
var scene = SceneJS.createScene({
nodes: [
{
type: "lookAt",
id: "myLookat",
eye: { x: 0, y: 200, z: 10 },
look: { x: 0, y: 200,z: 0 }
@xeolabs
xeolabs / quaternion-example-draft.html
Last active August 29, 2015 14:05
quaternion-example-draft.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>SceneJS Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0;
-moz-user-select: -moz-none;
@xeolabs
xeolabs / xeo-helloWorld.js
Created November 27, 2014 14:06
Playing around with alternative APIs on top of the SceneJS rendering core. This one is a component-based OOP API with publish/subscribe.
var engine = new XEO.Engine();
var scene = new XEO.Scene(engine);
var lookat = new XEO.Lookat(scene, {
eye: [0, 0, -100],
look: [0, 0, 0],
up: [0, 1, 0]
});