├── .DS_Store ├── .gitignore ├── README.md ├── ant └── ant-contrib.jar ├── away3d-tutorials-fp11.iml ├── build.xml ├── bundle ├── build │ ├── post_compile.xml │ └── pre_compile.xml ├── html-template │ ├── history │ │ ├── history.css │ │ ├── history.js │ │ └── historyFrame.html │ ├── index.template.html │ ├── playerProductInstall.swf │ └── swfobject.js └── launch │ └── project.launch └── tutorials ├── animation └── basic_tweening │ ├── Basic_Tweening3D.zip │ ├── bin │ ├── Basic_Tweening3D.html │ ├── Basic_Tweening3D.swf │ ├── history │ │ ├── history.css │ │ └── history.js │ ├── playerProductInstall.swf │ └── swfobject.js │ ├── embeds │ ├── floor_diffuse.jpg │ └── trinket_diffuse.jpg │ ├── images │ └── Basic_Tweening3D.jpg │ ├── libs │ └── tweener.swc │ ├── manifest.txt │ └── src │ ├── Basic_Tweening3D.as │ └── Interactivity and Tweening.html ├── materials ├── advanced_custom │ ├── assets │ │ └── floor_diffuse.jpg │ └── src │ │ ├── Custom Materials 01.html │ │ ├── Custom Materials 02.html │ │ ├── Custom Materials 03.html │ │ ├── CustomMaterials01.as │ │ ├── CustomMaterials02.as │ │ ├── CustomMaterials03.as │ │ ├── tut01 │ │ ├── TrivialColorMaterial.as │ │ └── TrivialColorPass.as │ │ ├── tut02 │ │ ├── TrivialTextureMaterial.as │ │ ├── TrivialTexturePass.as │ │ └── TrivialTexturePass_Alternative.as │ │ ├── tut03 │ │ ├── SingleLightTextureMaterial.as │ │ └── SingleLightTexturePass.as │ │ └── utils │ │ └── FlightController.as ├── basic_atf_shading │ ├── Basic_ATF_Shading.zip │ ├── asset │ │ ├── ball │ │ │ ├── beachball_diffuse.atf │ │ │ ├── beachball_diffuse.png │ │ │ ├── beachball_specular.atf │ │ │ └── beachball_specular.png │ │ ├── cube │ │ │ ├── trinket_diffuse.atf │ │ │ ├── trinket_diffuse.png │ │ │ ├── trinket_normal.atf │ │ │ ├── trinket_normal.png │ │ │ ├── trinket_specular.atf │ │ │ └── trinket_specular.png │ │ ├── floor │ │ │ ├── floor_diffuse.atf │ │ │ ├── floor_diffuse.png │ │ │ ├── floor_normal.atf │ │ │ ├── floor_normal.png │ │ │ ├── floor_specular.atf │ │ │ └── floor_specular.png │ │ ├── signature.fla │ │ ├── signature.swf │ │ ├── sky │ │ │ └── hourglass_cubemap2.atf │ │ └── torus │ │ │ ├── weave_diffuse.atf │ │ │ ├── weave_diffuse.png │ │ │ ├── weave_normal.atf │ │ │ └── weave_normal.png │ ├── bin │ │ └── Basic_Shading_with_ATF.swf │ ├── manifest.txt │ ├── pb │ │ ├── NormalizeSplats.pbj │ │ ├── NormalizeSplats.pbk │ │ ├── RayTriangleKernel.pbj │ │ └── RayTriangleKernel.pbk │ └── src │ │ └── Basic_Shading_with_ATF.as ├── basic_atf_texture │ ├── Basic_ATF_Texture.zip │ ├── asset │ │ ├── ball │ │ │ ├── beachball_diffuse.atf │ │ │ ├── beachball_diffuse.png │ │ │ ├── beachball_specular.atf │ │ │ └── beachball_specular.png │ │ ├── cube │ │ │ ├── trinket_diffuse.atf │ │ │ ├── trinket_diffuse.png │ │ │ ├── trinket_normal.atf │ │ │ ├── trinket_normal.png │ │ │ ├── trinket_specular.atf │ │ │ └── trinket_specular.png │ │ ├── floor │ │ │ ├── floor_diffuse.atf │ │ │ ├── floor_diffuse.png │ │ │ ├── floor_normal.atf │ │ │ ├── floor_normal.png │ │ │ ├── floor_specular.atf │ │ │ └── floor_specular.png │ │ ├── signature.fla │ │ ├── signature.swf │ │ ├── sky │ │ │ └── hourglass_cubemap2.atf │ │ └── torus │ │ │ ├── weave_diffuse.atf │ │ │ ├── weave_diffuse.png │ │ │ ├── weave_normal.atf │ │ │ └── weave_normal.png │ ├── bin │ │ └── Basic_ATF_Texture.swf │ ├── manifest.txt │ ├── pb │ │ ├── NormalizeSplats.pbj │ │ ├── NormalizeSplats.pbk │ │ ├── RayTriangleKernel.pbj │ │ └── RayTriangleKernel.pbk │ └── src │ │ └── Basic_ATF_Texture.as ├── basic_shading │ ├── Basic_Shading.zip │ ├── bin │ │ ├── Basic_Shading.html │ │ ├── Basic_Shading.swf │ │ ├── Basic_Shading_Ex1.html │ │ ├── Basic_Shading_Ex1.swf │ │ ├── Basic_Shading_Ex2.html │ │ ├── Basic_Shading_Ex2.swf │ │ ├── Basic_Shading_Ex3.html │ │ ├── Basic_Shading_Ex3.swf │ │ ├── assets │ │ │ └── PolarBear.awd │ │ ├── history │ │ │ ├── history.css │ │ │ └── history.js │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── embeds │ │ ├── beachball_diffuse.jpg │ │ ├── beachball_specular.jpg │ │ ├── floor_diffuse.jpg │ │ ├── floor_normal.jpg │ │ ├── floor_specular.jpg │ │ ├── signature.swf │ │ ├── trinket_diffuse.jpg │ │ ├── trinket_normal.jpg │ │ ├── trinket_specular.jpg │ │ ├── weave_diffuse.jpg │ │ └── weave_normal.jpg │ ├── images │ │ ├── Basic_Shading.jpg │ │ ├── Basic_Shading_Ex1.jpg │ │ ├── Basic_Shading_Ex2.jpg │ │ ├── Basic_Shading_Ex3.jpg │ │ ├── beachball_diffuse_t.jpg │ │ ├── beachball_specular_t.jpg │ │ ├── signature.swf │ │ ├── speculardifference_1.jpg │ │ ├── trinket_diffuse_t.jpg │ │ ├── trinket_normal_t.jpg │ │ ├── trinket_specular_t.jpg │ │ ├── weave_diffuse_t.jpg │ │ └── weave_normal_t.jpg │ ├── manifest.txt │ └── src │ │ ├── Basic_Shading.as │ │ ├── Basic_Shading_Ex1.as │ │ ├── Basic_Shading_Ex2.as │ │ ├── Basic_Shading_Ex3.as │ │ └── Introduction To Materials.html ├── basic_skybox │ ├── Basic_SkyBox.zip │ ├── bin │ │ ├── Basic_SkyBox.html │ │ ├── Basic_SkyBox.swf │ │ ├── history │ │ │ ├── history.css │ │ │ └── history.js │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── embeds │ │ └── skybox │ │ │ ├── snow_negative_x.jpg │ │ │ ├── snow_negative_y.jpg │ │ │ ├── snow_negative_z.jpg │ │ │ ├── snow_positive_x.jpg │ │ │ ├── snow_positive_y.jpg │ │ │ └── snow_positive_z.jpg │ ├── images │ │ ├── Basic_Skybox.jpg │ │ ├── skybox_description.jpg │ │ ├── snow_negative_x_t.jpg │ │ ├── snow_negative_y_t.jpg │ │ ├── snow_negative_z_t.jpg │ │ ├── snow_positive_x_t.jpg │ │ ├── snow_positive_y_t.jpg │ │ └── snow_positive_z_t.jpg │ ├── manifest.txt │ └── src │ │ ├── Basic_SkyBox.as │ │ └── Using A Skybox.html └── globe │ ├── GlobeMaterialsTutorial.zip │ ├── bin │ ├── listing_01 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_02 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_03 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_04 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_05 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_06 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_07 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_08 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ └── listing_09 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── embeds │ ├── earth_ambient.jpg │ ├── earth_clouds.jpg │ ├── earth_diffuse.jpg │ ├── earth_normals.png │ ├── earth_specular.jpg │ ├── flare0.jpg │ ├── flare1.jpg │ ├── flare10.jpg │ ├── flare11.jpg │ ├── flare12.jpg │ ├── flare2.jpg │ ├── flare3.jpg │ ├── flare4.jpg │ ├── flare5.jpg │ ├── flare6.jpg │ ├── flare7.jpg │ ├── flare8.jpg │ ├── flare9.jpg │ ├── moon.jpg │ ├── space_negX.jpg │ ├── space_negY.jpg │ ├── space_negZ.jpg │ ├── space_posX.jpg │ ├── space_posY.jpg │ ├── space_posZ.jpg │ ├── star.jpg │ └── sun.jpg │ ├── images │ ├── earth_ambient.jpg │ ├── earth_diffuse.jpg │ ├── earth_normals.png │ ├── earth_specular.jpg │ ├── listing_01.jpg │ ├── listing_02.jpg │ ├── listing_03.jpg │ ├── listing_04.jpg │ ├── listing_05.jpg │ ├── listing_06.jpg │ ├── listing_07.jpg │ ├── listing_08.jpg │ └── listing_09.jpg │ ├── manifest.txt │ └── src │ ├── GlobeMaterialsTutorial.html │ ├── GlobeMaterialsTutorialListing01.as │ ├── GlobeMaterialsTutorialListing02.as │ ├── GlobeMaterialsTutorialListing03.as │ ├── GlobeMaterialsTutorialListing04.as │ ├── GlobeMaterialsTutorialListing05.as │ ├── GlobeMaterialsTutorialListing06.as │ ├── GlobeMaterialsTutorialListing07.as │ ├── GlobeMaterialsTutorialListing08.as │ ├── GlobeMaterialsTutorialListing09.as │ └── GlobeMaterialsTutorialListingBase.as ├── misc └── wikitutorials │ └── src │ └── WikiTutorials.html ├── particles └── particles_beginning │ ├── ParticlesBeginning.zip │ ├── bin │ ├── TheAdvancedDemo.html │ ├── TheAdvancedDemo.jpg │ ├── TheAdvancedDemo.swf │ ├── TheBasicTutorial.html │ ├── TheBasicTutorial.jpg │ ├── TheBasicTutorial.swf │ ├── history │ │ ├── history.css │ │ ├── history.js │ │ └── historyFrame.html │ ├── playerProductInstall.swf │ ├── preview.html │ ├── preview.jpg │ ├── preview.swf │ └── swfobject.js │ ├── embeds │ └── text.png │ ├── manifest.txt │ └── src │ ├── ParticlesBeginning.html │ ├── TheAdvancedDemo.as │ └── TheBasicTutorial.as ├── picking └── overview │ ├── PickingTutorial.zip │ ├── assets │ └── RayScene.mb │ ├── bin │ ├── listing_01 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_02 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_03 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_04 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── listing_05 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ └── listing_06 │ │ ├── Launcher.html │ │ ├── Launcher.swf │ │ ├── playerProductInstall.swf │ │ └── swfobject.js │ ├── embeds │ ├── head.obj │ ├── hellknight.md5mesh │ ├── hellknight_diffuse.jpg │ ├── hellknight_normals.png │ ├── hellknight_specular.png │ └── walk7.md5anim │ ├── images │ ├── figure_01.jpg │ ├── figure_02.png │ ├── listing_01.jpg │ ├── listing_02.jpg │ ├── listing_03.jpg │ ├── listing_04.jpg │ ├── listing_05.jpg │ └── listing_06.jpg │ ├── manifest.txt │ └── src │ ├── PickingTutorial.html │ ├── PickingTutorialListing01.as │ ├── PickingTutorialListing02.as │ ├── PickingTutorialListing03.as │ ├── PickingTutorialListing04.as │ ├── PickingTutorialListing05.as │ ├── PickingTutorialListing06.as │ └── PickingTutorialListingBase.as ├── scenegraph └── basic_view │ ├── Basic_View.zip │ ├── bin │ ├── Basic_View.html │ ├── Basic_View.swf │ ├── history │ │ ├── history.css │ │ └── history.js │ ├── playerProductInstall.swf │ └── swfobject.js │ ├── embeds │ └── floor_diffuse.jpg │ ├── images │ ├── Basic_View.jpg │ └── floor_no_texture.png │ ├── manifest.txt │ └── src │ ├── Basic_View.as │ └── Setting_Up_Your_Scene.html ├── starling └── interoperation │ ├── Intermediate_One_Away3D_Two_Starling_Layers.zip │ ├── bin │ ├── Intermediate_One_Away3D_Two_Starling_Layers.html │ ├── Intermediate_One_Away3D_Two_Starling_Layers.swf │ ├── history │ │ ├── history.css │ │ └── history.js │ ├── playerProductInstall.swf │ └── swfobject.js │ ├── embeds │ ├── .svn │ │ ├── entries │ │ ├── prop-base │ │ │ ├── button.png.svn-base │ │ │ └── stars.png.svn-base │ │ └── text-base │ │ │ ├── button.png.svn-base │ │ │ ├── stars.pex.svn-base │ │ │ └── stars.png.svn-base │ ├── button.png │ ├── stars.pex │ └── stars.png │ ├── manifest.txt │ └── src │ ├── Intermediate_One_Away3D_Two_Starling_Layers.as │ ├── Starling_Tutorial.html │ └── starling │ ├── .svn │ └── entries │ └── rootsprites │ ├── .svn │ ├── entries │ └── text-base │ │ ├── StarlingCheckerboardSprite.as.svn-base │ │ └── StarlingStarsSprite.as.svn-base │ ├── StarlingCheckerboardSprite.as │ └── StarlingStarsSprite.as └── workflow └── max ├── bin └── listing_01 │ ├── Launcher.html │ ├── onkba.awd │ ├── onkba.html │ ├── onkba_N.jpg │ ├── onkba_N.png │ ├── swfobject.js │ ├── viewer.swf │ └── viewer_loth.swf ├── images └── listing_01.jpg └── src └── Away3DMaxWorkflow.html /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build and Release Folders 2 | bin-debug/ 3 | bin-release/ 4 | 5 | # Project property files 6 | .actionScriptProperties 7 | .flexProperties 8 | .settings/ 9 | .project 10 | .iml 11 | 12 | # OSX files 13 | .DS_Store 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | away3d-tutorials-fp11 2 | ===================== 3 | 4 | Tutorials for use with the Away3D engine for Flash Player 11 -------------------------------------------------------------------------------- /ant/ant-contrib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/ant/ant-contrib.jar -------------------------------------------------------------------------------- /away3d-tutorials-fp11.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tasks to construct the downloadable ZIP files for the tutorial projects. 8 | 9 | Requires an manifest.xml file located in the tutorial folder to be included in the 10 | zip. The manifest.xml file contains the filenames of the classes to be used to create 11 | launch scripts. 12 | 13 | 14 | 15 | 16 | 17 | 18 | - Util:Removing temporary folder. 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | - Util:Creating temporary folder. 33 | 34 | 35 | 36 | 37 | Generate Specified Tutorial ZIP" 38 | 39 | 40 | 41 | 42 | 43 | Generate ALL Tutorial ZIP Bundles 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Generating tutorial ZIP bundle @{manifest-file} 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /bundle/build/post_compile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | Creating Deploy Dir... 63 | 64 | 65 | 66 | 67 | 68 | Cleaning... 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Creating Wrapper... 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | Copying Assets... 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /bundle/build/pre_compile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Creating Output file... 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bundle/html-template/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /bundle/html-template/history/historyFrame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | Hidden frame for Browser History support. 28 | 29 | 30 | -------------------------------------------------------------------------------- /bundle/html-template/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/bundle/html-template/playerProductInstall.swf -------------------------------------------------------------------------------- /bundle/launch/project.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/Basic_Tweening3D.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/Basic_Tweening3D.zip -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/bin/Basic_Tweening3D.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/bin/Basic_Tweening3D.swf -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/embeds/floor_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/embeds/floor_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/embeds/trinket_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/embeds/trinket_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/images/Basic_Tweening3D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/images/Basic_Tweening3D.jpg -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/libs/tweener.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/animation/basic_tweening/libs/tweener.swc -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_Tweening3D,src/Basic_Tweening3D.as -------------------------------------------------------------------------------- /tutorials/animation/basic_tweening/src/Basic_Tweening3D.as: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 3D Tweening example in Away3d 4 | 5 | Demonstrates: 6 | 7 | How to use Tweener within a 3D coordinate system. 8 | How to create a 3D mouse event listener on a scene object. 9 | How to return the scene coordinates of a mouse click on the surface of a scene object. 10 | 11 | Code by Rob Bateman 12 | rob@infiniteturtles.co.uk 13 | http://www.infiniteturtles.co.uk 14 | 15 | This code is distributed under the MIT License 16 | 17 | Copyright (c) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the “Software”), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | */ 38 | 39 | package 40 | { 41 | import away3d.containers.*; 42 | import away3d.core.pick.*; 43 | import away3d.entities.*; 44 | import away3d.events.*; 45 | import away3d.materials.*; 46 | import away3d.primitives.*; 47 | import away3d.utils.*; 48 | 49 | import caurina.transitions.Tweener; 50 | import caurina.transitions.properties.CurveModifiers; 51 | 52 | import flash.display.*; 53 | import flash.events.*; 54 | import flash.geom.Vector3D; 55 | 56 | [SWF(backgroundColor="#000000", frameRate="60", quality="LOW")] 57 | 58 | public class Basic_Tweening3D extends Sprite 59 | { 60 | //plane texture 61 | [Embed(source="/../embeds/floor_diffuse.jpg")] 62 | public static var FloorDiffuse:Class; 63 | 64 | //cube texture jpg 65 | [Embed(source="/../embeds/trinket_diffuse.jpg")] 66 | public static var TrinketDiffuse:Class; 67 | 68 | //engine variables 69 | private var _view:View3D; 70 | 71 | //scene objects 72 | private var _plane:Mesh; 73 | private var _cube:Mesh; 74 | 75 | /** 76 | * Constructor 77 | */ 78 | public function Basic_Tweening3D() 79 | { 80 | stage.scaleMode = StageScaleMode.NO_SCALE; 81 | stage.align = StageAlign.TOP_LEFT; 82 | 83 | //setup the view 84 | _view = new View3D(); 85 | addChild(_view); 86 | 87 | //setup the camera 88 | _view.camera.z = -600; 89 | _view.camera.y = 500; 90 | _view.camera.lookAt(new Vector3D()); 91 | 92 | //setup the scene 93 | _cube = new Mesh(new CubeGeometry(100, 100, 100, 1, 1, 1, false), new TextureMaterial(Cast.bitmapTexture(TrinketDiffuse))); 94 | _cube.y = 50; 95 | _view.scene.addChild(_cube); 96 | 97 | _plane = new Mesh(new PlaneGeometry(700, 700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse))); 98 | _plane.pickingCollider = PickingColliderType.AS3_FIRST_ENCOUNTERED; 99 | _plane.mouseEnabled = true; 100 | _view.scene.addChild(_plane); 101 | 102 | //add mouse listener 103 | _plane.addEventListener(MouseEvent3D.MOUSE_UP, _onMouseUp); 104 | 105 | //initialize Tweener curve modifiers 106 | CurveModifiers.init(); 107 | 108 | //setup the render loop 109 | addEventListener(Event.ENTER_FRAME, _onEnterFrame); 110 | stage.addEventListener(Event.RESIZE, onResize); 111 | onResize(); 112 | } 113 | 114 | /** 115 | * render loop 116 | */ 117 | private function _onEnterFrame(e:Event):void 118 | { 119 | _view.render(); 120 | } 121 | 122 | /** 123 | * mesh listener for mouse up interaction 124 | */ 125 | private function _onMouseUp(ev:MouseEvent3D) : void 126 | { 127 | Tweener.addTween(_cube, { time:0.5, x:ev.scenePosition.x, z:ev.scenePosition.z, _bezier:{x:_cube.x, z:ev.scenePosition.z} }); 128 | } 129 | 130 | /** 131 | * stage listener for resize events 132 | */ 133 | private function onResize(event:Event = null):void 134 | { 135 | _view.width = stage.stageWidth; 136 | _view.height = stage.stageHeight; 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/assets/floor_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/advanced_custom/assets/floor_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/CustomMaterials01.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import away3d.containers.View3D; 4 | import away3d.entities.Mesh; 5 | import away3d.materials.MaterialBase; 6 | import away3d.primitives.SphereGeometry; 7 | 8 | import flash.display.Sprite; 9 | import flash.display.StageAlign; 10 | import flash.display.StageScaleMode; 11 | import flash.events.Event; 12 | 13 | import tut01.TrivialColorMaterial; 14 | 15 | import utils.FlightController; 16 | 17 | [SWF(width="800", height="600", frameRate="60")] 18 | public class CustomMaterials01 extends Sprite 19 | { 20 | private var view : View3D; 21 | private var controller : FlightController; 22 | 23 | public function CustomMaterials01() 24 | { 25 | stage.align = StageAlign.TOP_LEFT; 26 | stage.scaleMode = StageScaleMode.NO_SCALE; 27 | 28 | initView(); 29 | initController(); 30 | initScene(); 31 | 32 | addEventListener(Event.ENTER_FRAME, onEnterFrame); 33 | } 34 | 35 | private function initView() : void 36 | { 37 | view = new View3D(); 38 | view.camera.z = -150; 39 | addChild(view); 40 | } 41 | 42 | private function initController() : void 43 | { 44 | // we init controller already since it'll be useful to test materials 45 | controller = new FlightController(view.camera, stage); 46 | controller.start(); 47 | } 48 | 49 | private function initScene() : void 50 | { 51 | var sphereGeom : SphereGeometry = new SphereGeometry(); 52 | var material : MaterialBase = new TrivialColorMaterial(); 53 | view.scene.addChild(new Mesh(sphereGeom, material)); 54 | } 55 | 56 | private function onEnterFrame(event : Event) : void 57 | { 58 | view.render(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/CustomMaterials02.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import away3d.containers.View3D; 4 | import away3d.debug.Debug; 5 | import away3d.entities.Mesh; 6 | import away3d.materials.MaterialBase; 7 | import away3d.primitives.SphereGeometry; 8 | import away3d.textures.BitmapTexture; 9 | import away3d.utils.Cast; 10 | 11 | import flash.display.Sprite; 12 | import flash.display.StageAlign; 13 | import flash.display.StageScaleMode; 14 | import flash.events.Event; 15 | 16 | import tut01.TrivialColorMaterial; 17 | 18 | import tut02.TrivialTextureMaterial; 19 | 20 | import utils.FlightController; 21 | 22 | [SWF(width="800", height="600", frameRate="60")] 23 | public class CustomMaterials02 extends Sprite 24 | { 25 | [Embed(source="../assets/floor_diffuse.jpg")] 26 | private var TextureAsset : Class; 27 | 28 | private var view : View3D; 29 | private var controller : FlightController; 30 | 31 | public function CustomMaterials02() 32 | { 33 | Debug.active = true; 34 | stage.align = StageAlign.TOP_LEFT; 35 | stage.scaleMode = StageScaleMode.NO_SCALE; 36 | 37 | initView(); 38 | initController(); 39 | initScene(); 40 | 41 | addEventListener(Event.ENTER_FRAME, onEnterFrame); 42 | } 43 | 44 | private function initView() : void 45 | { 46 | view = new View3D(); 47 | view.camera.z = -150; 48 | addChild(view); 49 | } 50 | 51 | private function initController() : void 52 | { 53 | // we init controller already since it'll be useful to test materials 54 | controller = new FlightController(view.camera, stage); 55 | controller.start(); 56 | } 57 | 58 | private function initScene() : void 59 | { 60 | var sphereGeom : SphereGeometry = new SphereGeometry(); 61 | var texture : BitmapTexture = Cast.bitmapTexture(TextureAsset); 62 | var textureMaterial : MaterialBase = new TrivialTextureMaterial(texture); 63 | var colorMaterial : MaterialBase = new TrivialColorMaterial(); 64 | 65 | var mesh : Mesh = new Mesh(sphereGeom, textureMaterial); 66 | mesh.x = -50; 67 | view.scene.addChild(mesh); 68 | 69 | mesh = new Mesh(sphereGeom, colorMaterial); 70 | mesh.x = 50; 71 | view.scene.addChild(mesh); 72 | } 73 | 74 | private function onEnterFrame(event : Event) : void 75 | { 76 | view.render(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/CustomMaterials03.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import away3d.containers.View3D; 4 | import away3d.debug.Debug; 5 | import away3d.entities.Mesh; 6 | import away3d.lights.DirectionalLight; 7 | import away3d.materials.MaterialBase; 8 | import away3d.materials.lightpickers.StaticLightPicker; 9 | import away3d.primitives.SphereGeometry; 10 | import away3d.textures.BitmapTexture; 11 | import away3d.utils.Cast; 12 | 13 | import flash.display.Sprite; 14 | import flash.display.StageAlign; 15 | import flash.display.StageScaleMode; 16 | import flash.events.Event; 17 | import flash.geom.Vector3D; 18 | 19 | import tut03.SingleLightTextureMaterial; 20 | 21 | import utils.FlightController; 22 | 23 | [SWF(width="800", height="600", frameRate="60")] 24 | public class CustomMaterials03 extends Sprite 25 | { 26 | [Embed(source="../assets/floor_diffuse.jpg")] 27 | private var TextureAsset : Class; 28 | 29 | private var view : View3D; 30 | private var controller : FlightController; 31 | private var light : DirectionalLight; 32 | private var angle : Number = 0; 33 | 34 | public function CustomMaterials03() 35 | { 36 | Debug.active = true; 37 | stage.align = StageAlign.TOP_LEFT; 38 | stage.scaleMode = StageScaleMode.NO_SCALE; 39 | 40 | initView(); 41 | initController(); 42 | initScene(); 43 | 44 | addEventListener(Event.ENTER_FRAME, onEnterFrame); 45 | } 46 | 47 | private function initView() : void 48 | { 49 | view = new View3D(); 50 | view.camera.z = -150; 51 | addChild(view); 52 | } 53 | 54 | private function initController() : void 55 | { 56 | // we init controller already since it'll be useful to test materials 57 | controller = new FlightController(view.camera, stage); 58 | controller.start(); 59 | } 60 | 61 | private function initScene() : void 62 | { 63 | var sphereGeom : SphereGeometry = new SphereGeometry(); 64 | var texture : BitmapTexture = Cast.bitmapTexture(TextureAsset); 65 | var material : MaterialBase = new SingleLightTextureMaterial(texture); 66 | 67 | light = new DirectionalLight(-1, -1, 1); 68 | view.scene.addChild(light); 69 | 70 | material.lightPicker = new StaticLightPicker([light]); 71 | 72 | var mesh : Mesh = new Mesh(sphereGeom, material); 73 | view.scene.addChild(mesh); 74 | } 75 | 76 | private function onEnterFrame(event : Event) : void 77 | { 78 | // just rotate the light over time 79 | light.direction = new Vector3D(-Math.cos(angle), -1, -Math.sin(angle)); 80 | angle += .01; 81 | view.render(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut01/TrivialColorMaterial.as: -------------------------------------------------------------------------------- 1 | package tut01 2 | { 3 | import away3d.materials.MaterialBase; 4 | 5 | public class TrivialColorMaterial extends MaterialBase 6 | { 7 | public function TrivialColorMaterial() 8 | { 9 | addPass(new TrivialColorPass()); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut01/TrivialColorPass.as: -------------------------------------------------------------------------------- 1 | package tut01 2 | { 3 | import away3d.arcane; 4 | import away3d.cameras.Camera3D; 5 | import away3d.core.base.IRenderable; 6 | import away3d.core.managers.Stage3DProxy; 7 | import away3d.materials.passes.MaterialPassBase; 8 | 9 | import flash.display3D.Context3D; 10 | import flash.display3D.Context3DProgramType; 11 | import flash.geom.Matrix3D; 12 | 13 | use namespace arcane; 14 | 15 | /** 16 | * TrivialColorPass is a pass rendering a flat unshaded colour 17 | */ 18 | public class TrivialColorPass extends MaterialPassBase 19 | { 20 | private var _fragmentData : Vector.; 21 | private var _matrix : Matrix3D = new Matrix3D(); 22 | 23 | private var _color : uint; 24 | 25 | public function TrivialColorPass() 26 | { 27 | super(); 28 | 29 | _fragmentData = new Vector.(); 30 | color = 0xffff00ff; // purple by default 31 | } 32 | 33 | 34 | public function get color() : uint 35 | { 36 | return _color; 37 | } 38 | 39 | public function set color(value : uint) : void 40 | { 41 | _color = value; 42 | _fragmentData[0] = ((value >> 16) & 0xff) / 0xff; // red 43 | _fragmentData[1] = ((value >> 8) & 0xff) / 0xff; // green 44 | _fragmentData[2] = (value & 0xff) / 0xff; // blue 45 | _fragmentData[3] = ((value >> 24) & 0xff) / 0xff; // alpha 46 | } 47 | 48 | /** 49 | * Get the vertex shader code for this shader 50 | */ 51 | override arcane function getVertexCode() : String 52 | { 53 | // simply transform to view space 54 | return "m44 op, va0, vc0"; 55 | } 56 | 57 | /** 58 | * Get the fragment shader code for this shader 59 | * @param fragmentAnimatorCode Any additional fragment animation code imposed by the framework, used by some animators. Ignore this for now, since we're not using them. 60 | */ 61 | override arcane function getFragmentCode(fragmentAnimatorCode : String) : String 62 | { 63 | // simply set colour as output value 64 | return "mov oc, fc0"; 65 | } 66 | 67 | /** 68 | * Sets the render state which is constant for this pass 69 | * @param stage3DProxy The stage3DProxy used for the current render pass 70 | * @param camera The camera currently used for rendering 71 | */ 72 | override arcane function activate(stage3DProxy : Stage3DProxy, camera : Camera3D) : void 73 | { 74 | super.activate(stage3DProxy, camera); 75 | stage3DProxy._context3D.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, _fragmentData, 1); 76 | } 77 | 78 | /** 79 | * Set render state for the current renderable and draw the triangles. 80 | * @param renderable The renderable that needs to be drawn. 81 | * @param stage3DProxy The stage3DProxy used for the current render pass. 82 | * @param camera The camera currently used for rendering. 83 | * @param viewProjection The matrix that transforms world space to screen space. 84 | */ 85 | override arcane function render(renderable : IRenderable, stage3DProxy : Stage3DProxy, camera : Camera3D, viewProjection : Matrix3D) : void 86 | { 87 | var context : Context3D = stage3DProxy._context3D; 88 | _matrix.copyFrom(renderable.sceneTransform); 89 | _matrix.append(viewProjection); 90 | renderable.activateVertexBuffer(0, stage3DProxy); 91 | context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, _matrix, true); 92 | context.drawTriangles(renderable.getIndexBuffer(stage3DProxy), 0, renderable.numTriangles); 93 | } 94 | 95 | /** 96 | * Clear render state for the next pass. 97 | * @param stage3DProxy The stage3DProxy used for the current render pass. 98 | */ 99 | override arcane function deactivate(stage3DProxy : Stage3DProxy) : void 100 | { 101 | // just go for default behaviour 102 | super.deactivate(stage3DProxy); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut02/TrivialTextureMaterial.as: -------------------------------------------------------------------------------- 1 | package tut02 2 | { 3 | import away3d.textures.Texture2DBase; 4 | 5 | import away3d.materials.MaterialBase; 6 | 7 | public class TrivialTextureMaterial extends MaterialBase 8 | { 9 | public function TrivialTextureMaterial(texture : Texture2DBase) 10 | { 11 | // pick either of these, which shows a different approach in cleaning up render state 12 | // addPass(new TrivialTexturePass(texture)); 13 | addPass(new TrivialTexturePass_Alternative(texture)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut02/TrivialTexturePass.as: -------------------------------------------------------------------------------- 1 | package tut02 2 | { 3 | import away3d.arcane; 4 | import away3d.cameras.Camera3D; 5 | import away3d.core.base.IRenderable; 6 | import away3d.core.managers.Stage3DProxy; 7 | import away3d.materials.passes.MaterialPassBase; 8 | import away3d.textures.Texture2DBase; 9 | 10 | import flash.display3D.Context3D; 11 | import flash.display3D.Context3DProgramType; 12 | import flash.geom.Matrix3D; 13 | 14 | use namespace arcane; 15 | 16 | /** 17 | * TrivialTexturePass is a pass rendering an unshaded texture 18 | */ 19 | public class TrivialTexturePass extends MaterialPassBase 20 | { 21 | private var _matrix : Matrix3D = new Matrix3D(); 22 | 23 | private var _texture : Texture2DBase; 24 | 25 | public function TrivialTexturePass(texture : Texture2DBase) 26 | { 27 | super(); 28 | _texture = texture; 29 | } 30 | 31 | public function get texture() : Texture2DBase 32 | { 33 | return _texture; 34 | } 35 | 36 | public function set texture(value : Texture2DBase) : void 37 | { 38 | _texture = value; 39 | } 40 | 41 | /** 42 | * Get the vertex shader code for this shader 43 | */ 44 | override arcane function getVertexCode() : String 45 | { 46 | // transform to view space and pass on uv coords to the fragment shader 47 | return "m44 op, va0, vc0\n" + 48 | "mov v0, va1"; 49 | } 50 | 51 | /** 52 | * Get the fragment shader code for this shader 53 | * @param fragmentAnimatorCode Any additional fragment animation code imposed by the framework, used by some animators. Ignore this for now, since we're not using them. 54 | */ 55 | override arcane function getFragmentCode(fragmentAnimatorCode : String) : String 56 | { 57 | // simply set sampled colour as output value 58 | return "tex oc, v0, fs0 <2d, clamp, linear, miplinear>"; 59 | } 60 | 61 | /** 62 | * Sets the render state which is constant for this pass 63 | * @param stage3DProxy The stage3DProxy used for the current render pass 64 | * @param camera The camera currently used for rendering 65 | */ 66 | override arcane function activate(stage3DProxy : Stage3DProxy, camera : Camera3D) : void 67 | { 68 | super.activate(stage3DProxy, camera); 69 | 70 | // retrieve the actual texture object, and assign it to slot 0 (fs0) 71 | // we set this in activate, not in render, because the texture is constant for this pass 72 | stage3DProxy._context3D.setTextureAt(0, _texture.getTextureForStage3D(stage3DProxy)); 73 | } 74 | 75 | /** 76 | * Set render state for the current renderable and draw the triangles. 77 | * @param renderable The renderable that needs to be drawn. 78 | * @param stage3DProxy The stage3DProxy used for the current render pass. 79 | * @param camera The camera currently used for rendering. 80 | * @param viewProjection The matrix that transforms world space to screen space. 81 | */ 82 | override arcane function render(renderable : IRenderable, stage3DProxy : Stage3DProxy, camera : Camera3D, viewProjection : Matrix3D) : void 83 | { 84 | var context : Context3D = stage3DProxy._context3D; 85 | _matrix.copyFrom(renderable.sceneTransform); 86 | _matrix.append(viewProjection); 87 | 88 | renderable.activateVertexBuffer(0, stage3DProxy); 89 | renderable.activateUVBuffer(1, stage3DProxy); 90 | 91 | context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, _matrix, true); 92 | context.drawTriangles(renderable.getIndexBuffer(stage3DProxy), 0, renderable.numTriangles); 93 | } 94 | 95 | /** 96 | * Clear render state for the next pass. 97 | * @param stage3DProxy The stage3DProxy used for the current render pass. 98 | */ 99 | override arcane function deactivate(stage3DProxy : Stage3DProxy) : void 100 | { 101 | super.deactivate(stage3DProxy); 102 | 103 | var context : Context3D = stage3DProxy._context3D; 104 | 105 | // clear the texture and stream we set before 106 | // no need to clear attribute stream at slot 0, since it's always used 107 | context.setTextureAt(0, null); 108 | context.setVertexBufferAt(1, null); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut02/TrivialTexturePass_Alternative.as: -------------------------------------------------------------------------------- 1 | package tut02 2 | { 3 | import away3d.arcane; 4 | import away3d.cameras.Camera3D; 5 | import away3d.core.base.IRenderable; 6 | import away3d.core.managers.Stage3DProxy; 7 | import away3d.materials.passes.MaterialPassBase; 8 | import away3d.textures.Texture2DBase; 9 | 10 | import flash.display3D.Context3D; 11 | import flash.display3D.Context3DProgramType; 12 | import flash.geom.Matrix3D; 13 | 14 | use namespace arcane; 15 | 16 | /** 17 | * TrivialTexturePass_Alternative is a pass rendering an unshaded texture. 18 | * It is different from TrivialTexturePass_Alternative in that instead of cleaning up its own render state, it 19 | * allows MaterialPassBase to handle this by setting the _numUsedStreams and _numUsedTextures properties 20 | */ 21 | public class TrivialTexturePass_Alternative extends MaterialPassBase 22 | { 23 | private var _matrix : Matrix3D = new Matrix3D(); 24 | 25 | private var _texture : Texture2DBase; 26 | 27 | public function TrivialTexturePass_Alternative(texture : Texture2DBase) 28 | { 29 | super(); 30 | _texture = texture; 31 | 32 | // tell the material how many resources are used so it will know which to clear when switching passes. 33 | _numUsedStreams = 2; // vertex position and uv coords 34 | _numUsedTextures = 1; // a single texture 35 | } 36 | 37 | 38 | public function get texture() : Texture2DBase 39 | { 40 | return _texture; 41 | } 42 | 43 | public function set texture(value : Texture2DBase) : void 44 | { 45 | _texture = value; 46 | } 47 | 48 | /** 49 | * Get the vertex shader code for this shader 50 | */ 51 | override arcane function getVertexCode() : String 52 | { 53 | // transform to view space and pass on uv coords to the fragment shader 54 | return "m44 op, va0, vc0\n" + 55 | "mov v0, va1"; 56 | } 57 | 58 | /** 59 | * Get the fragment shader code for this shader 60 | * @param fragmentAnimatorCode Any additional fragment animation code imposed by the framework, used by some animators. Ignore this for now, since we're not using them. 61 | */ 62 | override arcane function getFragmentCode(fragmentAnimatorCode : String) : String 63 | { 64 | // simply set sampled colour as output value 65 | return "tex oc, v0, fs0 <2d, clamp, linear, miplinear>"; 66 | } 67 | 68 | /** 69 | * Sets the render state which is constant for this pass 70 | * @param stage3DProxy The stage3DProxy used for the current render pass 71 | * @param camera The camera currently used for rendering 72 | */ 73 | override arcane function activate(stage3DProxy : Stage3DProxy, camera : Camera3D) : void 74 | { 75 | super.activate(stage3DProxy, camera); 76 | 77 | // retrieve the actual texture object, and assign it to slot 0 (fs0) 78 | // we set this in activate, not in render, because the texture is constant for this pass 79 | stage3DProxy._context3D.setTextureAt(0, _texture.getTextureForStage3D(stage3DProxy)); 80 | } 81 | 82 | /** 83 | * Set render state for the current renderable and draw the triangles. 84 | * @param renderable The renderable that needs to be drawn. 85 | * @param stage3DProxy The stage3DProxy used for the current render pass. 86 | * @param camera The camera currently used for rendering. 87 | * @param viewProjection The matrix that transforms world space to screen space. 88 | */ 89 | override arcane function render(renderable : IRenderable, stage3DProxy : Stage3DProxy, camera : Camera3D, viewProjection : Matrix3D) : void 90 | { 91 | var context : Context3D = stage3DProxy._context3D; 92 | _matrix.copyFrom(renderable.sceneTransform); 93 | _matrix.append(viewProjection); 94 | 95 | renderable.activateVertexBuffer(0, stage3DProxy); 96 | renderable.activateUVBuffer(1, stage3DProxy); 97 | 98 | context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, _matrix, true); 99 | context.drawTriangles(renderable.getIndexBuffer(stage3DProxy), 0, renderable.numTriangles); 100 | } 101 | 102 | /** 103 | * Clear render state for the next pass. 104 | * @param stage3DProxy The stage3DProxy used for the current render pass. 105 | */ 106 | override arcane function deactivate(stage3DProxy : Stage3DProxy) : void 107 | { 108 | // don't need to clear anything ourselves 109 | super.deactivate(stage3DProxy); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut03/SingleLightTextureMaterial.as: -------------------------------------------------------------------------------- 1 | package tut03 2 | { 3 | import away3d.textures.Texture2DBase; 4 | 5 | import away3d.materials.MaterialBase; 6 | 7 | public class SingleLightTextureMaterial extends MaterialBase 8 | { 9 | public function SingleLightTextureMaterial(texture : Texture2DBase) 10 | { 11 | addPass(new SingleLightTexturePass(texture)); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tutorials/materials/advanced_custom/src/tut03/SingleLightTexturePass.as: -------------------------------------------------------------------------------- 1 | package tut03 2 | { 3 | import away3d.arcane; 4 | import away3d.cameras.Camera3D; 5 | import away3d.core.base.IRenderable; 6 | import away3d.core.managers.Stage3DProxy; 7 | import away3d.lights.DirectionalLight; 8 | import away3d.materials.passes.MaterialPassBase; 9 | import away3d.textures.Texture2DBase; 10 | 11 | import flash.display3D.Context3D; 12 | import flash.display3D.Context3DProgramType; 13 | import flash.geom.Matrix3D; 14 | import flash.geom.Vector3D; 15 | 16 | use namespace arcane; 17 | 18 | /** 19 | * SingleLightTexturePass is a pass rendering a texture material using a single directional light 20 | */ 21 | public class SingleLightTexturePass extends MaterialPassBase 22 | { 23 | private var _matrix : Matrix3D = new Matrix3D(); 24 | private var _fragmentData : Vector. = new [0, 0, 0, 0]; 25 | 26 | private var _texture : Texture2DBase; 27 | 28 | public function SingleLightTexturePass(texture : Texture2DBase) 29 | { 30 | super(); 31 | _texture = texture; 32 | 33 | // tell the material how many resources are used so it will know which to clear when switching passes. 34 | _numUsedStreams = 3; // vertex position, uv coords and normals 35 | _numUsedTextures = 1; // a single texture 36 | } 37 | 38 | 39 | public function get texture() : Texture2DBase 40 | { 41 | return _texture; 42 | } 43 | 44 | public function set texture(value : Texture2DBase) : void 45 | { 46 | _texture = value; 47 | } 48 | 49 | /** 50 | * Get the vertex shader code for this shader 51 | */ 52 | override arcane function getVertexCode() : String 53 | { 54 | return "m44 op, va0, vc0\n" + // transform to view space 55 | "mov v0, va1\n" + // pass on uv coords 56 | "mov v1, va2" // pass on normals 57 | } 58 | 59 | /** 60 | * Get the fragment shader code for this shader 61 | * @param fragmentAnimatorCode Any additional fragment animation code imposed by the framework, used by some animators. Ignore this for now, since we're not using them. 62 | */ 63 | override arcane function getFragmentCode(fragmentAnimatorCode : String) : String 64 | { 65 | return "tex ft0, v0, fs0 <2d, clamp, linear, miplinear>\n" + 66 | "nrm ft1.xyz, v1\n" + // renormalize interpolated normal 67 | "dp3 ft2.x, fc0.xyz, ft1.xyz\n" + // standard dot3 lambert shading: d = max(0, dot3(light, normal)) 68 | "max ft2.x, ft2.x, fc0.w\n" + // fc0.w contains 0 69 | "mul oc, ft0, ft2.x"; 70 | } 71 | 72 | /** 73 | * Sets the render state which is constant for this pass 74 | * @param stage3DProxy The stage3DProxy used for the current render pass 75 | * @param camera The camera currently used for rendering 76 | */ 77 | override arcane function activate(stage3DProxy : Stage3DProxy, camera : Camera3D) : void 78 | { 79 | super.activate(stage3DProxy, camera); 80 | 81 | // retrieve the actual texture object, and assign it to slot 0 (fs0) 82 | // we set this in activate, not in render, because the texture is constant for this pass 83 | stage3DProxy._context3D.setTextureAt(0, _texture.getTextureForStage3D(stage3DProxy)); 84 | } 85 | 86 | /** 87 | * Set render state for the current renderable and draw the triangles. 88 | * @param renderable The renderable that needs to be drawn. 89 | * @param stage3DProxy The stage3DProxy used for the current render pass. 90 | * @param camera The camera currently used for rendering. 91 | * @param viewProjection The matrix that transforms world space to screen space. 92 | */ 93 | override arcane function render(renderable : IRenderable, stage3DProxy : Stage3DProxy, camera : Camera3D, viewProjection : Matrix3D) : void 94 | { 95 | var context : Context3D = stage3DProxy._context3D; 96 | 97 | // expect a directional light to be assigned 98 | var light : DirectionalLight = _lightPicker.directionalLights[0]; 99 | 100 | // the light direction relative to the renderable object (model space) 101 | var objectSpaceDir : Vector3D = renderable.inverseSceneTransform.transformVector(light.sceneDirection); 102 | objectSpaceDir.normalize(); 103 | 104 | // passing on inverse light direction to simplify shader code (it expects the direction _to_ the light) 105 | _fragmentData[0] = -objectSpaceDir.x; 106 | _fragmentData[1] = -objectSpaceDir.y; 107 | _fragmentData[2] = -objectSpaceDir.z; 108 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, _fragmentData, 1); 109 | 110 | // upload the world-view-projection matrix 111 | _matrix.copyFrom(renderable.sceneTransform); 112 | _matrix.append(viewProjection); 113 | context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, _matrix, true); 114 | 115 | renderable.activateVertexBuffer(0, stage3DProxy); 116 | renderable.activateUVBuffer(1, stage3DProxy); 117 | renderable.activateVertexNormalBuffer(2, stage3DProxy); 118 | 119 | context.drawTriangles(renderable.getIndexBuffer(stage3DProxy), 0, renderable.numTriangles); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/Basic_ATF_Shading.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/Basic_ATF_Shading.zip -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/ball/beachball_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/ball/beachball_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/ball/beachball_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/ball/beachball_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/ball/beachball_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/ball/beachball_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/ball/beachball_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/ball/beachball_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/cube/trinket_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/cube/trinket_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/floor/floor_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/floor/floor_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/signature.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/signature.fla -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/signature.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/signature.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/sky/hourglass_cubemap2.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/sky/hourglass_cubemap2.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/torus/weave_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/torus/weave_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/torus/weave_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/torus/weave_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/torus/weave_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/torus/weave_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/asset/torus/weave_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/asset/torus/weave_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/bin/Basic_Shading_with_ATF.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/bin/Basic_Shading_with_ATF.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_ATF_Shading,src/Basic_Shading_with_ATF.as -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/pb/NormalizeSplats.pbj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/pb/NormalizeSplats.pbj -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/pb/NormalizeSplats.pbk: -------------------------------------------------------------------------------- 1 | 2 | 3 | kernel NormalizeSplats 4 | < namespace : "com.away3d"; 5 | vendor : "Away3D"; 6 | version : 1; 7 | description : "Normalizes the content of splat alpha maps for up to 3 layers."; 8 | > 9 | { 10 | input image3 src; 11 | output pixel3 dst; 12 | 13 | parameter int numLayers < minValue: 1; 14 | maxValue: 3; 15 | defaultValue: 3; 16 | >; 17 | 18 | void evaluatePixel() 19 | { 20 | dst = sampleNearest(src, outCoord()); 21 | if (numLayers >= 3) dst.y += dst.z; 22 | if (numLayers >= 2) dst.x += dst.y; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/pb/RayTriangleKernel.pbj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_shading/pb/RayTriangleKernel.pbj -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_shading/pb/RayTriangleKernel.pbk: -------------------------------------------------------------------------------- 1 | 2 | 3 | kernel RayTriangleKernel 4 | < namespace : ""; 5 | vendor : "Away3D"; 6 | version : 1; 7 | description : "Evaluates collisions between a ray and a potentially large set of triangles."; 8 | > 9 | { 10 | input image3 indexBuffer; 11 | input image3 vertexBuffer; 12 | output pixel3 intersectionBuffer; 13 | 14 | parameter float3 rayStartPoint 15 | < 16 | defaultValue : float3( 0.0, 0.0, 0.0 ); 17 | >; 18 | 19 | parameter float3 rayDirection 20 | < 21 | defaultValue : float3( 0.0, 0.0, 0.0 ); 22 | >; 23 | 24 | parameter float vertexBufferWidth 25 | < 26 | defaultValue : 0.0; 27 | >; 28 | 29 | void evaluatePixel() 30 | { 31 | // read current triangle indices ( r, g, b = i0, i1, i2 ) 32 | float2 currentTriangle = outCoord(); 33 | float3 currentTriangleIndices = sampleNearest( indexBuffer, currentTriangle ); 34 | 35 | // read current triangle vertices 36 | float width, height; 37 | height = floor( currentTriangleIndices.x / vertexBufferWidth ); 38 | width = currentTriangleIndices.x - height * vertexBufferWidth; 39 | float3 p0 = sampleNearest( vertexBuffer, float2( width, height ) ); 40 | height = floor( currentTriangleIndices.y / vertexBufferWidth ); 41 | width = currentTriangleIndices.y - height * vertexBufferWidth; 42 | float3 p1 = sampleNearest( vertexBuffer, float2( width, height ) ); 43 | height = floor( currentTriangleIndices.z / vertexBufferWidth ); 44 | width = currentTriangleIndices.z - height * vertexBufferWidth; 45 | float3 p2 = sampleNearest( vertexBuffer, float2( width, height ) ); 46 | 47 | float t = -1.0; // this t will mean no intersection 48 | float v = 0.0; 49 | float w = 0.0; 50 | 51 | // float3 zero = float3( 0.0, 0.0, 0.0 ); 52 | // if( !( p0 == zero && p1 == zero && p2 == zero ) ) { // check if its fill up data ( NOT IMPLEMENTED, CAUSES BUG ) 53 | // evaluate triangle sides and normal 54 | float3 s0 = p1 - p0; 55 | float3 s1 = p2 - p0; 56 | float3 normal = cross( s0, s1 ); 57 | normal = normalize( normal ); 58 | // evaluate ray-plane intersection 59 | float nDotV = dot( normal, rayDirection ); 60 | if( nDotV < 0.0 ) { // ray-plane intersection exists on the proper side 61 | float D = -dot( normal, p0 ); 62 | float distanceToPlane = -( dot( normal, rayStartPoint ) + D ); 63 | t = distanceToPlane / nDotV; 64 | } 65 | // evaluate ray-triangle intersection 66 | if( t > 0.0 ) { // if ray-plane intersection exists 67 | float3 intersection = rayStartPoint + t * rayDirection; 68 | float3 R = intersection - p0; 69 | float Q1Q2 = dot( s0, s1 ); 70 | float Q1Q1 = dot( s0, s0 ); 71 | float Q2Q2 = dot( s1, s1 ); 72 | float RQ1 = dot( R, s0 ); 73 | float RQ2 = dot( R, s1 ); 74 | float coeff = 1.0 / ( Q1Q1 * Q2Q2 - Q1Q2 * Q1Q2 ); 75 | v = coeff * ( Q2Q2 * RQ1 - Q1Q2 * RQ2 ); 76 | w = coeff * ( -Q1Q2 * RQ1 + Q1Q1 * RQ2 ); 77 | float u = 1.0 - v - w; 78 | if( v < 0.0 || w < 0.0 || u < 0.0 ) { // if all 3 barycentric coords are >= 0, intersection is in triangle 79 | t = -1.0; 80 | } 81 | } 82 | // } 83 | intersectionBuffer = float3( t, v, w ); 84 | } 85 | } -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/Basic_ATF_Texture.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/Basic_ATF_Texture.zip -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/ball/beachball_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/ball/beachball_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/ball/beachball_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/ball/beachball_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/ball/beachball_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/ball/beachball_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/ball/beachball_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/ball/beachball_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/cube/trinket_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/cube/trinket_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_specular.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_specular.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/floor/floor_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/floor/floor_specular.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/signature.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/signature.fla -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/signature.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/signature.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/sky/hourglass_cubemap2.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/sky/hourglass_cubemap2.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/torus/weave_diffuse.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/torus/weave_diffuse.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/torus/weave_diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/torus/weave_diffuse.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/torus/weave_normal.atf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/torus/weave_normal.atf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/asset/torus/weave_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/asset/torus/weave_normal.png -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/bin/Basic_ATF_Texture.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/bin/Basic_ATF_Texture.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_ATF_Texture,src/Basic_ATF_Texture.as -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/pb/NormalizeSplats.pbj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/pb/NormalizeSplats.pbj -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/pb/NormalizeSplats.pbk: -------------------------------------------------------------------------------- 1 | 2 | 3 | kernel NormalizeSplats 4 | < namespace : "com.away3d"; 5 | vendor : "Away3D"; 6 | version : 1; 7 | description : "Normalizes the content of splat alpha maps for up to 3 layers."; 8 | > 9 | { 10 | input image3 src; 11 | output pixel3 dst; 12 | 13 | parameter int numLayers < minValue: 1; 14 | maxValue: 3; 15 | defaultValue: 3; 16 | >; 17 | 18 | void evaluatePixel() 19 | { 20 | dst = sampleNearest(src, outCoord()); 21 | if (numLayers >= 3) dst.y += dst.z; 22 | if (numLayers >= 2) dst.x += dst.y; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/pb/RayTriangleKernel.pbj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_atf_texture/pb/RayTriangleKernel.pbj -------------------------------------------------------------------------------- /tutorials/materials/basic_atf_texture/pb/RayTriangleKernel.pbk: -------------------------------------------------------------------------------- 1 | 2 | 3 | kernel RayTriangleKernel 4 | < namespace : ""; 5 | vendor : "Away3D"; 6 | version : 1; 7 | description : "Evaluates collisions between a ray and a potentially large set of triangles."; 8 | > 9 | { 10 | input image3 indexBuffer; 11 | input image3 vertexBuffer; 12 | output pixel3 intersectionBuffer; 13 | 14 | parameter float3 rayStartPoint 15 | < 16 | defaultValue : float3( 0.0, 0.0, 0.0 ); 17 | >; 18 | 19 | parameter float3 rayDirection 20 | < 21 | defaultValue : float3( 0.0, 0.0, 0.0 ); 22 | >; 23 | 24 | parameter float vertexBufferWidth 25 | < 26 | defaultValue : 0.0; 27 | >; 28 | 29 | void evaluatePixel() 30 | { 31 | // read current triangle indices ( r, g, b = i0, i1, i2 ) 32 | float2 currentTriangle = outCoord(); 33 | float3 currentTriangleIndices = sampleNearest( indexBuffer, currentTriangle ); 34 | 35 | // read current triangle vertices 36 | float width, height; 37 | height = floor( currentTriangleIndices.x / vertexBufferWidth ); 38 | width = currentTriangleIndices.x - height * vertexBufferWidth; 39 | float3 p0 = sampleNearest( vertexBuffer, float2( width, height ) ); 40 | height = floor( currentTriangleIndices.y / vertexBufferWidth ); 41 | width = currentTriangleIndices.y - height * vertexBufferWidth; 42 | float3 p1 = sampleNearest( vertexBuffer, float2( width, height ) ); 43 | height = floor( currentTriangleIndices.z / vertexBufferWidth ); 44 | width = currentTriangleIndices.z - height * vertexBufferWidth; 45 | float3 p2 = sampleNearest( vertexBuffer, float2( width, height ) ); 46 | 47 | float t = -1.0; // this t will mean no intersection 48 | float v = 0.0; 49 | float w = 0.0; 50 | 51 | // float3 zero = float3( 0.0, 0.0, 0.0 ); 52 | // if( !( p0 == zero && p1 == zero && p2 == zero ) ) { // check if its fill up data ( NOT IMPLEMENTED, CAUSES BUG ) 53 | // evaluate triangle sides and normal 54 | float3 s0 = p1 - p0; 55 | float3 s1 = p2 - p0; 56 | float3 normal = cross( s0, s1 ); 57 | normal = normalize( normal ); 58 | // evaluate ray-plane intersection 59 | float nDotV = dot( normal, rayDirection ); 60 | if( nDotV < 0.0 ) { // ray-plane intersection exists on the proper side 61 | float D = -dot( normal, p0 ); 62 | float distanceToPlane = -( dot( normal, rayStartPoint ) + D ); 63 | t = distanceToPlane / nDotV; 64 | } 65 | // evaluate ray-triangle intersection 66 | if( t > 0.0 ) { // if ray-plane intersection exists 67 | float3 intersection = rayStartPoint + t * rayDirection; 68 | float3 R = intersection - p0; 69 | float Q1Q2 = dot( s0, s1 ); 70 | float Q1Q1 = dot( s0, s0 ); 71 | float Q2Q2 = dot( s1, s1 ); 72 | float RQ1 = dot( R, s0 ); 73 | float RQ2 = dot( R, s1 ); 74 | float coeff = 1.0 / ( Q1Q1 * Q2Q2 - Q1Q2 * Q1Q2 ); 75 | v = coeff * ( Q2Q2 * RQ1 - Q1Q2 * RQ2 ); 76 | w = coeff * ( -Q1Q2 * RQ1 + Q1Q1 * RQ2 ); 77 | float u = 1.0 - v - w; 78 | if( v < 0.0 || w < 0.0 || u < 0.0 ) { // if all 3 barycentric coords are >= 0, intersection is in triangle 79 | t = -1.0; 80 | } 81 | } 82 | // } 83 | intersectionBuffer = float3( t, v, w ); 84 | } 85 | } -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/Basic_Shading.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/Basic_Shading.zip -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/Basic_Shading.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/Basic_Shading.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/Basic_Shading_Ex1.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/Basic_Shading_Ex1.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/Basic_Shading_Ex2.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/Basic_Shading_Ex2.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/Basic_Shading_Ex3.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/Basic_Shading_Ex3.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/assets/PolarBear.awd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/assets/PolarBear.awd -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/beachball_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/beachball_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/beachball_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/beachball_specular.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/floor_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/floor_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/floor_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/floor_normal.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/floor_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/floor_specular.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/signature.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/signature.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/trinket_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/trinket_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/trinket_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/trinket_normal.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/trinket_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/trinket_specular.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/weave_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/weave_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/embeds/weave_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/embeds/weave_normal.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/Basic_Shading.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/Basic_Shading.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/Basic_Shading_Ex1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/Basic_Shading_Ex1.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/Basic_Shading_Ex2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/Basic_Shading_Ex2.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/Basic_Shading_Ex3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/Basic_Shading_Ex3.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/beachball_diffuse_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/beachball_diffuse_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/beachball_specular_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/beachball_specular_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/signature.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/signature.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/speculardifference_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/speculardifference_1.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/trinket_diffuse_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/trinket_diffuse_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/trinket_normal_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/trinket_normal_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/trinket_specular_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/trinket_specular_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/weave_diffuse_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/weave_diffuse_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/images/weave_normal_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_shading/images/weave_normal_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_shading/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_Shading,src/Basic_Shading.as,src/Basic_Shading_Ex1.as,src/Basic_Shading_Ex2.as,src/Basic_Shading_Ex3.as -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/Basic_SkyBox.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/Basic_SkyBox.zip -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/bin/Basic_SkyBox.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/bin/Basic_SkyBox.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_negative_x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_negative_x.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_negative_y.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_negative_y.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_negative_z.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_negative_z.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_positive_x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_positive_x.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_positive_y.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_positive_y.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/embeds/skybox/snow_positive_z.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/embeds/skybox/snow_positive_z.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/Basic_Skybox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/Basic_Skybox.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/skybox_description.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/skybox_description.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_negative_x_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_negative_x_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_negative_y_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_negative_y_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_negative_z_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_negative_z_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_positive_x_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_positive_x_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_positive_y_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_positive_y_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/images/snow_positive_z_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/basic_skybox/images/snow_positive_z_t.jpg -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_SkyBox,src/Basic_SkyBox.as -------------------------------------------------------------------------------- /tutorials/materials/basic_skybox/src/Basic_SkyBox.as: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SkyBox example in Away3d 4 | 5 | Demonstrates: 6 | 7 | How to use a CubeTexture to create a SkyBox object. 8 | How to apply a CubeTexture to a material as an environment map. 9 | 10 | Code by Rob Bateman 11 | rob@infiniteturtles.co.uk 12 | http://www.infiniteturtles.co.uk 13 | 14 | This code is distributed under the MIT License 15 | 16 | Copyright (c) 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy 19 | of this software and associated documentation files (the “Software”), to deal 20 | in the Software without restriction, including without limitation the rights 21 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | copies of the Software, and to permit persons to whom the Software is 23 | furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in 26 | all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 34 | THE SOFTWARE. 35 | 36 | */ 37 | 38 | package 39 | { 40 | import away3d.cameras.lenses.*; 41 | import away3d.containers.*; 42 | import away3d.entities.*; 43 | import away3d.materials.*; 44 | import away3d.materials.methods.*; 45 | import away3d.primitives.*; 46 | import away3d.textures.*; 47 | import away3d.utils.*; 48 | 49 | import flash.display.*; 50 | import flash.events.*; 51 | import flash.geom.Vector3D; 52 | 53 | [SWF(backgroundColor="#000000", frameRate="60", quality="LOW")] 54 | 55 | public class Basic_SkyBox extends Sprite 56 | { 57 | // Environment map. 58 | [Embed(source="../embeds/skybox/snow_positive_x.jpg")] 59 | private var EnvPosX:Class; 60 | [Embed(source="../embeds/skybox/snow_positive_y.jpg")] 61 | private var EnvPosY:Class; 62 | [Embed(source="../embeds/skybox/snow_positive_z.jpg")] 63 | private var EnvPosZ:Class; 64 | [Embed(source="../embeds/skybox/snow_negative_x.jpg")] 65 | private var EnvNegX:Class; 66 | [Embed(source="../embeds/skybox/snow_negative_y.jpg")] 67 | private var EnvNegY:Class; 68 | [Embed(source="../embeds/skybox/snow_negative_z.jpg")] 69 | private var EnvNegZ:Class; 70 | 71 | //engine variables 72 | private var _view:View3D; 73 | 74 | //scene objects 75 | private var _skyBox:SkyBox; 76 | private var _torus:Mesh; 77 | 78 | /** 79 | * Constructor 80 | */ 81 | public function Basic_SkyBox() 82 | { 83 | stage.scaleMode = StageScaleMode.NO_SCALE; 84 | stage.align = StageAlign.TOP_LEFT; 85 | 86 | //setup the view 87 | _view = new View3D(); 88 | addChild(_view); 89 | 90 | //setup the camera 91 | _view.camera.z = -600; 92 | _view.camera.y = 0; 93 | _view.camera.lookAt(new Vector3D()); 94 | _view.camera.lens = new PerspectiveLens(90); 95 | 96 | //setup the cube texture 97 | var cubeTexture:BitmapCubeTexture = new BitmapCubeTexture(Cast.bitmapData(EnvPosX), Cast.bitmapData(EnvNegX), Cast.bitmapData(EnvPosY), Cast.bitmapData(EnvNegY), Cast.bitmapData(EnvPosZ), Cast.bitmapData(EnvNegZ)); 98 | 99 | //setup the environment map material 100 | var material:ColorMaterial = new ColorMaterial(); 101 | material.addMethod(new EnvMapMethod(cubeTexture, 1)); 102 | 103 | //setup the scene 104 | _torus = new Mesh(new TorusGeometry(150, 60, 40, 20), material); 105 | _view.scene.addChild(_torus); 106 | 107 | _skyBox = new SkyBox(cubeTexture); 108 | _view.scene.addChild(_skyBox); 109 | 110 | //setup the render loop 111 | addEventListener(Event.ENTER_FRAME, _onEnterFrame); 112 | stage.addEventListener(Event.RESIZE, onResize); 113 | onResize(); 114 | } 115 | 116 | /** 117 | * render loop 118 | */ 119 | private function _onEnterFrame(e:Event):void 120 | { 121 | _torus.rotationX += 2; 122 | _torus.rotationY += 1; 123 | 124 | _view.camera.position = new Vector3D(); 125 | _view.camera.rotationY += 0.5*(stage.mouseX-stage.stageWidth/2)/800; 126 | _view.camera.moveBackward(600); 127 | 128 | _view.render(); 129 | } 130 | 131 | /** 132 | * stage listener for resize events 133 | */ 134 | private function onResize(event:Event = null):void 135 | { 136 | _view.width = stage.stageWidth; 137 | _view.height = stage.stageHeight; 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /tutorials/materials/globe/GlobeMaterialsTutorial.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/GlobeMaterialsTutorial.zip -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_01/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_01/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_01/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_01/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_02/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_02/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_02/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_02/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_03/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_03/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_03/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_03/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_04/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_04/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_04/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_04/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_05/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_05/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_05/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_05/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_06/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_06/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_06/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_06/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_07/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_07/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_07/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_07/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_08/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_08/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_08/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_08/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_09/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_09/Launcher.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/bin/listing_09/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/bin/listing_09/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/earth_ambient.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/earth_ambient.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/earth_clouds.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/earth_clouds.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/earth_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/earth_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/earth_normals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/earth_normals.png -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/earth_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/earth_specular.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare0.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare1.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare10.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare11.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare12.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare2.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare3.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare4.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare5.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare6.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare7.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare8.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/flare9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/flare9.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/moon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/moon.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_negX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_negX.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_negY.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_negY.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_negZ.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_negZ.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_posX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_posX.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_posY.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_posY.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/space_posZ.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/space_posZ.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/star.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/star.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/embeds/sun.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/embeds/sun.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/earth_ambient.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/earth_ambient.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/earth_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/earth_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/earth_normals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/earth_normals.png -------------------------------------------------------------------------------- /tutorials/materials/globe/images/earth_specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/earth_specular.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_01.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_02.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_03.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_04.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_05.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_06.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_07.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_08.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/images/listing_09.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/materials/globe/images/listing_09.jpg -------------------------------------------------------------------------------- /tutorials/materials/globe/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:GlobeMaterialsTutorial,src/GlobeMaterialsTutorialListing01.as,src/GlobeMaterialsTutorialListing02.as,src/GlobeMaterialsTutorialListing03.as,src/GlobeMaterialsTutorialListing04.as,src/GlobeMaterialsTutorialListing05.as,src/GlobeMaterialsTutorialListing06.as,src/GlobeMaterialsTutorialListing07.as,src/GlobeMaterialsTutorialListing08.as,src/GlobeMaterialsTutorialListing09.as -------------------------------------------------------------------------------- /tutorials/materials/globe/src/GlobeMaterialsTutorialListing01.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.containers.ObjectContainer3D; 5 | import away3d.entities.Mesh; 6 | import away3d.materials.TextureMaterial; 7 | import away3d.primitives.SphereGeometry; 8 | import away3d.textures.BitmapTexture; 9 | import away3d.utils.Cast; 10 | 11 | public class GlobeMaterialsTutorialListing01 extends GlobeMaterialsTutorialListingBase 12 | { 13 | // Diffuse map for the Earth's surface. 14 | [Embed(source="../embeds/earth_diffuse.jpg")] 15 | public static var EarthSurfaceDiffuse:Class; 16 | 17 | // Diffuse map for the Moon's surface. 18 | [Embed(source="../embeds/moon.jpg")] 19 | public static var MoonSurfaceDiffuse:Class; 20 | 21 | private var _earth:ObjectContainer3D; 22 | private var _moon:ObjectContainer3D; 23 | 24 | public function GlobeMaterialsTutorialListing01() { 25 | super(); 26 | } 27 | 28 | override protected function onSetup():void { 29 | createEarth(); 30 | createMoon(); 31 | } 32 | 33 | private function createEarth():void { 34 | // Material. 35 | var earthSurfaceTexture:BitmapTexture = Cast.bitmapTexture( EarthSurfaceDiffuse ); 36 | var earthSurfaceMaterial:TextureMaterial = new TextureMaterial( earthSurfaceTexture ); 37 | // Geometry. 38 | var earthSurfaceGeometry:SphereGeometry = new SphereGeometry( 100, 200, 100 ); 39 | // Mesh. 40 | var earthSurfaceMesh:Mesh = new Mesh( earthSurfaceGeometry, earthSurfaceMaterial ); 41 | // Container. 42 | _earth = new ObjectContainer3D(); 43 | _earth.rotationY = rand( 0, 360 ); 44 | _view.scene.addChild( _earth ); 45 | _earth.addChild( earthSurfaceMesh ); 46 | } 47 | 48 | private function createMoon():void { 49 | // Material. 50 | var moonSurfaceTexture:BitmapTexture = Cast.bitmapTexture( MoonSurfaceDiffuse ); 51 | var moonSurfaceMaterial:TextureMaterial = new TextureMaterial( moonSurfaceTexture ); 52 | // Geometry. 53 | var moonSurfaceGeometry:SphereGeometry = new SphereGeometry( 50, 100, 50 ); 54 | // Mesh. 55 | var moonSurfaceMesh:Mesh = new Mesh( moonSurfaceGeometry, moonSurfaceMaterial ); 56 | // Container. 57 | _moon = new ObjectContainer3D(); 58 | _moon.rotationY = rand( 0, 360 ); 59 | _view.scene.addChild( _moon ); 60 | moonSurfaceMesh.x = 1000; 61 | _moon.addChild( moonSurfaceMesh ); 62 | } 63 | 64 | override protected function onUpdate():void { 65 | super.onUpdate(); 66 | _earth.rotationY += 0.05; 67 | _moon.rotationY -= 0.005; 68 | } 69 | 70 | private function rand( min:Number, max:Number ):Number { 71 | return (max - min)*Math.random() + min; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /tutorials/materials/globe/src/GlobeMaterialsTutorialListing02.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.containers.ObjectContainer3D; 5 | import away3d.entities.Mesh; 6 | import away3d.entities.Sprite3D; 7 | import away3d.materials.TextureMaterial; 8 | import away3d.primitives.SkyBox; 9 | import away3d.primitives.SphereGeometry; 10 | import away3d.textures.BitmapCubeTexture; 11 | import away3d.textures.BitmapTexture; 12 | import away3d.utils.Cast; 13 | 14 | import flash.display.BitmapData; 15 | import flash.display.BitmapDataChannel; 16 | import flash.geom.Point; 17 | 18 | public class GlobeMaterialsTutorialListing02 extends GlobeMaterialsTutorialListingBase 19 | { 20 | // Diffuse map for the Earth's surface. 21 | [Embed(source="../embeds/earth_diffuse.jpg")] 22 | public static var EarthSurfaceDiffuse:Class; 23 | 24 | // Diffuse map for the Moon's surface. 25 | [Embed(source="../embeds/moon.jpg")] 26 | public static var MoonSurfaceDiffuse:Class; 27 | 28 | // Skybox textures. 29 | [Embed(source="../embeds/space_posX.jpg")] 30 | private var PosX:Class; 31 | [Embed(source="../embeds/space_negX.jpg")] 32 | private var NegX:Class; 33 | [Embed(source="../embeds/space_posY.jpg")] 34 | private var PosY:Class; 35 | [Embed(source="../embeds/space_negY.jpg")] 36 | private var NegY:Class; 37 | [Embed(source="../embeds/space_posZ.jpg")] 38 | private var PosZ:Class; 39 | [Embed(source="../embeds/space_negZ.jpg")] 40 | private var NegZ:Class; 41 | 42 | // Star texture. 43 | [Embed(source="../embeds/star.jpg")] 44 | private var StarTexture:Class; 45 | 46 | // Sun texture. 47 | [Embed(source="../embeds/sun.jpg")] 48 | private var SunTexture:Class; 49 | 50 | private var _earth:ObjectContainer3D; 51 | private var _moon:ObjectContainer3D; 52 | 53 | public function GlobeMaterialsTutorialListing02() { 54 | super(); 55 | } 56 | 57 | override protected function onSetup():void { 58 | createSun(); 59 | createEarth(); 60 | createMoon(); 61 | createDeepSpace(); 62 | createStarField(); 63 | } 64 | 65 | private function createSun():void { 66 | // Material. 67 | var bitmapData:BitmapData = blackToTransparent( Cast.bitmapData( SunTexture ) ); 68 | var sunMaterial:TextureMaterial = new TextureMaterial( new BitmapTexture( bitmapData ) ); 69 | sunMaterial.alphaBlending = true; 70 | // Geometry. 71 | var sun:Sprite3D = new Sprite3D( sunMaterial, 5000, 5000 ); 72 | sun.x = 10000; 73 | _view.scene.addChild( sun ); 74 | } 75 | 76 | private function createEarth():void { 77 | // Material. 78 | var earthMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( EarthSurfaceDiffuse ) ); 79 | // Container. 80 | _earth = new ObjectContainer3D(); 81 | _earth.rotationY = rand( 0, 360 ); 82 | _view.scene.addChild( _earth ); 83 | // Surface geometry. 84 | var earthSurface:Mesh = new Mesh( new SphereGeometry( 100, 200, 100 ), earthMaterial ); 85 | _earth.addChild( earthSurface ); 86 | } 87 | 88 | private function createMoon():void { 89 | // Material. 90 | var moonMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( MoonSurfaceDiffuse ) ); 91 | // Container. 92 | _moon = new ObjectContainer3D(); 93 | _moon.rotationY = rand( 0, 360 ); 94 | _view.scene.addChild( _moon ); 95 | // Surface geometry. 96 | var moonSurface:Mesh = new Mesh( new SphereGeometry( 50, 200, 100 ), moonMaterial ); 97 | moonSurface.x = 1000; 98 | _moon.addChild( moonSurface ); 99 | } 100 | 101 | private function createStarField():void { 102 | // Define material to be shared by all stars. 103 | var bitmapData:BitmapData = blackToTransparent( Cast.bitmapData( StarTexture ) ); 104 | var starMaterial:TextureMaterial = new TextureMaterial( new BitmapTexture( bitmapData ) ); 105 | starMaterial.alphaBlending = true; 106 | for( var i:uint = 0; i < 500; i++ ) { 107 | // Define unique star. 108 | var star:Sprite3D = new Sprite3D( starMaterial, 150, 150 ); 109 | _view.scene.addChild( star ); 110 | // Randomly position in spherical coordinates. 111 | var radius:Number = rand( 2000, 15000 ); 112 | var elevation:Number = rand( -Math.PI, Math.PI ); 113 | var azimuth:Number = rand( -Math.PI, Math.PI ); 114 | // Spherical to cartesian. 115 | star.x = radius * Math.cos( elevation ) * Math.sin( azimuth ); 116 | star.y = radius * Math.sin( elevation ); 117 | star.z = radius * Math.cos( elevation ) * Math.cos( azimuth ); 118 | } 119 | } 120 | 121 | private function createDeepSpace():void { 122 | // Cube texture. 123 | var cubeTexture:BitmapCubeTexture = new BitmapCubeTexture( 124 | Cast.bitmapData( PosX ), Cast.bitmapData( NegX ), 125 | Cast.bitmapData( PosY ), Cast.bitmapData( NegY ), 126 | Cast.bitmapData( PosZ ), Cast.bitmapData( NegZ ) ); 127 | // Skybox geometry. 128 | var skyBox:SkyBox = new SkyBox( cubeTexture ); 129 | _view.scene.addChild( skyBox ); 130 | } 131 | 132 | override protected function onUpdate():void { 133 | super.onUpdate(); 134 | _earth.rotationY += 0.05; 135 | _moon.rotationY -= 0.005; 136 | } 137 | 138 | private function rand( min:Number, max:Number ):Number { 139 | return (max - min)*Math.random() + min; 140 | } 141 | 142 | private function blackToTransparent( original:BitmapData ):BitmapData { 143 | var bmd:BitmapData = new BitmapData( original.width, original.height, true, 0xFFFFFFFF ); 144 | bmd.copyChannel( original, bmd.rect, new Point(), BitmapDataChannel.RED, BitmapDataChannel.ALPHA ); 145 | return bmd; 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /tutorials/materials/globe/src/GlobeMaterialsTutorialListing03.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.containers.ObjectContainer3D; 5 | import away3d.entities.Mesh; 6 | import away3d.entities.Sprite3D; 7 | import away3d.lights.PointLight; 8 | import away3d.materials.TextureMaterial; 9 | import away3d.primitives.SkyBox; 10 | import away3d.primitives.SphereGeometry; 11 | import away3d.textures.BitmapCubeTexture; 12 | import away3d.textures.BitmapTexture; 13 | import away3d.utils.Cast; 14 | 15 | import flash.display.BitmapData; 16 | import flash.display.BitmapDataChannel; 17 | import flash.geom.Point; 18 | 19 | public class GlobeMaterialsTutorialListing03 extends GlobeMaterialsTutorialListingBase 20 | { 21 | // Diffuse map for the Earth's surface. 22 | [Embed(source="../embeds/earth_diffuse.jpg")] 23 | public static var EarthSurfaceDiffuse:Class; 24 | 25 | // Diffuse map for the Moon's surface. 26 | [Embed(source="../embeds/moon.jpg")] 27 | public static var MoonSurfaceDiffuse:Class; 28 | 29 | // Skybox textures. 30 | [Embed(source="../embeds/space_posX.jpg")] 31 | private var PosX:Class; 32 | [Embed(source="../embeds/space_negX.jpg")] 33 | private var NegX:Class; 34 | [Embed(source="../embeds/space_posY.jpg")] 35 | private var PosY:Class; 36 | [Embed(source="../embeds/space_negY.jpg")] 37 | private var NegY:Class; 38 | [Embed(source="../embeds/space_posZ.jpg")] 39 | private var PosZ:Class; 40 | [Embed(source="../embeds/space_negZ.jpg")] 41 | private var NegZ:Class; 42 | 43 | // Star texture. 44 | [Embed(source="../embeds/star.jpg")] 45 | private var StarTexture:Class; 46 | 47 | // Sun texture. 48 | [Embed(source="../embeds/sun.jpg")] 49 | private var SunTexture:Class; 50 | 51 | private var _earth:ObjectContainer3D; 52 | private var _moon:ObjectContainer3D; 53 | 54 | public function GlobeMaterialsTutorialListing03() { 55 | super(); 56 | } 57 | 58 | override protected function onSetup():void { 59 | createSun(); 60 | createEarth(); 61 | createMoon(); 62 | createDeepSpace(); 63 | createStarField(); 64 | } 65 | 66 | private function createSun():void { 67 | // Light object. 68 | var light:PointLight = new PointLight(); 69 | light.ambient = 0.25; 70 | light.diffuse = 2; 71 | light.specular = 0.5; 72 | _lightPicker.lights = [ light ]; 73 | // Material. 74 | var bitmapData:BitmapData = blackToTransparent( Cast.bitmapData( SunTexture ) ); 75 | var sunMaterial:TextureMaterial = new TextureMaterial( new BitmapTexture( bitmapData ) ); 76 | sunMaterial.alphaBlending = true; 77 | // Geometry. 78 | var sun:Sprite3D = new Sprite3D( sunMaterial, 5000, 5000 ); 79 | sun.x = light.x = 10000; 80 | _view.scene.addChild( sun ); 81 | } 82 | 83 | private function createEarth():void { 84 | // Material. 85 | var earthMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( EarthSurfaceDiffuse ) ); 86 | earthMaterial.gloss = 5; 87 | earthMaterial.lightPicker = _lightPicker; 88 | // Container. 89 | _earth = new ObjectContainer3D(); 90 | _earth.rotationY = rand( 0, 360 ); 91 | _view.scene.addChild( _earth ); 92 | // Surface geometry. 93 | var earthSurface:Mesh = new Mesh( new SphereGeometry( 100, 200, 100 ), earthMaterial ); 94 | _earth.addChild( earthSurface ); 95 | } 96 | 97 | private function createMoon():void { 98 | // Material. 99 | var moonMaterial:TextureMaterial = new TextureMaterial( Cast.bitmapTexture( MoonSurfaceDiffuse ) ); 100 | moonMaterial.gloss = 5; 101 | moonMaterial.lightPicker = _lightPicker; 102 | // Container. 103 | _moon = new ObjectContainer3D(); 104 | _moon.rotationY = rand( 0, 360 ); 105 | _view.scene.addChild( _moon ); 106 | // Surface geometry. 107 | var moonSurface:Mesh = new Mesh( new SphereGeometry( 50, 200, 100 ), moonMaterial ); 108 | moonSurface.x = 1000; 109 | _moon.addChild( moonSurface ); 110 | } 111 | 112 | private function createStarField():void { 113 | // Define material to be shared by all stars. 114 | var bitmapData:BitmapData = blackToTransparent( Cast.bitmapData( StarTexture ) ); 115 | var starMaterial:TextureMaterial = new TextureMaterial( new BitmapTexture( bitmapData ) ); 116 | starMaterial.alphaBlending = true; 117 | for( var i:uint = 0; i < 500; i++ ) { 118 | // Define unique star. 119 | var star:Sprite3D = new Sprite3D( starMaterial, 150, 150 ); 120 | _view.scene.addChild( star ); 121 | // Randomly position in spherical coordinates. 122 | var radius:Number = rand( 2000, 15000 ); 123 | var elevation:Number = rand( -Math.PI, Math.PI ); 124 | var azimuth:Number = rand( -Math.PI, Math.PI ); 125 | // Spherical to cartesian. 126 | star.x = radius * Math.cos( elevation ) * Math.sin( azimuth ); 127 | star.y = radius * Math.sin( elevation ); 128 | star.z = radius * Math.cos( elevation ) * Math.cos( azimuth ); 129 | } 130 | } 131 | 132 | private function createDeepSpace():void { 133 | // Cube texture. 134 | var cubeTexture:BitmapCubeTexture = new BitmapCubeTexture( 135 | Cast.bitmapData( PosX ), Cast.bitmapData( NegX ), 136 | Cast.bitmapData( PosY ), Cast.bitmapData( NegY ), 137 | Cast.bitmapData( PosZ ), Cast.bitmapData( NegZ ) ); 138 | // Skybox geometry. 139 | var skyBox:SkyBox = new SkyBox( cubeTexture ); 140 | _view.scene.addChild( skyBox ); 141 | } 142 | 143 | override protected function onUpdate():void { 144 | super.onUpdate(); 145 | _earth.rotationY += 0.05; 146 | _moon.rotationY -= 0.005; 147 | } 148 | 149 | private function rand( min:Number, max:Number ):Number { 150 | return (max - min)*Math.random() + min; 151 | } 152 | 153 | private function blackToTransparent( original:BitmapData ):BitmapData { 154 | var bmd:BitmapData = new BitmapData( original.width, original.height, true, 0xFFFFFFFF ); 155 | bmd.copyChannel( original, bmd.rect, new Point(), BitmapDataChannel.RED, BitmapDataChannel.ALPHA ); 156 | return bmd; 157 | } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /tutorials/materials/globe/src/GlobeMaterialsTutorialListingBase.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.containers.View3D; 5 | import away3d.controllers.HoverController; 6 | import away3d.materials.lightpickers.StaticLightPicker; 7 | 8 | import flash.display.Sprite; 9 | import flash.display.StageAlign; 10 | import flash.display.StageScaleMode; 11 | import flash.events.Event; 12 | import flash.events.MouseEvent; 13 | 14 | public class GlobeMaterialsTutorialListingBase extends Sprite 15 | { 16 | // Protected. 17 | protected var _view:View3D; 18 | protected var _lightPicker:StaticLightPicker; 19 | protected var _cameraController:HoverController; 20 | 21 | // Camera control. 22 | private var _mouseIsDown:Boolean; 23 | private var _lastPanAngle:Number; 24 | private var _lastTiltAngle:Number; 25 | private var _lastMouseX:Number; 26 | private var _lastMouseY:Number; 27 | private var _tiltIncrement:Number = 0; 28 | private var _panIncrement:Number = 0; 29 | 30 | public function GlobeMaterialsTutorialListingBase() { 31 | super(); 32 | addEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); 33 | } 34 | 35 | // --------------------------------------------------------------------- 36 | // Private. 37 | // --------------------------------------------------------------------- 38 | 39 | private function initialize():void { 40 | initStage(); 41 | initAway3d(); 42 | onSetup(); 43 | addEventListener( Event.ENTER_FRAME, enterframeHandler ); 44 | } 45 | 46 | private function initStage():void { 47 | stage.scaleMode = StageScaleMode.NO_SCALE; 48 | stage.align = StageAlign.TOP_LEFT; 49 | stage.frameRate = 60; 50 | stage.addEventListener( MouseEvent.MOUSE_DOWN, stageMouseDownHandler ); 51 | stage.addEventListener( MouseEvent.MOUSE_UP, stageMouseUpHandler ); 52 | stage.addEventListener( MouseEvent.MOUSE_WHEEL, stageMouseWheelHandler ); 53 | } 54 | 55 | protected function initAway3d():void { 56 | // View. 57 | _view = new View3D(); 58 | _view.backgroundColor = 0x000000; 59 | _view.antiAlias = 4; 60 | _view.camera.lens.far = 15000; 61 | _view.addSourceURL( "srcview/index.html" ); 62 | _view.forceMouseMove = true; 63 | addChild( _view ); 64 | // Camera. 65 | _cameraController = new HoverController( _view.camera, null, 0, 0, 300 ); 66 | _cameraController.yFactor = 1; 67 | // Lights. 68 | _lightPicker = new StaticLightPicker( [] ); 69 | } 70 | 71 | private function update():void { 72 | onUpdate(); 73 | if( _mouseIsDown ) { 74 | _cameraController.panAngle = 0.4 * ( _view.mouseX - _lastMouseX ) + _lastPanAngle; 75 | _cameraController.tiltAngle = 0.4 * ( _view.mouseY - _lastMouseY ) + _lastTiltAngle; 76 | } 77 | _cameraController.panAngle += _panIncrement; 78 | _cameraController.tiltAngle += _tiltIncrement; 79 | _view.render(); 80 | } 81 | 82 | // --------------------------------------------------------------------- 83 | // Event handlers. 84 | // --------------------------------------------------------------------- 85 | 86 | private function addedToStageHandler( event:Event ):void { 87 | removeEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); 88 | initialize(); 89 | } 90 | 91 | private function stageMouseDownHandler( event:MouseEvent ):void { 92 | _mouseIsDown = true; 93 | _lastPanAngle = _cameraController.panAngle; 94 | _lastTiltAngle = _cameraController.tiltAngle; 95 | _lastMouseX = stage.mouseX; 96 | _lastMouseY = stage.mouseY; 97 | } 98 | 99 | private function stageMouseWheelHandler( event:MouseEvent ):void { 100 | _cameraController.distance -= event.delta * 5; 101 | if( _cameraController.distance < 150 ) 102 | _cameraController.distance = 150; 103 | else if( _cameraController.distance > 2000 ) 104 | _cameraController.distance = 2000; 105 | } 106 | 107 | private function stageMouseUpHandler( event:MouseEvent ):void { 108 | _mouseIsDown = false; 109 | } 110 | 111 | private function enterframeHandler( event:Event ):void { 112 | update(); 113 | } 114 | 115 | // --------------------------------------------------------------------- 116 | // Protected. 117 | // --------------------------------------------------------------------- 118 | 119 | protected function onSetup():void { 120 | // Override me. 121 | } 122 | 123 | protected function onUpdate():void { 124 | // Override me. 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /tutorials/misc/wikitutorials/src/WikiTutorials.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Writting Tutorials 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | This article will explain how to publish tutorials on the Away3D site, and which guidelines to follow to ensure the site's content is consistent. 23 |
24 |

