From 947bad893335e1023bcbe177ff8db454c27c4bf8 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 30 Mar 2012 06:23:53 -0700 Subject: converted materials to new texture structure --- js/lib/rdge/materials/water-material.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index b7413f55..2512e5be 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; /////////////////////////////////////////////////////////////////////// // Class GLMaterial @@ -67,6 +68,9 @@ var WaterMaterial = function WaterMaterial() { this._shader['default'].u_time.set( [this._time] ); } + var texMapName = this._propValues[this._propNames[0]]; + this._glTex = new Texture( world, texMapName ); + // set the shader values in the shader this.updateTexture(); this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); -- cgit v1.2.3 From 5a1965bf2ed9a54601ca16fd67555335c510ce08 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 26 Apr 2012 16:40:05 -0700 Subject: Update materials to the new texture model. Create local world for deleted source canvases --- js/lib/rdge/materials/water-material.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 2c3669c0..18a73915 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -37,12 +37,14 @@ var WaterMaterial = function WaterMaterial() { /////////////////////////////////////////////////////////////////////// // duplcate method requirde this.dup = function (world) { - // allocate a new uber material - var newMat = new WaterMaterial(); - - // copy over the current values; + // get the current values; var propNames = [], propValues = [], propTypes = [], propLabels = []; this.getAllProperties(propNames, propValues, propTypes, propLabels); + + // allocate a new material + var newMat = new WaterMaterial(); + + // copy over the current values; var n = propNames.length; for (var i = 0; i < n; i++) newMat.setProperty(propNames[i], propValues[i]); -- cgit v1.2.3 From 1e649405d66f17d6acddb9055b181bba7ad70566 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 16 May 2012 13:41:48 -0700 Subject: Exposing parameters in Water Material --- js/lib/rdge/materials/water-material.js | 172 ++++++++++++++++++++++++++++---- 1 file changed, 150 insertions(+), 22 deletions(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 18a73915..1f0aa46e 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -23,14 +23,29 @@ var WaterMaterial = function WaterMaterial() { this._time = 0.0; this._dTime = 0.01; + this._emboss = 0.3; + this._delta = 20.0; + this._intensity = 3.0; + + this._speed = 0.2; /////////////////////////////////////////////////////////////////////// // Properties /////////////////////////////////////////////////////////////////////// // all defined in parent PulseMaterial.js // load the local default value - this._propValues = []; - this._propValues[this._propNames[0]] = this._texMap.slice(0); + //this._propValues = []; + //this._propValues[this._propNames[0]] = this._texMap.slice(0); + this._propNames = ["texmap", "emboss", "delta", "intensity", "speed"]; + this._propLabels = ["Texture map", "Emboss", "Delta", "Intensity", "Speed"]; + this._propTypes = ["file", "float", "float", "float", "float"]; + + this._propValues = []; + this._propValues[ this._propNames[0] ] = this._texMap.slice(0); + this._propValues[ this._propNames[1] ] = this._emboss; + this._propValues[ this._propNames[2] ] = this._delta; + this._propValues[ this._propNames[3] ] = this._intensity; + this._propValues[ this._propNames[4] ] = this._speed; /////////////////////////////////////////////////////////////////////// // Methods @@ -52,32 +67,141 @@ var WaterMaterial = function WaterMaterial() { return newMat; }; + this.setProperty = function( prop, value ) { + // make sure we have legitimate imput + var ok = this.validateProperty( prop, value ); + if (!ok) { + console.log( "invalid property in Water Material:" + prop + " : " + value ); + } + + switch (prop) + { + case "texmap": + this.setTextureMap(value); + break; + + case "emboss": + this.setEmboss( value ); + break; + + case "delta": + this.setDelta( value ); + break; + + case "intensity": + this.setIntensity( value ); + break; + + case "speed": + this.setSpeed( value ); + break; + + case "color": + break; + } + }; + this.init = function (world) { - // save the world - if (world) this.setWorld(world); + // save the world + if (world) this.setWorld(world); + + // set up the shader + this._shader = new RDGE.jshader(); + this._shader.def = waterMaterialDef; + this._shader.init(); + + // set up the material node + this._materialNode = RDGE.createMaterialNode("waterMaterial" + "_" + world.generateUniqueNodeID()); + this._materialNode.setShader(this._shader); + + this._time = 0; + if (this._shader && this._shader['default']) { + this._shader['default'].u_time.set([this._time]); + + this._shader['default'].u_emboss.set( [this._emboss] ); + this._shader['default'].u_delta.set( [this._delta] ); + this._shader['default'].u_intensity.set( [this._intensity] ); + this._shader['default'].u_speed.set( [this._speed] ); + } + + var texMapName = this._propValues[this._propNames[0]]; + this._glTex = new Texture( world, texMapName ); + + // set the shader values in the shader + this.updateTexture(); + this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); + this.update(0); + }; + + this.setTextureMap = function( texMapName ) + { + this._texMap = texMapName.slice(); + this._propValues[ this._propNames[0] ] = this._texMap.slice(0); - // set up the shader - this._shader = new RDGE.jshader(); - this._shader.def = waterMaterialDef; - this._shader.init(); + this._glTex = new Texture( this.getWorld(), texMapName ); + this.updateTexture(); + } - // set up the material node - this._materialNode = RDGE.createMaterialNode("waterMaterial" + "_" + world.generateUniqueNodeID()); - this._materialNode.setShader(this._shader); + this.setEmboss = function( value ) + { + this._emboss = value; + this._propValues[ "emboss" ] = value; + + var material = this._materialNode; + if (material) { + var technique = material.shaderProgram['default']; + var renderer = RDGE.globals.engine.getContext().renderer; + if (renderer && technique) { + technique.u_emboss.set( [value] ); + } + } + } - this._time = 0; - if (this._shader && this._shader['default']) { - this._shader['default'].u_time.set([this._time]); - } + this.setIntensity = function( value ) + { + this._intensity = value; + this._propValues[ "intensity" ] = value; + + var material = this._materialNode; + if (material) { + var technique = material.shaderProgram['default']; + var renderer = RDGE.globals.engine.getContext().renderer; + if (renderer && technique) { + technique.u_intensity.set( [value] ); + console.log( "setting intensity to: " + value ); + } + } + } - var texMapName = this._propValues[this._propNames[0]]; - this._glTex = new Texture( world, texMapName ); + this.setDelta = function( value ) + { + this._delta = value; + this._propValues[ "delta" ] = value; + + var material = this._materialNode; + if (material) { + var technique = material.shaderProgram['default']; + var renderer = RDGE.globals.engine.getContext().renderer; + if (renderer && technique) { + technique.u_delta.set( [value] ); + } + } + } - // set the shader values in the shader - this.updateTexture(); - this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); - this.update(0); - }; + this.setSpeed = function( value ) + { + this._speed = value; + this._propValues[ "speed" ] = value; + + var material = this._materialNode; + if (material) { + var technique = material.shaderProgram['default']; + var renderer = RDGE.globals.engine.getContext().renderer; + if (renderer && technique) { + technique.u_speed.set( [value] ); + } + } + } }; /////////////////////////////////////////////////////////////////////////////////////// @@ -109,6 +233,10 @@ var waterMaterialDef = { 'u_tex0': { 'type': 'tex2d' }, 'u_time': { 'type': 'float' }, + 'u_emboss': { 'type': 'float' }, + 'u_delta': { 'type': 'float' }, + 'u_speed': { 'type': 'float' }, + 'u_intensity': { 'type': 'float' }, 'u_resolution': { 'type': 'vec2' } }, -- cgit v1.2.3 From 6c994c4b90023cecf4fd0caafb404b859fe28f54 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 6 Jun 2012 16:34:41 -0700 Subject: material cleanup and rearchitecture --- js/lib/rdge/materials/water-material.js | 45 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 1f0aa46e..8dbb3233 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -50,22 +50,6 @@ var WaterMaterial = function WaterMaterial() { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde - this.dup = function (world) { - // get the current values; - var propNames = [], propValues = [], propTypes = [], propLabels = []; - this.getAllProperties(propNames, propValues, propTypes, propLabels); - - // allocate a new material - var newMat = new WaterMaterial(); - - // copy over the current values; - var n = propNames.length; - for (var i = 0; i < n; i++) - newMat.setProperty(propNames[i], propValues[i]); - - return newMat; - }; this.setProperty = function( prop, value ) { // make sure we have legitimate imput @@ -142,6 +126,32 @@ var WaterMaterial = function WaterMaterial() { this.updateTexture(); } + this.updateTexture = function() { + + var texMapName = this._propValues[this._propNames[0]]; + this._glTex = new Texture( this.getWorld(), texMapName ); + + var material = this._materialNode; + if (material) { + var technique = material.shaderProgram['default']; + var renderer = RDGE.globals.engine.getContext().renderer; + if (renderer && technique) { + var wrap = 'REPEAT', mips = true; + var tex; + if (this._glTex) + { + if (this._glTex.isAnimated()) + this._glTex.render(); + tex = this._glTex.getTexture(); + } + + if (tex) { + technique.u_tex0.set( tex ); + } + } + } + }; + this.setEmboss = function( value ) { this._emboss = value; @@ -251,6 +261,7 @@ var waterMaterialDef = } }; +/* var ParisMaterial = function ParisMaterial() { // initialize the inherited members this.inheritedFrom = WaterMaterial; @@ -349,7 +360,7 @@ var parisMaterialDef = ] } }; - +*/ WaterMaterial.prototype = new PulseMaterial(); -- cgit v1.2.3 From db2bb0ab5d2747f0d07878e3b8a7d2d10c755110 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 7 Jun 2012 17:07:21 -0700 Subject: Material cleanup --- js/lib/rdge/materials/water-material.js | 387 ++++++++------------------------ 1 file changed, 96 insertions(+), 291 deletions(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 8dbb3233..3e63ddb6 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -11,81 +11,49 @@ var Texture = require("js/lib/rdge/texture").Texture; // Class GLMaterial // RDGE representation of a material. /////////////////////////////////////////////////////////////////////// -var WaterMaterial = function WaterMaterial() { - /////////////////////////////////////////////////////////////////////// - // Instance variables - /////////////////////////////////////////////////////////////////////// - this._name = "WaterMaterial"; - this._shaderName = "water"; - - this._texMap = 'assets/images/rocky-normal.jpg'; - //this._texMap = 'assets/images/powderblue.png'; - - this._time = 0.0; - this._dTime = 0.01; - this._emboss = 0.3; - this._delta = 20.0; - this._intensity = 3.0; - - this._speed = 0.2; - - /////////////////////////////////////////////////////////////////////// - // Properties - /////////////////////////////////////////////////////////////////////// - // all defined in parent PulseMaterial.js - // load the local default value - //this._propValues = []; - //this._propValues[this._propNames[0]] = this._texMap.slice(0); - this._propNames = ["texmap", "emboss", "delta", "intensity", "speed"]; +var WaterMaterial = function WaterMaterial() +{ + /////////////////////////////////////////////////////////////////////// + // Instance variables + /////////////////////////////////////////////////////////////////////// + this._name = "WaterMaterial"; + this._shaderName = "water"; + + this._defaultTexMap = 'assets/images/rocky-normal.jpg'; + + this._time = 0.0; + this._dTime = 0.01; + + this.isAnimated = function() { return true; }; + this.getShaderDef = function() { return waterMaterialDef; }; + + /////////////////////////////////////////////////////////////////////// + // Properties + /////////////////////////////////////////////////////////////////////// + // all defined in parent PulseMaterial.js + // load the local default value + this._propNames = ["u_tex0", "u_emboss", "u_delta", "u_intensity", "u_speed"]; this._propLabels = ["Texture map", "Emboss", "Delta", "Intensity", "Speed"]; this._propTypes = ["file", "float", "float", "float", "float"]; - this._propValues = []; - this._propValues[ this._propNames[0] ] = this._texMap.slice(0); - this._propValues[ this._propNames[1] ] = this._emboss; - this._propValues[ this._propNames[2] ] = this._delta; - this._propValues[ this._propNames[3] ] = this._intensity; - this._propValues[ this._propNames[4] ] = this._speed; - - /////////////////////////////////////////////////////////////////////// - // Methods - /////////////////////////////////////////////////////////////////////// - - this.setProperty = function( prop, value ) { - // make sure we have legitimate imput - var ok = this.validateProperty( prop, value ); - if (!ok) { - console.log( "invalid property in Water Material:" + prop + " : " + value ); - } - - switch (prop) - { - case "texmap": - this.setTextureMap(value); - break; - - case "emboss": - this.setEmboss( value ); - break; - - case "delta": - this.setDelta( value ); - break; - - case "intensity": - this.setIntensity( value ); - break; + var u_tex_index = 0, + u_emboss_index = 1, + u_delta_index = 2, + u_intensity_index = 3, + u_speed_index = 4; - case "speed": - this.setSpeed( value ); - break; + this._propValues = []; + this._propValues[ this._propNames[u_tex_index ] ] = this._defaultTexMap.slice(0); + this._propValues[ this._propNames[u_emboss_index ] ] = 0.3; + this._propValues[ this._propNames[u_delta_index ] ] = 20.0; + this._propValues[ this._propNames[u_intensity_index ] ] = 3.0; + this._propValues[ this._propNames[u_speed_index ] ] = 0.2; - case "color": - break; - } - }; + /////////////////////////////////////////////////////////////////////// + // Methods + /////////////////////////////////////////////////////////////////////// - this.init = function (world) { + this.init = function (world) { // save the world if (world) this.setWorld(world); @@ -99,119 +67,14 @@ var WaterMaterial = function WaterMaterial() { this._materialNode.setShader(this._shader); this._time = 0; - if (this._shader && this._shader['default']) { + if (this._shader && this._shader['default']) this._shader['default'].u_time.set([this._time]); - this._shader['default'].u_emboss.set( [this._emboss] ); - this._shader['default'].u_delta.set( [this._delta] ); - this._shader['default'].u_intensity.set( [this._intensity] ); - this._shader['default'].u_speed.set( [this._speed] ); - } - - var texMapName = this._propValues[this._propNames[0]]; - this._glTex = new Texture( world, texMapName ); - // set the shader values in the shader - this.updateTexture(); + this.setShaderValues(); this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); this.update(0); }; - - this.setTextureMap = function( texMapName ) - { - this._texMap = texMapName.slice(); - this._propValues[ this._propNames[0] ] = this._texMap.slice(0); - - this._glTex = new Texture( this.getWorld(), texMapName ); - this.updateTexture(); - } - - this.updateTexture = function() { - - var texMapName = this._propValues[this._propNames[0]]; - this._glTex = new Texture( this.getWorld(), texMapName ); - - var material = this._materialNode; - if (material) { - var technique = material.shaderProgram['default']; - var renderer = RDGE.globals.engine.getContext().renderer; - if (renderer && technique) { - var wrap = 'REPEAT', mips = true; - var tex; - if (this._glTex) - { - if (this._glTex.isAnimated()) - this._glTex.render(); - tex = this._glTex.getTexture(); - } - - if (tex) { - technique.u_tex0.set( tex ); - } - } - } - }; - - this.setEmboss = function( value ) - { - this._emboss = value; - this._propValues[ "emboss" ] = value; - - var material = this._materialNode; - if (material) { - var technique = material.shaderProgram['default']; - var renderer = RDGE.globals.engine.getContext().renderer; - if (renderer && technique) { - technique.u_emboss.set( [value] ); - } - } - } - - this.setIntensity = function( value ) - { - this._intensity = value; - this._propValues[ "intensity" ] = value; - - var material = this._materialNode; - if (material) { - var technique = material.shaderProgram['default']; - var renderer = RDGE.globals.engine.getContext().renderer; - if (renderer && technique) { - technique.u_intensity.set( [value] ); - console.log( "setting intensity to: " + value ); - } - } - } - - this.setDelta = function( value ) - { - this._delta = value; - this._propValues[ "delta" ] = value; - - var material = this._materialNode; - if (material) { - var technique = material.shaderProgram['default']; - var renderer = RDGE.globals.engine.getContext().renderer; - if (renderer && technique) { - technique.u_delta.set( [value] ); - } - } - } - - this.setSpeed = function( value ) - { - this._speed = value; - this._propValues[ "speed" ] = value; - - var material = this._materialNode; - if (material) { - var technique = material.shaderProgram['default']; - var renderer = RDGE.globals.engine.getContext().renderer; - if (renderer && technique) { - technique.u_speed.set( [value] ); - } - } - } }; /////////////////////////////////////////////////////////////////////////////////////// @@ -221,153 +84,95 @@ var WaterMaterial = function WaterMaterial() { var waterMaterialDef = { 'shaders': { - 'defaultVShader': "assets/shaders/Basic.vert.glsl", - 'defaultFShader': "assets/shaders/Water2.frag.glsl" + 'defaultVShader': "assets/shaders/Basic.vert.glsl", + 'defaultFShader': "assets/shaders/Water2.frag.glsl" }, - 'techniques': + 'techniques': { - 'default': + 'default': [ { - 'vshader': 'defaultVShader', - 'fshader': 'defaultFShader', - // attributes - 'attributes': + 'vshader': 'defaultVShader', + 'fshader': 'defaultFShader', + // attributes + 'attributes': { - 'vert': { 'type': 'vec3' }, - 'normal': { 'type': 'vec3' }, - 'texcoord': { 'type': 'vec2' } + 'vert': { 'type': 'vec3' }, + 'normal': { 'type': 'vec3' }, + 'texcoord': { 'type': 'vec2' } }, - // parameters - 'params': + // parameters + 'params': { - 'u_tex0': { 'type': 'tex2d' }, - 'u_time': { 'type': 'float' }, - 'u_emboss': { 'type': 'float' }, - 'u_delta': { 'type': 'float' }, - 'u_speed': { 'type': 'float' }, - 'u_intensity': { 'type': 'float' }, - 'u_resolution': { 'type': 'vec2' } + 'u_tex0': { 'type': 'tex2d' }, + 'u_time': { 'type': 'float' }, + 'u_emboss': { 'type': 'float' }, + 'u_delta': { 'type': 'float' }, + 'u_speed': { 'type': 'float' }, + 'u_intensity': { 'type': 'float' }, + 'u_resolution': { 'type': 'vec2' } }, - // render states - 'states': + // render states + 'states': { - 'depthEnable': true, - 'offset': [1.0, 0.1] + 'depthEnable': true, + 'offset': [1.0, 0.1] } } ] } }; -/* -var ParisMaterial = function ParisMaterial() { - // initialize the inherited members - this.inheritedFrom = WaterMaterial; - this.inheritedFrom(); - - this._name = "ParisMaterial"; - this._shaderName = "paris"; +var ParisMaterial = function ParisMaterial() +{ + // initialize the inherited members + this.inheritedFrom = WaterMaterial; + this.inheritedFrom(); - this._texMap = 'assets/images/paris.png'; - this._propValues[this._propNames[0]] = this._texMap.slice(0); + this._name = "ParisMaterial"; + this._shaderName = "paris"; - this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; - this._propValues[this._propNames[1]] = this._diffuseColor.slice(); + this._defaultTexMap = 'assets/images/paris.png'; + this._propValues[this._propNames[u_tex_index]] = this._defaultTexMap.slice(0); - // duplcate method requirde - this.dup = function (world) { - // allocate a new uber material - var newMat = new ParisMaterial(); + //this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; + //this._propValues[this._propNames[1]] = this._diffuseColor.slice(); - // copy over the current values; - var propNames = [], propValues = [], propTypes = [], propLabels = []; - this.getAllProperties(propNames, propValues, propTypes, propLabels); - var n = propNames.length; - for (var i = 0; i < n; i++) - newMat.setProperty(propNames[i], propValues[i]); - - return newMat; - }; - - this.init = function (world) { - // save the world - if (world) this.setWorld(world); + this.init = function (world) + { + // save the world + if (world) this.setWorld(world); - // set up the shader - this._shader = new RDGE.jshader(); - this._shader.def = parisMaterialDef; - this._shader.init(); + // set up the shader + this._shader = new RDGE.jshader(); + this._shader.def = waterMaterialDef; + this._shader.init(); - // set up the material node - this._materialNode = RDGE.createMaterialNode("parisMaterial" + "_" + world.generateUniqueNodeID()); - this._materialNode.setShader(this._shader); + // set up the material node + this._materialNode = RDGE.createMaterialNode("parisMaterial" + "_" + world.generateUniqueNodeID()); + this._materialNode.setShader(this._shader); - this._time = 0; - if (this._shader && this._shader['default']) { - this._shader['default'].u_time.set([this._time]); - } + this._time = 0; + if (this._shader && this._shader['default']) + this._shader['default'].u_time.set([this._time]); - // set the shader values in the shader - this.updateTexture(); - this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); - this.update(0); - }; + // set the shader values in the shader + this.setShaderValues(); + this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); + this.update(0); + } } + ParisMaterial.prototype = new PulseMaterial(); if (typeof exports === "object") { - exports.ParisMaterial = ParisMaterial; + exports.ParisMaterial = ParisMaterial; } -// shader spec (can also be loaded from a .JSON file, or constructed at runtime) -var parisMaterialDef = -{ 'shaders': - { - 'defaultVShader': "assets/shaders/Basic.vert.glsl", - 'defaultFShader': "assets/shaders/Paris.frag.glsl" - }, - 'techniques': - { - 'default': - [ - { - 'vshader': 'defaultVShader', - 'fshader': 'defaultFShader', - // attributes - 'attributes': - { - 'vert': { 'type': 'vec3' }, - 'normal': { 'type': 'vec3' }, - 'texcoord': { 'type': 'vec2' } - }, - // parameters - 'params': - { - 'u_tex0': { 'type': 'tex2d' }, - 'u_time': { 'type': 'float' }, - 'u_resolution': { 'type': 'vec2' } - }, - - // render states - 'states': - { - 'depthEnable': true, - 'offset': [1.0, 0.1] - } - } - ] - } -}; -*/ WaterMaterial.prototype = new PulseMaterial(); if (typeof exports === "object") { - exports.WaterMaterial = WaterMaterial; + exports.WaterMaterial = WaterMaterial; } - - - - -- cgit v1.2.3 From a7aa51e6b91623772eef54b827616432838b560e Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 13 Jun 2012 13:56:10 -0700 Subject: Material bug fixes - reset texture array. --- js/lib/rdge/materials/water-material.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 3e63ddb6..1dd127fc 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -24,6 +24,9 @@ var WaterMaterial = function WaterMaterial() this._time = 0.0; this._dTime = 0.01; + // array textures indexed by shader uniform name + this._glTextures = []; + this.isAnimated = function() { return true; }; this.getShaderDef = function() { return waterMaterialDef; }; -- cgit v1.2.3 From f0fc7a5678093cce986bd99fef2c5c88add19b68 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 14 Jun 2012 16:09:31 -0700 Subject: Fix for line color. Name change for all materials --- js/lib/rdge/materials/water-material.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 1dd127fc..f2ef0e49 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -16,7 +16,7 @@ var WaterMaterial = function WaterMaterial() /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - this._name = "WaterMaterial"; + this._name = "Water"; this._shaderName = "water"; this._defaultTexMap = 'assets/images/rocky-normal.jpg'; -- cgit v1.2.3 From 2779b48197effabe1a975c8139c497631238f8f1 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 15 Jun 2012 11:26:57 -0700 Subject: Re-added Paris material --- js/lib/rdge/materials/water-material.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/lib/rdge/materials/water-material.js') diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index f2ef0e49..982b581f 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -133,11 +133,11 @@ var ParisMaterial = function ParisMaterial() this.inheritedFrom = WaterMaterial; this.inheritedFrom(); - this._name = "ParisMaterial"; + this._name = "Paris"; this._shaderName = "paris"; this._defaultTexMap = 'assets/images/paris.png'; - this._propValues[this._propNames[u_tex_index]] = this._defaultTexMap.slice(0); + this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0); //this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; //this._propValues[this._propNames[1]] = this._diffuseColor.slice(); -- cgit v1.2.3