├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── as3_internal_api ├── Paths.props ├── as3_internal_api.sln ├── as3_internal_api.swc ├── as3_internal_api.vcxproj ├── as3_internal_api.vcxproj.filters ├── as3_internal_api.vcxproj.user ├── crossbridge_compile.sh ├── crossbridge_launcher.bat ├── debug_utils.cpp ├── detour.cpp ├── detour_crowd.cpp ├── localvar.cpp ├── main.cpp ├── rc_context_adapter.cpp ├── readme.txt ├── recast.cpp └── sizeof.cpp ├── as3_lib ├── bin │ └── Crossbridge-Recast-Navigation.swc └── src │ └── recastnavigation │ ├── core │ ├── RNBase.as │ ├── rn_internal.as │ └── utils │ │ ├── copyBytes.as │ │ ├── mallocInt16Vector.as │ │ ├── mallocInt32Vector.as │ │ ├── mallocInt8Vector.as │ │ ├── mallocNumberVector.as │ │ ├── offsetBytes.as │ │ ├── readBits.as │ │ ├── setBytes.as │ │ └── writeBits.as │ ├── debugutils │ ├── DUDebugDraw.as │ ├── duDebugDrawBoxWire.as │ ├── duDebugDrawCircle.as │ ├── duDebugDrawCompactHeightfieldDistance.as │ ├── duDebugDrawCompactHeightfieldRegions.as │ ├── duDebugDrawCompactHeightfieldSolid.as │ ├── duDebugDrawContours.as │ ├── duDebugDrawCylinderWire.as │ ├── duDebugDrawHeightfieldLayer.as │ ├── duDebugDrawHeightfieldLayers.as │ ├── duDebugDrawHeightfieldLayersRegions.as │ ├── duDebugDrawHeightfieldSolid.as │ ├── duDebugDrawHeightfieldWalkable.as │ ├── duDebugDrawNavMesh.as │ ├── duDebugDrawNavMeshBVTree.as │ ├── duDebugDrawNavMeshNodes.as │ ├── duDebugDrawNavMeshPoly.as │ ├── duDebugDrawNavMeshPolysWithFlags.as │ ├── duDebugDrawNavMeshPortals.as │ ├── duDebugDrawNavMeshWithClosedList.as │ ├── duDebugDrawPolyMesh.as │ ├── duDebugDrawPolyMeshDetail.as │ ├── duDebugDrawRawContours.as │ ├── duDebugDrawRegionConnections.as │ ├── duDebugDrawTriMesh.as │ ├── duDebugDrawTriMeshSlope.as │ ├── duLogBuildTimes.as │ ├── duRGBA.as │ └── enum │ │ ├── DUDebugDrawPrimitives.as │ │ └── DrawNavMeshFlags.as │ ├── detour │ ├── crowd │ │ ├── DTCrowd.as │ │ ├── DTCrowdAgent.as │ │ ├── DTCrowdAgentDebugInfo.as │ │ ├── DTCrowdAgentParams.as │ │ ├── DTCrowdNeighbour.as │ │ ├── DTObstacleAvoidanceParams.as │ │ └── enum │ │ │ ├── DTCrowdAgentState.as │ │ │ └── DTCrowdUpdateFlags.as │ ├── navmesh │ │ ├── DTBVNode.as │ │ ├── DTLink.as │ │ ├── DTMeshHeader.as │ │ ├── DTMeshTile.as │ │ ├── DTNavMesh.as │ │ ├── DTNavMeshParams.as │ │ ├── DTOffMeshConnection.as │ │ ├── DTPoly.as │ │ ├── DTPolyDetail.as │ │ └── enum │ │ │ ├── DTFindPathOptions.as │ │ │ ├── DTPolyTypes.as │ │ │ ├── DTRaycastOptions.as │ │ │ ├── DTStraightPathFlags.as │ │ │ ├── DTStraightPathOptions.as │ │ │ └── DTTileFlags.as │ ├── navmeshbuilder │ │ ├── DTNavMeshCreateParams.as │ │ ├── dtCreateNavMeshData.as │ │ ├── dtNavMeshDataSwapEndian.as │ │ └── dtNavMeshHeaderSwapEndian.as │ ├── navmeshquery │ │ ├── DTNavMeshQuery.as │ │ ├── DTQueryFilter.as │ │ └── DTRaycastHit.as │ └── status │ │ ├── dtStatusDetail.as │ │ ├── dtStatusFailed.as │ │ ├── dtStatusInProgress.as │ │ ├── dtStatusSucceed.as │ │ └── enum │ │ └── DTStatus.as │ └── recast │ ├── RCCompactCell.as │ ├── RCCompactHeightfield.as │ ├── RCCompactSpan.as │ ├── RCConfig.as │ ├── RCContext.as │ ├── RCHeightfield.as │ ├── RCHeightfieldLayer.as │ ├── RCHeightfieldLayerSet.as │ ├── RCSpan.as │ ├── RCSpanPool.as │ ├── contour │ ├── RCContour.as │ ├── RCContourSet.as │ └── rcBuildContours.as │ ├── enum │ ├── RCAreaType.as │ ├── RCBuildContoursFlags.as │ ├── RCLogCategory.as │ └── RCTimerLabel.as │ ├── filter │ ├── rcFilterLedgeSpans.as │ ├── rcFilterLowHangingWalkableObstacles.as │ └── rcFilterWalkableLowHeightSpans.as │ ├── mesh │ ├── RCPolyMesh.as │ ├── rcBuildPolyMesh.as │ ├── rcCopyPolyMesh.as │ └── rcMergePolyMeshes.as │ ├── meshdetail │ ├── RCPolyMeshDetail.as │ ├── rcBuildPolyMeshDetail.as │ └── rcMergePolyMeshDetails.as │ ├── rcBuildCompactHeightfield.as │ ├── rcCreateHeightfield.as │ ├── rcErodeWalkableArea.as │ ├── rcMarkWalkableTriangles.as │ ├── rcRasterizeTriangles.as │ └── region │ ├── rcBuildDistanceField.as │ ├── rcBuildLayerRegions.as │ ├── rcBuildRegions.as │ └── rcBuildRegionsMonotone.as └── demo ├── html-template ├── history │ ├── history.css │ ├── history.js │ └── historyFrame.html ├── index.template.html ├── playerProductInstall.swf └── swfobject.js ├── lib ├── Feathers-Lib.swc ├── Starling-Extension-Graphics.swc └── starling.swc ├── meshes ├── Mesh-001.obj └── Mesh-002.obj ├── src └── app │ ├── Main.as │ ├── MainApplication.as │ ├── TestApplication.as │ ├── data │ ├── ColorData.as │ ├── DebugDrawVertexData.as │ ├── MeshBounds.as │ └── mesh │ │ ├── EmbeddedMeshes.as │ │ ├── MeshInfo.as │ │ └── MeshInfoLibrary.as │ ├── model │ ├── CoordSpace.as │ ├── GUIModel.as │ ├── GUIModelEvent.as │ ├── SoloMesh.as │ ├── SoloMeshEvent.as │ ├── enum │ │ ├── PartitionType.as │ │ └── ToolType.as │ └── tool │ │ ├── CrowdTool.as │ │ ├── MeshTool.as │ │ ├── MeshToolEvent.as │ │ ├── TesterTool.as │ │ └── enum │ │ ├── CrowdToolState.as │ │ └── TesterToolState.as │ ├── rccontext │ ├── CustomRCContext.as │ └── CustomRCContextEvent.as │ └── view │ ├── GUIView.as │ ├── GUIViewMediator.as │ ├── LogView.as │ ├── LogViewMediator.as │ ├── MeshView.as │ ├── MeshViewMediator.as │ ├── PolygonView.as │ ├── PropertiesView.as │ ├── PropertiesViewMediator.as │ ├── SceneView.as │ ├── SceneViewMediator.as │ ├── ToolsView.as │ ├── ToolsViewMediator.as │ ├── basic │ ├── LabeledSlider.as │ └── SimpleToggleGroup.as │ ├── debugdraw │ ├── PolyViewDUDebugDraw.as │ ├── StarlingGraphicsDUDebugDraw.as │ └── StarlingTextureDUDebugDraw.as │ └── tool │ ├── CrowdToolViewMediator.as │ └── TesterToolViewMediator.as └── themes └── MetalWorksMobileTheme ├── README.md ├── assets ├── fonts │ ├── SourceSansPro-Regular.ttf │ └── SourceSansPro-Semibold.ttf └── images │ ├── metalworks.png │ ├── metalworks.tps │ ├── metalworks.xml │ └── metalworks │ ├── Thumbs.db │ ├── background-disabled-skin.png │ ├── background-down-skin.png │ ├── background-focused-skin.png │ ├── background-inset-skin.png │ ├── background-popup-skin.png │ ├── background-skin.png │ ├── button-back-disabled-skin.png │ ├── button-back-down-skin.png │ ├── button-back-up-skin.png │ ├── button-call-to-action-down-skin.png │ ├── button-call-to-action-up-skin.png │ ├── button-danger-down-skin.png │ ├── button-danger-up-skin.png │ ├── button-disabled-skin.png │ ├── button-down-skin.png │ ├── button-forward-disabled-skin.png │ ├── button-forward-down-skin.png │ ├── button-forward-up-skin.png │ ├── button-selected-disabled-skin.png │ ├── button-selected-up-skin.png │ ├── button-up-skin.png │ ├── callout-arrow-bottom-skin.png │ ├── callout-arrow-left-skin.png │ ├── callout-arrow-right-skin.png │ ├── callout-arrow-top-skin.png │ ├── check-selected-disabled-icon.png │ ├── check-selected-down-icon.png │ ├── check-selected-up-icon.png │ ├── header-background-skin.png │ ├── horizontal-scroll-bar-thumb-skin.png │ ├── list-accessory-drill-down-icon.png │ ├── list-inset-item-first-selected-skin.png │ ├── list-inset-item-first-up-skin.png │ ├── list-inset-item-last-selected-skin.png │ ├── list-inset-item-last-up-skin.png │ ├── list-inset-item-single-selected-skin.png │ ├── list-inset-item-single-up-skin.png │ ├── list-item-selected-skin.png │ ├── list-item-up-skin.png │ ├── page-indicator-normal-skin.png │ ├── page-indicator-selected-skin.png │ ├── picker-list-icon.png │ ├── picker-list-item-selected-icon.png │ ├── radio-selected-disabled-icon.png │ ├── radio-selected-down-icon.png │ ├── radio-selected-up-icon.png │ ├── search-icon.png │ ├── tab-down-skin.png │ ├── tab-selected-disabled-skin.png │ ├── tab-selected-skin.png │ └── vertical-scroll-bar-thumb-skin.png └── source └── feathers └── themes ├── BaseMetalWorksMobileTheme.as ├── MetalWorksMobileTheme.as └── MetalWorksMobileThemeWithAssetManager.as /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #MS Visual Studio 2 | .settings/ 3 | as3_internal_api/Debug/* 4 | as3_internal_api/Release/* 5 | as3_internal_api/obj/* 6 | *.suo 7 | *.sdf 8 | *.opensdf 9 | 10 | # Mac 11 | .DS_Store 12 | 13 | # Intellij 14 | .idea/ 15 | *.iml 16 | *.iws 17 | 18 | # Eclipse 19 | .classpath 20 | .project 21 | .settings/ 22 | 23 | demo/bin-debug/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "recastnavigation"] 2 | path = recastnavigation 3 | url = https://github.com/memononen/recastnavigation.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Vladimir Atamanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Crossbridge-Recast-Navigation 2 | This project is a [FlasCC](http://www.adobe.com/devnet-docs/flascc/README.html) port to ActionScript 3.0 of C++ navigation mesh library [Recast Navigation](https://github.com/memononen/recastnavigation) by Mikko Mononen. 3 | 4 | ## Usage 5 | In order to integrate the library with your project simply add `as3_lib/bin/Crossbridge-Recast-Navigation.swc` to it's library path. 6 | 7 | ## Demo 8 | Live demo in Flash featuring some of Recast Navigation capabilities is available [here](http://work.rokannon.com/navmesh_demo/). It's source code can be found in `demo` folder. 9 | 10 | #### How to build demo 11 | To build demo from source you need to add `demo/src` and `demo/themes` folders to source path, add `lib` folder to library path. You can use html template from `demo/html-template` folder or use your own, but don't forget to set `wmode` parameter to `"direct"` as it is required by Starling Stage 3D rendering. Input geometry meshes are in `demo/meshes` folder. 12 | 13 | ## How it's all organized 14 | FlasCC compiler is used to generate swc library with internal API which is further used in final AS3 library project providing easy to understand AS3 API. Final product preserves original API as much as it's possible. 15 | 16 | #### Internal API 17 | Using FlasCC compiler you can manually expose C++ functions to AS3. Study [this](http://www.adobe.com/devnet-docs/flascc/docs/samples.html#T5) example to understand how it's done. Internal API creation code is in folder `as3_internal_api`. To build `as3_internal_api.swc` run `crossbridge_compile.sh` from Crossbridge environment. You can also run `crossbridge_launcher.bat` providing it with path to Crossbridge folder as an argument. 18 | 19 | #### AS3 Library 20 | Final AS3 library wraps internal API methods and C++ structures and classes. It creates simple AS3 classes and functions so it can be easily used in standard AS3 workflows. Most recent version of it is always available in `as3_lib/bin` folder. But you can build it yourself. You need to create an AS3 library project with source from `as3_lib` folder and add `as3_internal_api/as3_internal_api.swc` as a library. You can also add `-inline` as an additional compiler options. 21 | -------------------------------------------------------------------------------- /as3_internal_api/Paths.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | c:\Crossbridge_1.0.1\ 6 | 7 | 8 | 9 | 10 | 11 | $(CROSSBRIDGE_PATH) 12 | 13 | 14 | -------------------------------------------------------------------------------- /as3_internal_api/as3_internal_api.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "as3_internal_api", "as3_internal_api.vcxproj", "{C82420C8-0C34-4831-B663-ED0DD8F72E52}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C82420C8-0C34-4831-B663-ED0DD8F72E52}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {C82420C8-0C34-4831-B663-ED0DD8F72E52}.Debug|Win32.Build.0 = Debug|Win32 16 | {C82420C8-0C34-4831-B663-ED0DD8F72E52}.Release|Win32.ActiveCfg = Release|Win32 17 | {C82420C8-0C34-4831-B663-ED0DD8F72E52}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /as3_internal_api/as3_internal_api.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/as3_internal_api/as3_internal_api.swc -------------------------------------------------------------------------------- /as3_internal_api/as3_internal_api.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {C82420C8-0C34-4831-B663-ED0DD8F72E52} 15 | MakeFileProj 16 | 17 | 18 | 19 | Makefile 20 | true 21 | v120 22 | 23 | 24 | Makefile 25 | false 26 | v120 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | as3_internal_api.exe 42 | WIN32;_DEBUG;$(NMakePreprocessorDefinitions) 43 | crossbridge_launcher.bat "$(CROSSBRIDGE_PATH)" 44 | $(VC_IncludePath);$(WindowsSDK_IncludePath);$(CROSSBRIDGE_PATH)\sdk\usr\include\;$(ProjectDir)\..\recastnavigation\Recast\Include;$(ProjectDir)\..\recastnavigation\Detour\Include;$(ProjectDir)\..\recastnavigation\DetourCrowd\Include;$(ProjectDir)\..\recastnavigation\DebugUtils\Include; 45 | $(VC_SourcePath);$(CROSSBRIDGE_PATH)\sdk\usr\include\; 46 | 47 | 48 | as3_internal_api.exe 49 | WIN32;NDEBUG;$(NMakePreprocessorDefinitions) 50 | $(VC_IncludePath);$(WindowsSDK_IncludePath);$(CROSSBRIDGE_PATH)\sdk\usr\include\;$(ProjectDir)\..\recastnavigation\Recast\Include 51 | $(VC_SourcePath);$(CROSSBRIDGE_PATH)\sdk\usr\include\; 52 | crossbridge_launcher.bat "$(CROSSBRIDGE_PATH)" 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /as3_internal_api/as3_internal_api.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | -------------------------------------------------------------------------------- /as3_internal_api/as3_internal_api.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /as3_internal_api/crossbridge_compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | FLASCC="/cygdrive/c/Crossbridge_1.0.1/sdk" 5 | CFLAGS="-Werror -Wno-write-strings -Wno-trigraphs -jvmopt=-Xmx1G -O4" 6 | RECAST_SOURCE_PATH="${DIR}/../recastnavigation/Recast/Source" 7 | RECAST_INCLUDE_PATH="${DIR}/../recastnavigation/Recast/Include" 8 | DETOUR_SOURCE_PATH="${DIR}/../recastnavigation/Detour/Source" 9 | DETOUR_INCLUDE_PATH="${DIR}/../recastnavigation/Detour/Include" 10 | DETOUR_CROWD_SOURCE_PATH="${DIR}/../recastnavigation/DetourCrowd/Source" 11 | DETOUR_CROWD_INCLUDE_PATH="${DIR}/../recastnavigation/DetourCrowd/Include" 12 | DETOUR_TILE_CACHE_SOURCE_PATH="${DIR}/../recastnavigation/DetourTileCache/Source" 13 | DETOUR_TILE_CACHE_INCLUDE_PATH="${DIR}/../recastnavigation/DetourTileCache/Include" 14 | DEBUG_UTILS_SOURCE_PATH="${DIR}/../recastnavigation/DebugUtils/Source" 15 | DEBUG_UTILS_INCLUDE_PATH="${DIR}/../recastnavigation/DebugUtils/Include" 16 | 17 | echo Compiling... 18 | "${FLASCC}/usr/bin/g++" ${CFLAGS} -I${DEBUG_UTILS_INCLUDE_PATH} ${DEBUG_UTILS_SOURCE_PATH}/*.cpp -I${RECAST_INCLUDE_PATH} ${RECAST_SOURCE_PATH}/*.cpp ${CFLAGS} -I${DETOUR_INCLUDE_PATH} ${DETOUR_SOURCE_PATH}/*.cpp -I${DETOUR_CROWD_INCLUDE_PATH} ${DETOUR_CROWD_SOURCE_PATH}/*.cpp -I${DETOUR_TILE_CACHE_INCLUDE_PATH} ${DETOUR_TILE_CACHE_SOURCE_PATH}/*.cpp "${DIR}/rc_context_adapter.cpp" "${DIR}/recast.cpp" "${DIR}/detour.cpp" "${DIR}/localvar.cpp" "${DIR}/sizeof.cpp" "${DIR}/detour_crowd.cpp" "${DIR}/debug_utils.cpp" "${DIR}/main.cpp" -lAS3++ -emit-swc=recastnavigation.internal_api -o "${DIR}/as3_internal_api.swc" -------------------------------------------------------------------------------- /as3_internal_api/crossbridge_launcher.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SET RUN_BAT=%~f1\run.bat 3 | IF EXIST "%RUN_BAT%" ( 4 | "%RUN_BAT%" "%~dp0\crossbridge_compile.sh" 5 | ) ELSE ( 6 | ECHO Error: "%RUN_BAT%" not found. Check $^(CROSSBRIDGE_PATH^) macro in Visual Studio project. 7 | ) -------------------------------------------------------------------------------- /as3_internal_api/localvar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void _localvar_alloc() __attribute__((used, 6 | annotate("as3sig:public function internal_localvar_alloc():int"), 7 | annotate("as3package:recastnavigation.internal_api"))); 8 | 9 | void _localvar_alloc() 10 | { 11 | AS3_Return(new AS3::local::var()); 12 | } 13 | 14 | void _localvar_set() __attribute__((used, 15 | annotate("as3sig:public function internal_localvar_set(var_ptr:int, obj:Object):void"), 16 | annotate("as3package:recastnavigation.internal_api"))); 17 | 18 | void _localvar_set() 19 | { 20 | AS3::local::var * var; 21 | AS3_GetScalarFromVar(var, var_ptr); 22 | AS3_GetVarxxFromVar(*var, obj); 23 | } 24 | 25 | void _localvar_get() __attribute__((used, 26 | annotate("as3sig:public function internal_localvar_get(var_ptr:int):Object"), 27 | annotate("as3package:recastnavigation.internal_api"))); 28 | 29 | void _localvar_get() 30 | { 31 | AS3::local::var * var; 32 | AS3_GetScalarFromVar(var, var_ptr); 33 | AS3_DeclareVar(obj, Object); 34 | AS3_CopyVarxxToVar(obj, *var); 35 | AS3_ReturnAS3Var(obj); 36 | } -------------------------------------------------------------------------------- /as3_internal_api/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Used to avoid '"__asm__" is undefined' error in Visual Studio. 4 | #ifdef _MSC_VER 5 | #define __asm__ 6 | #endif 7 | 8 | int main(void) 9 | { 10 | AS3_GoAsync(); 11 | return(0); 12 | } -------------------------------------------------------------------------------- /as3_internal_api/readme.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MAKEFILE PROJECT : as3_internal_api Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this as3_internal_api project for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your as3_internal_api project. 9 | 10 | 11 | as3_internal_api.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | as3_internal_api.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | This project allows you to build/clean/rebuild from within Visual Studio by calling the commands you have input 25 | in the wizard. The build command can be nmake or any other tool you use. 26 | 27 | This project does not contain any files, so there are none displayed in Solution Explorer. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /as3_internal_api/sizeof.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Recast 6 | #include 7 | #include 8 | #include 9 | 10 | // Detour 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | // Detour Crowd 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define _SIZEOF(x) \ 30 | void _sizeof_ ## x() __attribute__((used,\ 31 | annotate("as3sig:public function internal_sizeof_" #x "():int"),\ 32 | annotate("as3package:recastnavigation.internal_api")));\ 33 | void _sizeof_ ## x()\ 34 | {\ 35 | AS3_Return(sizeof(x));\ 36 | } 37 | 38 | // //// 39 | // Recast 40 | // //// 41 | 42 | _SIZEOF(rcContour); 43 | _SIZEOF(rcContourSet); 44 | _SIZEOF(rcPolyMesh); 45 | _SIZEOF(rcPolyMeshDetail); 46 | _SIZEOF(rcCompactCell); 47 | _SIZEOF(rcCompactHeightfield); 48 | _SIZEOF(rcCompactSpan); 49 | _SIZEOF(rcConfig); 50 | _SIZEOF(rcContext); 51 | _SIZEOF(rcHeightfield); 52 | _SIZEOF(rcHeightfieldLayer); 53 | _SIZEOF(rcHeightfieldLayerSet); 54 | _SIZEOF(rcSpan); 55 | _SIZEOF(rcSpanPool); 56 | 57 | // //// 58 | // Detour 59 | // //// 60 | 61 | _SIZEOF(dtBVNode); 62 | _SIZEOF(dtLink); 63 | _SIZEOF(dtMeshHeader); 64 | _SIZEOF(dtMeshTile); 65 | _SIZEOF(dtNavMesh); 66 | _SIZEOF(dtNavMeshParams); 67 | _SIZEOF(dtOffMeshConnection); 68 | _SIZEOF(dtPoly); 69 | _SIZEOF(dtPolyDetail); 70 | _SIZEOF(dtNavMeshCreateParams); 71 | _SIZEOF(dtNavMeshQuery); 72 | _SIZEOF(dtQueryFilter); 73 | _SIZEOF(dtRaycastHit); 74 | 75 | // //// 76 | // Detour Crowd 77 | // //// 78 | 79 | _SIZEOF(dtCrowd); 80 | _SIZEOF(dtCrowdAgent); 81 | _SIZEOF(dtCrowdAgentDebugInfo); 82 | _SIZEOF(dtCrowdAgentParams); 83 | _SIZEOF(dtCrowdNeighbour); 84 | _SIZEOF(dtObstacleAvoidanceParams); 85 | 86 | _SIZEOF(dtPathCorridor); 87 | _SIZEOF(dtLocalBoundary); 88 | _SIZEOF(dtPathQueue); 89 | _SIZEOF(dtObstacleAvoidanceDebugData); -------------------------------------------------------------------------------- /as3_lib/bin/Crossbridge-Recast-Navigation.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/as3_lib/bin/Crossbridge-Recast-Navigation.swc -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/RNBase.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core 2 | { 3 | use namespace rn_internal; 4 | 5 | public class RNBase 6 | { 7 | rn_internal var ptr:int; 8 | 9 | public function RNBase() 10 | { 11 | } 12 | 13 | public function alloc():Boolean 14 | { 15 | return false; 16 | } 17 | 18 | public function free():void 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/rn_internal.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core 2 | { 3 | public namespace rn_internal = "https://github.com/memononen/recastnavigation/ns/rn_internal"; 4 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/copyBytes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function copyBytes(srcPtr:int, dstPtr:int, length:int):void 6 | { 7 | for (var i:int = 0; i < length; ++i) 8 | CModule.write8(dstPtr + i, CModule.read8(srcPtr + i)); 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/mallocInt16Vector.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function mallocInt16Vector(vector:Vector.):int 6 | { 7 | var ptr:int = CModule.malloc(2 * vector.length); 8 | for (var i:int = vector.length - 1; i >= 0; --i) 9 | CModule.write16(ptr + 2 * i, vector[i]); 10 | return ptr; 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/mallocInt32Vector.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function mallocInt32Vector(vector:Vector.):int 6 | { 7 | var ptr:int = CModule.malloc(4 * vector.length); 8 | for (var i:int = vector.length - 1; i >= 0; --i) 9 | CModule.write32(ptr + 4 * i, vector[i]); 10 | return ptr; 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/mallocInt8Vector.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function mallocInt8Vector(vector:Vector.):int 6 | { 7 | var ptr:int = CModule.malloc(1 * vector.length); 8 | for (var i:int = vector.length - 1; i >= 0; --i) 9 | CModule.write8(ptr + 1 * i, vector[i]); 10 | return ptr; 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/mallocNumberVector.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function mallocNumberVector(vector:Vector.):int 6 | { 7 | var ptr:int = CModule.malloc(4 * vector.length); 8 | for (var i:int = vector.length - 1; i >= 0; --i) 9 | CModule.writeFloat(ptr + 4 * i, vector[i]); 10 | return ptr; 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/offsetBytes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | 5 | use namespace rn_internal; 6 | 7 | public function offsetBytes(size:int, structClass:Class):int 8 | { 9 | return (structClass["SIZE"] += size) - size; 10 | } 11 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/readBits.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | public function readBits(src:int, offset:int, length:int):int 4 | { 5 | return (src >> offset) & ((1 << length) - 1); 6 | } 7 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/setBytes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | import recastnavigation.internal_api.CModule; 4 | 5 | public function setBytes(ptr:int, value:int, size:int):void 6 | { 7 | for (var i:int = 0; i < size; ++i) 8 | CModule.write8(ptr + i, value); 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/core/utils/writeBits.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.core.utils 2 | { 3 | public function writeBits(src:int, offset:int, length:int, value:int):int 4 | { 5 | value &= ((1 << length) - 1); 6 | src &= ~(((1 << length) - 1) << offset); 7 | return src | (value << offset); 8 | } 9 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/DUDebugDraw.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.internal_api.CModule; 6 | import recastnavigation.internal_api.internal_duDebugDraw_alloc; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Abstract debug draw interface. 12 | */ 13 | public class DUDebugDraw extends RNBase 14 | { 15 | private const _obj:Object = new Object(); 16 | 17 | public function DUDebugDraw() 18 | { 19 | super(); 20 | _obj.depthMask = depthMask; 21 | _obj.texture = texture; 22 | _obj.begin = begin; 23 | _obj.vertex = vertex; 24 | _obj.vertex_uv = vertex_uv; 25 | _obj.end = end; 26 | } 27 | 28 | public override function alloc():Boolean 29 | { 30 | ptr = internal_duDebugDraw_alloc(_obj); 31 | return ptr != 0; 32 | } 33 | 34 | public override function free():void 35 | { 36 | CModule.free(ptr); 37 | ptr = 0; 38 | } 39 | 40 | protected function depthMask(state:Boolean):void 41 | { 42 | } 43 | 44 | protected function texture(state:Boolean):void 45 | { 46 | } 47 | 48 | /** Begin drawing primitives. */ 49 | protected function begin(prim:int, size:Number = 1.0):void 50 | { 51 | } 52 | 53 | /** Submit a vertex */ 54 | protected function vertex(x:Number, y:Number, z:Number, color:int):void 55 | { 56 | } 57 | 58 | /** Submit a vertex */ 59 | protected function vertex_uv(x:Number, y:Number, z:Number, color:int, u:Number, v:Number):void 60 | { 61 | } 62 | 63 | /** End drawing primitives. */ 64 | protected function end():void 65 | { 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawBoxWire.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawBoxWire; 5 | 6 | use namespace rn_internal; 7 | 8 | public function duDebugDrawBoxWire(dd:DUDebugDraw, minx:Number, miny:Number, minz:Number, maxx:Number, maxy:Number, 9 | maxz:Number, col:int, lineWidth:Number):void 10 | { 11 | internal_duDebugDrawBoxWire(dd.ptr, minx, miny, minz, maxx, maxy, maxz, col, lineWidth); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawCircle.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawCircle; 5 | 6 | use namespace rn_internal; 7 | 8 | public function duDebugDrawCircle(dd:DUDebugDraw, x:Number, y:Number, z:Number, r:Number, col:int, 9 | lineWidth:Number):void 10 | { 11 | internal_duDebugDrawCircle(dd.ptr, x, y, z, r, col, lineWidth); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawCompactHeightfieldDistance.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawCompactHeightfieldDistance; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawCompactHeightfieldDistance(dd:DUDebugDraw, chf:RCCompactHeightfield):void 10 | { 11 | internal_duDebugDrawCompactHeightfieldDistance(dd.ptr, chf.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawCompactHeightfieldRegions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawCompactHeightfieldRegions; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawCompactHeightfieldRegions(dd:DUDebugDraw, chf:RCCompactHeightfield):void 10 | { 11 | internal_duDebugDrawCompactHeightfieldRegions(dd.ptr, chf.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawCompactHeightfieldSolid.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawCompactHeightfieldSolid; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawCompactHeightfieldSolid(dd:DUDebugDraw, chf:RCCompactHeightfield):void 10 | { 11 | internal_duDebugDrawCompactHeightfieldSolid(dd.ptr, chf.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawContours.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawContours; 5 | import recastnavigation.recast.contour.RCContourSet; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawContours(dd:DUDebugDraw, cset:RCContourSet, alpha:Number = 1.0):void 10 | { 11 | internal_duDebugDrawContours(dd.ptr, cset.ptr, alpha); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawCylinderWire.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawCylinderWire; 5 | 6 | use namespace rn_internal; 7 | 8 | public function duDebugDrawCylinderWire(dd:DUDebugDraw, minx:Number, miny:Number, minz:Number, maxx:Number, 9 | maxy:Number, maxz:Number, col:int, lineWidth:Number):void 10 | { 11 | internal_duDebugDrawCylinderWire(dd.ptr, minx, miny, minz, maxx, maxy, maxz, col, lineWidth); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawHeightfieldLayer.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawHeightfieldLayer; 5 | import recastnavigation.recast.RCHeightfieldLayer; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawHeightfieldLayer(dd:DUDebugDraw, layer:RCHeightfieldLayer, idx:int):void 10 | { 11 | internal_duDebugDrawHeightfieldLayer(dd.ptr, layer.ptr, idx); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawHeightfieldLayers.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawHeightfieldLayers; 5 | import recastnavigation.recast.RCHeightfieldLayerSet; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawHeightfieldLayers(dd:DUDebugDraw, lset:RCHeightfieldLayerSet):void 10 | { 11 | internal_duDebugDrawHeightfieldLayers(dd.ptr, lset.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawHeightfieldLayersRegions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.recast.RCHeightfieldLayerSet; 5 | 6 | use namespace rn_internal; 7 | 8 | public function duDebugDrawHeightfieldLayersRegions(dd:DUDebugDraw, lset:RCHeightfieldLayerSet):void 9 | { 10 | // internal_duDebugDrawHeightfieldLayersRegions(dd.ptr, lset.ptr); 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawHeightfieldSolid.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawHeightfieldSolid; 5 | import recastnavigation.recast.RCHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawHeightfieldSolid(dd:DUDebugDraw, hf:RCHeightfield):void 10 | { 11 | internal_duDebugDrawHeightfieldSolid(dd.ptr, hf.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawHeightfieldWalkable.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawHeightfieldWalkable; 5 | import recastnavigation.recast.RCHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawHeightfieldWalkable(dd:DUDebugDraw, hf:RCHeightfield):void 10 | { 11 | internal_duDebugDrawHeightfieldWalkable(dd.ptr, hf.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMesh; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMesh(dd:DUDebugDraw, mesh:DTNavMesh, flags:int):void 10 | { 11 | internal_duDebugDrawNavMesh(dd.ptr, mesh.ptr, flags); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshBVTree.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshBVTree; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMeshBVTree(dd:DUDebugDraw, mesh:DTNavMesh):void 10 | { 11 | internal_duDebugDrawNavMeshBVTree(dd.ptr, mesh.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshNodes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmeshquery.DTNavMeshQuery; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshNodes; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMeshNodes(dd:DUDebugDraw, query:DTNavMeshQuery):void 10 | { 11 | internal_duDebugDrawNavMeshNodes(dd.ptr, query.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshPoly.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshPoly; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMeshPoly(dd:DUDebugDraw, mesh:DTNavMesh, ref:int, col:int):void 10 | { 11 | internal_duDebugDrawNavMeshPoly(dd.ptr, mesh.ptr, ref, col); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshPolysWithFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshPolysWithFlags; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMeshPolysWithFlags(dd:DUDebugDraw, mesh:DTNavMesh, polyFlags:int, col:int):void 10 | { 11 | internal_duDebugDrawNavMeshPolysWithFlags(dd.ptr, mesh.ptr, polyFlags, col); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshPortals.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshPortals; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawNavMeshPortals(dd:DUDebugDraw, mesh:DTNavMesh):void 10 | { 11 | internal_duDebugDrawNavMeshPortals(dd.ptr, mesh.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawNavMeshWithClosedList.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.detour.navmesh.DTNavMesh; 5 | import recastnavigation.detour.navmeshquery.DTNavMeshQuery; 6 | import recastnavigation.internal_api.internal_duDebugDrawNavMeshWithClosedList; 7 | 8 | use namespace rn_internal; 9 | 10 | public function duDebugDrawNavMeshWithClosedList(dd:DUDebugDraw, mesh:DTNavMesh, query:DTNavMeshQuery, 11 | flags:int):void 12 | { 13 | internal_duDebugDrawNavMeshWithClosedList(dd.ptr, mesh.ptr, query.ptr, flags); 14 | } 15 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawPolyMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawPolyMesh; 5 | import recastnavigation.recast.mesh.RCPolyMesh; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawPolyMesh(dd:DUDebugDraw, mesh:RCPolyMesh):void 10 | { 11 | internal_duDebugDrawPolyMesh(dd.ptr, mesh.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawPolyMeshDetail.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawPolyMeshDetail; 5 | import recastnavigation.recast.meshdetail.RCPolyMeshDetail; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawPolyMeshDetail(dd:DUDebugDraw, dmesh:RCPolyMeshDetail):void 10 | { 11 | internal_duDebugDrawPolyMeshDetail(dd.ptr, dmesh.ptr); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawRawContours.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawRawContours; 5 | import recastnavigation.recast.contour.RCContourSet; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawRawContours(dd:DUDebugDraw, cset:RCContourSet, alpha:Number = 1.0):void 10 | { 11 | internal_duDebugDrawRawContours(dd.ptr, cset.ptr, alpha); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawRegionConnections.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duDebugDrawRegionConnections; 5 | import recastnavigation.recast.contour.RCContourSet; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duDebugDrawRegionConnections(dd:DUDebugDraw, cset:RCContourSet, alpha:Number = 1.0):void 10 | { 11 | internal_duDebugDrawRegionConnections(dd.ptr, cset.ptr, alpha); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawTriMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.mallocInt32Vector; 5 | import recastnavigation.core.utils.mallocInt8Vector; 6 | import recastnavigation.core.utils.mallocNumberVector; 7 | import recastnavigation.internal_api.CModule; 8 | import recastnavigation.internal_api.internal_duDebugDrawTriMesh; 9 | 10 | use namespace rn_internal; 11 | 12 | public function duDebugDrawTriMesh(dd:DUDebugDraw, verts:Vector., tris:Vector., 13 | normals:Vector., flags:Vector., texScale:Number):void 14 | { 15 | var verts_ptr:int = mallocNumberVector(verts); 16 | var nverts:int = verts.length / 3; 17 | var tris_ptr:int = mallocInt32Vector(tris); 18 | var normals_ptr:int = mallocNumberVector(normals); 19 | var ntris:int = tris.length / 3; 20 | var flags_ptr:int = mallocInt8Vector(flags); 21 | internal_duDebugDrawTriMesh(dd.ptr, verts_ptr, nverts, tris_ptr, normals_ptr, ntris, flags_ptr, texScale); 22 | CModule.free(verts_ptr); 23 | CModule.free(tris_ptr); 24 | CModule.free(normals_ptr); 25 | CModule.free(flags_ptr); 26 | } 27 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duDebugDrawTriMeshSlope.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.mallocInt32Vector; 5 | import recastnavigation.core.utils.mallocNumberVector; 6 | import recastnavigation.internal_api.CModule; 7 | import recastnavigation.internal_api.internal_duDebugDrawTriMeshSlope; 8 | 9 | use namespace rn_internal; 10 | 11 | public function duDebugDrawTriMeshSlope(dd:DUDebugDraw, verts:Vector., tris:Vector., 12 | normals:Vector., walkableSlopeAngle:Number, texScale:Number):void 13 | { 14 | var verts_ptr:int = mallocNumberVector(verts); 15 | var nverts:int = verts.length / 3; 16 | var tris_ptr:int = mallocInt32Vector(tris); 17 | var normals_ptr:int = mallocNumberVector(normals); 18 | var ntris:int = tris.length / 3; 19 | internal_duDebugDrawTriMeshSlope(dd.ptr, verts_ptr, nverts, tris_ptr, normals_ptr, ntris, walkableSlopeAngle, 20 | texScale); 21 | CModule.free(verts_ptr); 22 | CModule.free(tris_ptr); 23 | CModule.free(normals_ptr); 24 | } 25 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duLogBuildTimes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_duLogBuildTimes; 5 | import recastnavigation.recast.RCContext; 6 | 7 | use namespace rn_internal; 8 | 9 | public function duLogBuildTimes(ctx:RCContext, totalTileUsec:int):void 10 | { 11 | internal_duLogBuildTimes(ctx.ptr, totalTileUsec); 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/duRGBA.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils 2 | { 3 | import recastnavigation.internal_api.internal_duRGBA; 4 | 5 | public function duRGBA(r:int, g:int, b:int, a:int):int 6 | { 7 | return internal_duRGBA(r, g, b, a); 8 | } 9 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/enum/DUDebugDrawPrimitives.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils.enum 2 | { 3 | public class DUDebugDrawPrimitives 4 | { 5 | public static const DU_DRAW_POINTS:int = 0; 6 | public static const DU_DRAW_LINES:int = 1; 7 | public static const DU_DRAW_TRIS:int = 2; 8 | public static const DU_DRAW_QUADS:int = 3; 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/debugutils/enum/DrawNavMeshFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.debugutils.enum 2 | { 3 | public class DrawNavMeshFlags 4 | { 5 | public static const DU_DRAWNAVMESH_OFFMESHCONS:int = 0x01; 6 | public static const DU_DRAWNAVMESH_CLOSEDLIST:int = 0x02; 7 | public static const DU_DRAWNAVMESH_COLOR_TILES:int = 0x04; 8 | } 9 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/crowd/DTCrowdAgentDebugInfo.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.crowd 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | import recastnavigation.internal_api.internal_sizeof_dtCrowdAgentDebugInfo; 8 | 9 | use namespace rn_internal; 10 | 11 | public class DTCrowdAgentDebugInfo extends RNBase 12 | { 13 | rn_internal static var SIZE:int = 0; 14 | rn_internal static const OFFSET_IDX:int = offsetBytes(4, DTCrowdAgentDebugInfo); 15 | rn_internal static const OFFSET_OPT_START:int = offsetBytes(12, DTCrowdAgentDebugInfo); 16 | rn_internal static const OFFSET_OPT_END:int = offsetBytes(12, DTCrowdAgentDebugInfo); 17 | rn_internal static const OFFSET_VOD:int = offsetBytes(4, DTCrowdAgentDebugInfo); 18 | 19 | public function get idx():int 20 | { 21 | return CModule.read32(ptr + OFFSET_IDX); 22 | } 23 | 24 | public function set idx(value:int):void 25 | { 26 | CModule.write32(ptr + OFFSET_IDX, value); 27 | } 28 | 29 | public function get optStartX():Number 30 | { 31 | return CModule.readFloat(ptr + OFFSET_OPT_START); 32 | } 33 | 34 | public function set optStartX(value:Number):void 35 | { 36 | CModule.writeFloat(ptr + OFFSET_OPT_START, value); 37 | } 38 | 39 | public function get optStartY():Number 40 | { 41 | return CModule.readFloat(ptr + OFFSET_OPT_START + 4); 42 | } 43 | 44 | public function set optStartY(value:Number):void 45 | { 46 | CModule.writeFloat(ptr + OFFSET_OPT_START + 4, value); 47 | } 48 | 49 | public function get optStartZ():Number 50 | { 51 | return CModule.readFloat(ptr + OFFSET_OPT_START + 8); 52 | } 53 | 54 | public function set optStartZ(value:Number):void 55 | { 56 | CModule.writeFloat(ptr + OFFSET_OPT_START + 8, value); 57 | } 58 | 59 | public function get optEndX():Number 60 | { 61 | return CModule.readFloat(ptr + OFFSET_OPT_END); 62 | } 63 | 64 | public function set optEndX(value:Number):void 65 | { 66 | CModule.writeFloat(ptr + OFFSET_OPT_END, value); 67 | } 68 | 69 | public function get optEndY():Number 70 | { 71 | return CModule.readFloat(ptr + OFFSET_OPT_END + 4); 72 | } 73 | 74 | public function set optEndY(value:Number):void 75 | { 76 | CModule.writeFloat(ptr + OFFSET_OPT_END + 4, value); 77 | } 78 | 79 | public function get optEndZ():Number 80 | { 81 | return CModule.readFloat(ptr + OFFSET_OPT_END + 8); 82 | } 83 | 84 | public function set optEndZ(value:Number):void 85 | { 86 | CModule.writeFloat(ptr + OFFSET_OPT_END + 8, value); 87 | } 88 | 89 | override public function alloc():Boolean 90 | { 91 | ptr = CModule.malloc(internal_sizeof_dtCrowdAgentDebugInfo()); 92 | return ptr != 0; 93 | } 94 | 95 | override public function free():void 96 | { 97 | CModule.free(ptr); 98 | ptr = 0; 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/crowd/DTCrowdNeighbour.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.crowd 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Provides neighbor data for agents managed by the crowd. 12 | */ 13 | public class DTCrowdNeighbour extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_IDX:int = offsetBytes(4, DTCrowdNeighbour); 17 | rn_internal static const OFFSET_DIST:int = offsetBytes(4, DTCrowdNeighbour); 18 | 19 | /** The index of the neighbor in the crowd. */ 20 | public function get idx():int 21 | { 22 | return CModule.read32(ptr + OFFSET_IDX); 23 | } 24 | 25 | public function set idx(value:int):void 26 | { 27 | CModule.write32(ptr + OFFSET_IDX, value); 28 | } 29 | 30 | /** The distance between the current agent and the neighbor. */ 31 | public function get dist():Number 32 | { 33 | return CModule.readFloat(ptr + OFFSET_DIST); 34 | } 35 | 36 | public function set dist(value:Number):void 37 | { 38 | CModule.writeFloat(ptr + OFFSET_DIST, value); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/crowd/enum/DTCrowdAgentState.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.crowd.enum 2 | { 3 | /** 4 | * The type of navigation mesh polygon the agent is currently traversing. 5 | */ 6 | public class DTCrowdAgentState 7 | { 8 | /** The agent is not in a valid state. */ 9 | public static const DT_CROWDAGENT_STATE_INVALID:int = 0; 10 | /** The agent is traversing a normal navigation mesh polygon. */ 11 | public static const DT_CROWDAGENT_STATE_WALKING:int = 1; 12 | /** The agent is traversing an off-mesh connection. */ 13 | public static const DT_CROWDAGENT_STATE_OFFMESH:int = 2; 14 | } 15 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/crowd/enum/DTCrowdUpdateFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.crowd.enum 2 | { 3 | /** 4 | * Crowd agent update flags. 5 | */ 6 | public class DTCrowdUpdateFlags 7 | { 8 | public static const DT_CROWD_ANTICIPATE_TURNS:int = 1 << 0; 9 | public static const DT_CROWD_OBSTACLE_AVOIDANCE:int = 1 << 1; 10 | public static const DT_CROWD_SEPARATION:int = 1 << 2; 11 | /** Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path. */ 12 | public static const DT_CROWD_OPTIMIZE_VIS:int = 1 << 3; 13 | /** Use dtPathCorridor::optimizePathTopology() to optimize the agent path. */ 14 | public static const DT_CROWD_OPTIMIZE_TOPO:int = 1 << 4; 15 | } 16 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/DTBVNode.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Bounding volume node. 12 | */ 13 | public class DTBVNode extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_BMIN:int = offsetBytes(6, DTBVNode); 17 | rn_internal static const OFFSET_BMAX:int = offsetBytes(6, DTBVNode); 18 | rn_internal static const OFFSET_I:int = offsetBytes(4, DTBVNode); 19 | 20 | /** Minimum bounds of the node's AABB. Component x. [(x, y, z)] */ 21 | public function get bminX():int 22 | { 23 | return CModule.read16(ptr + OFFSET_BMIN); 24 | } 25 | 26 | public function set bminX(value:int):void 27 | { 28 | CModule.write16(ptr + OFFSET_BMIN, value); 29 | } 30 | 31 | /** Minimum bounds of the node's AABB. Component y. [(x, y, z)] */ 32 | public function get bminY():int 33 | { 34 | return CModule.read16(ptr + OFFSET_BMIN + 2); 35 | } 36 | 37 | public function set bminY(value:int):void 38 | { 39 | CModule.write16(ptr + OFFSET_BMIN + 2, value); 40 | } 41 | 42 | /** Minimum bounds of the node's AABB. Component z. [(x, y, z)] */ 43 | public function get bminZ():int 44 | { 45 | return CModule.read16(ptr + OFFSET_BMIN + 4); 46 | } 47 | 48 | public function set bminZ(value:int):void 49 | { 50 | CModule.write16(ptr + OFFSET_BMIN + 4, value); 51 | } 52 | 53 | /** Maximum bounds of the node's AABB. Component x. [(x, y, z)] */ 54 | public function get bmaxX():int 55 | { 56 | return CModule.read16(ptr + OFFSET_BMAX); 57 | } 58 | 59 | public function set bmaxX(value:int):void 60 | { 61 | CModule.write16(ptr + OFFSET_BMAX, value); 62 | } 63 | 64 | /** Maximum bounds of the node's AABB. Component y. [(x, y, z)] */ 65 | public function get bmaxY():int 66 | { 67 | return CModule.read16(ptr + OFFSET_BMAX + 2); 68 | } 69 | 70 | public function set bmaxY(value:int):void 71 | { 72 | CModule.write16(ptr + OFFSET_BMAX + 2, value); 73 | } 74 | 75 | /** Maximum bounds of the node's AABB. Component z. [(x, y, z)] */ 76 | public function get bmaxZ():int 77 | { 78 | return CModule.read16(ptr + OFFSET_BMAX + 4); 79 | } 80 | 81 | public function set bmaxZ(value:int):void 82 | { 83 | CModule.write16(ptr + OFFSET_BMAX + 4, value); 84 | } 85 | 86 | /** The node's index. (Negative for escape sequence.) */ 87 | public function get i():int 88 | { 89 | return CModule.read32(ptr + OFFSET_I); 90 | } 91 | 92 | public function set i(value:int):void 93 | { 94 | CModule.write32(ptr + OFFSET_I, value); 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/DTLink.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Defines a link between polygons. 12 | */ 13 | public class DTLink extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_REF:int = offsetBytes(4, DTLink); 17 | rn_internal static const OFFSET_NEXT:int = offsetBytes(4, DTLink); 18 | rn_internal static const OFFSET_EDGE:int = offsetBytes(1, DTLink); 19 | rn_internal static const OFFSET_SIDE:int = offsetBytes(1, DTLink); 20 | rn_internal static const OFFSET_BMIN:int = offsetBytes(1, DTLink); 21 | rn_internal static const OFFSET_BMAX:int = offsetBytes(1, DTLink); 22 | 23 | /** Neighbour reference. (The neighbor that is linked to.) */ 24 | public function get ref():int 25 | { 26 | return CModule.read32(ptr + OFFSET_REF); 27 | } 28 | 29 | public function set ref(value:int):void 30 | { 31 | CModule.write32(ptr + OFFSET_REF, value); 32 | } 33 | 34 | /** Index of the next link. */ 35 | public function get next():int 36 | { 37 | return CModule.read32(ptr + OFFSET_NEXT); 38 | } 39 | 40 | public function set next(value:int):void 41 | { 42 | CModule.write32(ptr + OFFSET_NEXT, value); 43 | } 44 | 45 | /** Index of the polygon edge that owns this link. */ 46 | public function get edge():int 47 | { 48 | return CModule.read8(ptr + OFFSET_EDGE); 49 | } 50 | 51 | public function set edge(value:int):void 52 | { 53 | CModule.write8(ptr + OFFSET_EDGE, value); 54 | } 55 | 56 | /** If a boundary link, defines on which side the link is. */ 57 | public function get side():int 58 | { 59 | return CModule.read8(ptr + OFFSET_SIDE); 60 | } 61 | 62 | public function set side(value:int):void 63 | { 64 | CModule.write8(ptr + OFFSET_SIDE, value); 65 | } 66 | 67 | /** If a boundary link, defines the minimum sub-edge area. */ 68 | public function get bmin():int 69 | { 70 | return CModule.read8(ptr + OFFSET_BMIN); 71 | } 72 | 73 | public function set bmin(value:int):void 74 | { 75 | CModule.write8(ptr + OFFSET_BMIN, value); 76 | } 77 | 78 | /** If a boundary link, defines the maximum sub-edge area. */ 79 | public function get bmax():int 80 | { 81 | return CModule.read8(ptr + OFFSET_BMAX); 82 | } 83 | 84 | public function set bmax(value:int):void 85 | { 86 | CModule.write8(ptr + OFFSET_BMAX, value); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/DTNavMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.mallocInt8Vector; 6 | import recastnavigation.internal_api.internal_dtAllocNavMesh; 7 | import recastnavigation.internal_api.internal_dtFreeNavMesh; 8 | import recastnavigation.internal_api.internal_dtNavMesh_getPolyRefBase; 9 | import recastnavigation.internal_api.internal_dtNavMesh_getTileAt; 10 | import recastnavigation.internal_api.internal_dtNavMesh_init; 11 | 12 | use namespace rn_internal; 13 | 14 | /** A navigation mesh based on tiles of convex polygons. */ 15 | public class DTNavMesh extends RNBase 16 | { 17 | /** The maximum number of vertices per navigation polygon. */ 18 | public static const DT_VERTS_PER_POLYGON:int = 6; 19 | /** The maximum number of user defined area ids. */ 20 | public static const DT_MAX_AREAS:int = 64; 21 | 22 | /** Initializes the navigation mesh for single tile use. */ 23 | public function init(data:Vector., flags:int):int 24 | { 25 | var data_ptr:int = mallocInt8Vector(data); 26 | var result:int = internal_dtNavMesh_init(ptr, data_ptr, data.length, flags); 27 | return result; 28 | } 29 | 30 | /** Gets the tile at the specified grid location. */ 31 | public function getTileAt(x:int, y:int, layer:int, resultTile:DTMeshTile = null):DTMeshTile 32 | { 33 | if (resultTile == null) 34 | resultTile = new DTMeshTile(); 35 | resultTile.ptr = internal_dtNavMesh_getTileAt(ptr, x, y, layer); 36 | return resultTile; 37 | } 38 | 39 | /** Gets the polygon reference for the tile's base polygon. */ 40 | public function getPolyRefBase(tile:DTMeshTile):int 41 | { 42 | return internal_dtNavMesh_getPolyRefBase(ptr, tile.ptr); 43 | } 44 | 45 | public override function alloc():Boolean 46 | { 47 | ptr = internal_dtAllocNavMesh(); 48 | return ptr != 0; 49 | } 50 | 51 | public override function free():void 52 | { 53 | internal_dtFreeNavMesh(ptr); 54 | ptr = 0; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/DTNavMeshParams.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Configuration parameters used to define multi-tile navigation 12 | * meshes. The values are used to allocate space during the 13 | * initialization of a navigation mesh. 14 | */ 15 | public class DTNavMeshParams extends RNBase 16 | { 17 | rn_internal static var SIZE:int = 0; 18 | rn_internal static const OFFSET_ORIG:int = offsetBytes(12, DTNavMeshParams); 19 | rn_internal static const OFFSET_TILE_WIDTH:int = offsetBytes(4, DTNavMeshParams); 20 | rn_internal static const OFFSET_TILE_HEIGHT:int = offsetBytes(4, DTNavMeshParams); 21 | rn_internal static const OFFSET_MAX_TILES:int = offsetBytes(4, DTNavMeshParams); 22 | rn_internal static const OFFSET_MAX_POLYS:int = offsetBytes(4, DTNavMeshParams); 23 | 24 | /** The world space origin of the navigation mesh's tile space. Component x. [(x, y, z)] */ 25 | public function get origX():Number 26 | { 27 | return CModule.readFloat(ptr + OFFSET_ORIG); 28 | } 29 | 30 | public function set origX(value:Number):void 31 | { 32 | CModule.writeFloat(ptr + OFFSET_ORIG, value); 33 | } 34 | 35 | /** The world space origin of the navigation mesh's tile space. Component y. [(x, y, z)] */ 36 | public function get origY():Number 37 | { 38 | return CModule.readFloat(ptr + OFFSET_ORIG + 4); 39 | } 40 | 41 | public function set origY(value:Number):void 42 | { 43 | CModule.writeFloat(ptr + OFFSET_ORIG + 4, value); 44 | } 45 | 46 | /** The world space origin of the navigation mesh's tile space. Component z. [(x, y, z)] */ 47 | public function get origZ():Number 48 | { 49 | return CModule.readFloat(ptr + OFFSET_ORIG + 8); 50 | } 51 | 52 | public function set origZ(value:Number):void 53 | { 54 | CModule.writeFloat(ptr + OFFSET_ORIG + 8, value); 55 | } 56 | 57 | /** The width of each tile. (Along the x-axis.) */ 58 | public function get tileWidth():Number 59 | { 60 | return CModule.readFloat(ptr + OFFSET_TILE_WIDTH); 61 | } 62 | 63 | public function set tileWidth(value:Number):void 64 | { 65 | CModule.writeFloat(ptr + OFFSET_TILE_WIDTH, value); 66 | } 67 | 68 | /** The height of each tile. (Along the z-axis.) */ 69 | public function get tileHeight():Number 70 | { 71 | return CModule.readFloat(ptr + OFFSET_TILE_HEIGHT); 72 | } 73 | 74 | public function set tileHeight(value:Number):void 75 | { 76 | CModule.writeFloat(ptr + OFFSET_TILE_HEIGHT, value); 77 | } 78 | 79 | /** The maximum number of tiles the navigation mesh can contain. */ 80 | public function get maxTiles():int 81 | { 82 | return CModule.read32(ptr + OFFSET_MAX_TILES); 83 | } 84 | 85 | public function set maxTiles(value:int):void 86 | { 87 | CModule.write32(ptr + OFFSET_MAX_TILES, value); 88 | } 89 | 90 | /** The maximum number of polygons each tile can contain. */ 91 | public function get maxPolys():int 92 | { 93 | return CModule.read32(ptr + OFFSET_MAX_POLYS); 94 | } 95 | 96 | public function set maxPolys(value:int):void 97 | { 98 | CModule.write32(ptr + OFFSET_MAX_POLYS, value); 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/DTPolyDetail.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Defines the location of detail sub-mesh data within a dtMeshTile. 12 | */ 13 | public class DTPolyDetail extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_VERT_BASE:int = offsetBytes(4, DTPolyDetail); 17 | rn_internal static const OFFSET_TRI_VASE:int = offsetBytes(4, DTPolyDetail); 18 | rn_internal static const OFFSET_VERT_COUNT:int = offsetBytes(1, DTPolyDetail); 19 | rn_internal static const OFFSET_TRI_COUNT:int = offsetBytes(1, DTPolyDetail); 20 | 21 | /** The offset of the vertices in the dtMeshTile::detailVerts array. */ 22 | public function get vertBase():int 23 | { 24 | return CModule.read32(ptr + OFFSET_VERT_BASE); 25 | } 26 | 27 | public function set vertBase(value:int):void 28 | { 29 | CModule.write32(ptr + OFFSET_VERT_BASE, value); 30 | } 31 | 32 | /** The offset of the triangles in the dtMeshTile::detailTris array. */ 33 | public function get triBase():int 34 | { 35 | return CModule.read32(ptr + OFFSET_TRI_VASE); 36 | } 37 | 38 | public function set triBase(value:int):void 39 | { 40 | CModule.write32(ptr + OFFSET_TRI_VASE, value); 41 | } 42 | 43 | /** The number of vertices in the sub-mesh. */ 44 | public function get vertCount():int 45 | { 46 | return CModule.read8(ptr + OFFSET_VERT_COUNT); 47 | } 48 | 49 | public function set vertCount(value:int):void 50 | { 51 | CModule.write8(ptr + OFFSET_VERT_COUNT, value); 52 | } 53 | 54 | /** The number of triangles in the sub-mesh. */ 55 | public function get triCount():int 56 | { 57 | return CModule.read8(ptr + OFFSET_TRI_COUNT); 58 | } 59 | 60 | public function set triCount(value:int):void 61 | { 62 | CModule.write8(ptr + OFFSET_TRI_COUNT, value); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTFindPathOptions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Options for dtNavMeshQuery::findPath 5 | */ 6 | public class DTFindPathOptions 7 | { 8 | /** [provisional] trade quality for performance far from the origin. The idea is that by then a new query will be issued */ 9 | public static const DT_FINDPATH_LOW_QUALITY_FAR:int = 0x01; 10 | /** use raycasts during pathfind to "shortcut" (raycast still consider costs) */ 11 | public static const DT_FINDPATH_ANY_ANGLE:int = 0x02; 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTPolyTypes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Flags representing the type of a navigation mesh polygon. 5 | */ 6 | public class DTPolyTypes 7 | { 8 | /** The polygon is a standard convex polygon that is part of the surface of the mesh. */ 9 | public static const DT_POLYTYPE_GROUND:int = 0; 10 | /** The polygon is an off-mesh connection consisting of two vertices. */ 11 | public static const DT_POLYTYPE_OFFMESH_CONNECTION:int = 1; 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTRaycastOptions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Options for dtNavMeshQuery::raycast 5 | */ 6 | public class DTRaycastOptions 7 | { 8 | /** Raycast should calculate movement cost along the ray and fill RaycastHit::cost */ 9 | public static const DT_RAYCAST_USE_COSTS:int = 0x01; 10 | } 11 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTStraightPathFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Vertex flags returned by dtNavMeshQuery::findStraightPath. 5 | **/ 6 | public class DTStraightPathFlags 7 | { 8 | /** The vertex is the start position in the path. */ 9 | public static const DT_STRAIGHTPATH_START:int = 0x01; 10 | /** The vertex is the end position in the path. */ 11 | public static const DT_STRAIGHTPATH_END:int = 0x02; 12 | /** The vertex is the start of an off-mesh connection. */ 13 | public static const DT_STRAIGHTPATH_OFFMESH_CONNECTION:int = 0x04; 14 | } 15 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTStraightPathOptions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Options for dtNavMeshQuery::findStraightPath. 5 | */ 6 | public class DTStraightPathOptions 7 | { 8 | /** Add a vertex at every polygon edge crossing where area changes. */ 9 | public static const DT_STRAIGHTPATH_AREA_CROSSINGS:int = 0x01; 10 | /** Add a vertex at every polygon edge crossing. */ 11 | public static const DT_STRAIGHTPATH_ALL_CROSSINGS:int = 0x02; 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmesh/enum/DTTileFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmesh.enum 2 | { 3 | /** 4 | * Tile flags used for various functions and fields. 5 | * For an example, see dtNavMesh::addTile(). 6 | */ 7 | public class DTTileFlags 8 | { 9 | /** The navigation mesh owns the tile memory and is responsible for freeing it. */ 10 | public static const DT_TILE_FREE_DATA:int = 0x01; 11 | } 12 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmeshbuilder/dtCreateNavMeshData.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmeshbuilder 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.CModule; 5 | import recastnavigation.internal_api.internal_dtCreateNavMeshData; 6 | 7 | use namespace rn_internal; 8 | 9 | /** 10 | * Builds navigation mesh tile data from the provided tile creation data. 11 | */ 12 | public function dtCreateNavMeshData(params:DTNavMeshCreateParams, outData:Vector.):Boolean 13 | { 14 | var outData_ptr_ptr:int = CModule.malloc(4); 15 | var outDataSize_ptr:int = CModule.malloc(4); 16 | var result:Boolean = internal_dtCreateNavMeshData(params.ptr, outData_ptr_ptr, outDataSize_ptr); 17 | outData.length = CModule.read32(outDataSize_ptr); 18 | for (var i:int = outData.length - 1; i >= 0; --i) 19 | outData[i] = CModule.read8(CModule.read32(outData_ptr_ptr) + 1 * i); 20 | CModule.free(outData_ptr_ptr); 21 | CModule.free(outDataSize_ptr); 22 | return result; 23 | } 24 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmeshbuilder/dtNavMeshDataSwapEndian.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmeshbuilder 2 | { 3 | import recastnavigation.core.utils.mallocInt8Vector; 4 | import recastnavigation.internal_api.CModule; 5 | import recastnavigation.internal_api.internal_dtNavMeshDataSwapEndian; 6 | 7 | /** 8 | * Swaps endianess of the tile data. 9 | */ 10 | public function dtNavMeshDataSwapEndian(data:Vector.):Boolean 11 | { 12 | var data_ptr:int = mallocInt8Vector(data); 13 | var dataSize:int = data.length; 14 | var result:Boolean = internal_dtNavMeshDataSwapEndian(data_ptr, dataSize); 15 | for (var i:int = 0; i < dataSize; ++i) 16 | data[i] = CModule.read8(data_ptr + 1 * i); 17 | CModule.free(data_ptr); 18 | return result; 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmeshbuilder/dtNavMeshHeaderSwapEndian.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmeshbuilder 2 | { 3 | import recastnavigation.core.utils.mallocInt8Vector; 4 | import recastnavigation.internal_api.CModule; 5 | import recastnavigation.internal_api.internal_dtNavMeshHeaderSwapEndian; 6 | 7 | /** 8 | * Swaps the endianess of the tile data's header (#dtMeshHeader). 9 | */ 10 | public function dtNavMeshHeaderSwapEndian(data:Vector.):Boolean 11 | { 12 | var data_ptr:int = mallocInt8Vector(data); 13 | var dataSize:int = data.length; 14 | var result:Boolean = internal_dtNavMeshHeaderSwapEndian(data_ptr, dataSize); 15 | for (var i:int = 0; i < dataSize; ++i) 16 | data[i] = CModule.read8(data_ptr + 1 * i); 17 | CModule.free(data_ptr); 18 | return result; 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/navmeshquery/DTRaycastHit.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.navmeshquery 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Provides information about raycast hit filled by dtNavMeshQuery::raycast. 12 | */ 13 | public class DTRaycastHit extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_T:int = offsetBytes(4, DTRaycastHit); 17 | rn_internal static const OFFSET_HIT_NORMAL:int = offsetBytes(12, DTRaycastHit); 18 | rn_internal static const OFFSET_PATH:int = offsetBytes(4, DTRaycastHit); 19 | rn_internal static const OFFSET_PATH_COUNT:int = offsetBytes(4, DTRaycastHit); 20 | rn_internal static const OFFSET_MAX_PATH:int = offsetBytes(4, DTRaycastHit); 21 | rn_internal static const OFFSET_PATH_COST:int = offsetBytes(4, DTRaycastHit); 22 | 23 | /** The hit parameter. (FLT_MAX if no wall hit.) */ 24 | public function get t():Number 25 | { 26 | return CModule.readFloat(ptr + OFFSET_T); 27 | } 28 | 29 | public function set t(value:Number):void 30 | { 31 | CModule.writeFloat(ptr + OFFSET_T, value); 32 | } 33 | 34 | /** hitNormal The normal of the nearest wall hit. Component x. [(x, y, z)] */ 35 | public function get hitNormalX():Number 36 | { 37 | return CModule.readFloat(ptr + OFFSET_HIT_NORMAL); 38 | } 39 | 40 | public function set hitNormalX(value:Number):void 41 | { 42 | CModule.writeFloat(ptr + OFFSET_HIT_NORMAL, value); 43 | } 44 | 45 | /** hitNormal The normal of the nearest wall hit. Component y. [(x, y, z)] */ 46 | public function get hitNormalY():Number 47 | { 48 | return CModule.readFloat(ptr + OFFSET_HIT_NORMAL + 4); 49 | } 50 | 51 | public function set hitNormalY(value:Number):void 52 | { 53 | CModule.writeFloat(ptr + OFFSET_HIT_NORMAL + 4, value); 54 | } 55 | 56 | /** hitNormal The normal of the nearest wall hit. Component z. [(x, y, z)] */ 57 | public function get hitNormalZ():Number 58 | { 59 | return CModule.readFloat(ptr + OFFSET_HIT_NORMAL + 8); 60 | } 61 | 62 | public function set hitNormalZ(value:Number):void 63 | { 64 | CModule.writeFloat(ptr + OFFSET_HIT_NORMAL + 8, value); 65 | } 66 | 67 | /** Pointer to an array of reference ids of the visited polygons. Getter. [opt] */ 68 | public function getPath(index:int):int 69 | { 70 | return CModule.read32(CModule.read32(ptr + OFFSET_PATH) + 4 * index); 71 | } 72 | 73 | /** Pointer to an array of reference ids of the visited polygons. Setter. [opt] */ 74 | public function setPath(index:int, value:int):void 75 | { 76 | CModule.write32(CModule.read32(ptr + OFFSET_PATH) + 4 * index, value); 77 | } 78 | 79 | /** The number of visited polygons. [opt] */ 80 | public function get pathCount():int 81 | { 82 | return CModule.read32(ptr + OFFSET_PATH_COUNT); 83 | } 84 | 85 | public function set pathCount(value:int):void 86 | { 87 | CModule.write32(ptr + OFFSET_PATH_COUNT, value); 88 | } 89 | 90 | /** The maximum number of polygons the @p path array can hold. */ 91 | public function get maxPath():int 92 | { 93 | return CModule.read32(ptr + OFFSET_MAX_PATH); 94 | } 95 | 96 | public function set maxPath(value:int):void 97 | { 98 | CModule.write32(ptr + OFFSET_MAX_PATH, value); 99 | } 100 | 101 | /** The cost of the path until hit. */ 102 | public function get pathCost():Number 103 | { 104 | return CModule.readFloat(ptr + OFFSET_PATH_COST); 105 | } 106 | 107 | public function set pathCost(value:Number):void 108 | { 109 | CModule.writeFloat(ptr + OFFSET_PATH_COST, value); 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/status/dtStatusDetail.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.status 2 | { 3 | /** Returns true if specific detail is set. */ 4 | public function dtStatusDetail(status:int, detail:int):Boolean 5 | { 6 | return (status & detail) != 0; 7 | } 8 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/status/dtStatusFailed.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.status 2 | { 3 | import recastnavigation.detour.status.enum.DTStatus; 4 | 5 | /** Returns true of status is failure. */ 6 | public function dtStatusFailed(status:int):Boolean 7 | { 8 | return (status & DTStatus.DT_FAILURE) != 0; 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/status/dtStatusInProgress.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.status 2 | { 3 | import recastnavigation.detour.status.enum.DTStatus; 4 | 5 | /** Returns true of status is in progress. */ 6 | public function dtStatusInProgress(status:int):Boolean 7 | { 8 | return (status & DTStatus.DT_IN_PROGRESS) != 0; 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/status/dtStatusSucceed.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.status 2 | { 3 | import recastnavigation.detour.status.enum.DTStatus; 4 | 5 | /** Returns true of status is success. */ 6 | public function dtStatusSucceed(status:int):Boolean 7 | { 8 | return (status & DTStatus.DT_SUCCESS) != 0; 9 | } 10 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/detour/status/enum/DTStatus.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.detour.status.enum 2 | { 3 | public class DTStatus 4 | { 5 | /** Operation failed. */ 6 | public static const DT_FAILURE:int = 1 << 31; 7 | /** Operation succeed. */ 8 | public static const DT_SUCCESS:int = 1 << 30; 9 | /** Operation still in progress. */ 10 | public static const DT_IN_PROGRESS:int = 1 << 29; 11 | /** Input data is not recognized. */ 12 | public static const DT_WRONG_MAGIC:int = 1 << 0; 13 | /** Input data is in wrong version. */ 14 | public static const DT_WRONG_VERSION:int = 1 << 1; 15 | /** Operation ran out of memory. */ 16 | public static const DT_OUT_OF_MEMORY:int = 1 << 2; 17 | /** An input parameter was invalid. */ 18 | public static const DT_INVALID_PARAM:int = 1 << 3; 19 | /** Result buffer for the query was too small to store all results. */ 20 | public static const DT_BUFFER_TOO_SMALL:int = 1 << 4; 21 | /** Query ran out of nodes during search. */ 22 | public static const DT_OUT_OF_NODES:int = 1 << 5; 23 | /** Query did not reach the end location, returning best guess. */ 24 | public static const DT_PARTIAL_RESULT:int = 1 << 6; 25 | } 26 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/RCCompactCell.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.core.utils.readBits; 7 | import recastnavigation.core.utils.writeBits; 8 | import recastnavigation.internal_api.CModule; 9 | 10 | use namespace rn_internal; 11 | 12 | /** 13 | * Provides information on the content of a cell column in a compact heightfield. 14 | */ 15 | public class RCCompactCell extends RNBase 16 | { 17 | rn_internal static var SIZE:int = 0; 18 | rn_internal static const OFFSET_UNION:int = offsetBytes(4, RCCompactCell); 19 | 20 | /** Index to the first span in the column. */ 21 | public function get index():int 22 | { 23 | return readBits(CModule.read32(ptr + OFFSET_UNION), 0, 24); 24 | } 25 | 26 | public function set index(value:int):void 27 | { 28 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 0, 24, value)); 29 | } 30 | 31 | /** Number of spans in the column. */ 32 | public function get count():int 33 | { 34 | return readBits(CModule.read32(ptr + OFFSET_UNION), 24, 8); 35 | } 36 | 37 | public function set count(value:int):void 38 | { 39 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 24, 8, value)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/RCCompactSpan.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.core.utils.readBits; 7 | import recastnavigation.core.utils.writeBits; 8 | import recastnavigation.internal_api.CModule; 9 | 10 | use namespace rn_internal; 11 | 12 | /** 13 | * Represents a span of unobstructed space within a compact heightfield. 14 | */ 15 | public class RCCompactSpan extends RNBase 16 | { 17 | rn_internal static var SIZE:int = 0; 18 | rn_internal static const OFFSET_Y:int = offsetBytes(4, RCCompactSpan); 19 | rn_internal static const OFFSET_REG:int = offsetBytes(4, RCCompactSpan); 20 | rn_internal static const OFFSET_UNION:int = offsetBytes(4, RCCompactSpan); 21 | 22 | /** The lower extent of the span. (Measured from the heightfield's base.) */ 23 | public function get y():int 24 | { 25 | return CModule.read32(ptr + OFFSET_Y); 26 | } 27 | 28 | public function set y(value:int):void 29 | { 30 | CModule.write32(ptr + OFFSET_Y, value); 31 | } 32 | 33 | /** The id of the region the span belongs to. (Or zero if not in a region.) */ 34 | public function get reg():int 35 | { 36 | return CModule.read32(ptr + OFFSET_REG); 37 | } 38 | 39 | public function set reg(value:int):void 40 | { 41 | CModule.write32(ptr + OFFSET_REG, value); 42 | } 43 | 44 | /** Packed neighbor connection data. */ 45 | public function get con():int 46 | { 47 | return readBits(CModule.read32(ptr + OFFSET_UNION), 0, 24); 48 | } 49 | 50 | public function set con(value:int):void 51 | { 52 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 0, 24, value)); 53 | } 54 | 55 | /** The height of the span. (Measured from #y.) */ 56 | public function get h():int 57 | { 58 | return readBits(CModule.read32(ptr + OFFSET_UNION), 24, 8); 59 | } 60 | 61 | public function set h(value:int):void 62 | { 63 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 24, 8, value)); 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/RCHeightfieldLayerSet.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.copyBytes; 6 | import recastnavigation.core.utils.offsetBytes; 7 | import recastnavigation.internal_api.CModule; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Represents a set of heightfield layers. 13 | */ 14 | public class RCHeightfieldLayerSet extends RNBase 15 | { 16 | rn_internal static var SIZE:int = 0; 17 | rn_internal static const OFFSET_LAYERS:int = offsetBytes(4, RCHeightfieldLayerSet); 18 | rn_internal static const OFFSET_NLAYERS:int = offsetBytes(4, RCHeightfieldLayerSet); 19 | 20 | /** The layers in the set. Getter. [Size: #nlayers] */ 21 | public function getLayer(index:int, resultLayer:RCHeightfieldLayer = null):RCHeightfieldLayer 22 | { 23 | if (resultLayer == null) 24 | resultLayer = new RCHeightfieldLayer(); 25 | resultLayer.ptr = CModule.read32(ptr + OFFSET_LAYERS) + RCHeightfieldLayer.SIZE * index; 26 | return resultLayer; 27 | } 28 | 29 | /** The layers in the set. Setter. [Size: #nlayers] */ 30 | public function setLayer(index:int, value:RCHeightfieldLayer):void 31 | { 32 | copyBytes(value.ptr, CModule.read32(ptr + OFFSET_LAYERS) + RCHeightfieldLayer.SIZE * index, 33 | RCHeightfieldLayer.SIZE); 34 | } 35 | 36 | /** The number of layers in the set. */ 37 | public function get nlayers():int 38 | { 39 | return CModule.read32(ptr + OFFSET_NLAYERS); 40 | } 41 | 42 | public function set nlayers(value:int):void 43 | { 44 | CModule.write32(ptr + OFFSET_NLAYERS, value); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/RCSpan.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.core.utils.readBits; 7 | import recastnavigation.core.utils.writeBits; 8 | import recastnavigation.internal_api.CModule; 9 | 10 | use namespace rn_internal; 11 | 12 | /** 13 | * Represents a span in a heightfield. 14 | */ 15 | public class RCSpan extends RNBase 16 | { 17 | rn_internal static var SIZE:int = 0; 18 | rn_internal static const OFFSET_UNION:int = offsetBytes(4, RCSpan); 19 | rn_internal static const OFFSET_NEXT:int = offsetBytes(4, RCSpan); 20 | 21 | /** The lower limit of the span. [Limit: < #smax] */ 22 | public function get smin():int 23 | { 24 | return readBits(CModule.read32(ptr + OFFSET_UNION), 0, 13); 25 | } 26 | 27 | public function set smin(value:int):void 28 | { 29 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 0, 13, value)); 30 | } 31 | 32 | /** The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT] */ 33 | public function get smax():int 34 | { 35 | return readBits(CModule.read32(ptr + OFFSET_UNION), 13, 13); 36 | } 37 | 38 | public function set smax(value:int):void 39 | { 40 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 13, 13, value)); 41 | } 42 | 43 | /** The area id assigned to the span. */ 44 | public function get area():int 45 | { 46 | return readBits(CModule.read32(ptr + OFFSET_UNION), 26, 6); 47 | } 48 | 49 | public function set area(value:int):void 50 | { 51 | CModule.write32(ptr + OFFSET_UNION, writeBits(CModule.read32(ptr + OFFSET_UNION), 26, 6, value)); 52 | } 53 | 54 | /** The next span higher up in column. Getter. */ 55 | public function getNext(resultSpan:RCSpan = null):RCSpan 56 | { 57 | if (resultSpan == null) 58 | resultSpan = new RCSpan(); 59 | resultSpan.ptr = CModule.read32(ptr + OFFSET_NEXT); 60 | return resultSpan; 61 | } 62 | 63 | /** The next span higher up in column. Setter. */ 64 | public function setNext(value:RCSpan):void 65 | { 66 | CModule.write32(ptr + OFFSET_NEXT, value.ptr); 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/RCSpanPool.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | import recastnavigation.internal_api.internal_sizeof_rcSpan; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * A memory pool used for quick allocation of spans within a heightfield. 13 | */ 14 | public class RCSpanPool extends RNBase 15 | { 16 | public static const RC_SPANS_PER_POOL:int = 2048; 17 | rn_internal static var SIZE:int = 0; 18 | rn_internal static const OFFSET_NEXT:int = offsetBytes(4, RCSpanPool); 19 | rn_internal static const OFFSET_ITEMS:int = offsetBytes(internal_sizeof_rcSpan() * RC_SPANS_PER_POOL, 20 | RCSpanPool); 21 | 22 | /** The next span pool. Getter. */ 23 | public function getNext(resultSpanPool:RCSpanPool = null):RCSpanPool 24 | { 25 | if (resultSpanPool == null) 26 | resultSpanPool = new RCSpanPool(); 27 | resultSpanPool.ptr = CModule.read32(ptr + OFFSET_NEXT); 28 | return resultSpanPool; 29 | } 30 | 31 | /** The next span pool. Setter. */ 32 | public function setNext(value:RCSpanPool):void 33 | { 34 | CModule.write32(ptr + OFFSET_NEXT, value.ptr); 35 | } 36 | 37 | /** Array of spans in the pool. Getter. */ 38 | public function getItem(index:int, resultSpan:RCSpan = null):RCSpan 39 | { 40 | if (resultSpan == null) 41 | resultSpan = new RCSpan(); 42 | resultSpan.ptr = CModule.read32(ptr + OFFSET_ITEMS + RCSpan.SIZE * index); 43 | return resultSpan; 44 | } 45 | 46 | /** Array of spans in the pool. Setter. */ 47 | public function setItem(index:int, value:RCSpanPool):void 48 | { 49 | CModule.write32(ptr + OFFSET_ITEMS + RCSpan.SIZE * index, value.ptr); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/contour/RCContour.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.contour 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Represents a simple, non-overlapping contour in field space. 12 | */ 13 | public class RCContour extends RNBase 14 | { 15 | rn_internal static var SIZE:int = 0; 16 | rn_internal static const OFFSET_VERTS:int = offsetBytes(4, RCContour); 17 | rn_internal static const OFFSET_NVERTS:int = offsetBytes(4, RCContour); 18 | rn_internal static const OFFSET_RVERTS:int = offsetBytes(4, RCContour); 19 | rn_internal static const OFFSET_NRVERTS:int = offsetBytes(4, RCContour); 20 | rn_internal static const OFFSET_REG:int = offsetBytes(2, RCContour); 21 | rn_internal static const OFFSET_AREA:int = offsetBytes(2, RCContour); 22 | 23 | /** Simplified contour vertex and connection data. */ 24 | public function getVert(index:int):int 25 | { 26 | return CModule.read32(CModule.read32(ptr + OFFSET_VERTS) + 4 * index); 27 | } 28 | 29 | public function setVert(index:int, value:int):void 30 | { 31 | CModule.write32(CModule.read32(ptr + OFFSET_VERTS) + 4 * index, value); 32 | } 33 | 34 | /** The number of vertices in the simplified contour. */ 35 | public function get nverts():int 36 | { 37 | return CModule.read32(ptr + OFFSET_NVERTS); 38 | } 39 | 40 | public function set nverts(value:int):void 41 | { 42 | CModule.write32(ptr + OFFSET_NVERTS, value); 43 | } 44 | 45 | /** Raw contour vertex and connection data. */ 46 | public function getRVert(index:int):int 47 | { 48 | return CModule.read32(CModule.read32(ptr + OFFSET_RVERTS) + 4 * index); 49 | } 50 | 51 | public function setRVert(index:int, value:int):void 52 | { 53 | CModule.write32(CModule.read32(ptr + OFFSET_RVERTS) + 4 * index, value); 54 | } 55 | 56 | /** The number of vertices in the raw contour. */ 57 | public function get nrverts():int 58 | { 59 | return CModule.read32(ptr + OFFSET_NRVERTS); 60 | } 61 | 62 | public function set nrverts(value:int):void 63 | { 64 | CModule.write32(ptr + OFFSET_NRVERTS, value); 65 | } 66 | 67 | /** The region id of the contour. */ 68 | public function get reg():int 69 | { 70 | return CModule.read16(ptr + OFFSET_REG); 71 | } 72 | 73 | public function set reg(value:int):void 74 | { 75 | CModule.write16(ptr + OFFSET_REG, value); 76 | } 77 | 78 | /** The area id of the contour. */ 79 | public function get area():int 80 | { 81 | return CModule.read8(ptr + OFFSET_AREA); 82 | } 83 | 84 | public function set area(value:int):void 85 | { 86 | CModule.write8(ptr + OFFSET_AREA, value); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/contour/rcBuildContours.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.contour 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildContours; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | import recastnavigation.recast.enum.RCBuildContoursFlags; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Builds a contour set from the region outlines in the provided compact heightfield. 13 | */ 14 | public function rcBuildContours(ctx:RCContext, chf:RCCompactHeightfield, maxError:Number, maxEdgeLen:int, 15 | cset:RCContourSet, 16 | buildFlags:int = RCBuildContoursFlags.RC_CONTOUR_TESS_WALL_EDGES):Boolean 17 | { 18 | return internal_rcBuildContours(ctx.ptr, chf.ptr, maxError, maxEdgeLen, cset.ptr, buildFlags); 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/enum/RCAreaType.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.enum 2 | { 3 | public class RCAreaType 4 | { 5 | /** 6 | * Represents the null area. When a data element is given 7 | * this value it is considered to no longer be assigned 8 | * to a usable area. (E.g. It is unwalkable.) 9 | */ 10 | public static const RC_NULL_AREA:int = 0; 11 | /** 12 | * The default area id used to indicate a walkable polygon. 13 | * This is also the maximum allowed area id, and the only 14 | * non-null area id recognized by some steps in the build process. 15 | */ 16 | public static const RC_WALKABLE_AREA:int = 63; 17 | } 18 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/enum/RCBuildContoursFlags.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.enum 2 | { 3 | /** 4 | * Contour build flags. 5 | */ 6 | public class RCBuildContoursFlags 7 | { 8 | /** Tessellate solid (impassable) edges during contour simplification. */ 9 | public static const RC_CONTOUR_TESS_WALL_EDGES:int = 0x01; 10 | /** Tessellate edges between areas during contour simplification. */ 11 | public static const RC_CONTOUR_TESS_AREA_EDGES:int = 0x02; 12 | } 13 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/enum/RCLogCategory.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.enum 2 | { 3 | /** 4 | * Recast log categories. 5 | */ 6 | public class RCLogCategory 7 | { 8 | /** A progress log entry. */ 9 | public static const RC_LOG_PROGRESS:int = 1; 10 | /** A warning log entry. */ 11 | public static const RC_LOG_WARNING:int = 2; 12 | /** An error log entry. */ 13 | public static const RC_LOG_ERROR:int = 3; 14 | } 15 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/enum/RCTimerLabel.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.enum 2 | { 3 | /** 4 | * Recast performance timer categories. 5 | */ 6 | public class RCTimerLabel 7 | { 8 | /** The user defined total time of the build. */ 9 | public static const RC_TIMER_TOTAL:int = 0; 10 | /** A user defined build time. */ 11 | public static const RC_TIMER_TEMP:int = 1; 12 | /** The time to rasterize the triangles. (See: #rcRasterizeTriangle) */ 13 | public static const RC_TIMER_RASTERIZE_TRIANGLES:int = 2; 14 | /** The time to build the compact heightfield. (See: #rcBuildCompactHeightfield) */ 15 | public static const RC_TIMER_BUILD_COMPACTHEIGHTFIELD:int = 3; 16 | /** The total time to build the contours. (See: #rcBuildContours) */ 17 | public static const RC_TIMER_BUILD_CONTOURS:int = 4; 18 | /** The time to trace the boundaries of the contours. (See: #rcBuildContours) */ 19 | public static const RC_TIMER_BUILD_CONTOURS_TRACE:int = 5; 20 | /** The time to simplify the contours. (See: #rcBuildContours) */ 21 | public static const RC_TIMER_BUILD_CONTOURS_SIMPLIFY:int = 6; 22 | /** The time to filter ledge spans. (See: #rcFilterLedgeSpans) */ 23 | public static const RC_TIMER_FILTER_BORDER:int = 7; 24 | /** The time to filter low height spans. (See: #rcFilterWalkableLowHeightSpans) */ 25 | public static const RC_TIMER_FILTER_WALKABLE:int = 8; 26 | /** The time to apply the median filter. (See: #rcMedianFilterWalkableArea) */ 27 | public static const RC_TIMER_MEDIAN_AREA:int = 9; 28 | /** The time to filter low obstacles. (See: #rcFilterLowHangingWalkableObstacles) */ 29 | public static const RC_TIMER_FILTER_LOW_OBSTACLES:int = 10; 30 | /** The time to build the polygon mesh. (See: #rcBuildPolyMesh) */ 31 | public static const RC_TIMER_BUILD_POLYMESH:int = 11; 32 | /** The time to merge polygon meshes. (See: #rcMergePolyMeshes) */ 33 | public static const RC_TIMER_MERGE_POLYMESH:int = 12; 34 | /** The time to erode the walkable area. (See: #rcErodeWalkableArea) */ 35 | public static const RC_TIMER_ERODE_AREA:int = 13; 36 | /** The time to mark a box area. (See: #rcMarkBoxArea) */ 37 | public static const RC_TIMER_MARK_BOX_AREA:int = 14; 38 | /** The time to mark a cylinder area. (See: #rcMarkCylinderArea) */ 39 | public static const RC_TIMER_MARK_CYLINDER_AREA:int = 15; 40 | /** The time to mark a convex polygon area. (See: #rcMarkConvexPolyArea) */ 41 | public static const RC_TIMER_MARK_CONVEXPOLY_AREA:int = 16; 42 | /** The total time to build the distance field. (See: #rcBuildDistanceField) */ 43 | public static const RC_TIMER_BUILD_DISTANCEFIELD:int = 17; 44 | /** The time to build the distances of the distance field. (See: #rcBuildDistanceField) */ 45 | public static const RC_TIMER_BUILD_DISTANCEFIELD_DIST:int = 18; 46 | /** The time to blur the distance field. (See: #rcBuildDistanceField) */ 47 | public static const RC_TIMER_BUILD_DISTANCEFIELD_BLUR:int = 19; 48 | /** The total time to build the regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone) */ 49 | public static const RC_TIMER_BUILD_REGIONS:int = 20; 50 | /** The total time to apply the watershed algorithm. (See: #rcBuildRegions) */ 51 | public static const RC_TIMER_BUILD_REGIONS_WATERSHED:int = 21; 52 | /** The time to expand regions while applying the watershed algorithm. (See: #rcBuildRegions) */ 53 | public static const RC_TIMER_BUILD_REGIONS_EXPAND:int = 22; 54 | /** The time to flood regions while applying the watershed algorithm. (See: #rcBuildRegions) */ 55 | public static const RC_TIMER_BUILD_REGIONS_FLOOD:int = 23; 56 | /** The time to filter out small regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone) */ 57 | public static const RC_TIMER_BUILD_REGIONS_FILTER:int = 24; 58 | /** The time to build heightfield layers. (See: #rcBuildHeightfieldLayers) */ 59 | public static const RC_TIMER_BUILD_LAYERS:int = 25; 60 | /** The time to build the polygon mesh detail. (See: #rcBuildPolyMeshDetail) */ 61 | public static const RC_TIMER_BUILD_POLYMESHDETAIL:int = 26; 62 | /** The time to merge polygon mesh details. (See: #rcMergePolyMeshDetails) */ 63 | public static const RC_TIMER_MERGE_POLYMESHDETAIL:int = 27; 64 | /** The maximum number of timers. (Used for iterating timers.) */ 65 | public static const RC_MAX_TIMERS:int = 28; 66 | } 67 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/filter/rcFilterLedgeSpans.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.filter 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcFilterLedgeSpans; 5 | import recastnavigation.recast.RCContext; 6 | import recastnavigation.recast.RCHeightfield; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * A ledge is a span with one or more neighbors whose maximum is further away 12 | * than "walkableClimb" from the current span's maximum. This method removes 13 | * the impact of the overestimation of conservative voxelization so the 14 | * resulting mesh will not have regions hanging in the air over ledges. 15 | */ 16 | public function rcFilterLedgeSpans(ctx:RCContext, walkableHeight:int, walkableClimb:int, solid:RCHeightfield):void 17 | { 18 | internal_rcFilterLedgeSpans(ctx.ptr, walkableHeight, walkableClimb, solid.ptr); 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/filter/rcFilterLowHangingWalkableObstacles.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.filter 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcFilterLowHangingWalkableObstacles; 5 | import recastnavigation.recast.RCContext; 6 | import recastnavigation.recast.RCHeightfield; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Allows the formation of walkable regions that will flow over low lying 12 | * objects such as curbs, and up structures such as stairways. 13 | */ 14 | public function rcFilterLowHangingWalkableObstacles(ctx:RCContext, walkableClimb:int, solid:RCHeightfield):void 15 | { 16 | internal_rcFilterLowHangingWalkableObstacles(ctx.ptr, walkableClimb, solid.ptr); 17 | } 18 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/filter/rcFilterWalkableLowHeightSpans.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.filter 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcFilterWalkableLowHeightSpans; 5 | import recastnavigation.recast.RCContext; 6 | import recastnavigation.recast.RCHeightfield; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Marks walkable spans as not walkable if the clearence 12 | * above the span is less than the specified height. 13 | */ 14 | public function rcFilterWalkableLowHeightSpans(ctx:RCContext, walkableHeight:int, solid:RCHeightfield):void 15 | { 16 | internal_rcFilterWalkableLowHeightSpans(ctx.ptr, walkableHeight, solid.ptr); 17 | } 18 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/mesh/rcBuildPolyMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.mesh 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildPolyMesh; 5 | import recastnavigation.recast.RCContext; 6 | import recastnavigation.recast.contour.RCContourSet; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Builds a polygon mesh from the provided contours. 12 | */ 13 | public function rcBuildPolyMesh(ctx:RCContext, cset:RCContourSet, nvp:int, mesh:RCPolyMesh):Boolean 14 | { 15 | return internal_rcBuildPolyMesh(ctx.ptr, cset.ptr, nvp, mesh.ptr); 16 | } 17 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/mesh/rcCopyPolyMesh.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.mesh 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcCopyPolyMesh; 5 | import recastnavigation.recast.RCContext; 6 | 7 | use namespace rn_internal; 8 | 9 | /** 10 | * Copies the poly mesh data from src to dst. 11 | */ 12 | public function rcCopyPolyMesh(ctx:RCContext, src:RCPolyMesh, dst:RCPolyMesh):Boolean 13 | { 14 | return internal_rcCopyPolyMesh(ctx.ptr, src.ptr, dst.ptr); 15 | } 16 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/mesh/rcMergePolyMeshes.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.mesh 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.copyBytes; 5 | import recastnavigation.internal_api.CModule; 6 | import recastnavigation.internal_api.internal_rcMergePolyMeshes; 7 | import recastnavigation.recast.RCContext; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Merges multiple polygon meshes into a single mesh. 13 | */ 14 | public function rcMergePolyMeshes(ctx:RCContext, meshes:Vector., mesh:RCPolyMesh):Boolean 15 | { 16 | var nmeshes:int = meshes.length; 17 | var meshes_ptr:int = CModule.malloc(nmeshes * RCPolyMesh.SIZE); 18 | for (var i:int = 0; i < nmeshes; ++i) 19 | copyBytes(meshes[i].ptr, meshes_ptr + RCPolyMesh.SIZE * i, RCPolyMesh.SIZE); 20 | var res:Boolean = internal_rcMergePolyMeshes(ctx.ptr, meshes_ptr, nmeshes, mesh.ptr); 21 | CModule.free(meshes_ptr); 22 | return res; 23 | } 24 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/meshdetail/RCPolyMeshDetail.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.meshdetail 2 | { 3 | import recastnavigation.core.RNBase; 4 | import recastnavigation.core.rn_internal; 5 | import recastnavigation.core.utils.offsetBytes; 6 | import recastnavigation.internal_api.CModule; 7 | import recastnavigation.internal_api.internal_rcAllocPolyMeshDetail; 8 | import recastnavigation.internal_api.internal_rcFreePolyMeshDetail; 9 | 10 | use namespace rn_internal; 11 | 12 | /** 13 | * Contains triangle meshes that represent detailed height data associated 14 | * with the polygons in its associated polygon mesh object. 15 | */ 16 | public class RCPolyMeshDetail extends RNBase 17 | { 18 | rn_internal static var SIZE:int = 0; 19 | rn_internal static const OFFSET_MESHES:int = offsetBytes(4, RCPolyMeshDetail); 20 | rn_internal static const OFFSET_VERTS:int = offsetBytes(4, RCPolyMeshDetail); 21 | rn_internal static const OFFSET_TRIS:int = offsetBytes(4, RCPolyMeshDetail); 22 | rn_internal static const OFFSET_NMESHES:int = offsetBytes(4, RCPolyMeshDetail); 23 | rn_internal static const OFFSET_NVERTS:int = offsetBytes(4, RCPolyMeshDetail); 24 | rn_internal static const OFFSET_NTRIS:int = offsetBytes(4, RCPolyMeshDetail); 25 | 26 | /** The sub-mesh data. Getter. [Size: 4*#nmeshes] */ 27 | public function getMesh(index:int):int 28 | { 29 | return CModule.read32(CModule.read32(ptr + OFFSET_MESHES) + 4 * index); 30 | } 31 | 32 | /** The sub-mesh data. Setter. [Size: 4*#nmeshes] */ 33 | public function setMesh(index:int, value:int):void 34 | { 35 | return CModule.write32(CModule.read32(ptr + OFFSET_MESHES) + 4 * index, value); 36 | } 37 | 38 | /** The mesh vertices. Getter. [Size: 3*#nverts] */ 39 | public function getVert(index:int):Number 40 | { 41 | return CModule.readFloat(CModule.read32(ptr + OFFSET_VERTS) + 4 * index); 42 | } 43 | 44 | /** The mesh vertices. Setter. [Size: 3*#nverts] */ 45 | public function setVert(index:int, value:Number):void 46 | { 47 | CModule.writeFloat(CModule.read32(ptr + OFFSET_VERTS) + 4 * index, value); 48 | } 49 | 50 | /** The mesh triangles. Getter. [Size: 4*#ntris] */ 51 | public function getTri(index:int):int 52 | { 53 | return CModule.read8(CModule.read32(ptr + OFFSET_TRIS) + 1 * index); 54 | } 55 | 56 | /** The mesh triangles. Setter. [Size: 4*#ntris] */ 57 | public function setTri(index:int, value:int):void 58 | { 59 | CModule.write8(CModule.read32(ptr + OFFSET_TRIS) + 1 * index, value); 60 | } 61 | 62 | /** The number of sub-meshes defined by #meshes. */ 63 | public function get nmeshes():int 64 | { 65 | return CModule.read32(ptr + OFFSET_NMESHES); 66 | } 67 | 68 | public function set nmeshes(value:int):void 69 | { 70 | CModule.write32(ptr + OFFSET_NMESHES, value); 71 | } 72 | 73 | /** The number of vertices in #verts. */ 74 | public function get nverts():int 75 | { 76 | return CModule.read32(ptr + OFFSET_NVERTS); 77 | } 78 | 79 | public function set nverts(value:int):void 80 | { 81 | CModule.write32(ptr + OFFSET_NVERTS, value); 82 | } 83 | 84 | /** The number of triangles in #tris. */ 85 | public function get ntris():int 86 | { 87 | return CModule.read32(ptr + OFFSET_NTRIS); 88 | } 89 | 90 | public function set ntris(value:int):void 91 | { 92 | CModule.write32(ptr + OFFSET_NTRIS, value); 93 | } 94 | 95 | public override function alloc():Boolean 96 | { 97 | ptr = internal_rcAllocPolyMeshDetail(); 98 | return ptr != 0; 99 | } 100 | 101 | public override function free():void 102 | { 103 | internal_rcFreePolyMeshDetail(ptr); 104 | ptr = 0; 105 | } 106 | } 107 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/meshdetail/rcBuildPolyMeshDetail.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.meshdetail 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildPolyMeshDetail; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | import recastnavigation.recast.mesh.RCPolyMesh; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Builds a detail mesh from the provided polygon mesh. 13 | */ 14 | public function rcBuildPolyMeshDetail(ctx:RCContext, mesh:RCPolyMesh, chf:RCCompactHeightfield, sampleDist:Number, 15 | sampleMaxError:Number, dmesh:RCPolyMeshDetail):Boolean 16 | { 17 | return internal_rcBuildPolyMeshDetail(ctx.ptr, mesh.ptr, chf.ptr, sampleDist, sampleMaxError, dmesh.ptr); 18 | } 19 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/meshdetail/rcMergePolyMeshDetails.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.meshdetail 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.copyBytes; 5 | import recastnavigation.internal_api.CModule; 6 | import recastnavigation.internal_api.internal_rcMergePolyMeshDetails; 7 | import recastnavigation.recast.RCContext; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Merges multiple detail meshes into a single detail mesh. 13 | */ 14 | public function rcMergePolyMeshDetails(ctx:RCContext, dmeshes:Vector., 15 | dmesh:RCPolyMeshDetail):Boolean 16 | { 17 | var nmeshes:int = dmeshes.length; 18 | var dmeshes_ptr:int = CModule.malloc(RCPolyMeshDetail.SIZE * nmeshes); 19 | for (var i:int = 0; i < nmeshes; ++i) 20 | copyBytes(dmeshes[i].ptr, dmeshes_ptr + RCPolyMeshDetail.SIZE * i, RCPolyMeshDetail.SIZE); 21 | var res:Boolean = internal_rcMergePolyMeshDetails(ctx.ptr, dmeshes_ptr, nmeshes, dmesh.ptr); 22 | CModule.free(dmeshes_ptr); 23 | return res; 24 | } 25 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/rcBuildCompactHeightfield.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.CModule; 5 | import recastnavigation.internal_api.internal_rcBuildCompactHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | /** 10 | * Builds a compact heightfield representing open space, 11 | * from a heightfield representing solid space. 12 | */ 13 | public function rcBuildCompactHeightfield(ctx:RCContext, cfg:RCConfig, hf:RCHeightfield, 14 | chf:RCCompactHeightfield):Boolean 15 | { 16 | return internal_rcBuildCompactHeightfield(ctx.ptr, CModule.read32(cfg.ptr + RCConfig.OFFSET_WALKABLE_HEIGHT), 17 | CModule.read32(cfg.ptr + RCConfig.OFFSET_WALKABLE_CLIMB), hf.ptr, 18 | chf.ptr); 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/rcCreateHeightfield.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.CModule; 5 | import recastnavigation.internal_api.internal_rcCreateHeightfield; 6 | 7 | use namespace rn_internal; 8 | 9 | /** 10 | * Initializes a new heightfield. 11 | */ 12 | public function rcCreateHeightfield(ctx:RCContext, hf:RCHeightfield, cfg:RCConfig):Boolean 13 | { 14 | return internal_rcCreateHeightfield(ctx.ptr, hf.ptr, CModule.read32(cfg.ptr + RCConfig.OFFSET_WIDTH), 15 | CModule.read32(cfg.ptr + RCConfig.OFFSET_HEIGHT), 16 | cfg.ptr + RCConfig.OFFSET_BMIN, cfg.ptr + RCConfig.OFFSET_BMAX, 17 | CModule.readFloat(cfg.ptr + RCConfig.OFFSET_CS), 18 | CModule.readFloat(cfg.ptr + RCConfig.OFFSET_CH)); 19 | } 20 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/rcErodeWalkableArea.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcErodeWalkableArea; 5 | 6 | use namespace rn_internal; 7 | 8 | /** 9 | * Basically, any spans that are closer to a boundary or obstruction 10 | * than the specified radius are marked as unwalkable. This method 11 | * is usually called immediately after the heightfield has been built. 12 | */ 13 | public function rcErodeWalkableArea(ctx:RCContext, radius:int, chf:RCCompactHeightfield):Boolean 14 | { 15 | return internal_rcErodeWalkableArea(ctx.ptr, radius, chf.ptr); 16 | } 17 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/rcMarkWalkableTriangles.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.mallocInt32Vector; 5 | import recastnavigation.core.utils.mallocNumberVector; 6 | import recastnavigation.internal_api.CModule; 7 | import recastnavigation.internal_api.internal_rcMarkWalkableTriangles; 8 | 9 | use namespace rn_internal; 10 | 11 | /** 12 | * Sets the area id of all triangles with a slope below the specified value to #RC_WALKABLE_AREA. 13 | */ 14 | public function rcMarkWalkableTriangles(ctx:RCContext, walkableSlopeAngle:Number, verts:Vector., 15 | tris:Vector., resultAreas:Vector.):void 16 | { 17 | var i:int; 18 | 19 | var verts_ptr:int = mallocNumberVector(verts); 20 | var nv:int = verts.length / 3; 21 | var tris_ptr:int = mallocInt32Vector(tris); 22 | var nt:int = tris.length / 3; 23 | resultAreas.fixed = false; 24 | resultAreas.length = nt; 25 | resultAreas.fixed = true; 26 | var areas_ptr:int = CModule.malloc(nt); 27 | for (i = 0; i < nt; ++i) 28 | CModule.write8(areas_ptr + i, 0); 29 | internal_rcMarkWalkableTriangles(ctx.ptr, walkableSlopeAngle, verts_ptr, nv, tris_ptr, nt, areas_ptr); 30 | CModule.free(verts_ptr); 31 | CModule.free(tris_ptr); 32 | for (i = 0; i < nt; ++i) 33 | resultAreas[i] = CModule.read8(areas_ptr + i); 34 | CModule.free(areas_ptr); 35 | } 36 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/rcRasterizeTriangles.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.core.utils.mallocInt32Vector; 5 | import recastnavigation.core.utils.mallocInt8Vector; 6 | import recastnavigation.core.utils.mallocNumberVector; 7 | import recastnavigation.internal_api.CModule; 8 | import recastnavigation.internal_api.internal_rcRasterizeTriangles; 9 | 10 | use namespace rn_internal; 11 | 12 | /** 13 | * Rasterizes an indexed triangle mesh into the specified heightfield. 14 | */ 15 | public function rcRasterizeTriangles(ctx:RCContext, verts:Vector., tris:Vector., areas:Vector., 16 | solid:RCHeightfield, flagMergeThr:int = 1.0):void 17 | { 18 | var verts_ptr:int = mallocNumberVector(verts); 19 | var nv:int = verts.length / 3; 20 | var tris_ptr:int = mallocInt32Vector(tris); 21 | var areas_ptr:int = mallocInt8Vector(areas); 22 | var nt:int = tris.length / 3; 23 | internal_rcRasterizeTriangles(ctx.ptr, verts_ptr, nv, tris_ptr, areas_ptr, nt, solid.ptr, flagMergeThr); 24 | CModule.free(verts_ptr); 25 | CModule.free(tris_ptr); 26 | CModule.free(areas_ptr); 27 | } 28 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/region/rcBuildDistanceField.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.region 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildDistanceField; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Builds the distance field for the specified compact heightfield. 12 | */ 13 | public function rcBuildDistanceField(ctx:RCContext, chf:RCCompactHeightfield):Boolean 14 | { 15 | return internal_rcBuildDistanceField(ctx.ptr, chf.ptr); 16 | } 17 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/region/rcBuildLayerRegions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.region 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildLayerRegions; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Builds region data for the heightfield by partitioning the heightfield in non-overlapping layers. 12 | */ 13 | public function rcBuildLayerRegions(ctx:RCContext, chf:RCCompactHeightfield, borderSize:int, 14 | minRegionArea:int):Boolean 15 | { 16 | return internal_rcBuildLayerRegions(ctx.ptr, chf.ptr, borderSize, minRegionArea); 17 | } 18 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/region/rcBuildRegions.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.region 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildRegions; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Builds region data for the heightfield using watershed partitioning. 12 | */ 13 | public function rcBuildRegions(ctx:RCContext, chf:RCCompactHeightfield, borderSize:int, minRegionArea:int, 14 | mergeRegionArea:int):Boolean 15 | { 16 | return internal_rcBuildRegions(ctx.ptr, chf.ptr, borderSize, minRegionArea, mergeRegionArea); 17 | } 18 | } -------------------------------------------------------------------------------- /as3_lib/src/recastnavigation/recast/region/rcBuildRegionsMonotone.as: -------------------------------------------------------------------------------- 1 | package recastnavigation.recast.region 2 | { 3 | import recastnavigation.core.rn_internal; 4 | import recastnavigation.internal_api.internal_rcBuildRegionsMonotone; 5 | import recastnavigation.recast.RCCompactHeightfield; 6 | import recastnavigation.recast.RCContext; 7 | 8 | use namespace rn_internal; 9 | 10 | /** 11 | * Builds region data for the heightfield using simple monotone partitioning. 12 | */ 13 | public function rcBuildRegionsMonotone(ctx:RCContext, chf:RCCompactHeightfield, borderSize:int, minRegionArea:int, 14 | mergeRegionArea:int):Boolean 15 | { 16 | return internal_rcBuildRegionsMonotone(ctx.ptr, chf.ptr, borderSize, minRegionArea, mergeRegionArea); 17 | } 18 | } -------------------------------------------------------------------------------- /demo/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 | -------------------------------------------------------------------------------- /demo/html-template/history/historyFrame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | Hidden frame for Browser History support. 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo/html-template/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/html-template/playerProductInstall.swf -------------------------------------------------------------------------------- /demo/lib/Feathers-Lib.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/lib/Feathers-Lib.swc -------------------------------------------------------------------------------- /demo/lib/Starling-Extension-Graphics.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/lib/Starling-Extension-Graphics.swc -------------------------------------------------------------------------------- /demo/lib/starling.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/lib/starling.swc -------------------------------------------------------------------------------- /demo/meshes/Mesh-001.obj: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware 2 | # File Created: 18.08.2014 21:10:52 3 | 4 | # 5 | # object default 6 | # 7 | 8 | v -39.3055 0.0000 -0.2310 9 | v -39.3055 0.0000 11.9419 10 | v -26.8232 0.0000 -0.2310 11 | v -26.8232 0.0000 11.9419 12 | v -14.3409 0.0000 -0.2310 13 | v -1.8585 0.0000 11.9419 14 | v 12.1121 0.0000 -0.2310 15 | v -54.0462 0.0000 -12.4039 16 | v -26.8232 0.0000 -12.4039 17 | v -14.3409 0.0000 -12.4039 18 | v 12.1121 0.0000 -12.4039 19 | v -54.0462 0.0000 -24.5767 20 | v -26.8232 0.0000 -24.5767 21 | v -14.3409 0.0000 -24.5767 22 | v -1.8585 0.0000 -24.5767 23 | v -109.6237 0.0000 -36.7496 24 | v -109.6237 0.0000 -24.5767 25 | v -54.0462 0.0000 -36.7496 26 | v -26.8232 0.0000 -36.7496 27 | v -14.3409 0.0000 -36.7496 28 | v -1.8585 0.0000 -36.7496 29 | v -14.3409 0.0000 11.9419 30 | # 22 vertices 31 | 32 | g default 33 | f 1 2 3 34 | f 3 4 5 35 | f 5 6 7 36 | f 8 1 9 37 | f 10 5 11 38 | f 12 8 13 39 | f 14 10 15 40 | f 16 17 18 41 | f 18 12 19 42 | f 20 14 21 43 | f 2 4 3 44 | f 4 22 5 45 | f 5 22 6 46 | f 1 3 9 47 | f 5 7 11 48 | f 8 9 13 49 | f 10 11 15 50 | f 17 12 18 51 | f 12 13 19 52 | f 14 15 21 53 | # 20 faces 54 | 55 | -------------------------------------------------------------------------------- /demo/meshes/Mesh-002.obj: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware 2 | # File Created: 18.08.2014 21:13:24 3 | 4 | # 5 | # object default001 6 | # 7 | 8 | v 23.1061 0.0000 -73.2682 9 | v 18.8787 0.0000 -120.6371 10 | v 1.2332 0.0000 -96.6763 11 | v 6.3964 0.0000 -120.6371 12 | v -11.2491 0.0000 -96.6763 13 | v -18.5683 0.0000 -120.6371 14 | v -57.0429 0.0000 -86.3500 15 | v 37.8468 0.0000 -61.0953 16 | v 10.6238 0.0000 -61.0953 17 | v -27.2815 0.0000 -66.8215 18 | v -53.7345 0.0000 -66.8215 19 | v 90.4246 0.0000 -66.2123 20 | v 10.6238 0.0000 -48.9224 21 | v -27.2815 0.0000 -54.6486 22 | v -39.7639 0.0000 -54.6486 23 | v 12.1121 0.0000 -0.2310 24 | v 101.8949 0.0000 -1.6727 25 | v 12.1121 0.0000 -12.4039 26 | v -1.8585 0.0000 -24.5767 27 | v -1.8585 0.0000 -36.7496 28 | v -14.3409 0.0000 -36.7496 29 | v -6.0860 0.0000 -120.6371 30 | v -39.3055 0.0000 -0.2310 31 | v -39.3055 0.0000 11.9419 32 | v -26.8232 0.0000 -0.2310 33 | v -26.8232 0.0000 11.9419 34 | v -14.3409 0.0000 -0.2310 35 | v -1.8585 0.0000 11.9419 36 | v -54.0462 0.0000 -12.4039 37 | v -26.8232 0.0000 -12.4039 38 | v -14.3409 0.0000 -12.4039 39 | v -54.0462 0.0000 -24.5767 40 | v -26.8232 0.0000 -24.5767 41 | v -14.3409 0.0000 -24.5767 42 | v -109.6237 0.0000 -36.7496 43 | v -109.6237 0.0000 -24.5767 44 | v -54.0462 0.0000 -36.7496 45 | v -26.8232 0.0000 -36.7496 46 | v -14.3409 0.0000 11.9419 47 | # 39 vertices 48 | 49 | g default001 50 | f 1 2 3 51 | f 3 4 5 52 | f 5 6 7 53 | f 8 1 9 54 | f 10 5 11 55 | f 12 8 13 56 | f 14 10 15 57 | f 16 17 18 58 | f 18 12 19 59 | f 20 14 21 60 | f 2 4 3 61 | f 4 22 5 62 | f 5 22 6 63 | f 1 3 9 64 | f 5 7 11 65 | f 8 9 13 66 | f 10 11 15 67 | f 17 12 18 68 | f 12 13 19 69 | f 14 15 21 70 | f 23 24 25 71 | f 25 26 27 72 | f 27 28 16 73 | f 29 23 30 74 | f 31 27 18 75 | f 32 29 33 76 | f 34 31 19 77 | f 35 36 37 78 | f 37 32 38 79 | f 21 34 20 80 | f 24 26 25 81 | f 26 39 27 82 | f 27 39 28 83 | f 23 25 30 84 | f 27 16 18 85 | f 29 30 33 86 | f 31 18 19 87 | f 36 32 37 88 | f 32 33 38 89 | f 34 19 20 90 | # 40 faces 91 | 92 | -------------------------------------------------------------------------------- /demo/src/app/Main.as: -------------------------------------------------------------------------------- 1 | package app 2 | { 3 | import app.data.mesh.EmbeddedMeshes; 4 | 5 | import feathers.system.DeviceCapabilities; 6 | 7 | import flash.display.Sprite; 8 | 9 | import starling.core.Starling; 10 | 11 | [SWF(width="1280", height="720", frameRate="60", backgroundColor="0x262422")] 12 | public class Main extends Sprite 13 | { 14 | private var _starlingInstance:Starling; 15 | 16 | public function Main() 17 | { 18 | EmbeddedMeshes.initialize(); 19 | DeviceCapabilities.dpi = 150; 20 | _starlingInstance = new Starling(MainApplication, stage); 21 | // _starlingInstance = new Starling(TestApplication, stage); 22 | // _starlingInstance.showStats = true; 23 | _starlingInstance.start(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /demo/src/app/MainApplication.as: -------------------------------------------------------------------------------- 1 | package app 2 | { 3 | import app.model.GUIModel; 4 | import app.model.SoloMesh; 5 | import app.rccontext.CustomRCContext; 6 | import app.view.GUIView; 7 | import app.view.GUIViewMediator; 8 | import app.view.LogViewMediator; 9 | import app.view.MeshViewMediator; 10 | import app.view.PropertiesViewMediator; 11 | import app.view.SceneView; 12 | import app.view.SceneViewMediator; 13 | import app.view.ToolsViewMediator; 14 | import app.view.tool.CrowdToolViewMediator; 15 | import app.view.tool.TesterToolViewMediator; 16 | 17 | import feathers.themes.MetalWorksMobileTheme; 18 | 19 | import flash.utils.getTimer; 20 | 21 | import starling.display.Sprite; 22 | import starling.events.Event; 23 | 24 | public class MainApplication extends Sprite 25 | { 26 | private var _soloMesh:SoloMesh; 27 | private var _prevTime:uint; 28 | 29 | public function MainApplication() 30 | { 31 | super(); 32 | addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); 33 | } 34 | 35 | private function onAddedToStage(event:Event):void 36 | { 37 | removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); 38 | addEventListener(Event.ENTER_FRAME, onEnterFrame); 39 | _prevTime = getTimer(); 40 | 41 | var context:CustomRCContext = new CustomRCContext(true); 42 | context.alloc(); 43 | 44 | _soloMesh = new SoloMesh(); 45 | _soloMesh.connect(context); 46 | 47 | var sceneView:SceneView = new SceneView(); 48 | addChild(sceneView); 49 | 50 | var guiModel:GUIModel = new GUIModel(); 51 | 52 | new MetalWorksMobileTheme(); 53 | var guiView:GUIView = new GUIView(); 54 | addChild(guiView); 55 | 56 | (new GUIViewMediator()).connect(guiView, guiModel, _soloMesh); 57 | (new LogViewMediator()).connect(guiView.logView, guiModel, context); 58 | (new PropertiesViewMediator()).connect(guiView.propertiesView, guiModel, _soloMesh); 59 | (new ToolsViewMediator()).connect(guiView.toolsView, _soloMesh); 60 | 61 | (new SceneViewMediator()).connect(sceneView, _soloMesh); 62 | (new MeshViewMediator()).connect(sceneView.meshView, _soloMesh); 63 | (new TesterToolViewMediator()).connect(sceneView.toolView, _soloMesh); 64 | (new CrowdToolViewMediator()).connect(sceneView.toolView, _soloMesh); 65 | } 66 | 67 | private function onEnterFrame(event:Event):void 68 | { 69 | var currTime:uint = getTimer(); 70 | var dt:Number = (currTime - _prevTime) / 1000; 71 | _prevTime = currTime; 72 | 73 | _soloMesh.handleUpdate(dt); 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /demo/src/app/TestApplication.as: -------------------------------------------------------------------------------- 1 | package app 2 | { 3 | import app.data.mesh.MeshInfo; 4 | import app.data.mesh.MeshInfoLibrary; 5 | import app.model.SoloMesh; 6 | 7 | import flash.geom.Point; 8 | 9 | import recastnavigation.detour.crowd.DTCrowd; 10 | import recastnavigation.detour.navmeshquery.DTQueryFilter; 11 | import recastnavigation.recast.RCContext; 12 | 13 | import starling.display.Sprite; 14 | import starling.events.Event; 15 | 16 | public class TestApplication extends Sprite 17 | { 18 | public function TestApplication() 19 | { 20 | super(); 21 | addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); 22 | } 23 | 24 | private function onAddedToStage():void 25 | { 26 | removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); 27 | var meshInfo:MeshInfo = MeshInfoLibrary.instance.getMeshInfoByName("Obj-test-1.obj"); 28 | var soloMesh:SoloMesh = new SoloMesh(); 29 | var rcContext:RCContext = new RCContext(); 30 | rcContext.alloc(); 31 | soloMesh.connect(rcContext); 32 | soloMesh.setMesh(meshInfo); 33 | soloMesh.build(); 34 | trace("Mesh built."); 35 | 36 | var crowd:DTCrowd = new DTCrowd(); 37 | crowd.alloc(); 38 | 39 | var filter:DTQueryFilter = new DTQueryFilter(); 40 | filter.alloc(); 41 | 42 | var p:Point = new Point(); 43 | soloMesh.query.findNearestPoly(p.x, 0, p.y, 20, 40, 20, filter); 44 | p.setTo(soloMesh.query.nearestPtX, soloMesh.query.nearestPtZ); 45 | var ref:int = soloMesh.query.nearestRef; 46 | trace(p, ref); 47 | 48 | crowd.init(128, 5, soloMesh.navMesh); 49 | for (var i:int = crowd.getAgentCount() - 1; i >= 0; --i) 50 | { 51 | if (crowd.getAgent(i).active) 52 | trace("active"); 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /demo/src/app/data/ColorData.as: -------------------------------------------------------------------------------- 1 | package app.data 2 | { 3 | import recastnavigation.debugutils.duRGBA; 4 | 5 | public class ColorData 6 | { 7 | public var r:int; 8 | public var g:int; 9 | public var b:int; 10 | public var a:int; 11 | 12 | public function ColorData(r:int = 0, g:int = 0, b:int = 0, a:int = 0) 13 | { 14 | this.r = r; 15 | this.g = g; 16 | this.b = b; 17 | this.a = a; 18 | } 19 | 20 | public function getFlashColor():uint 21 | { 22 | return (r << 16) | (g << 8) | (b << 0); 23 | } 24 | 25 | public function getFlashAlpha():Number 26 | { 27 | return a / 255; 28 | } 29 | 30 | public function getRecastColor():int 31 | { 32 | return duRGBA(r, g, b, a); 33 | } 34 | 35 | public function copyFrom(colorData:ColorData):void 36 | { 37 | r = colorData.r; 38 | g = colorData.g; 39 | b = colorData.b; 40 | a = colorData.a; 41 | } 42 | 43 | public function mutliply(t:Number):void 44 | { 45 | r *= t; 46 | g *= t; 47 | b *= t; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /demo/src/app/data/DebugDrawVertexData.as: -------------------------------------------------------------------------------- 1 | package app.data 2 | { 3 | public class DebugDrawVertexData 4 | { 5 | public var x:Number; 6 | public var y:Number; 7 | public var color:uint; 8 | public var alpha:Number; 9 | 10 | public function DebugDrawVertexData() 11 | { 12 | } 13 | 14 | public function toString():String 15 | { 16 | return "(x:" + x + ", y:" + y + ", color:" + color + ", alpha:" + alpha + ")"; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /demo/src/app/data/MeshBounds.as: -------------------------------------------------------------------------------- 1 | package app.data 2 | { 3 | public class MeshBounds 4 | { 5 | public var x:Number; 6 | public var y:Number; 7 | public var z:Number; 8 | 9 | public function MeshBounds() 10 | { 11 | } 12 | 13 | public function toString():String 14 | { 15 | return "(" + x.toString() + ", " + y.toString() + ", " + z.toString() + ")"; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /demo/src/app/data/mesh/EmbeddedMeshes.as: -------------------------------------------------------------------------------- 1 | package app.data.mesh 2 | { 3 | public class EmbeddedMeshes 4 | { 5 | [Embed(source="/../meshes/Mesh-001.obj", mimeType="application/octet-stream")] 6 | private static const Mesh1:Class; 7 | 8 | [Embed(source="/../meshes/Mesh-002.obj", mimeType="application/octet-stream")] 9 | private static const Mesh2:Class; 10 | 11 | public function EmbeddedMeshes() 12 | { 13 | } 14 | 15 | public static function initialize():void 16 | { 17 | MeshInfoLibrary.instance.addMeshInfoFromByteArray(new Mesh1(), "Mesh-1.obj"); 18 | MeshInfoLibrary.instance.addMeshInfoFromByteArray(new Mesh2(), "Mesh-2.obj"); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /demo/src/app/data/mesh/MeshInfo.as: -------------------------------------------------------------------------------- 1 | package app.data.mesh 2 | { 3 | import app.data.MeshBounds; 4 | 5 | import flash.utils.ByteArray; 6 | 7 | public class MeshInfo 8 | { 9 | public var name:String; 10 | public const verts:Vector. = new Vector.(); 11 | public const tris:Vector. = new Vector.(); 12 | public const normals:Vector. = new Vector.(); 13 | public var nverts:int = 0; 14 | public var ntris:int = 0; 15 | 16 | public function MeshInfo() 17 | { 18 | } 19 | 20 | public function initFromByteArray(byteArray:ByteArray, scale:Number = 1.0):void 21 | { 22 | var i:int; 23 | byteArray.position = 0; 24 | var string:String = byteArray.readUTFBytes(byteArray.bytesAvailable); 25 | var lines:Array = string.split("\r\n"); 26 | var length:int = lines.length; 27 | for (i = 0; i < length; ++i) 28 | { 29 | var parts:Array = lines[i].split(/\s+/gi); 30 | if (parts[0] == "v") 31 | { 32 | ++nverts; 33 | verts.push(scale * parts[1], scale * parts[2], scale * parts[3]); 34 | } 35 | if (parts[0] == "f") 36 | { 37 | ++ntris; 38 | tris.push(parts[1] - 1, parts[2] - 1, parts[3] - 1); 39 | } 40 | } 41 | 42 | // Calculate normals. 43 | for (i = 0; i < 3 * ntris; i += 3) 44 | { 45 | var v0x:Number = verts[3 * tris[i + 0] + 0]; 46 | var v0y:Number = verts[3 * tris[i + 0] + 1]; 47 | var v0z:Number = verts[3 * tris[i + 0] + 2]; 48 | var v1x:Number = verts[3 * tris[i + 1] + 0]; 49 | var v1y:Number = verts[3 * tris[i + 1] + 1]; 50 | var v1z:Number = verts[3 * tris[i + 1] + 2]; 51 | var v2x:Number = verts[3 * tris[i + 2] + 0]; 52 | var v2y:Number = verts[3 * tris[i + 2] + 1]; 53 | var v2z:Number = verts[3 * tris[i + 2] + 2]; 54 | var e0x:Number = v1x - v0x; 55 | var e1x:Number = v2x - v0x; 56 | var e0y:Number = v1y - v0y; 57 | var e1y:Number = v2y - v0y; 58 | var e0z:Number = v1z - v0z; 59 | var e1z:Number = v2z - v0z; 60 | var nx:Number = e0y * e1z - e0z * e1y; 61 | var ny:Number = e0z * e1x - e0x * e1z; 62 | var nz:Number = e0x * e1y - e0y * e1x; 63 | var d:Number = Math.sqrt(nx * nx + ny * ny + nz * nz); 64 | if (d > 0) 65 | { 66 | d = 1 / d; 67 | nx *= d; 68 | ny *= d; 69 | nz *= d; 70 | } 71 | normals[i + 0] = nx; 72 | normals[i + 1] = ny; 73 | normals[i + 2] = nz; 74 | } 75 | } 76 | 77 | public function getMeshBoundMin(resultBounds:MeshBounds = null):MeshBounds 78 | { 79 | if (resultBounds == null) 80 | resultBounds = new MeshBounds(); 81 | resultBounds.x = Number.POSITIVE_INFINITY; 82 | resultBounds.y = Number.POSITIVE_INFINITY; 83 | resultBounds.z = Number.POSITIVE_INFINITY; 84 | for (var i:int = 0; i < nverts; ++i) 85 | { 86 | resultBounds.x = Math.min(resultBounds.x, verts[3 * i + 0]); 87 | resultBounds.y = Math.min(resultBounds.y, verts[3 * i + 1]); 88 | resultBounds.z = Math.min(resultBounds.z, verts[3 * i + 2]); 89 | } 90 | return resultBounds; 91 | } 92 | 93 | public function getMeshBoundMax(resultBounds:MeshBounds = null):MeshBounds 94 | { 95 | if (resultBounds == null) 96 | resultBounds = new MeshBounds(); 97 | resultBounds.x = Number.NEGATIVE_INFINITY; 98 | resultBounds.y = Number.NEGATIVE_INFINITY; 99 | resultBounds.z = Number.NEGATIVE_INFINITY; 100 | for (var i:int = 0; i < nverts; ++i) 101 | { 102 | resultBounds.x = Math.max(resultBounds.x, verts[3 * i + 0]); 103 | resultBounds.y = Math.max(resultBounds.y, verts[3 * i + 1]); 104 | resultBounds.z = Math.max(resultBounds.z, verts[3 * i + 2]); 105 | } 106 | return resultBounds; 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /demo/src/app/data/mesh/MeshInfoLibrary.as: -------------------------------------------------------------------------------- 1 | package app.data.mesh 2 | { 3 | import flash.utils.ByteArray; 4 | import flash.utils.Dictionary; 5 | 6 | public class MeshInfoLibrary 7 | { 8 | public static const instance:MeshInfoLibrary = new MeshInfoLibrary(); 9 | 10 | public const meshes:Vector. = new Vector.(); 11 | 12 | private const _meshInfoByName:Dictionary = new Dictionary(); 13 | 14 | public function MeshInfoLibrary() 15 | { 16 | } 17 | 18 | public function addMeshInfoFromByteArray(byteArray:ByteArray, name:String, scale:Number = 1.0):void 19 | { 20 | var meshInfo:MeshInfo = new MeshInfo(); 21 | meshInfo.name = name; 22 | meshInfo.initFromByteArray(byteArray, scale); 23 | meshes.push(meshInfo); 24 | _meshInfoByName[name] = meshInfo; 25 | } 26 | 27 | public function getMeshInfoByName(name:String):MeshInfo 28 | { 29 | return _meshInfoByName[name]; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /demo/src/app/model/CoordSpace.as: -------------------------------------------------------------------------------- 1 | package app.model 2 | { 3 | import flash.geom.Point; 4 | 5 | public class CoordSpace 6 | { 7 | private var _textureSize:Number; 8 | private var _xMin:Number; 9 | private var _yMin:Number; 10 | private var _xMax:Number; 11 | private var _yMax:Number; 12 | 13 | public function CoordSpace() 14 | { 15 | } 16 | 17 | public function reset(textureSize:Number, xMin:Number, yMin:Number, xMax:Number, yMax:Number):void 18 | { 19 | _textureSize = textureSize; 20 | _xMin = xMin; 21 | _yMin = yMin; 22 | _xMax = xMax; 23 | _yMax = yMax; 24 | } 25 | 26 | public function sceneToModel(point:Point, resultPoint:Point = null):Point 27 | { 28 | if (resultPoint == null) 29 | resultPoint = new Point(); 30 | var dx:Number = _xMax - _xMin; 31 | var dy:Number = _yMax - _yMin; 32 | if (dx < dy) 33 | { 34 | resultPoint.setTo(_xMin - 0.5 * (dy - dx) + (point.x / _textureSize) * dy, 35 | _yMin + (point.y / _textureSize) * dy); 36 | } 37 | else 38 | { 39 | resultPoint.setTo(_xMin + (point.x / _textureSize) * dx, 40 | _yMin - 0.5 * (dx - dy) + (point.y / _textureSize) * dx); 41 | } 42 | return resultPoint; 43 | } 44 | 45 | public function modelToScene(point:Point, resultPoint:Point = null):Point 46 | { 47 | if (resultPoint == null) 48 | resultPoint = new Point(); 49 | var dx:Number = _xMax - _xMin; 50 | var dy:Number = _yMax - _yMin; 51 | if (dx < dy) 52 | { 53 | resultPoint.setTo(_textureSize * (point.x - _xMin + 0.5 * (dy - dx)) / dy, 54 | _textureSize * (point.y - _yMin) / dy); 55 | } 56 | else 57 | { 58 | resultPoint.setTo(_textureSize * (point.x - _xMin) / dx, 59 | _textureSize * (point.y - _yMin + 0.5 * (dx - dy)) / dx); 60 | } 61 | return resultPoint; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /demo/src/app/model/GUIModel.as: -------------------------------------------------------------------------------- 1 | package app.model 2 | { 3 | import flash.events.EventDispatcher; 4 | 5 | public class GUIModel extends EventDispatcher 6 | { 7 | public static const BOUNDS_PADDING:Number = 1; 8 | 9 | private var _showLog:Boolean = false; 10 | 11 | public function GUIModel() 12 | { 13 | } 14 | 15 | public function get showLog():Boolean 16 | { 17 | return _showLog; 18 | } 19 | 20 | public function set showLog(value:Boolean):void 21 | { 22 | if (_showLog != value) 23 | { 24 | _showLog = value; 25 | dispatchEvent(new GUIModelEvent(GUIModelEvent.TOGGLE_SHOW_LOG)); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /demo/src/app/model/GUIModelEvent.as: -------------------------------------------------------------------------------- 1 | package app.model 2 | { 3 | import flash.events.Event; 4 | 5 | public class GUIModelEvent extends Event 6 | { 7 | public static const TOGGLE_SHOW_LOG:String = "toggleShowLog"; 8 | 9 | public function GUIModelEvent(type:String) 10 | { 11 | super(type); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /demo/src/app/model/SoloMeshEvent.as: -------------------------------------------------------------------------------- 1 | package app.model 2 | { 3 | import flash.events.Event; 4 | 5 | public class SoloMeshEvent extends Event 6 | { 7 | public static const BUILD_COMPLETE:String = "buildComplete"; 8 | public static const MESH_SELECTED:String = "meshSelected"; 9 | public static const TOOL_CHANGED:String = "toolChanged"; 10 | public static const NO_TOOL_SELECTED:String = "noToolSelected"; 11 | public static const NO_MESH_SELECTED:String = "noMeshSelected"; 12 | public static const MESH_IS_NOT_BUILT:String = "meshIsNotBuilt"; 13 | 14 | public function SoloMeshEvent(type:String) 15 | { 16 | super(type); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /demo/src/app/model/enum/PartitionType.as: -------------------------------------------------------------------------------- 1 | package app.model.enum 2 | { 3 | public class PartitionType 4 | { 5 | public static const PARTITION_WATERSHED:int = 0; 6 | public static const PARTITION_MONOTONE:int = 1; 7 | public static const PARTITION_LAYERS:int = 2; 8 | } 9 | } -------------------------------------------------------------------------------- /demo/src/app/model/enum/ToolType.as: -------------------------------------------------------------------------------- 1 | package app.model.enum 2 | { 3 | public class ToolType 4 | { 5 | public static const TOOL_TESTER:int = 0; 6 | public static const TOOL_CROWD:int = 1; 7 | } 8 | } -------------------------------------------------------------------------------- /demo/src/app/model/tool/MeshTool.as: -------------------------------------------------------------------------------- 1 | package app.model.tool 2 | { 3 | import app.model.SoloMesh; 4 | 5 | import flash.events.EventDispatcher; 6 | 7 | public class MeshTool extends EventDispatcher 8 | { 9 | protected var _soloMesh:SoloMesh; 10 | protected var _toolState:int; 11 | protected var _isWake:Boolean; 12 | 13 | public function MeshTool() 14 | { 15 | super(); 16 | } 17 | 18 | public function get soloMesh():SoloMesh 19 | { 20 | return _soloMesh; 21 | } 22 | 23 | public function get toolState():int 24 | { 25 | return _toolState; 26 | } 27 | 28 | public function connect(soloMesh:SoloMesh):void 29 | { 30 | _soloMesh = soloMesh; 31 | } 32 | 33 | public function setToolState(toolState:int):void 34 | { 35 | _toolState = toolState; 36 | } 37 | 38 | public function handleClick(x:Number, y:Number, shift:Boolean):void 39 | { 40 | } 41 | 42 | public function sleep():void 43 | { 44 | _isWake = false; 45 | dispatchEvent(new MeshToolEvent(MeshToolEvent.SLEEP)); 46 | } 47 | 48 | public function wake():void 49 | { 50 | _isWake = true; 51 | dispatchEvent(new MeshToolEvent(MeshToolEvent.WAKE)); 52 | } 53 | 54 | public function handleUpdate(dt:Number):void 55 | { 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /demo/src/app/model/tool/MeshToolEvent.as: -------------------------------------------------------------------------------- 1 | package app.model.tool 2 | { 3 | import flash.events.Event; 4 | 5 | public class MeshToolEvent extends Event 6 | { 7 | public static const RENDER:String = "render"; 8 | public static const WAKE:String = "wake"; 9 | public static const SLEEP:String = "sleep"; 10 | 11 | public function MeshToolEvent(type:String) 12 | { 13 | super(type); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /demo/src/app/model/tool/TesterTool.as: -------------------------------------------------------------------------------- 1 | package app.model.tool 2 | { 3 | import app.model.tool.enum.TesterToolState; 4 | 5 | import flash.geom.Point; 6 | 7 | import recastnavigation.detour.status.dtStatusInProgress; 8 | import recastnavigation.detour.status.dtStatusSucceed; 9 | import recastnavigation.detour.status.enum.DTStatus; 10 | 11 | public class TesterTool extends MeshTool 12 | { 13 | public const startPoint:Point = new Point(); 14 | public const endPoint:Point = new Point(); 15 | 16 | private var _startRef:int; 17 | private var _endRef:int; 18 | private var _slicedStatus:int; 19 | 20 | public function TesterTool() 21 | { 22 | super(); 23 | } 24 | 25 | public function get startRef():int 26 | { 27 | return _startRef; 28 | } 29 | 30 | public function get endRef():int 31 | { 32 | return _endRef; 33 | } 34 | 35 | public override function handleClick(x:Number, y:Number, shift:Boolean):void 36 | { 37 | if (shift) 38 | endPoint.setTo(x, y); 39 | else 40 | startPoint.setTo(x, y); 41 | recalc(); 42 | } 43 | 44 | private function recalc():void 45 | { 46 | _soloMesh.query.findNearestPoly(startPoint.x, 0, startPoint.y, 2, 4, 2, _soloMesh.filter); 47 | _startRef = _soloMesh.query.nearestRef; 48 | _soloMesh.query.findNearestPoly(endPoint.x, 0, endPoint.y, 2, 4, 2, _soloMesh.filter); 49 | _endRef = _soloMesh.query.nearestRef; 50 | if (_toolState == TesterToolState.STRAIGHT) 51 | { 52 | _soloMesh.query.findPath(_startRef, _endRef, startPoint.x, 0, startPoint.y, endPoint.x, 0, endPoint.y, 53 | _soloMesh.filter); 54 | _soloMesh.query.findStraightPath(startPoint.x, 0, startPoint.y, endPoint.x, 0, endPoint.y, 55 | _soloMesh.query.polys); 56 | } 57 | else 58 | { 59 | _slicedStatus = _soloMesh.query.initSlicedFindPath(_startRef, _endRef, startPoint.x, 0, startPoint.y, 60 | endPoint.x, 0, endPoint.y, _soloMesh.filter, 0); 61 | } 62 | dispatchEvent(new MeshToolEvent(MeshToolEvent.RENDER)); 63 | } 64 | 65 | public override function wake():void 66 | { 67 | super.wake(); 68 | recalc(); 69 | } 70 | 71 | override public function handleUpdate(dt:Number):void 72 | { 73 | super.handleUpdate(dt); 74 | var renderPending:Boolean; 75 | if (_toolState == TesterToolState.SLICED) 76 | { 77 | if (dtStatusInProgress(_slicedStatus)) 78 | { 79 | _slicedStatus = _soloMesh.query.updateSlicedFindPath(1); 80 | _soloMesh.query.straightPath.length = 0; 81 | _soloMesh.query.polys.length = 0; 82 | renderPending = true; 83 | } 84 | if (dtStatusSucceed(_slicedStatus)) 85 | { 86 | _soloMesh.query.finalizeSlicedFindPath(); 87 | _soloMesh.query.findStraightPath(startPoint.x, 0, startPoint.y, endPoint.x, 0, endPoint.y, 88 | _soloMesh.query.polys); 89 | _slicedStatus = DTStatus.DT_FAILURE; 90 | renderPending = true; 91 | } 92 | if (renderPending) 93 | dispatchEvent(new MeshToolEvent(MeshToolEvent.RENDER)); 94 | } 95 | } 96 | 97 | override public function setToolState(toolState:int):void 98 | { 99 | super.setToolState(toolState); 100 | if (_isWake) 101 | recalc(); 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /demo/src/app/model/tool/enum/CrowdToolState.as: -------------------------------------------------------------------------------- 1 | package app.model.tool.enum 2 | { 3 | public class CrowdToolState 4 | { 5 | public static const CREATE:int = 0; 6 | public static const MOVE:int = 1; 7 | } 8 | } -------------------------------------------------------------------------------- /demo/src/app/model/tool/enum/TesterToolState.as: -------------------------------------------------------------------------------- 1 | package app.model.tool.enum 2 | { 3 | public class TesterToolState 4 | { 5 | public static const STRAIGHT:int = 0; 6 | public static const SLICED:int = 1; 7 | } 8 | } -------------------------------------------------------------------------------- /demo/src/app/rccontext/CustomRCContext.as: -------------------------------------------------------------------------------- 1 | package app.rccontext 2 | { 3 | import flash.events.Event; 4 | import flash.events.EventDispatcher; 5 | import flash.events.IEventDispatcher; 6 | import flash.utils.getTimer; 7 | 8 | import recastnavigation.recast.RCContext; 9 | 10 | public class CustomRCContext extends RCContext implements IEventDispatcher 11 | { 12 | private const _eventDispatcher:EventDispatcher = new EventDispatcher(this); 13 | private const _logCategoryNames:Vector. = new [ 14 | "", "Progress", "Warning", "Error" 15 | ]; 16 | private const _accumulatedTimes:Vector. = new Vector.(); 17 | private const _startTimes:Vector. = new Vector.(); 18 | 19 | public function CustomRCContext(state:Boolean = true) 20 | { 21 | super(state); 22 | _accumulatedTimes.fixed = false; 23 | _accumulatedTimes.length = 29; 24 | _accumulatedTimes.fixed = true; 25 | _startTimes.fixed = false; 26 | _startTimes.length = 29; 27 | _startTimes.fixed = true; 28 | } 29 | 30 | protected override function doResetLog():void 31 | { 32 | _eventDispatcher.dispatchEvent(new CustomRCContextEvent(CustomRCContextEvent.RESET)); 33 | } 34 | 35 | protected override function doLog(logCategory:int, message:String):void 36 | { 37 | _eventDispatcher.dispatchEvent(new CustomRCContextEvent(CustomRCContextEvent.MESSAGE, logCategory, 38 | message)); 39 | } 40 | 41 | protected override function doResetTimers():void 42 | { 43 | for (var i:int = _accumulatedTimes.length - 1; i >= 0; --i) 44 | _accumulatedTimes[i] = 0; 45 | } 46 | 47 | protected override function doStartTimer(timerLabel:int):void 48 | { 49 | _startTimes[timerLabel] = getTimer(); 50 | } 51 | 52 | protected override function doStopTimer(timerLabel:int):void 53 | { 54 | _accumulatedTimes[timerLabel] += getTimer() - _startTimes[timerLabel]; 55 | } 56 | 57 | protected override function doGetAccumulatedTime(timerLabel:int):int 58 | { 59 | return _accumulatedTimes[timerLabel] * 1000; 60 | } 61 | 62 | /* **************** ** 63 | ** IEventDispatcher ** 64 | ** **************** */ 65 | 66 | public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, 67 | useWeakReference:Boolean = false):void 68 | { 69 | _eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); 70 | } 71 | 72 | public function dispatchEvent(event:Event):Boolean 73 | { 74 | return _eventDispatcher.dispatchEvent(event); 75 | } 76 | 77 | public function hasEventListener(type:String):Boolean 78 | { 79 | return _eventDispatcher.hasEventListener(type); 80 | } 81 | 82 | public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void 83 | { 84 | _eventDispatcher.removeEventListener(type, listener, useCapture); 85 | } 86 | 87 | public function willTrigger(type:String):Boolean 88 | { 89 | return _eventDispatcher.willTrigger(type); 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /demo/src/app/rccontext/CustomRCContextEvent.as: -------------------------------------------------------------------------------- 1 | package app.rccontext 2 | { 3 | import flash.events.Event; 4 | 5 | public class CustomRCContextEvent extends Event 6 | { 7 | public static const MESSAGE:String = "message"; 8 | public static const RESET:String = "reset"; 9 | 10 | private var _logCategory:int; 11 | private var _message:String; 12 | 13 | public function CustomRCContextEvent(type:String, logCategory:int = 0, message:String = null) 14 | { 15 | super(type); 16 | _logCategory = logCategory; 17 | _message = message; 18 | } 19 | 20 | public function get logCategory():int 21 | { 22 | return _logCategory; 23 | } 24 | 25 | public function get message():String 26 | { 27 | return _message; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /demo/src/app/view/GUIView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import feathers.controls.Label; 4 | import feathers.controls.Screen; 5 | import feathers.layout.AnchorLayout; 6 | import feathers.layout.AnchorLayoutData; 7 | 8 | public class GUIView extends Screen 9 | { 10 | public static const SIDEBAR_PADDING:Number = 7; 11 | public static const SIDEBAR_WIDTH:Number = 200; 12 | public static const SIDEBAR_GAP:Number = 15; 13 | public static const TOGGLE_GROUP_GAP:Number = 10; 14 | 15 | public const propertiesView:PropertiesView = new PropertiesView(); 16 | public const logView:LogView = new LogView(); 17 | public const toolsView:ToolsView = new ToolsView(); 18 | public const toolCaptionLabel:Label = new Label(); 19 | 20 | private var _propertiesViewLayoutData:AnchorLayoutData; 21 | private var _logViewLayoutData:AnchorLayoutData; 22 | 23 | public function GUIView() 24 | { 25 | super(); 26 | } 27 | 28 | protected override function initialize():void 29 | { 30 | super.initialize(); 31 | 32 | width = stage.stageWidth; 33 | height = stage.stageHeight; 34 | layout = new AnchorLayout(); 35 | 36 | var ald:AnchorLayoutData; 37 | 38 | ald = new AnchorLayoutData(); 39 | ald.top = SIDEBAR_PADDING; 40 | ald.bottom = SIDEBAR_PADDING; 41 | ald.right = SIDEBAR_PADDING; 42 | propertiesView.layoutData = ald; 43 | addChild(propertiesView); 44 | 45 | ald = new AnchorLayoutData(); 46 | ald.bottom = SIDEBAR_PADDING; 47 | ald.horizontalCenter = 0; 48 | logView.layoutData = ald; 49 | addChild(logView); 50 | 51 | ald = new AnchorLayoutData(); 52 | ald.top = SIDEBAR_PADDING; 53 | ald.bottom = SIDEBAR_PADDING; 54 | ald.left = SIDEBAR_PADDING; 55 | toolsView.layoutData = ald; 56 | addChild(toolsView); 57 | 58 | ald = new AnchorLayoutData(); 59 | ald.top = SIDEBAR_PADDING; 60 | ald.left = SIDEBAR_PADDING + toolsView.width; 61 | toolCaptionLabel.layoutData = ald; 62 | addChild(toolCaptionLabel); 63 | } 64 | 65 | public function hideLog():void 66 | { 67 | removeChild(logView); 68 | } 69 | 70 | public function showLog():void 71 | { 72 | addChild(logView); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /demo/src/app/view/GUIViewMediator.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.model.GUIModel; 4 | import app.model.GUIModelEvent; 5 | import app.model.SoloMesh; 6 | import app.model.SoloMeshEvent; 7 | import app.model.enum.ToolType; 8 | 9 | import feathers.controls.Alert; 10 | import feathers.data.ListCollection; 11 | 12 | import flash.events.Event; 13 | 14 | public class GUIViewMediator 15 | { 16 | private var _guiView:GUIView; 17 | private var _guiModel:GUIModel; 18 | private var _soloMesh:SoloMesh; 19 | 20 | public function GUIViewMediator() 21 | { 22 | } 23 | 24 | public function connect(guiView:GUIView, guiModel:GUIModel, soloMesh:SoloMesh):void 25 | { 26 | _guiView = guiView; 27 | _guiModel = guiModel; 28 | _guiModel.addEventListener(GUIModelEvent.TOGGLE_SHOW_LOG, onToggleShowLog); 29 | _soloMesh = soloMesh; 30 | _soloMesh.addEventListener(SoloMeshEvent.NO_MESH_SELECTED, onNoMeshSelected); 31 | _soloMesh.addEventListener(SoloMeshEvent.MESH_IS_NOT_BUILT, onMeshIsNotBuilt); 32 | _soloMesh.addEventListener(SoloMeshEvent.NO_TOOL_SELECTED, onNoToolSelected); 33 | _soloMesh.addEventListener(SoloMeshEvent.TOOL_CHANGED, onToolChanged); 34 | updateLog(); 35 | } 36 | 37 | private function onToolChanged(event:SoloMeshEvent):void 38 | { 39 | if (_soloMesh.currentToolType == ToolType.TOOL_TESTER) 40 | _guiView.toolCaptionLabel.text = "Click/SHIFT+Click to set Start/End points."; 41 | else 42 | _guiView.toolCaptionLabel.text = ""; 43 | } 44 | 45 | private function onNoToolSelected(event:SoloMeshEvent):void 46 | { 47 | var buttons:ListCollection = new ListCollection([ 48 | { 49 | label: "OK" 50 | } 51 | ]); 52 | Alert.show("No tool selected.", "Alert", buttons); 53 | } 54 | 55 | private function onMeshIsNotBuilt(event:SoloMeshEvent):void 56 | { 57 | var buttons:ListCollection = new ListCollection([ 58 | { 59 | label: "OK" 60 | } 61 | ]); 62 | Alert.show("Mesh is not built.", "Alert", buttons); 63 | } 64 | 65 | private function onNoMeshSelected(event:SoloMeshEvent):void 66 | { 67 | var buttons:ListCollection = new ListCollection([ 68 | { 69 | label: "OK" 70 | } 71 | ]); 72 | Alert.show("No mesh selected.", "Alert", buttons); 73 | } 74 | 75 | private function onToggleShowLog(event:Event):void 76 | { 77 | updateLog(); 78 | } 79 | 80 | private function updateLog():void 81 | { 82 | if (_guiModel.showLog) 83 | _guiView.showLog(); 84 | else 85 | _guiView.hideLog(); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /demo/src/app/view/LogView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.model.GUIModel; 4 | import app.rccontext.CustomRCContext; 5 | 6 | import feathers.controls.ScrollContainer; 7 | import feathers.controls.ScrollText; 8 | import feathers.layout.AnchorLayout; 9 | import feathers.layout.AnchorLayoutData; 10 | 11 | public class LogView extends ScrollContainer 12 | { 13 | public const scrollText:ScrollText = new ScrollText(); 14 | 15 | private var _guiModel:GUIModel; 16 | private var _context:CustomRCContext; 17 | 18 | public function LogView() 19 | { 20 | super(); 21 | } 22 | 23 | protected override function initialize():void 24 | { 25 | super.initialize(); 26 | 27 | height = 200; 28 | width = 800; 29 | layout = new AnchorLayout(); 30 | 31 | scrollText.layoutData = new AnchorLayoutData(10, 0, 10, 0); 32 | addChild(scrollText); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /demo/src/app/view/LogViewMediator.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.model.GUIModel; 4 | import app.rccontext.CustomRCContext; 5 | import app.rccontext.CustomRCContextEvent; 6 | 7 | import recastnavigation.recast.enum.RCLogCategory; 8 | 9 | public class LogViewMediator 10 | { 11 | private var _logView:LogView; 12 | private var _context:CustomRCContext; 13 | private var _guiModel:GUIModel; 14 | 15 | public function LogViewMediator() 16 | { 17 | } 18 | 19 | public function connect(logView:LogView, guiModel:GUIModel, context:CustomRCContext):void 20 | { 21 | _logView = logView; 22 | _guiModel = guiModel; 23 | _context = context; 24 | _context.addEventListener(CustomRCContextEvent.MESSAGE, onContextMessage); 25 | _context.addEventListener(CustomRCContextEvent.RESET, onContextReset); 26 | } 27 | 28 | private function onContextMessage(event:CustomRCContextEvent):void 29 | { 30 | _logView.scrollText.text += event.message + "\n"; 31 | if (event.logCategory == RCLogCategory.RC_LOG_ERROR) 32 | _guiModel.showLog = true; 33 | } 34 | 35 | private function onContextReset(event:CustomRCContextEvent):void 36 | { 37 | _logView.scrollText.text = ""; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /demo/src/app/view/MeshView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import starling.display.Image; 4 | import starling.textures.RenderTexture; 5 | 6 | public class MeshView extends Image 7 | { 8 | public function MeshView(textureSize:int) 9 | { 10 | super(new RenderTexture(textureSize, textureSize)); 11 | } 12 | 13 | public function get renderTexture():RenderTexture 14 | { 15 | return texture as RenderTexture; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /demo/src/app/view/MeshViewMediator.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.data.MeshBounds; 4 | import app.model.GUIModel; 5 | import app.model.SoloMesh; 6 | import app.model.SoloMeshEvent; 7 | import app.view.debugdraw.StarlingTextureDUDebugDraw; 8 | 9 | import recastnavigation.debugutils.duDebugDrawNavMesh; 10 | import recastnavigation.debugutils.duDebugDrawTriMeshSlope; 11 | import recastnavigation.debugutils.enum.DrawNavMeshFlags; 12 | 13 | public class MeshViewMediator 14 | { 15 | private static const HELPER_BOUNDS_1:MeshBounds = new MeshBounds(); 16 | private static const HELPER_BOUNDS_2:MeshBounds = new MeshBounds(); 17 | 18 | private var _meshView:MeshView; 19 | private var _soloMesh:SoloMesh; 20 | private var _debugDraw:StarlingTextureDUDebugDraw 21 | private var _firstBuild:Boolean; 22 | 23 | public function MeshViewMediator() 24 | { 25 | } 26 | 27 | public function connect(meshView:MeshView, soloMesh:SoloMesh):void 28 | { 29 | _meshView = meshView; 30 | _soloMesh = soloMesh; 31 | 32 | _debugDraw = new StarlingTextureDUDebugDraw(_meshView.renderTexture, 0, 0, 1, 1); 33 | _debugDraw.alloc(); 34 | 35 | _soloMesh.addEventListener(SoloMeshEvent.BUILD_COMPLETE, onMeshBuildComplete); 36 | _soloMesh.addEventListener(SoloMeshEvent.MESH_SELECTED, onMeshSelected); 37 | } 38 | 39 | private function onMeshSelected(event:SoloMeshEvent):void 40 | { 41 | _meshView.renderTexture.clear(); 42 | _soloMesh.meshInfo.getMeshBoundMin(HELPER_BOUNDS_1); 43 | _soloMesh.meshInfo.getMeshBoundMax(HELPER_BOUNDS_2); 44 | _debugDraw.reset(_meshView.renderTexture, HELPER_BOUNDS_1.x - GUIModel.BOUNDS_PADDING, 45 | HELPER_BOUNDS_1.z - GUIModel.BOUNDS_PADDING, HELPER_BOUNDS_2.x + GUIModel.BOUNDS_PADDING, 46 | HELPER_BOUNDS_2.z + GUIModel.BOUNDS_PADDING); 47 | duDebugDrawTriMeshSlope(_debugDraw, _soloMesh.meshInfo.verts, _soloMesh.meshInfo.tris, 48 | _soloMesh.meshInfo.normals, _soloMesh.agentMaxSlope, 1); 49 | _firstBuild = true; 50 | } 51 | 52 | private function onMeshBuildComplete(event:SoloMeshEvent):void 53 | { 54 | if (!_firstBuild) 55 | { 56 | _meshView.renderTexture.clear(); 57 | duDebugDrawTriMeshSlope(_debugDraw, _soloMesh.meshInfo.verts, _soloMesh.meshInfo.tris, 58 | _soloMesh.meshInfo.normals, _soloMesh.agentMaxSlope, 1); 59 | } 60 | duDebugDrawNavMesh(_debugDraw, _soloMesh.navMesh, DrawNavMeshFlags.DU_DRAWNAVMESH_COLOR_TILES); 61 | _firstBuild = false; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /demo/src/app/view/PolygonView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import starling.display.Shape; 4 | import starling.display.materials.FlatColorMaterial; 5 | 6 | public class PolygonView extends Shape 7 | { 8 | public const material:FlatColorMaterial = new FlatColorMaterial(); 9 | 10 | public var polyRef:int; 11 | 12 | public function PolygonView() 13 | { 14 | super(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /demo/src/app/view/SceneView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.model.SoloMesh; 4 | 5 | import starling.display.Sprite; 6 | 7 | public class SceneView extends Sprite 8 | { 9 | public const meshView:MeshView = new MeshView(SoloMesh.TEXTURE_SIZE); 10 | public const toolView:Sprite = new Sprite(); 11 | 12 | public function SceneView() 13 | { 14 | super(); 15 | addChild(meshView); 16 | addChild(toolView); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /demo/src/app/view/ToolsView.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.view.basic.SimpleToggleGroup; 4 | 5 | import feathers.controls.Panel; 6 | import feathers.controls.ScrollContainer; 7 | import feathers.layout.VerticalLayout; 8 | 9 | import starling.events.Event; 10 | 11 | public class ToolsView extends Panel 12 | { 13 | public const toolSelectToggleGroup:SimpleToggleGroup = new SimpleToggleGroup(new ["Test NavMesh", "Create Crowds"]); 14 | public const toolStateToggleGroups:Vector. = new [ 15 | new SimpleToggleGroup(new ["Pathfind Straight", "Pathfind Sliced"], 16 | "Tool States"), new SimpleToggleGroup(new ["Create Agents", "Move Target"], 17 | "Tool States") 18 | ]; 19 | 20 | private const _scrollContainer:ScrollContainer = new ScrollContainer(); 21 | 22 | public function ToolsView() 23 | { 24 | super(); 25 | } 26 | 27 | protected override function initialize():void 28 | { 29 | super.initialize(); 30 | width = GUIView.SIDEBAR_WIDTH; 31 | headerProperties.title = "Tools"; 32 | var vl:VerticalLayout = new VerticalLayout(); 33 | vl.gap = GUIView.SIDEBAR_GAP; 34 | vl.horizontalAlign = VerticalLayout.HORIZONTAL_ALIGN_LEFT; 35 | _scrollContainer.layout = vl; 36 | addChild(_scrollContainer); 37 | 38 | _scrollContainer.addChild(toolSelectToggleGroup); 39 | toolSelectToggleGroup.toggleGroup.selectedIndex = -1; 40 | updateToolStatesToggleGroup(); 41 | toolSelectToggleGroup.toggleGroup.addEventListener(Event.CHANGE, toolSelectToggleGroup_changeHandler); 42 | } 43 | 44 | private function toolSelectToggleGroup_changeHandler(event:Event):void 45 | { 46 | updateToolStatesToggleGroup(); 47 | } 48 | 49 | private function updateToolStatesToggleGroup():void 50 | { 51 | for (var i:int = 0; i < toolStateToggleGroups.length; ++i) 52 | { 53 | if (i == toolSelectToggleGroup.toggleGroup.selectedIndex) 54 | { 55 | _scrollContainer.addChild(toolStateToggleGroups[i]); 56 | toolStateToggleGroups[i].toggleGroup.addEventListener(Event.CHANGE, 57 | toolStateToggleGroup_changeHandler); 58 | } 59 | else 60 | { 61 | _scrollContainer.removeChild(toolStateToggleGroups[i]); 62 | toolStateToggleGroups[i].toggleGroup.removeEventListener(Event.CHANGE, 63 | toolStateToggleGroup_changeHandler); 64 | } 65 | } 66 | } 67 | 68 | private function toolStateToggleGroup_changeHandler(event:Event):void 69 | { 70 | dispatchEventWith(Event.CHANGE); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /demo/src/app/view/ToolsViewMediator.as: -------------------------------------------------------------------------------- 1 | package app.view 2 | { 3 | import app.model.SoloMesh; 4 | import app.view.basic.SimpleToggleGroup; 5 | 6 | import feathers.events.FeathersEventType; 7 | 8 | import flash.utils.Dictionary; 9 | 10 | import starling.events.Event; 11 | 12 | public class ToolsViewMediator 13 | { 14 | private var _toolsView:ToolsView; 15 | private var _soloMesh:SoloMesh; 16 | 17 | private const _toolStateByToggleGroup:Dictionary = new Dictionary(); 18 | 19 | public function ToolsViewMediator() 20 | { 21 | } 22 | 23 | public function connect(toolsView:ToolsView, soloMesh:SoloMesh):void 24 | { 25 | _toolsView = toolsView; 26 | _soloMesh = soloMesh; 27 | _toolsView.toolSelectToggleGroup.toggleGroup.selectedIndex = _soloMesh.currentToolType; 28 | _toolsView.toolSelectToggleGroup.toggleGroup.addEventListener(Event.CHANGE, onToolChanged); 29 | for (var i:int = 0; i < _toolsView.toolStateToggleGroups.length; ++i) 30 | { 31 | if (_toolsView.toolStateToggleGroups[i].isInitialized) 32 | initToolStateToggleGroup(_toolsView.toolStateToggleGroups[i]); 33 | else 34 | { 35 | _toolsView.toolStateToggleGroups[i].addEventListener(FeathersEventType.INITIALIZE, 36 | toolStateToggleGroups_initializeHandler); 37 | } 38 | _toolsView.toolStateToggleGroups[i].toggleGroup.addEventListener(Event.CHANGE, 39 | toolStateToggleGroups_changeHandler); 40 | _toolStateByToggleGroup[_toolsView.toolStateToggleGroups[i].toggleGroup] = _toolsView.toolStateToggleGroups[i]; 41 | } 42 | } 43 | 44 | private function toolStateToggleGroups_changeHandler(event:Event):void 45 | { 46 | var toolStateToggleGroup:SimpleToggleGroup = _toolStateByToggleGroup[event.target]; 47 | var index:int = _toolsView.toolStateToggleGroups.indexOf(toolStateToggleGroup); 48 | var toolState:int = _toolsView.toolStateToggleGroups[index].toggleGroup.selectedIndex; 49 | _soloMesh.meshTools[index].setToolState(toolState); 50 | } 51 | 52 | private function toolStateToggleGroups_initializeHandler(event:Event):void 53 | { 54 | initToolStateToggleGroup(event.target as SimpleToggleGroup); 55 | } 56 | 57 | private function onToolChanged(event:Event):void 58 | { 59 | _soloMesh.setCurrentToolType(_toolsView.toolSelectToggleGroup.toggleGroup.selectedIndex); 60 | } 61 | 62 | private function initToolStateToggleGroup(toolStateToggleGroup:SimpleToggleGroup):void 63 | { 64 | var index:int = _toolsView.toolStateToggleGroups.indexOf(toolStateToggleGroup); 65 | toolStateToggleGroup.toggleGroup.selectedIndex = _soloMesh.meshTools[index].toolState; 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /demo/src/app/view/basic/LabeledSlider.as: -------------------------------------------------------------------------------- 1 | package app.view.basic 2 | { 3 | import feathers.controls.Label; 4 | import feathers.controls.LayoutGroup; 5 | import feathers.controls.Slider; 6 | import feathers.layout.AnchorLayout; 7 | import feathers.layout.AnchorLayoutData; 8 | 9 | import starling.events.Event; 10 | 11 | public class LabeledSlider extends LayoutGroup 12 | { 13 | public const slider:Slider = new Slider(); 14 | public const title:Label = new Label(); 15 | 16 | private const _valueLabel:Label = new Label(); 17 | 18 | public function LabeledSlider() 19 | { 20 | } 21 | 22 | public override function dispose():void 23 | { 24 | if (isInitialized) 25 | slider.removeEventListener(Event.CHANGE, slider_changeHandler); 26 | super.dispose(); 27 | } 28 | 29 | protected override function initialize():void 30 | { 31 | super.initialize(); 32 | 33 | layout = new AnchorLayout(); 34 | 35 | var ald:AnchorLayoutData; 36 | 37 | ald = new AnchorLayoutData(); 38 | ald.verticalCenter = 0; 39 | ald.horizontalCenter = 0; 40 | slider.layoutData = ald; 41 | slider.addEventListener(Event.CHANGE, slider_changeHandler); 42 | addChild(slider); 43 | 44 | ald = new AnchorLayoutData(); 45 | ald.verticalCenter = 0; 46 | ald.left = 5; 47 | title.layoutData = ald; 48 | title.touchable = false; 49 | addChild(title); 50 | 51 | ald = new AnchorLayoutData(); 52 | ald.verticalCenter = 0; 53 | ald.right = 5; 54 | _valueLabel.layoutData = ald; 55 | _valueLabel.touchable = false; 56 | addChild(_valueLabel); 57 | } 58 | 59 | private function slider_changeHandler(event:Event):void 60 | { 61 | _valueLabel.text = slider.value.toFixed(2); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /demo/src/app/view/basic/SimpleToggleGroup.as: -------------------------------------------------------------------------------- 1 | package app.view.basic 2 | { 3 | import app.view.GUIView; 4 | 5 | import feathers.controls.Label; 6 | import feathers.controls.LayoutGroup; 7 | import feathers.controls.Radio; 8 | import feathers.core.ToggleGroup; 9 | import feathers.layout.VerticalLayout; 10 | 11 | public class SimpleToggleGroup extends LayoutGroup 12 | { 13 | public const toggleGroup:ToggleGroup = new ToggleGroup(); 14 | 15 | private var _radioNames:Vector.; 16 | private var _title:String; 17 | 18 | public function SimpleToggleGroup(radioNames:Vector., title:String = null) 19 | { 20 | super(); 21 | _radioNames = radioNames; 22 | _title = title; 23 | } 24 | 25 | protected override function initialize():void 26 | { 27 | super.initialize(); 28 | 29 | var vl:VerticalLayout = new VerticalLayout(); 30 | vl.gap = GUIView.TOGGLE_GROUP_GAP; 31 | layout = vl; 32 | 33 | if (_title != null) 34 | { 35 | var label:Label = new Label(); 36 | label.text = _title; 37 | addChild(label); 38 | } 39 | 40 | for (var i:int = 0; i < _radioNames.length; ++i) 41 | { 42 | var radio:Radio; 43 | radio = new Radio(); 44 | radio.label = _radioNames[i]; 45 | toggleGroup.addItem(radio); 46 | addChild(radio); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/README.md: -------------------------------------------------------------------------------- 1 | # Metal Works Mobile Theme for Feathers 2 | 3 | This [Feathers](http://feathersui.com/) theme for mobile devices combines has an industrial aesthetic with bright orange highlights. 4 | 5 | ## Credits 6 | 7 | Created exclusively for Feathers by [Josh Tynjala](http://twitter.com/joshtynjala). Uses the open source font [Source Sans Pro](https://github.com/adobe/Source-Sans-Pro) created by Adobe Systems Incorporated. 8 | 9 | ## Preview 10 | 11 | The Metal Works Mobile Theme is used in the [Feathers Components Explorer](http://feathersui.com/examples/components-explorer/) example. -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/fonts/SourceSansPro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/fonts/SourceSansPro-Regular.ttf -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/fonts/SourceSansPro-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/fonts/SourceSansPro-Semibold.ttf -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/Thumbs.db -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-focused-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-focused-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-inset-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-inset-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-popup-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-popup-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/background-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-back-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-call-to-action-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-call-to-action-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-call-to-action-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-call-to-action-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-danger-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-danger-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-danger-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-danger-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-forward-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-selected-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-selected-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-selected-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-selected-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/button-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-bottom-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-bottom-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-left-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-left-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-right-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-right-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-top-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/callout-arrow-top-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-disabled-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-disabled-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-down-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-down-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-up-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/check-selected-up-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/header-background-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/header-background-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/horizontal-scroll-bar-thumb-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/horizontal-scroll-bar-thumb-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-accessory-drill-down-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-accessory-drill-down-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-first-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-first-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-first-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-first-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-last-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-last-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-last-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-last-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-single-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-single-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-single-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-inset-item-single-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-item-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-item-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-item-up-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/list-item-up-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/page-indicator-normal-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/page-indicator-normal-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/page-indicator-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/page-indicator-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/picker-list-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/picker-list-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/picker-list-item-selected-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/picker-list-item-selected-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-disabled-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-disabled-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-down-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-down-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-up-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/radio-selected-up-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/search-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/search-icon.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-down-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-down-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-selected-disabled-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-selected-disabled-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-selected-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/tab-selected-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/assets/images/metalworks/vertical-scroll-bar-thumb-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rokannon/Crossbridge-Recast-Navigation/ba19b5f0a27bb645e6cabea7d37f40d4636c30d4/demo/themes/MetalWorksMobileTheme/assets/images/metalworks/vertical-scroll-bar-thumb-skin.png -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/source/feathers/themes/MetalWorksMobileTheme.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Josh Tynjala 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | package feathers.themes 26 | { 27 | import flash.display.Bitmap; 28 | import flash.display.BitmapData; 29 | 30 | import starling.events.Event; 31 | import starling.textures.Texture; 32 | import starling.textures.TextureAtlas; 33 | 34 | /** 35 | * The "Metal Works" theme for mobile Feathers apps. 36 | * 37 | *

