Skip to content

Commit

Permalink
Added diffuse flag
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed May 15, 2013
1 parent 0dffcc5 commit 3a62248
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 225 deletions.
131 changes: 131 additions & 0 deletions examples/ex/flags/diffuse.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<!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;
-khtml-user-select: none;
-webkit-user-select: none;
}
</style>

<script src="../../../build/latest/scenejs.js"></script>
<script src="../../../build/latest/extras/orbitControl.js"></script>
</head>
<body>

<script>

// Demonstrates how to enable and disable specular lighting for geometry.
//
// Specularity is governed by light nodes working in conjunction with
// specular surface color defined by material nodes.
//
// With SceneJS' default lighting in effect, the 'specular' attribute
// of the flags node in the example below will govern whether or not specular
// light is applied to the geometry in its subgraph.
//
// As we periodically toggle the attribute, watch the specular highlights
// appear and disappear on the geometry accordingly.
//
// Specular lighting will be enabled by default when no flags node
// is present, or if the 'specular' flag is not specified and
// defaults to true.
//

var scene = SceneJS.createScene({
nodes:[

// Override SceneJS' default lights to make specular reflection look nice
// for this example
{
type:"lights",
lights:[
{
mode:"ambient",
color:{ r:0.7, g:0.7, b:0.8 },
diffuse:true,
specular:false
},
{
mode:"dir",
color:{ r:0.5, g:0.5, b:1.0 },
diffuse:true,
specular:true,
dir:{ x:0.5, y:0.5, z:-1.0 },
space:"view"
}
],

nodes:[

// Our flags can be anywhere above the geometry
// we want to toggle specularity for
{
type:"flags",
id:"myFlags",
flags:{
specular:true // (default is true)
},

nodes:[

// Some specular material
{
type:"material",
color:{ r:0.5, g:0.5, b:0.6 },
specularColor:{ r:0.7, g:0.7, b:0.8 },
specular:1.0,
shine:5.0,

nodes:[

// A specular map for completeness
{
type:"texture",
id:"theTexture",
layers:[
{
src:"../../textures/crossGridSpecularMap.jpg",
applyTo:"specular",
blendMode:"multiply"
}
],
nodes:[
{
type:"geometry",
plugin:"torus"
}
]
}
]
}
]
}
]
}
]
});

new SceneJS.OrbitControls(scene, {
yaw:30,
pitch:-30,
zoom:5
});

var flags = scene.getNode("myFlags");

setInterval(
function () {
flags.setSpecular(!flags.getSpecular());
},
1000);

</script>
</body>
</html>
225 changes: 0 additions & 225 deletions examples/ex/transforms/dynamicTransformHierarchyOLD.html

This file was deleted.

2 changes: 2 additions & 0 deletions src/distWiring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//SceneJS.configure({ pluginPath: "http://xeolabs.github.com/scenejs/build/latest/plugins" });
SceneJS.configure({ pluginPath: "/home/lindsay/xeolabs/projects/scenejs3.0/build/latest/plugins" });

0 comments on commit 3a62248

Please sign in to comment.