From d3443f777534dec68eb30a5a3173d845498e9737 Mon Sep 17 00:00:00 2001 From: Rob Shearing Date: Wed, 4 Mar 2015 18:09:39 +1100 Subject: [PATCH 1/2] Removed PHONG shading reference Fixed the method signature and fragment register accessors in the custom diffuseMethod of the CompositeDiffuseMethod instance --- .../globe/src/GlobeMaterialsTutorialListing07.as | 2 +- .../globe/src/GlobeMaterialsTutorialListing08.as | 6 +++--- .../globe/src/GlobeMaterialsTutorialListing09.as | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as index d672297..a40f722 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as @@ -106,7 +106,7 @@ package var earthFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); earthFresnelSpecularMethod.fresnelPower = 1; earthFresnelSpecularMethod.normalReflectance = 0.1; - earthFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material for earth surface. var earthSurfaceMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( EarthSurfaceDiffuse ) ); earthSurfaceMaterial.specularMethod = earthFresnelSpecularMethod; diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as index 2595542..c9c4397 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as @@ -150,9 +150,9 @@ package _earth.addChild( earthAtmosphere ); } - private function modulateDiffuseMethod( vo:MethodVO, t:ShaderRegisterElement, regCache:ShaderRegisterCache ):String { - var viewDirFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.viewDirFragmentReg; - var normalFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.normalFragmentReg; + private function modulateDiffuseMethod(vo : MethodVO, t:ShaderRegisterElement, regCache:ShaderRegisterCache, sharedRegisters:ShaderRegisterData):String{ + var viewDirFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.sharedRegisters.viewDirFragment; + var normalFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.sharedRegisters.normalFragment; var temp:ShaderRegisterElement = regCache.getFreeFragmentSingleTemp(); regCache.addFragmentTempUsages( temp, 1 ); var code:String = "dp3 " + temp + ", " + viewDirFragmentReg + ".xyz, " + normalFragmentReg + ".xyz\n" + diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as index fd28bac..41ba6a5 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as @@ -162,7 +162,7 @@ package var earthFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); earthFresnelSpecularMethod.fresnelPower = 1; earthFresnelSpecularMethod.normalReflectance = 0.1; - earthFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material for earth surface. var earthSurfaceMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( EarthSurfaceDiffuse ) ); earthSurfaceMaterial.specularMethod = earthFresnelSpecularMethod; @@ -201,9 +201,9 @@ package _earth.addChild( earthAtmosphere ); } - private function modulateDiffuseMethod( vo:MethodVO, t:ShaderRegisterElement, regCache:ShaderRegisterCache ):String { - var viewDirFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.viewDirFragmentReg; - var normalFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.normalFragmentReg; + private function modulateDiffuseMethod(vo : MethodVO, t:ShaderRegisterElement, regCache:ShaderRegisterCache, sharedRegisters:ShaderRegisterData):String{ + var viewDirFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.sharedRegisters.viewDirFragment; + var normalFragmentReg:ShaderRegisterElement = _atmosphereDiffuseMethod.sharedRegisters.normalFragment; var temp:ShaderRegisterElement = regCache.getFreeFragmentSingleTemp(); regCache.addFragmentTempUsages( temp, 1 ); var code:String = "dp3 " + temp + ", " + viewDirFragmentReg + ".xyz, " + normalFragmentReg + ".xyz\n" + From 65dd3c5e318215987a278865a136f199fb78f41f Mon Sep 17 00:00:00 2001 From: Rob Shearing Date: Wed, 4 Mar 2015 18:28:31 +1100 Subject: [PATCH 2/2] Globe tutorial now compatible with Away 4.1.6 --- .../globe/src/GlobeMaterialsTutorialListing07.as | 3 +-- .../globe/src/GlobeMaterialsTutorialListing08.as | 5 ++--- .../globe/src/GlobeMaterialsTutorialListing09.as | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as index a40f722..5fc2431 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing07.as @@ -8,7 +8,6 @@ package import away3d.lights.PointLight; import away3d.materials.ColorMaterial; import away3d.materials.TextureMaterial; - import away3d.materials.methods.FresnelSpecularMethod; import away3d.materials.methods.SpecularShadingModel; import away3d.primitives.SkyBox; import away3d.primitives.SphereGeometry; @@ -147,7 +146,7 @@ package var moonFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); moonFresnelSpecularMethod.fresnelPower = 1; moonFresnelSpecularMethod.normalReflectance = 0.1; - moonFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material. var moonMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( MoonSurfaceDiffuse ) ); moonMaterial.specularMethod = moonFresnelSpecularMethod; diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as index c9c4397..c21162c 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as @@ -11,7 +11,6 @@ package import away3d.materials.methods.CompositeDiffuseMethod; import away3d.materials.methods.FresnelSpecularMethod; import away3d.materials.methods.MethodVO; - import away3d.materials.methods.SpecularShadingModel; import away3d.materials.utils.ShaderRegisterCache; import away3d.materials.utils.ShaderRegisterElement; import away3d.primitives.SkyBox; @@ -111,7 +110,7 @@ package var earthFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); earthFresnelSpecularMethod.fresnelPower = 1; earthFresnelSpecularMethod.normalReflectance = 0.1; - earthFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material for earth surface. var earthSurfaceMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( EarthSurfaceDiffuse ) ); earthSurfaceMaterial.specularMethod = earthFresnelSpecularMethod; @@ -167,7 +166,7 @@ package var moonFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); moonFresnelSpecularMethod.fresnelPower = 1; moonFresnelSpecularMethod.normalReflectance = 0.1; - moonFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material. var moonMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( MoonSurfaceDiffuse ) ); moonMaterial.specularMethod = moonFresnelSpecularMethod; diff --git a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as index 41ba6a5..153d8ed 100644 --- a/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as +++ b/tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as @@ -12,9 +12,9 @@ package import away3d.materials.methods.CompositeDiffuseMethod; import away3d.materials.methods.FresnelSpecularMethod; import away3d.materials.methods.MethodVO; - import away3d.materials.methods.SpecularShadingModel; - import away3d.materials.utils.ShaderRegisterCache; - import away3d.materials.utils.ShaderRegisterElement; + import away3d.materials.compilation.ShaderRegisterData; + import away3d.materials.compilation.ShaderRegisterCache; + import away3d.materials.compilation.ShaderRegisterElement; import away3d.primitives.SkyBox; import away3d.primitives.SphereGeometry; import away3d.textures.BitmapCubeTexture; @@ -218,7 +218,7 @@ package var moonFresnelSpecularMethod:FresnelSpecularMethod = new FresnelSpecularMethod( true ); moonFresnelSpecularMethod.fresnelPower = 1; moonFresnelSpecularMethod.normalReflectance = 0.1; - moonFresnelSpecularMethod.shadingModel = SpecularShadingModel.PHONG; + // Material. var moonMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( MoonSurfaceDiffuse ) ); moonMaterial.specularMethod = moonFresnelSpecularMethod;