This version of the theme embeds its assets. To load assets at 38 | * runtime, see MetalWorksMobileThemeWithAssetManager instead.

39 | * 40 | * @see http://wiki.starling-framework.org/feathers/theme-assets 41 | */ 42 | public class MetalWorksMobileTheme extends BaseMetalWorksMobileTheme 43 | { 44 | [Embed(source="/../assets/images/metalworks.xml",mimeType="application/octet-stream")] 45 | public static const ATLAS_XML:Class; 46 | 47 | [Embed(source="/../assets/images/metalworks.png")] 48 | public static const ATLAS_BITMAP:Class; 49 | 50 | public function MetalWorksMobileTheme(scaleToDPI:Boolean = true) 51 | { 52 | super(scaleToDPI); 53 | this.initialize(); 54 | this.dispatchEventWith(Event.COMPLETE); 55 | } 56 | 57 | override protected function initialize():void 58 | { 59 | var atlasBitmapData:BitmapData = Bitmap(new ATLAS_BITMAP()).bitmapData; 60 | this.atlasTexture = Texture.fromBitmapData(atlasBitmapData, false); 61 | this.atlasTexture.root.onRestore = this.atlasTexture_onRestore; 62 | atlasBitmapData.dispose(); 63 | this.atlas = new TextureAtlas(atlasTexture, XML(new ATLAS_XML())); 64 | 65 | super.initialize(); 66 | } 67 | 68 | protected function atlasTexture_onRestore():void 69 | { 70 | var atlasBitmapData:BitmapData = Bitmap(new ATLAS_BITMAP()).bitmapData; 71 | this.atlasTexture.root.uploadBitmapData(atlasBitmapData); 72 | atlasBitmapData.dispose(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /demo/themes/MetalWorksMobileTheme/source/feathers/themes/MetalWorksMobileThemeWithAssetManager.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Josh Tynjala 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | package feathers.themes 26 | { 27 | import starling.core.Starling; 28 | import starling.events.Event; 29 | import starling.utils.AssetManager; 30 | 31 | [Event(name="complete",type="starling.events.Event")] 32 | 33 | /** 34 | * The "Metal Works" theme for mobile Feathers apps. 35 | * 36 | *