User Access

25 | If you are a registered away3d.com user, you can email the Away3D team at info@away3d.com and request that you are granted privileges for publishing articles in our tutorials wiki. Once this is done, you can create a new tutorial by typing the name of the article you want to create in the "Find or Create Tutorial" search box on the top-right of this page. If a page named like that does not previously exist, you should see an edit button. Once you press it, you enter edit mode for the article and will be able to submit your tutorial. 26 |
27 |
28 |

Tutorial Writing Guidelines

29 | The following sections in this article will enumerate the guidelines to follow when writing articles for the tutorials wiki. 30 |
31 |

Using Other Tutorials as Templates

32 | The first thing you should do is enter edit mode for one of the older tutorials and extract its html code. This will show you a general structure to follow including css styling, usage of swf demos within figure elements, structure of sections, etc. Having the source of one of such tutorials should be of great help while you are developing your own. 33 |
34 |
35 |

No p's

36 | Since this is a wiki, there is no need to use html p elements. The white space in whatever you enter in the edit window will be maintained, meaning that you can use line breaks to specify paragraphs and should not manually split lines within a paragraph. 37 |
38 |
39 |

Sections and Navigation

40 | Have a look at how older tutorials put content within sections and have a nav element on top in order to quickly see and navigate to the sections within the tutorial. 41 |
42 |
43 |

