/src/away3d/materials/SkyBoxMaterial.as
http://github.com/away3d/away3d-core-fp11 · ActionScript · 48 lines · 29 code · 7 blank · 12 comment · 6 complexity · cc3b0ee3c5b2fe7340889fe35714fc99 MD5 · raw file
- package away3d.materials
- {
- import away3d.arcane;
- import away3d.materials.passes.SkyBoxPass;
- import away3d.textures.CubeTextureBase;
-
- use namespace arcane;
-
- /**
- * SkyBoxMaterial is a material exclusively used to render skyboxes
- *
- * @see away3d.primitives.SkyBox
- */
- public class SkyBoxMaterial extends MaterialBase
- {
- private var _cubeMap:CubeTextureBase;
- private var _skyboxPass:SkyBoxPass;
-
- /**
- * Creates a new SkyBoxMaterial object.
- * @param cubeMap The CubeMap to use as the skybox.
- */
- public function SkyBoxMaterial(cubeMap:CubeTextureBase)
- {
- _cubeMap = cubeMap;
- addPass(_skyboxPass = new SkyBoxPass());
- _skyboxPass.cubeTexture = _cubeMap;
- }
-
- /**
- * The cube texture to use as the skybox.
- */
- public function get cubeMap():CubeTextureBase
- {
- return _cubeMap;
- }
-
- public function set cubeMap(value:CubeTextureBase):void
- {
- if (value && _cubeMap && (value.hasMipMaps != _cubeMap.hasMipMaps || value.format != _cubeMap.format))
- invalidatePasses(null);
-
- _cubeMap = value;
-
- _skyboxPass.cubeTexture = _cubeMap;
- }
- }
- }