This version of the theme requires loading assets at runtime. To use 37 | * embedded assets, see MetalWorksMobileTheme instead.

38 | * 39 | *

To use this theme, the following files must be included when packaging 40 | * your app:

41 | *
    42 | *
  • images/metalworks.png
  • 43 | *
  • images/metalworks.xml
  • 44 | *
45 | * 46 | * @see http://wiki.starling-framework.org/feathers/theme-assets 47 | */ 48 | public class MetalWorksMobileThemeWithAssetManager extends BaseMetalWorksMobileTheme 49 | { 50 | public function MetalWorksMobileThemeWithAssetManager(assetsBasePath:String = null, assetManager:AssetManager = null) 51 | { 52 | this.loadAssets(assetsBasePath, assetManager); 53 | } 54 | 55 | protected var assetPaths:Vector. = new 56 | [ 57 | "images/metalworks.xml", 58 | "images/metalworks.png" 59 | ]; 60 | 61 | protected var assetManager:AssetManager; 62 | 63 | override public function dispose():void 64 | { 65 | super.dispose(); 66 | if(this.assetManager) 67 | { 68 | this.assetManager.removeTextureAtlas(ATLAS_NAME); 69 | this.assetManager = null; 70 | } 71 | } 72 | 73 | override protected function initialize():void 74 | { 75 | this.atlas = this.assetManager.getTextureAtlas(ATLAS_NAME); 76 | super.initialize(); 77 | } 78 | 79 | protected function assetManager_onProgress(progress:Number):void 80 | { 81 | if(progress < 1) 82 | { 83 | return; 84 | } 85 | this.initialize(); 86 | this.dispatchEventWith(Event.COMPLETE); 87 | } 88 | 89 | protected function loadAssets(assetsBasePath:String, assetManager:AssetManager):void 90 | { 91 | this.assetManager = assetManager; 92 | if(!this.assetManager) 93 | { 94 | this.assetManager = new AssetManager(Starling.contentScaleFactor); 95 | } 96 | //add a trailing slash, if needed 97 | if(assetsBasePath.lastIndexOf("/") != assetsBasePath.length - 1) 98 | { 99 | assetsBasePath += "/"; 100 | } 101 | var assetPaths:Vector. = this.assetPaths; 102 | var assetCount:int = assetPaths.length; 103 | for(var i:int = 0; i < assetCount; i++) 104 | { 105 | var asset:String = assetPaths[i]; 106 | this.assetManager.enqueue(assetsBasePath + asset); 107 | } 108 | this.assetManager.loadQueue(assetManager_onProgress); 109 | } 110 | } 111 | } 112 | --------------------------------------------------------------------------------