Aside

44 | If you see the source of one of the older tutorials, you will see an aside section that specifies the difficulty of the article, requirements etc. This is an important section of your article and is required. This section should include a link to the sources of the tutorial on github as well as a downloadable zip file. More on the sources section. 45 |
46 |
47 |

Sources

48 | You can embed code snippets in the article using the appropriate pre tag ( see older tutorials for how to link it to syntax highlighter ). When listing entire classes or demos, you should provide a link to the file in github.com. To upload the files to this repository, please contact the Away3D team who will upload it for you or give you write access to the repository. 49 |
50 |
51 |

Special Terms and Code

52 | See how older tutorials use the code html tag and styling for dealing with words that refer to new concepts or language variables. 53 |
54 |
55 |

Demos

56 | All swf demos are image links within figure html tags with related captions. The caption includes a description of the demo and a link to its sources. The image triggers a shadowbox overlay that contains the demo. See the code on an older tutorial for this setup and please pay attention to the styling of the image, its size, and the size of the demo. 57 |
58 |
59 |

BBCode

60 | Notice how at the start of articles there is a div with class "tutorialMetadata" that specifies the category of your tutorial. If you do not include this, your article will not be categorized and will be more difficult to find. You can also use BBCode tags to link to other pages in the wiki. Follow this link to learn more about BBCode usage in the wiki. 61 |
62 |
63 |
64 | 65 | -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/ParticlesBeginning.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/ParticlesBeginning.zip -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/TheAdvancedDemo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/TheAdvancedDemo.jpg -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/TheAdvancedDemo.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/TheAdvancedDemo.swf -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/TheBasicTutorial.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/TheBasicTutorial.jpg -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/TheBasicTutorial.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/TheBasicTutorial.swf -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/history/historyFrame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | Hidden frame for Browser History support. 28 | 29 | 30 | -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 62 | 63 | 64 | 68 |
69 |

