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/deform-material.js | 5 +++++ js/lib/rdge/materials/fly-material.js | 5 +++++ js/lib/rdge/materials/julia-material.js | 5 +++++ js/lib/rdge/materials/keleidoscope-material.js | 5 +++++ js/lib/rdge/materials/mandel-material.js | 5 +++++ js/lib/rdge/materials/pulse-material.js | 8 +++++--- js/lib/rdge/materials/square-tunnel-material.js | 5 +++++ js/lib/rdge/materials/star-material.js | 5 +++++ js/lib/rdge/materials/tunnel-material.js | 5 +++++ js/lib/rdge/materials/twist-material.js | 5 +++++ js/lib/rdge/materials/water-material.js | 4 ++++ js/lib/rdge/materials/z-invert-material.js | 5 +++++ 12 files changed, 59 insertions(+), 3 deletions(-) diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js index dfd89d12..c7bfe67a 100644 --- a/js/lib/rdge/materials/deform-material.js +++ b/js/lib/rdge/materials/deform-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var DeformMaterial = function DeformMaterial() { /////////////////////////////////////////////////////////////////////// @@ -68,6 +69,10 @@ var DeformMaterial = function DeformMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js index bd92ecd8..81cd1522 100644 --- a/js/lib/rdge/materials/fly-material.js +++ b/js/lib/rdge/materials/fly-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var FlyMaterial = function FlyMaterial() { /////////////////////////////////////////////////////////////////////// @@ -61,6 +62,10 @@ var FlyMaterial = function FlyMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js index a85bd6f7..c1eb2b6d 100644 --- a/js/lib/rdge/materials/julia-material.js +++ b/js/lib/rdge/materials/julia-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var JuliaMaterial = function JuliaMaterial() { /////////////////////////////////////////////////////////////////////// @@ -59,6 +60,10 @@ var JuliaMaterial = function JuliaMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + var texMapName = this._propValues[this._propNames[0]]; + this._glTex = new Texture( world, texMapName ); + // set the shader values in the shader this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); this.update( 0 ); diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js index 16d1ccfa..a687bd59 100644 --- a/js/lib/rdge/materials/keleidoscope-material.js +++ b/js/lib/rdge/materials/keleidoscope-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var KeleidoscopeMaterial = function KeleidoscopeMaterial() { /////////////////////////////////////////////////////////////////////// @@ -68,6 +69,10 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js index e7b105e1..4babe239 100644 --- a/js/lib/rdge/materials/mandel-material.js +++ b/js/lib/rdge/materials/mandel-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var MandelMaterial = function MandelMaterial() { /////////////////////////////////////////////////////////////////////// @@ -70,6 +71,10 @@ var MandelMaterial = function MandelMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + var texMapName = this._propValues[this._propNames[0]]; + this._glTex = new Texture( world, texMapName ); + // set the shader values in the shader this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); this.update( 0 ); diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index b12e9dd5..f7f6c7ae 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js @@ -4,8 +4,9 @@ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ -var Texture = require("js/lib/rdge/texture").Texture; var Material = require("js/lib/rdge/materials/material").Material; +var Texture = require("js/lib/rdge/texture").Texture; + /////////////////////////////////////////////////////////////////////// // Class GLMaterial // RDGE representation of a material. @@ -24,8 +25,8 @@ var PulseMaterial = function PulseMaterial() this._name = "PulseMaterial"; this._shaderName = "pulse"; - this._texMap = 'assets/images/cubelight.png'; - //this._texMap = 'texture'; + //this._texMap = 'assets/images/cubelight.png'; + this._texMap = 'texture'; this._time = 0.0; this._dTime = 0.01; @@ -117,6 +118,7 @@ var PulseMaterial = function PulseMaterial() this._shader['default'].u_time.set( [this._time] ); } + // set up the texture var texMapName = this._propValues[this._propNames[0]]; this._glTex = new Texture( world, texMapName ); diff --git a/js/lib/rdge/materials/square-tunnel-material.js b/js/lib/rdge/materials/square-tunnel-material.js index 9264872f..6e987fdc 100644 --- a/js/lib/rdge/materials/square-tunnel-material.js +++ b/js/lib/rdge/materials/square-tunnel-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var SquareTunnelMaterial = function SquareTunnelMaterial() { /////////////////////////////////////////////////////////////////////// @@ -63,6 +64,10 @@ var SquareTunnelMaterial = function SquareTunnelMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/star-material.js b/js/lib/rdge/materials/star-material.js index d7d797e4..1506927b 100644 --- a/js/lib/rdge/materials/star-material.js +++ b/js/lib/rdge/materials/star-material.js @@ -5,6 +5,7 @@ */ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var StarMaterial = function StarMaterial() { /////////////////////////////////////////////////////////////////////// @@ -63,6 +64,10 @@ var StarMaterial = function StarMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/tunnel-material.js b/js/lib/rdge/materials/tunnel-material.js index fe0fbd51..aa93d5ba 100644 --- a/js/lib/rdge/materials/tunnel-material.js +++ b/js/lib/rdge/materials/tunnel-material.js @@ -6,6 +6,7 @@ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var TunnelMaterial = function TunnelMaterial() { /////////////////////////////////////////////////////////////////////// @@ -64,6 +65,10 @@ var TunnelMaterial = function TunnelMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); diff --git a/js/lib/rdge/materials/twist-material.js b/js/lib/rdge/materials/twist-material.js index 163c8a77..d0a2d8c4 100644 --- a/js/lib/rdge/materials/twist-material.js +++ b/js/lib/rdge/materials/twist-material.js @@ -6,6 +6,7 @@ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; /////////////////////////////////////////////////////////////////////// var TwistMaterial = function TwistMaterial() { @@ -64,6 +65,10 @@ var TwistMaterial = function TwistMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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()] ); 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()] ); diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js index a0d20de5..0d62d1b0 100644 --- a/js/lib/rdge/materials/z-invert-material.js +++ b/js/lib/rdge/materials/z-invert-material.js @@ -6,6 +6,7 @@ var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var Texture = require("js/lib/rdge/texture").Texture; var ZInvertMaterial = function ZInvertMaterial() { /////////////////////////////////////////////////////////////////////// @@ -63,6 +64,10 @@ var ZInvertMaterial = function ZInvertMaterial() { this._shader['default'].u_time.set( [this._time] ); } + // set up the texture + 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