Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Globe Tutorials #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,7 +105,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;
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions tutorials/materials/globe/src/GlobeMaterialsTutorialListing08.as
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -150,9 +149,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" +
Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions tutorials/materials/globe/src/GlobeMaterialsTutorialListing09.as
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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" +
Expand All @@ -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;
Expand Down