70 | To view this page ensure that Adobe Flash Player version 71 | 11.4.0 or greater is installed. 72 |

73 | 78 |
79 | 80 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/preview.jpg -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/bin/preview.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/bin/preview.swf -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/embeds/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/particles/particles_beginning/embeds/text.png -------------------------------------------------------------------------------- /tutorials/particles/particles_beginning/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:ParticlesBeginning,src/TheBasicTutorial.as,src/TheAdvancedDemo.as -------------------------------------------------------------------------------- /tutorials/picking/overview/PickingTutorial.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/PickingTutorial.zip -------------------------------------------------------------------------------- /tutorials/picking/overview/assets/RayScene.mb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/assets/RayScene.mb -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_01/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_01/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_01/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_01/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_02/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_02/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_02/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_02/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_03/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_03/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_03/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_03/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_04/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_04/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_04/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_04/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_05/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_05/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_05/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_05/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_06/Launcher.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_06/Launcher.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/bin/listing_06/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/bin/listing_06/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/picking/overview/embeds/hellknight_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/embeds/hellknight_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/embeds/hellknight_normals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/embeds/hellknight_normals.png -------------------------------------------------------------------------------- /tutorials/picking/overview/embeds/hellknight_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/embeds/hellknight_specular.png -------------------------------------------------------------------------------- /tutorials/picking/overview/images/figure_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/figure_01.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/figure_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/figure_02.png -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_01.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_02.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_03.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_04.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_05.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/images/listing_06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/picking/overview/images/listing_06.jpg -------------------------------------------------------------------------------- /tutorials/picking/overview/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:PickingTutorial,src/PickingTutorialListing01.as,src/PickingTutorialListing02.as,src/PickingTutorialListing03.as,src/PickingTutorialListing04.as,src/PickingTutorialListing05.as,src/PickingTutorialListing06.as -------------------------------------------------------------------------------- /tutorials/picking/overview/src/PickingTutorialListing01.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.entities.Mesh; 5 | import away3d.events.MouseEvent3D; 6 | import away3d.materials.ColorMaterial; 7 | import away3d.primitives.CubeGeometry; 8 | import away3d.primitives.SphereGeometry; 9 | 10 | public class PickingTutorialListing01 extends PickingTutorialListingBase 11 | { 12 | public function PickingTutorialListing01() { 13 | super(); 14 | } 15 | 16 | private var _inactiveMaterial:ColorMaterial; 17 | private var _activeMaterial:ColorMaterial; 18 | 19 | override protected function onSetup():void { 20 | 21 | _cameraController.panAngle = 20; 22 | _cameraController.tiltAngle = 20; 23 | 24 | // Init materials. 25 | _activeMaterial = new ColorMaterial( 0xFF0000 ); 26 | _activeMaterial.lightPicker = _lightPicker; 27 | _inactiveMaterial = new ColorMaterial( 0xCCCCCC ); 28 | _inactiveMaterial.lightPicker = _lightPicker; 29 | 30 | // Create 2 objects. 31 | var cube:Mesh = new Mesh( new CubeGeometry(), _inactiveMaterial ); 32 | cube.x = -75; 33 | _view.scene.addChild( cube ); 34 | var sphere:Mesh = new Mesh( new SphereGeometry(), _inactiveMaterial ); 35 | sphere.x = 75; 36 | _view.scene.addChild( sphere ); 37 | 38 | // Enable mouse interactivity. 39 | cube.mouseEnabled = true; 40 | sphere.mouseEnabled = true; 41 | 42 | // Attach mouse event listeners. 43 | cube.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); 44 | cube.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 45 | sphere.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); 46 | sphere.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 47 | 48 | } 49 | 50 | private function onObjectMouseOver( event:MouseEvent3D ):void { 51 | event.target.material = _activeMaterial; 52 | } 53 | 54 | private function onObjectMouseOut( event:MouseEvent3D ):void { 55 | event.target.material = _inactiveMaterial; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tutorials/picking/overview/src/PickingTutorialListing02.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.entities.Mesh; 5 | import away3d.events.MouseEvent3D; 6 | import away3d.materials.ColorMaterial; 7 | import away3d.primitives.CubeGeometry; 8 | import away3d.primitives.SphereGeometry; 9 | 10 | public class PickingTutorialListing02 extends PickingTutorialListingBase 11 | { 12 | public function PickingTutorialListing02() { 13 | super(); 14 | } 15 | 16 | private var _inactiveMaterial:ColorMaterial; 17 | private var _activeMaterial:ColorMaterial; 18 | 19 | override protected function onSetup():void { 20 | 21 | _cameraController.panAngle = -63; 22 | _cameraController.tiltAngle = 10; 23 | 24 | // Init materials. 25 | _activeMaterial = new ColorMaterial( 0xFF0000 ); 26 | _activeMaterial.lightPicker = _lightPicker; 27 | _inactiveMaterial = new ColorMaterial( 0xCCCCCC ); 28 | _inactiveMaterial.lightPicker = _lightPicker; 29 | var disabledMaterial:ColorMaterial = new ColorMaterial( 0x666666 ); 30 | disabledMaterial.lightPicker = _lightPicker; 31 | 32 | // Create 2 objects. 33 | var cube:Mesh = new Mesh( new CubeGeometry(), disabledMaterial ); 34 | cube.x = -75; 35 | _view.scene.addChild( cube ); 36 | var sphere:Mesh = new Mesh( new SphereGeometry(), _inactiveMaterial ); 37 | sphere.x = 75; 38 | _view.scene.addChild( sphere ); 39 | 40 | // Enable mouse interactivity. 41 | cube.mouseEnabled = true; 42 | sphere.mouseEnabled = true; 43 | 44 | // Attach mouse event listeners. 45 | // cube.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); // By attaching no listeners to the object, it simply occludes picking ( if mouseEnabled = true ). 46 | // cube.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 47 | sphere.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); 48 | sphere.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 49 | 50 | } 51 | 52 | private function onObjectMouseOver( event:MouseEvent3D ):void { 53 | event.target.material = _activeMaterial; 54 | } 55 | 56 | private function onObjectMouseOut( event:MouseEvent3D ):void { 57 | event.target.material = _inactiveMaterial; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tutorials/picking/overview/src/PickingTutorialListing03.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.core.pick.PickingColliderType; 5 | import away3d.entities.Mesh; 6 | import away3d.events.MouseEvent3D; 7 | import away3d.materials.ColorMaterial; 8 | import away3d.primitives.CubeGeometry; 9 | import away3d.primitives.SphereGeometry; 10 | 11 | import flash.events.KeyboardEvent; 12 | import flash.text.TextField; 13 | 14 | public class PickingTutorialListing03 extends PickingTutorialListingBase 15 | { 16 | public function PickingTutorialListing03() { 17 | super(); 18 | } 19 | 20 | private var _inactiveMaterial:ColorMaterial; 21 | private var _activeMaterial:ColorMaterial; 22 | private var _msg:TextField; 23 | private var _usingBoundsCollider:Boolean = false; 24 | private var _sphere:Mesh; 25 | 26 | override protected function onSetup():void { 27 | 28 | _cameraController.panAngle = 46; 29 | _cameraController.tiltAngle = 10; 30 | 31 | // Init materials. 32 | _activeMaterial = new ColorMaterial( 0xFF0000 ); 33 | _activeMaterial.lightPicker = _lightPicker; 34 | _inactiveMaterial = new ColorMaterial( 0xCCCCCC ); 35 | _inactiveMaterial.lightPicker = _lightPicker; 36 | 37 | // Create 2 objects. 38 | var cube:Mesh = new Mesh( new CubeGeometry(), _inactiveMaterial ); 39 | cube.x = -75; 40 | _view.scene.addChild( cube ); 41 | _sphere = new Mesh( new SphereGeometry(), _inactiveMaterial ); 42 | _sphere.x = 75; 43 | _view.scene.addChild( _sphere ); 44 | 45 | // Enable mouse interactivity. 46 | cube.mouseEnabled = true; 47 | _sphere.mouseEnabled = true; 48 | _sphere.showBounds = true; 49 | 50 | // Msg. 51 | _msg = new TextField(); 52 | _msg.textColor = 0xFFFFFF; 53 | _msg.selectable = false; 54 | _msg.mouseEnabled = false; 55 | _msg.width = 540; 56 | _msg.height = 100; 57 | addChild( _msg ); 58 | 59 | // Choose picking precision ( either solution works ). 60 | _sphere.pickingCollider = PickingColliderType.AS3_FIRST_ENCOUNTERED; 61 | // _sphere.bounds = new BoundingSphere(); 62 | // BoundingSphere( _sphere.bounds ).fromSphere( new Vector3D(), 50 ); // Make sure radius is not calculated from a cube volume. 63 | updateMsg( "AS3_FIRST_ENCOUNTERED" ); 64 | 65 | // Keyboard listeners. 66 | stage.addEventListener( KeyboardEvent.KEY_UP, onStageKeyUp ); 67 | 68 | // Attach mouse event listeners. 69 | cube.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); 70 | cube.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 71 | _sphere.addEventListener( MouseEvent3D.MOUSE_OVER, onObjectMouseOver ); 72 | _sphere.addEventListener( MouseEvent3D.MOUSE_OUT, onObjectMouseOut ); 73 | } 74 | 75 | private function onStageKeyUp( event:KeyboardEvent ):void { 76 | if( _usingBoundsCollider ) { 77 | _sphere.pickingCollider = PickingColliderType.AS3_FIRST_ENCOUNTERED; 78 | updateMsg( "AS3_FIRST_ENCOUNTERED" ); 79 | } 80 | else { 81 | _sphere.pickingCollider = PickingColliderType.BOUNDS_ONLY; 82 | updateMsg( "BOUNDS_ONLY" ); 83 | } 84 | _usingBoundsCollider = !_usingBoundsCollider; 85 | } 86 | 87 | private function updateMsg( type:String ):void { 88 | _msg.text = "PickingColliderType: " + type + "\n"; 89 | _msg.text += "Press SPACE to change type ( click to gain focus )."; 90 | } 91 | 92 | private function onObjectMouseOver( event:MouseEvent3D ):void { 93 | event.target.material = _activeMaterial; 94 | } 95 | 96 | private function onObjectMouseOut( event:MouseEvent3D ):void { 97 | event.target.material = _inactiveMaterial; 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /tutorials/picking/overview/src/PickingTutorialListing06.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.core.pick.PickingColliderType; 5 | import away3d.entities.Mesh; 6 | import away3d.entities.SegmentSet; 7 | import away3d.events.AssetEvent; 8 | import away3d.events.MouseEvent3D; 9 | import away3d.library.assets.AssetType; 10 | import away3d.loaders.parsers.OBJParser; 11 | import away3d.materials.ColorMaterial; 12 | import away3d.materials.TextureMaterial; 13 | import away3d.primitives.LineSegment; 14 | import away3d.primitives.SphereGeometry; 15 | import away3d.textures.BitmapTexture; 16 | 17 | import flash.display.Bitmap; 18 | import flash.display.BitmapData; 19 | import flash.display.Sprite; 20 | import flash.events.MouseEvent; 21 | import flash.geom.Matrix; 22 | import flash.geom.Point; 23 | import flash.geom.Vector3D; 24 | 25 | public class PickingTutorialListing06 extends PickingTutorialListingBase 26 | { 27 | // Assets. 28 | [Embed(source="../embeds/head.obj", mimeType="application/octet-stream")] 29 | private var HeadAsset:Class; 30 | 31 | private const TEXTURE_SIZE:uint = 2048; 32 | 33 | private var _painting:Boolean; 34 | private var _bitmap:Bitmap; 35 | private var _painter:Sprite; 36 | private var _material:TextureMaterial; 37 | private var _texture:BitmapTexture; 38 | private var _locationTracer:Mesh; 39 | private var _normalTracer:SegmentSet; 40 | 41 | public function PickingTutorialListing06() { 42 | super(); 43 | } 44 | 45 | override protected function onSetup():void { 46 | 47 | _cameraController.panAngle = 158; 48 | _cameraController.tiltAngle = -2; 49 | 50 | _view.forceMouseMove = true; 51 | 52 | // To trace picking positions. 53 | _locationTracer = new Mesh( new SphereGeometry( 5 ), new ColorMaterial( 0x00FF00 ) ); 54 | _locationTracer.mouseEnabled = _locationTracer.mouseChildren = false; 55 | _locationTracer.visible = false; 56 | _view.scene.addChild( _locationTracer ); 57 | 58 | // To trace picking normals. 59 | _normalTracer = new SegmentSet(); 60 | _normalTracer.mouseEnabled = _normalTracer.mouseChildren = false; 61 | var lineSegment:LineSegment = new LineSegment( new Vector3D(), new Vector3D(), 0xFFFFFF, 0xFFFFFF, 3 ); 62 | _normalTracer.addSegment( lineSegment ); 63 | _normalTracer.visible = false; 64 | _view.scene.addChild( _normalTracer ); 65 | 66 | // uv _painter 67 | _painter = new Sprite(); 68 | _painter.graphics.beginFill( 0x0000FF ); 69 | _painter.graphics.drawCircle( 0, 0, 50 ); 70 | _painter.graphics.endFill(); 71 | 72 | // Load head model. 73 | var parser:OBJParser = new OBJParser( 30 ); 74 | parser.addEventListener( AssetEvent.ASSET_COMPLETE, onAssetComplete ); 75 | parser.parseAsync( new HeadAsset() ); 76 | } 77 | 78 | private function onAssetComplete( event:AssetEvent ):void { 79 | if( event.asset.assetType == AssetType.MESH ) { 80 | initializeModel( event.asset as Mesh ); 81 | } 82 | } 83 | 84 | private function initializeModel( model:Mesh ):void { 85 | 86 | // Apply materials. 87 | var bmd:BitmapData = new BitmapData( TEXTURE_SIZE, TEXTURE_SIZE, false, 0xFF0000 ); 88 | bmd.perlinNoise( 50, 50, 8, 1, false, true, 7, true ); 89 | _bitmap = new Bitmap( bmd ); 90 | _bitmap.scaleX = _bitmap.scaleY = 0.1; 91 | addChildAt( _bitmap, 1 ); 92 | _texture = new BitmapTexture( bmd ); 93 | _material = new TextureMaterial( _texture ); 94 | _material.lightPicker = _lightPicker; 95 | model.material = _material; 96 | 97 | // Set up interactivity. 98 | model.pickingCollider = PickingColliderType.PB_BEST_HIT; 99 | 100 | // Apply interactivity. 101 | model.mouseEnabled = model.mouseChildren = model.shaderPickingDetails = true; 102 | model.addEventListener( MouseEvent3D.MOUSE_MOVE, onMeshMouseMove ); 103 | model.addEventListener( MouseEvent3D.MOUSE_DOWN, onMeshMouseDown ); 104 | model.addEventListener( MouseEvent3D.MOUSE_UP, onMeshMouseUp ); 105 | model.addEventListener( MouseEvent3D.MOUSE_OVER, onMeshMouseOver ); 106 | model.addEventListener( MouseEvent3D.MOUSE_OUT, onMeshMouseOut ); 107 | stage.addEventListener( MouseEvent.MOUSE_UP, onStageMouseUp ) 108 | 109 | _view.scene.addChild( model ); 110 | } 111 | 112 | private function onMeshMouseMove( event:MouseEvent3D ):void { 113 | if( _painting ) { 114 | var uv:Point = event.uv; 115 | var bmd:BitmapData = _bitmap.bitmapData; 116 | var x:uint = uint( TEXTURE_SIZE * uv.x ); 117 | var y:uint = uint( TEXTURE_SIZE * uv.y ); 118 | var matrix:Matrix = new Matrix(); 119 | matrix.translate( x, y ); 120 | bmd.draw( _painter, matrix ); 121 | _texture.invalidateContent(); 122 | } 123 | // Update tracers. 124 | _locationTracer.position = event.scenePosition; 125 | _normalTracer.position = _locationTracer.position; 126 | var normal:Vector3D = event.sceneNormal.clone(); 127 | normal.scaleBy( 25 ); 128 | var lineSegment:LineSegment = _normalTracer.getSegment( 0 ) as LineSegment; 129 | lineSegment.end = normal.clone(); 130 | } 131 | 132 | private function onMeshMouseDown( event:MouseEvent3D ):void { 133 | _painting = true; 134 | } 135 | 136 | private function onMeshMouseUp( event:MouseEvent3D ):void { 137 | _painting = false; 138 | } 139 | 140 | private function onMeshMouseOver( event:MouseEvent3D ):void { 141 | _locationTracer.visible = _normalTracer.visible = true; 142 | } 143 | 144 | private function onMeshMouseOut( event:MouseEvent3D ):void { 145 | _locationTracer.visible = _normalTracer.visible = false; 146 | _painting = false; 147 | } 148 | 149 | private function onStageMouseUp( event:MouseEvent ):void { 150 | _painting = false; 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /tutorials/picking/overview/src/PickingTutorialListingBase.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | 4 | import away3d.containers.View3D; 5 | import away3d.controllers.HoverController; 6 | import away3d.lights.PointLight; 7 | import away3d.materials.lightpickers.StaticLightPicker; 8 | 9 | import flash.display.Sprite; 10 | import flash.display.StageAlign; 11 | import flash.display.StageScaleMode; 12 | import flash.events.Event; 13 | import flash.events.MouseEvent; 14 | 15 | public class PickingTutorialListingBase extends Sprite 16 | { 17 | // Protected. 18 | protected var _view:View3D; 19 | protected var _lightPicker:StaticLightPicker; 20 | protected var _cameraController:HoverController; 21 | 22 | // Private. 23 | private var _light:PointLight; 24 | 25 | // Camera control. 26 | private var _mouseIsDown:Boolean; 27 | private var _lastPanAngle:Number; 28 | private var _lastTiltAngle:Number; 29 | private var _lastMouseX:Number; 30 | private var _lastMouseY:Number; 31 | private var _tiltIncrement:Number = 0; 32 | private var _panIncrement:Number = 0; 33 | 34 | private const WIDTH:Number = 800; 35 | private const HEIGHT:Number = 600; 36 | 37 | public function PickingTutorialListingBase() { 38 | super(); 39 | addEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); 40 | } 41 | 42 | // --------------------------------------------------------------------- 43 | // Private. 44 | // --------------------------------------------------------------------- 45 | 46 | private function initialize():void { 47 | initStage(); 48 | initAway3d(); 49 | onSetup(); 50 | addEventListener( Event.ENTER_FRAME, enterframeHandler ); 51 | } 52 | 53 | private function initStage():void { 54 | stage.scaleMode = StageScaleMode.NO_SCALE; 55 | stage.align = StageAlign.TOP_LEFT; 56 | stage.frameRate = 60; 57 | stage.addEventListener( MouseEvent.MOUSE_DOWN, stageMouseDownHandler ); 58 | stage.addEventListener( MouseEvent.MOUSE_UP, stageMouseUpHandler ); 59 | stage.addEventListener( MouseEvent.MOUSE_WHEEL, stageMouseWheelHandler ); 60 | } 61 | 62 | protected function initAway3d():void { 63 | // View. 64 | _view = new View3D(); 65 | _view.backgroundColor = 0x000000; 66 | _view.width = WIDTH; 67 | _view.height = HEIGHT; 68 | _view.antiAlias = 4; 69 | _view.camera.lens.far = 15000; 70 | _view.addSourceURL( "srcview/index.html" ); 71 | _view.forceMouseMove = true; 72 | addChild( _view ); 73 | // Camera. 74 | _cameraController = new HoverController( _view.camera, null, 0, 0, 300 ); 75 | _cameraController.yFactor = 1; 76 | // Lights. 77 | _lightPicker = new StaticLightPicker( [] ); 78 | _light = new PointLight(); 79 | _lightPicker.lights = [ _light ]; 80 | _view.scene.addChild( _light ); 81 | } 82 | 83 | private function update():void { 84 | onUpdate(); 85 | if( _mouseIsDown ) { 86 | _cameraController.panAngle = 0.4 * ( _view.mouseX - _lastMouseX ) + _lastPanAngle; 87 | _cameraController.tiltAngle = 0.4 * ( _view.mouseY - _lastMouseY ) + _lastTiltAngle; 88 | } 89 | _cameraController.panAngle += _panIncrement; 90 | _cameraController.tiltAngle += _tiltIncrement; 91 | _light.position = _view.camera.position; 92 | _view.render(); 93 | } 94 | 95 | // --------------------------------------------------------------------- 96 | // Event handlers. 97 | // --------------------------------------------------------------------- 98 | 99 | private function addedToStageHandler( event:Event ):void { 100 | removeEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); 101 | initialize(); 102 | } 103 | 104 | private function stageMouseDownHandler( event:MouseEvent ):void { 105 | _mouseIsDown = true; 106 | _lastPanAngle = _cameraController.panAngle; 107 | _lastTiltAngle = _cameraController.tiltAngle; 108 | _lastMouseX = stage.mouseX; 109 | _lastMouseY = stage.mouseY; 110 | } 111 | 112 | private function stageMouseWheelHandler( event:MouseEvent ):void { 113 | _cameraController.distance -= event.delta * 5; 114 | if( _cameraController.distance < 150 ) 115 | _cameraController.distance = 150; 116 | else if( _cameraController.distance > 2000 ) 117 | _cameraController.distance = 2000; 118 | } 119 | 120 | private function stageMouseUpHandler( event:MouseEvent ):void { 121 | _mouseIsDown = false; 122 | } 123 | 124 | private function enterframeHandler( event:Event ):void { 125 | update(); 126 | } 127 | 128 | // --------------------------------------------------------------------- 129 | // Protected. 130 | // --------------------------------------------------------------------- 131 | 132 | protected function onSetup():void { 133 | // Override me. 134 | } 135 | 136 | protected function onUpdate():void { 137 | // Override me. 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/Basic_View.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/Basic_View.zip -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/bin/Basic_View.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/bin/Basic_View.swf -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/embeds/floor_diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/embeds/floor_diffuse.jpg -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/images/Basic_View.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/images/Basic_View.jpg -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/images/floor_no_texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/scenegraph/basic_view/images/floor_no_texture.png -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Basic_View,src/Basic_View.as -------------------------------------------------------------------------------- /tutorials/scenegraph/basic_view/src/Basic_View.as: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Basic View example in Away3d 4 | 5 | Demonstrates: 6 | 7 | How to create a 3D environment for your objects 8 | How to add a new textured object to your world 9 | How to rotate an object in your world 10 | 11 | Code by Rob Bateman 12 | rob@infiniteturtles.co.uk 13 | http://www.infiniteturtles.co.uk 14 | 15 | This code is distributed under the MIT License 16 | 17 | Copyright (c) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the “Software”), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | */ 38 | 39 | package tutorials.scenegraph.basic_view.src 40 | { 41 | import away3d.containers.*; 42 | import away3d.entities.*; 43 | import away3d.materials.*; 44 | import away3d.primitives.*; 45 | import away3d.utils.*; 46 | 47 | import flash.display.*; 48 | import flash.events.*; 49 | import flash.geom.Vector3D; 50 | 51 | [SWF(backgroundColor="#000000", frameRate="60")] 52 | 53 | public class Basic_View extends Sprite 54 | { 55 | //plane texture 56 | [Embed(source="../embeds/floor_diffuse.jpg")] 57 | public static var FloorDiffuse:Class; 58 | 59 | //engine variables 60 | private var _view:View3D; 61 | 62 | //scene objects 63 | private var _plane:Mesh; 64 | 65 | /** 66 | * Constructor 67 | */ 68 | public function Basic_View() 69 | { 70 | stage.scaleMode = StageScaleMode.NO_SCALE; 71 | stage.align = StageAlign.TOP_LEFT; 72 | 73 | //setup the view 74 | _view = new View3D(); 75 | addChild(_view); 76 | 77 | //setup the camera 78 | _view.camera.z = -600; 79 | _view.camera.y = 500; 80 | _view.camera.lookAt(new Vector3D()); 81 | 82 | //setup the scene 83 | _plane = new Mesh(new PlaneGeometry(700, 700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse))); 84 | _view.scene.addChild(_plane); 85 | 86 | //setup the render loop 87 | addEventListener(Event.ENTER_FRAME, _onEnterFrame); 88 | stage.addEventListener(Event.RESIZE, onResize); 89 | onResize(); 90 | } 91 | 92 | /** 93 | * render loop 94 | */ 95 | private function _onEnterFrame(e:Event):void 96 | { 97 | _plane.rotationY += 1; 98 | 99 | _view.render(); 100 | } 101 | 102 | /** 103 | * stage listener for resize events 104 | */ 105 | private function onResize(event:Event = null):void 106 | { 107 | _view.width = stage.stageWidth; 108 | _view.height = stage.stageHeight; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/Intermediate_One_Away3D_Two_Starling_Layers.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/Intermediate_One_Away3D_Two_Starling_Layers.zip -------------------------------------------------------------------------------- /tutorials/starling/interoperation/bin/Intermediate_One_Away3D_Two_Starling_Layers.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/bin/Intermediate_One_Away3D_Two_Starling_Layers.swf -------------------------------------------------------------------------------- /tutorials/starling/interoperation/bin/history/history.css: -------------------------------------------------------------------------------- 1 | /* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */ 2 | 3 | #ie_historyFrame { width: 0px; height: 0px; display:none } 4 | #firefox_anchorDiv { width: 0px; height: 0px; display:none } 5 | #safari_formDiv { width: 0px; height: 0px; display:none } 6 | #safari_rememberDiv { width: 0px; height: 0px; display:none } 7 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/bin/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/bin/playerProductInstall.swf -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 240 5 | file:///Volumes/Workspace/WorkspaceRepo/trunk/FlashDev/MobileProjects/Playground/JetPackPaddy/ADCTest/embeds 6 | file:///Volumes/Workspace/WorkspaceRepo 7 | 8 | 9 | 10 | 2012-10-10T08:51:11.099630Z 11 | 240 12 | Greg 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f798dcd9-1ec7-4ad9-9c14-0e829724c50f 28 | 29 | stars.png 30 | file 31 | 32 | 33 | 34 | 35 | 2012-08-08T13:33:58.000000Z 36 | bb8fe2c39473913632e8341a235e3df4 37 | 2012-10-10T08:51:11.099630Z 38 | 240 39 | Greg 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 3592 62 | 63 | stars.pex 64 | file 65 | 66 | 67 | 68 | 69 | 2012-08-08T13:33:58.000000Z 70 | 74b80f48ec6cb3b3a64d745e21632e20 71 | 2012-10-10T08:51:11.099630Z 72 | 240 73 | Greg 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 2006 96 | 97 | button.png 98 | file 99 | 100 | 101 | 102 | 103 | 2012-08-08T13:33:41.000000Z 104 | b2eff79bbab37a7650dd5ed573031442 105 | 2012-10-10T08:51:11.099630Z 106 | 240 107 | Greg 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 14287 130 | 131 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/prop-base/button.png.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/prop-base/stars.png.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/text-base/button.png.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/embeds/.svn/text-base/button.png.svn-base -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/text-base/stars.pex.svn-base: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/.svn/text-base/stars.png.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/embeds/.svn/text-base/stars.png.svn-base -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/embeds/button.png -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/stars.pex: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/embeds/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/starling/interoperation/embeds/stars.png -------------------------------------------------------------------------------- /tutorials/starling/interoperation/manifest.txt: -------------------------------------------------------------------------------- 1 | Project:Intermediate_One_Away3D_Two_Starling_Layers,src/Intermediate_One_Away3D_Two_Starling_Layers.as -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 240 5 | file:///Volumes/Workspace/WorkspaceRepo/trunk/FlashDev/MobileProjects/Playground/JetPackPaddy/ADCTest/src/starling 6 | file:///Volumes/Workspace/WorkspaceRepo 7 | 8 | 9 | 10 | 2012-10-10T08:51:11.099630Z 11 | 240 12 | Greg 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f798dcd9-1ec7-4ad9-9c14-0e829724c50f 28 | 29 | rootsprites 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/rootsprites/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 240 5 | file:///Volumes/Workspace/WorkspaceRepo/trunk/FlashDev/MobileProjects/Playground/JetPackPaddy/ADCTest/src/starling/rootsprites 6 | file:///Volumes/Workspace/WorkspaceRepo 7 | 8 | 9 | 10 | 2012-10-10T08:51:11.099630Z 11 | 240 12 | Greg 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f798dcd9-1ec7-4ad9-9c14-0e829724c50f 28 | 29 | StarlingCheckerboardSprite.as 30 | file 31 | 32 | 33 | 34 | 35 | 2012-08-08T13:27:17.000000Z 36 | 4d5b7c490c898f4db847ae9c09c0a2f8 37 | 2012-10-10T08:51:11.099630Z 38 | 240 39 | Greg 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 3303 62 | 63 | StarlingStarsSprite.as 64 | file 65 | 66 | 67 | 68 | 69 | 2012-08-08T13:36:16.000000Z 70 | bd93eef8ffad45c2af0c98896b60bffe 71 | 2012-10-10T08:51:11.099630Z 72 | 240 73 | Greg 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 2483 96 | 97 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/rootsprites/.svn/text-base/StarlingCheckerboardSprite.as.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Framework Integration Example 3 | 4 | Starling scene used in the framework integration examples. 5 | 6 | Code by Greg Caldwell 7 | greg@geepers.co.uk 8 | http://www.geepers.co.uk 9 | 10 | This code is distributed under the MIT License 11 | 12 | Copyright (c) 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the “Software”), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | */ 33 | package 34 | starling.rootsprites{ 35 | import flash.display.BitmapData; 36 | import flash.display.GradientType; 37 | import flash.geom.Matrix; 38 | import flash.geom.Rectangle; 39 | import starling.display.Image; 40 | import starling.display.Sprite; 41 | import starling.textures.Texture; 42 | 43 | public class StarlingCheckerboardSprite extends Sprite 44 | { 45 | private static var _instance : StarlingCheckerboardSprite; 46 | 47 | private var container : Sprite; 48 | 49 | public static function getInstance():StarlingCheckerboardSprite 50 | { 51 | return _instance; 52 | } 53 | 54 | public function StarlingCheckerboardSprite() 55 | { 56 | _instance = this; 57 | 58 | // Draw the checkerboard pattern to a bitmap data - using a flash Sprite gradien 59 | var m:Matrix = new Matrix(); 60 | m.createGradientBox(512, 512, 0, 0, 0); 61 | 62 | // Create gradient background 63 | var fS:flash.display.Sprite = new flash.display.Sprite(); 64 | fS.graphics.beginGradientFill(GradientType.RADIAL, [ 0xaa0000, 0x00bb00 ], [ 1, 1 ], [ 0, 255 ], m); 65 | fS.graphics.drawRect(0, 0, 512, 512); 66 | fS.graphics.endFill(); 67 | 68 | // Draw the gradient to the bitmap data 69 | var checkers:BitmapData = new BitmapData(512, 512, true, 0x0); 70 | checkers.draw(fS); 71 | 72 | // Create the holes in the board (bitmap data) 73 | for (var yP:int = 0; yP < 16; yP++) { 74 | for (var xP:int = 0; xP < 16; xP++) { 75 | if ((yP + xP) % 2 == 0) { 76 | checkers.fillRect(new Rectangle(xP * 32, yP * 32, 32, 32), 0x0); 77 | } 78 | } 79 | } 80 | 81 | // Create the Starling texture from the bitmapdata 82 | var checkerTx:Texture = Texture.fromBitmapData(checkers); 83 | 84 | // Create a sprite and add an image using the checker texture 85 | // Assign the pivot point in the centre of the sprite 86 | container = new Sprite(); 87 | container.pivotX = container.pivotY = 256; 88 | container.x = 400; 89 | container.y = 300; 90 | container.scaleX = container.scaleY = 2; 91 | 92 | 93 | container.addChild(new Image(checkerTx)); 94 | // Add the container sprite to the Starling stage 95 | addChild(container); 96 | } 97 | 98 | public function update() : void 99 | { 100 | container.rotation += 0.005; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/rootsprites/.svn/text-base/StarlingStarsSprite.as.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Framework Integration Example 3 | 4 | Starling scene used in the framework integration examples. 5 | 6 | Code by Greg Caldwell 7 | greg@geepers.co.uk 8 | http://www.geepers.co.uk 9 | 10 | This code is distributed under the MIT License 11 | 12 | Copyright (c) 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the “Software”), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | */ 33 | package starling.rootsprites{ 34 | import starling.core.Starling; 35 | import starling.extensions.PDParticleSystem; 36 | import starling.extensions.ParticleSystem; 37 | import starling.textures.Texture; 38 | import starling.display.Sprite; 39 | 40 | public class StarlingStarsSprite extends Sprite 41 | { 42 | // Starling Particle assets 43 | [Embed(source="../embeds/stars.pex", mimeType="application/octet-stream")] 44 | private static const StarsConfig:Class; 45 | 46 | [Embed(source = "../embeds/stars.png")] 47 | private static const StarsParticle:Class; 48 | 49 | private static var _instance:StarlingStarsSprite; 50 | 51 | private var mParticleSystem:ParticleSystem; 52 | 53 | public static function getInstance():StarlingStarsSprite 54 | { 55 | return _instance; 56 | } 57 | 58 | public function StarlingStarsSprite() 59 | { 60 | _instance = this; 61 | 62 | var psConfig:XML = XML(new StarsConfig()); 63 | var psTexture:Texture = Texture.fromBitmap(new StarsParticle()); 64 | 65 | mParticleSystem = new PDParticleSystem(psConfig, psTexture); 66 | mParticleSystem.emitterX = 400; 67 | mParticleSystem.emitterY = 300; 68 | mParticleSystem.maxCapacity = 100; 69 | mParticleSystem.emissionRate = 50; 70 | this.addChild(mParticleSystem); 71 | 72 | Starling.juggler.add(mParticleSystem); 73 | 74 | mParticleSystem.start(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/rootsprites/StarlingCheckerboardSprite.as: -------------------------------------------------------------------------------- 1 | /* 2 | Framework Integration Example 3 | 4 | Starling scene used in the framework integration examples. 5 | 6 | Code by Greg Caldwell 7 | greg@geepers.co.uk 8 | http://www.geepers.co.uk 9 | 10 | This code is distributed under the MIT License 11 | 12 | Copyright (c) 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the “Software”), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | */ 33 | package 34 | starling.rootsprites{ 35 | import flash.display.BitmapData; 36 | import flash.display.GradientType; 37 | import flash.geom.Matrix; 38 | import flash.geom.Rectangle; 39 | import starling.display.Image; 40 | import starling.display.Sprite; 41 | import starling.textures.Texture; 42 | 43 | public class StarlingCheckerboardSprite extends Sprite 44 | { 45 | private static var _instance : StarlingCheckerboardSprite; 46 | 47 | private var container : Sprite; 48 | 49 | public static function getInstance():StarlingCheckerboardSprite 50 | { 51 | return _instance; 52 | } 53 | 54 | public function StarlingCheckerboardSprite() 55 | { 56 | _instance = this; 57 | 58 | // Draw the checkerboard pattern to a bitmap data - using a flash Sprite gradien 59 | var m:Matrix = new Matrix(); 60 | m.createGradientBox(512, 512, 0, 0, 0); 61 | 62 | // Create gradient background 63 | var fS:flash.display.Sprite = new flash.display.Sprite(); 64 | fS.graphics.beginGradientFill(GradientType.RADIAL, [ 0xaa0000, 0x00bb00 ], [ 1, 1 ], [ 0, 255 ], m); 65 | fS.graphics.drawRect(0, 0, 512, 512); 66 | fS.graphics.endFill(); 67 | 68 | // Draw the gradient to the bitmap data 69 | var checkers:BitmapData = new BitmapData(512, 512, true, 0x0); 70 | checkers.draw(fS); 71 | 72 | // Create the holes in the board (bitmap data) 73 | for (var yP:int = 0; yP < 16; yP++) { 74 | for (var xP:int = 0; xP < 16; xP++) { 75 | if ((yP + xP) % 2 == 0) { 76 | checkers.fillRect(new Rectangle(xP * 32, yP * 32, 32, 32), 0x0); 77 | } 78 | } 79 | } 80 | 81 | // Create the Starling texture from the bitmapdata 82 | var checkerTx:Texture = Texture.fromBitmapData(checkers); 83 | 84 | // Create a sprite and add an image using the checker texture 85 | // Assign the pivot point in the centre of the sprite 86 | container = new Sprite(); 87 | container.pivotX = container.pivotY = 256; 88 | container.x = 400; 89 | container.y = 300; 90 | container.scaleX = container.scaleY = 2; 91 | 92 | 93 | container.addChild(new Image(checkerTx)); 94 | // Add the container sprite to the Starling stage 95 | addChild(container); 96 | } 97 | 98 | public function update() : void 99 | { 100 | container.rotation += 0.005; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /tutorials/starling/interoperation/src/starling/rootsprites/StarlingStarsSprite.as: -------------------------------------------------------------------------------- 1 | /* 2 | Framework Integration Example 3 | 4 | Starling scene used in the framework integration examples. 5 | 6 | Code by Greg Caldwell 7 | greg@geepers.co.uk 8 | http://www.geepers.co.uk 9 | 10 | This code is distributed under the MIT License 11 | 12 | Copyright (c) 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the “Software”), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | */ 33 | package starling.rootsprites{ 34 | import starling.core.Starling; 35 | import starling.extensions.PDParticleSystem; 36 | import starling.extensions.ParticleSystem; 37 | import starling.textures.Texture; 38 | import starling.display.Sprite; 39 | 40 | public class StarlingStarsSprite extends Sprite 41 | { 42 | // Starling Particle assets 43 | [Embed(source="../../../embeds/stars.pex", mimeType="application/octet-stream")] 44 | private static const StarsConfig:Class; 45 | 46 | [Embed(source = "../../../embeds/stars.png")] 47 | private static const StarsParticle:Class; 48 | 49 | private static var _instance:StarlingStarsSprite; 50 | 51 | private var mParticleSystem:ParticleSystem; 52 | 53 | public static function getInstance():StarlingStarsSprite 54 | { 55 | return _instance; 56 | } 57 | 58 | public function StarlingStarsSprite() 59 | { 60 | _instance = this; 61 | 62 | var psConfig:XML = XML(new StarsConfig()); 63 | var psTexture:Texture = Texture.fromBitmap(new StarsParticle()); 64 | 65 | mParticleSystem = new PDParticleSystem(psConfig, psTexture); 66 | mParticleSystem.emitterX = 400; 67 | mParticleSystem.emitterY = 300; 68 | mParticleSystem.maxCapacity = 100; 69 | mParticleSystem.emissionRate = 50; 70 | this.addChild(mParticleSystem); 71 | 72 | Starling.juggler.add(mParticleSystem); 73 | 74 | mParticleSystem.start(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/Launcher.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 31 | 32 | 56 | 57 | 58 |
59 |

60 | To view this page ensure that Adobe Flash Player version 61 | 11.1.0 or greater is installed. 62 |

63 |
64 | 68 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/onkba.awd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/bin/listing_01/onkba.awd -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/onkba.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 31 | 32 | 56 | 57 | 58 |
59 |

60 | To view this page ensure that Adobe Flash Player version 61 | 11.1.0 or greater is installed. 62 |

63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/onkba_N.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/bin/listing_01/onkba_N.jpg -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/onkba_N.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/bin/listing_01/onkba_N.png -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/viewer.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/bin/listing_01/viewer.swf -------------------------------------------------------------------------------- /tutorials/workflow/max/bin/listing_01/viewer_loth.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/bin/listing_01/viewer_loth.swf -------------------------------------------------------------------------------- /tutorials/workflow/max/images/listing_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/away3d/away3d-tutorials-fp11/a01efc1f2b23b6468e00393abe9e42a6770e2fbe/tutorials/workflow/max/images/listing_01.jpg --------------------------------------------------------------------------------