- Separating demo out from the Recast folder (osx version only)
This commit is contained in:
parent
ddc9af1d93
commit
ec96c8d1ef
15234
RecastDemo/Bin/Meshes/dungeon.obj
Normal file
15234
RecastDemo/Bin/Meshes/dungeon.obj
Normal file
File diff suppressed because it is too large
Load Diff
3506
RecastDemo/Bin/Meshes/nav_test.obj
Normal file
3506
RecastDemo/Bin/Meshes/nav_test.obj
Normal file
File diff suppressed because it is too large
Load Diff
27
RecastDemo/Bin/Recast.app.dSYM/Contents/Info.plist
Normal file
27
RecastDemo/Bin/Recast.app.dSYM/Contents/Info.plist
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.Recast.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>dSYM_UUID</key>
|
||||
<dict>
|
||||
<key>i386</key>
|
||||
<string>685875C5-C5AC-A396-AD66-F1786F182F83</string>
|
||||
<key>ppc</key>
|
||||
<string>926F8AC2-E6E5-458F-D123-0BF762F1EA7D</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
BIN
RecastDemo/Bin/Recast.app.dSYM/Contents/Resources/DWARF/Recast
Normal file
BIN
RecastDemo/Bin/Recast.app.dSYM/Contents/Resources/DWARF/Recast
Normal file
Binary file not shown.
26
RecastDemo/Bin/Recast.app/Contents/Info.plist
Normal file
26
RecastDemo/Bin/Recast.app/Contents/Info.plist
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Recast</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.Recast</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Recast</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
RecastDemo/Bin/Recast.app/Contents/MacOS/Recast
Executable file
BIN
RecastDemo/Bin/Recast.app/Contents/MacOS/Recast
Executable file
Binary file not shown.
1
RecastDemo/Bin/Recast.app/Contents/PkgInfo
Normal file
1
RecastDemo/Bin/Recast.app/Contents/PkgInfo
Normal file
@ -0,0 +1 @@
|
||||
APPL????
|
Binary file not shown.
BIN
RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
generated
Normal file
BIN
RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
generated
Normal file
Binary file not shown.
BIN
RecastDemo/Bin/font.cfnt
Normal file
BIN
RecastDemo/Bin/font.cfnt
Normal file
Binary file not shown.
20
RecastDemo/Build/VC9/Recast.sln
Normal file
20
RecastDemo/Build/VC9/Recast.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recast", "Recast.vcproj", "{CEF242C5-E9A3-403B-BAFF-99397BDA5730}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
RecastDemo/Build/VC9/Recast.suo
Normal file
BIN
RecastDemo/Build/VC9/Recast.suo
Normal file
Binary file not shown.
275
RecastDemo/Build/VC9/Recast.vcproj
Normal file
275
RecastDemo/Build/VC9/Recast.vcproj
Normal file
@ -0,0 +1,275 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="Recast"
|
||||
ProjectGUID="{CEF242C5-E9A3-403B-BAFF-99397BDA5730}"
|
||||
RootNamespace="Recast"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\Examples"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\Contrib\SDL\include;..\..\Include;..\..\Examples;$(NOINHERIT)"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\Examples"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\Contrib\SDL\include;..\..\Include;..\..\Examples;$(NOINHERIT)"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\Examples\demo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Examples\glfont.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Examples\imgui.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Examples\MeshLoaderObj.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\Recast.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastContour.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastDebugDraw.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastFilter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastLog.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastMesh.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastRasterization.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastRegion.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\RecastTimer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\Examples\glfont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Examples\imgui.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Examples\MeshLoaderObj.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\Recast.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\RecastDebugDraw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\RecastLog.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\RecastTimer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
BIN
RecastDemo/Build/Xcode/English.lproj/InfoPlist.strings
Normal file
BIN
RecastDemo/Build/Xcode/English.lproj/InfoPlist.strings
Normal file
Binary file not shown.
3034
RecastDemo/Build/Xcode/English.lproj/MainMenu.xib
Normal file
3034
RecastDemo/Build/Xcode/English.lproj/MainMenu.xib
Normal file
File diff suppressed because it is too large
Load Diff
28
RecastDemo/Build/Xcode/Info.plist
Normal file
28
RecastDemo/Build/Xcode/Info.plist
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
RecastDemo/Build/Xcode/Recast.xcodeproj/TemplateIcon.icns
Normal file
BIN
RecastDemo/Build/Xcode/Recast.xcodeproj/TemplateIcon.icns
Normal file
Binary file not shown.
131
RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser
Normal file
131
RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser
Normal file
@ -0,0 +1,131 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
activeBuildConfigurationName = Release;
|
||||
activeExecutable = 6B8632970F78114600E2684A /* Recast */;
|
||||
activeTarget = 8D1107260486CEB800E47090 /* Recast */;
|
||||
addToTargets = (
|
||||
8D1107260486CEB800E47090 /* Recast */,
|
||||
);
|
||||
codeSenseManager = 6B8632AA0F78115100E2684A /* Code sense */;
|
||||
executables = (
|
||||
6B8632970F78114600E2684A /* Recast */,
|
||||
);
|
||||
perUserDictionary = {
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
625,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
PBXFileDataSource_Filename_ColumnID,
|
||||
PBXFileDataSource_Built_ColumnID,
|
||||
PBXFileDataSource_ObjectSize_ColumnID,
|
||||
PBXFileDataSource_Errors_ColumnID,
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
PBXFileDataSource_Target_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXPerProjectTemplateStateSaveDate = 260033439;
|
||||
PBXWorkspaceStateSaveDate = 260033439;
|
||||
};
|
||||
perUserProjectItems = {
|
||||
6B8633370F7813A600E2684A /* PBXTextBookmark */ = 6B8633370F7813A600E2684A /* PBXTextBookmark */;
|
||||
6B86333B0F7813A600E2684A /* PBXTextBookmark */ = 6B86333B0F7813A600E2684A /* PBXTextBookmark */;
|
||||
};
|
||||
sourceControlManager = 6B8632A90F78115100E2684A /* Source Control */;
|
||||
userBuildSettings = {
|
||||
};
|
||||
};
|
||||
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {952, 567}}";
|
||||
sepNavSelRange = "{143, 0}";
|
||||
sepNavVisRange = "{0, 143}";
|
||||
sepNavWindowFrame = "{{38, 57}, {1011, 695}}";
|
||||
};
|
||||
};
|
||||
6B8632970F78114600E2684A /* Recast */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
);
|
||||
argumentStrings = (
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 0;
|
||||
configStateDict = {
|
||||
};
|
||||
customDataFormattersEnabled = 1;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = "";
|
||||
enableDebugStr = 1;
|
||||
environmentEntries = (
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
libgmallocEnabled = 0;
|
||||
name = Recast;
|
||||
sourceDirectories = (
|
||||
);
|
||||
};
|
||||
6B8632A90F78115100E2684A /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
scmConfiguration = {
|
||||
};
|
||||
};
|
||||
6B8632AA0F78115100E2684A /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
6B8633370F7813A600E2684A /* PBXTextBookmark */ = {
|
||||
isa = PBXTextBookmark;
|
||||
fRef = 6B8633380F7813A600E2684A /* SDL_events.h */;
|
||||
name = "SDL_events.h: 238";
|
||||
rLen = 0;
|
||||
rLoc = 8641;
|
||||
rType = 0;
|
||||
vrLen = 785;
|
||||
vrLoc = 8262;
|
||||
};
|
||||
6B8633380F7813A600E2684A /* SDL_events.h */ = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
name = SDL_events.h;
|
||||
path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL_events.h;
|
||||
sourceTree = "<absolute>";
|
||||
};
|
||||
6B86333B0F7813A600E2684A /* PBXTextBookmark */ = {
|
||||
isa = PBXTextBookmark;
|
||||
fRef = 6B86333C0F7813A600E2684A /* SDL_events.h */;
|
||||
name = "SDL_events.h: 238";
|
||||
rLen = 0;
|
||||
rLoc = 8641;
|
||||
rType = 0;
|
||||
vrLen = 785;
|
||||
vrLoc = 8262;
|
||||
};
|
||||
6B86333C0F7813A600E2684A /* SDL_events.h */ = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
name = SDL_events.h;
|
||||
path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL_events.h;
|
||||
sourceTree = "<absolute>";
|
||||
};
|
||||
8D1107260486CEB800E47090 /* Recast */ = {
|
||||
activeExec = 0;
|
||||
executables = (
|
||||
6B8632970F78114600E2684A /* Recast */,
|
||||
);
|
||||
};
|
||||
}
|
1476
RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3
Normal file
1476
RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3
Normal file
File diff suppressed because it is too large
Load Diff
364
RecastDemo/Build/Xcode/Recast.xcodeproj/project.pbxproj
Normal file
364
RecastDemo/Build/Xcode/Recast.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,364 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||
6B137C6F0F7FCBBB00459200 /* demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6A0F7FCBBB00459200 /* demo.cpp */; };
|
||||
6B137C700F7FCBBB00459200 /* glfont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6B0F7FCBBB00459200 /* glfont.cpp */; };
|
||||
6B137C710F7FCBBB00459200 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6C0F7FCBBB00459200 /* imgui.cpp */; };
|
||||
6B137C720F7FCBBB00459200 /* MeshLoaderObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */; };
|
||||
6B137C730F7FCBBB00459200 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6E0F7FCBBB00459200 /* SDLMain.m */; };
|
||||
6B137C8B0F7FCC1100459200 /* Recast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C820F7FCC1100459200 /* Recast.cpp */; };
|
||||
6B137C8C0F7FCC1100459200 /* RecastContour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C830F7FCC1100459200 /* RecastContour.cpp */; };
|
||||
6B137C8D0F7FCC1100459200 /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C840F7FCC1100459200 /* RecastDebugDraw.cpp */; };
|
||||
6B137C8E0F7FCC1100459200 /* RecastFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C850F7FCC1100459200 /* RecastFilter.cpp */; };
|
||||
6B137C8F0F7FCC1100459200 /* RecastLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C860F7FCC1100459200 /* RecastLog.cpp */; };
|
||||
6B137C900F7FCC1100459200 /* RecastMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C870F7FCC1100459200 /* RecastMesh.cpp */; };
|
||||
6B137C910F7FCC1100459200 /* RecastRasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C880F7FCC1100459200 /* RecastRasterization.cpp */; };
|
||||
6B137C920F7FCC1100459200 /* RecastRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; };
|
||||
6B137C930F7FCC1100459200 /* RecastTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C8A0F7FCC1100459200 /* RecastTimer.cpp */; };
|
||||
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632D90F78122C00E2684A /* SDL.framework */; };
|
||||
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632DB0F78123E00E2684A /* OpenGL.framework */; };
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recast_Prefix.pch; sourceTree = "<group>"; };
|
||||
6B137C6A0F7FCBBB00459200 /* demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = demo.cpp; path = ../../Source/demo.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6B0F7FCBBB00459200 /* glfont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glfont.cpp; path = ../../Source/glfont.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6C0F7FCBBB00459200 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../Source/imgui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MeshLoaderObj.cpp; path = ../../Source/MeshLoaderObj.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6E0F7FCBBB00459200 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = ../../Source/SDLMain.m; sourceTree = SOURCE_ROOT; };
|
||||
6B137C790F7FCBE400459200 /* glfont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glfont.h; path = ../../Include/glfont.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C7A0F7FCBE400459200 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../Include/imgui.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C7B0F7FCBE400459200 /* MeshLoaderObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeshLoaderObj.h; path = ../../Include/MeshLoaderObj.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C7C0F7FCBE400459200 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLMain.h; path = ../../Include/SDLMain.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C7E0F7FCBFE00459200 /* Recast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Recast.h; path = ../../../Recast/Include/Recast.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C7F0F7FCBFE00459200 /* RecastDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastDebugDraw.h; path = ../../../Recast/Include/RecastDebugDraw.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C800F7FCBFE00459200 /* RecastLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastLog.h; path = ../../../Recast/Include/RecastLog.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C810F7FCBFE00459200 /* RecastTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastTimer.h; path = ../../../Recast/Include/RecastTimer.h; sourceTree = SOURCE_ROOT; };
|
||||
6B137C820F7FCC1100459200 /* Recast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Recast.cpp; path = ../../../Recast/Source/Recast.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C830F7FCC1100459200 /* RecastContour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastContour.cpp; path = ../../../Recast/Source/RecastContour.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C840F7FCC1100459200 /* RecastDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDebugDraw.cpp; path = ../../../Recast/Source/RecastDebugDraw.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C850F7FCC1100459200 /* RecastFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastFilter.cpp; path = ../../../Recast/Source/RecastFilter.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C860F7FCC1100459200 /* RecastLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastLog.cpp; path = ../../../Recast/Source/RecastLog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C870F7FCC1100459200 /* RecastMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastMesh.cpp; path = ../../../Recast/Source/RecastMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRasterization.cpp; path = ../../../Recast/Source/RecastRasterization.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C890F7FCC1100459200 /* RecastRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRegion.cpp; path = ../../../Recast/Source/RecastRegion.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C8A0F7FCC1100459200 /* RecastTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastTimer.cpp; path = ../../../Recast/Source/RecastTimer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B8632D90F78122C00E2684A /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = Library/Frameworks/SDL.framework; sourceTree = SDKROOT; };
|
||||
6B8632DB0F78123E00E2684A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* Recast.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Recast.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8D11072E0486CEB800E47090 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */,
|
||||
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B137C7D0F7FCBE800459200 /* Recast */,
|
||||
6B137C790F7FCBE400459200 /* glfont.h */,
|
||||
6B137C7A0F7FCBE400459200 /* imgui.h */,
|
||||
6B137C7B0F7FCBE400459200 /* MeshLoaderObj.h */,
|
||||
6B137C7C0F7FCBE400459200 /* SDLMain.h */,
|
||||
6B137C6A0F7FCBBB00459200 /* demo.cpp */,
|
||||
6B137C6B0F7FCBBB00459200 /* glfont.cpp */,
|
||||
6B137C6C0F7FCBBB00459200 /* imgui.cpp */,
|
||||
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */,
|
||||
6B137C6E0F7FCBBB00459200 /* SDLMain.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B8632D90F78122C00E2684A /* SDL.framework */,
|
||||
6B8632DB0F78123E00E2684A /* OpenGL.framework */,
|
||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
||||
);
|
||||
name = "Linked Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
|
||||
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
|
||||
);
|
||||
name = "Other Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D1107320486CEB800E47090 /* Recast.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97314FDCFA39411CA2CEA /* Recast */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||
);
|
||||
name = Recast;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */,
|
||||
);
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6B137C7D0F7FCBE800459200 /* Recast */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B137C820F7FCC1100459200 /* Recast.cpp */,
|
||||
6B137C830F7FCC1100459200 /* RecastContour.cpp */,
|
||||
6B137C840F7FCC1100459200 /* RecastDebugDraw.cpp */,
|
||||
6B137C850F7FCC1100459200 /* RecastFilter.cpp */,
|
||||
6B137C860F7FCC1100459200 /* RecastLog.cpp */,
|
||||
6B137C870F7FCC1100459200 /* RecastMesh.cpp */,
|
||||
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */,
|
||||
6B137C890F7FCC1100459200 /* RecastRegion.cpp */,
|
||||
6B137C8A0F7FCC1100459200 /* RecastTimer.cpp */,
|
||||
6B137C7E0F7FCBFE00459200 /* Recast.h */,
|
||||
6B137C7F0F7FCBFE00459200 /* RecastDebugDraw.h */,
|
||||
6B137C800F7FCBFE00459200 /* RecastLog.h */,
|
||||
6B137C810F7FCBFE00459200 /* RecastTimer.h */,
|
||||
);
|
||||
name = Recast;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8D1107260486CEB800E47090 /* Recast */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Recast" */;
|
||||
buildPhases = (
|
||||
8D1107290486CEB800E47090 /* Resources */,
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Recast;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = Recast;
|
||||
productReference = 8D1107320486CEB800E47090 /* Recast.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Recast" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* Recast */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D1107260486CEB800E47090 /* Recast */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
8D1107290486CEB800E47090 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
|
||||
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6B137C6F0F7FCBBB00459200 /* demo.cpp in Sources */,
|
||||
6B137C700F7FCBBB00459200 /* glfont.cpp in Sources */,
|
||||
6B137C710F7FCBBB00459200 /* imgui.cpp in Sources */,
|
||||
6B137C720F7FCBBB00459200 /* MeshLoaderObj.cpp in Sources */,
|
||||
6B137C730F7FCBBB00459200 /* SDLMain.m in Sources */,
|
||||
6B137C8B0F7FCC1100459200 /* Recast.cpp in Sources */,
|
||||
6B137C8C0F7FCC1100459200 /* RecastContour.cpp in Sources */,
|
||||
6B137C8D0F7FCC1100459200 /* RecastDebugDraw.cpp in Sources */,
|
||||
6B137C8E0F7FCC1100459200 /* RecastFilter.cpp in Sources */,
|
||||
6B137C8F0F7FCC1100459200 /* RecastLog.cpp in Sources */,
|
||||
6B137C900F7FCC1100459200 /* RecastMesh.cpp in Sources */,
|
||||
6B137C910F7FCC1100459200 /* RecastRasterization.cpp in Sources */,
|
||||
6B137C920F7FCC1100459200 /* RecastRegion.cpp in Sources */,
|
||||
6B137C930F7FCC1100459200 /* RecastTimer.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
089C165DFE840E0CC02AAC07 /* English */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
1DDD58150DA1D0A300B32029 /* English */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = ../../Bin;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = Recast_Prefix.pch;
|
||||
HEADER_SEARCH_PATHS = "/Library/Frameworks/SDL.framework/Headers/**";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = Recast;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CONFIGURATION_BUILD_DIR = ../../Bin;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = Recast_Prefix.pch;
|
||||
HEADER_SEARCH_PATHS = "/Library/Frameworks/SDL.framework/Headers/**";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = Recast;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Recast" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4B08A954540054247B /* Debug */,
|
||||
C01FCF4C08A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Recast" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4F08A954540054247B /* Debug */,
|
||||
C01FCF5008A954540054247B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||
}
|
7
RecastDemo/Build/Xcode/Recast_Prefix.pch
Normal file
7
RecastDemo/Build/Xcode/Recast_Prefix.pch
Normal file
@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'Recast' target in the 'Recast' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/demo.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/glfont.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/imgui.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/MeshLoaderObj.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/SDLMain.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/Recast.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastContour.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastDebugDraw.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastFilter.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastLog.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastMesh.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastRasterization.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastRegion.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastTimer.o
|
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/demo.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/glfont.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/imgui.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/MeshLoaderObj.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/SDLMain.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/Recast.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastContour.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastDebugDraw.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastFilter.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastLog.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastMesh.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastRasterization.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastRegion.o
|
||||
/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastTimer.o
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,56 @@
|
||||
00000000000000000000000000000000 d24cf90aabd3d95dbd191b0e43d57736 ffffffffffffffffffffffffffffffff 102 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app.dSYM
|
||||
fd63bed43f6597b9f45f1762c8fb5655 82a096cf3e962a2ea81a9f9866153e02 ffffffffffffffffffffffffffffffff 102 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app
|
||||
0000000049cf5266000000000001fb6c 13296e1543d5ae55c1d87c59e73a1bae ffffffffffffffffffffffffffffffff 26602 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
|
||||
0000000049cf5266000000000000005c c39ab8d6d91f3b7e83c0e85cac5b7f68 ffffffffffffffffffffffffffffffff 92 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
00000000000000000000000000000000 0cd7401ada453875deea91e334b49ff9 ffffffffffffffffffffffffffffffff 8 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app/Contents/PkgInfo
|
||||
00000000000000000000000000000000 0cd7401ada453875deea91e334b49ff9 ffffffffffffffffffffffffffffffff 766 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app/Contents/Info.plist
|
||||
44dc4ff1011cf447828f702012df77bb 690c27e6a4b3f6d534c8f3479144be18 ffffffffffffffffffffffffffffffff 225020 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Bin/Recast.app/Contents/MacOS/Recast
|
||||
582aa8b3ef964f5ac5ca6e10ada96da1 812ac1188eb54ef11bf678538609797d ffffffffffffffffffffffffffffffff 110332 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/Recast
|
||||
e9f468378ca9595a7dc03fd97eb82007 74284e6dec96acb6217359ba47c74360 ffffffffffffffffffffffffffffffff 109312 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/Recast
|
||||
f59d59c927c710df9c374c3246ea39b8 73969549742972a203beb3aca37beb6d ffffffffffffffffffffffffffffffff 4444 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastTimer.o
|
||||
c71a5ab16538615b2db5a26d5a9aa151 b40ab993c982a1364d41efb6e32aabab ffffffffffffffffffffffffffffffff 4180 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastTimer.o
|
||||
f59d59c9284b3c6d9c374c3246ead15a d37aa5184e4305451d61228251a6afe9 ffffffffffffffffffffffffffffffff 59956 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastRegion.o
|
||||
c71a5ab16ab44de92db5a26d5a9a49b3 ced1a06455ce0d744db57bbec6059569 ffffffffffffffffffffffffffffffff 57660 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastRegion.o
|
||||
f59d59c927c716459c374c3246eac5f1 7b1424f5623f1dff2800f7ccc9f31cdd ffffffffffffffffffffffffffffffff 22040 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastRasterization.o
|
||||
c71a5ab1653867c12db5a26d5a9a5d18 422428af83e757028e8bf9fed3cb8e4d ffffffffffffffffffffffffffffffff 19104 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastRasterization.o
|
||||
f59d59c9607d88ea9c374c3246ea8345 d5ae5aad87c5aa60df2a9aec7d5432d3 ffffffffffffffffffffffffffffffff 32012 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastMesh.o
|
||||
c71a5ab12282f96e2db5a26d5a9a1bac daed578b038da4df12f4c2563c5cc0b8 ffffffffffffffffffffffffffffffff 30096 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastMesh.o
|
||||
f59d59c9607d8e359c374c3246ea3fde 80bca2d20aa34b15b7522915c9a82693 ffffffffffffffffffffffffffffffff 6720 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastLog.o
|
||||
c71a5ab12282ffb12db5a26d5a9aa737 b879da81dde03d58cf9887d757b39776 ffffffffffffffffffffffffffffffff 6448 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastLog.o
|
||||
f59d59c927c716459c374c3246eac14b 4ee88749e9d978d35f4c994f04863504 ffffffffffffffffffffffffffffffff 17684 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastFilter.o
|
||||
c71a5ab1653867c12db5a26d5a9a59a2 17925c16e82af2aaeb96163cc9b5dcb6 ffffffffffffffffffffffffffffffff 14384 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastFilter.o
|
||||
f59d59c960c5eedc9c374c3246ef9a87 a3f2e740694e0849049ee981c64ba303 ffffffffffffffffffffffffffffffff 49912 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastDebugDraw.o
|
||||
c71a5ab1223a9f582db5a26d5a9f026e 321296cdf25d4f93a0720bdef904c116 ffffffffffffffffffffffffffffffff 39036 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastDebugDraw.o
|
||||
f59d59c9607db08f9c374c3246ea8540 a961d55772ae2ba5edb1ab9a0eafae40 ffffffffffffffffffffffffffffffff 52976 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/RecastContour.o
|
||||
c71a5ab12282c10b2db5a26d5a9a1da9 0cecb7ef9566ed43ae7a12893deec9d1 ffffffffffffffffffffffffffffffff 46364 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/RecastContour.o
|
||||
f59d59c9284b07459c374c3246eaae6c bb2581cb5e8f0fefddec50dc2dfa88b9 ffffffffffffffffffffffffffffffff 29540 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/Recast.o
|
||||
c71a5ab16ab476c12db5a26d5a9a3685 9fcd6f101247b1ebf453755457135a12 ffffffffffffffffffffffffffffffff 24380 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/Recast.o
|
||||
b63e8074b40cec42205956693107f511 612c0e390200a8c1e32a3efc923beb25 ffffffffffffffffffffffffffffffff 43228 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/SDLMain.o
|
||||
283ea167edec6922940e5ce444e170f5 7ffc38aed311fa10c196100e131e1124 ffffffffffffffffffffffffffffffff 39324 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/SDLMain.o
|
||||
f59d59c9284b07459c374c3246eab8e7 0ce9948d2106268a38ba8060aab15995 ffffffffffffffffffffffffffffffff 14920 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/MeshLoaderObj.o
|
||||
c71a5ab16ab476c12db5a26d5a9a200e 55076a86223f2ba117a78a29d9ae6b51 ffffffffffffffffffffffffffffffff 13292 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/MeshLoaderObj.o
|
||||
f59d59c9277f7bb39c374c3246efdc2a b78e068e6ca4c0f483736f043b64b882 ffffffffffffffffffffffffffffffff 64368 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/imgui.o
|
||||
c71a5ab165800a372db5a26d5a9f44c3 d6b6f2252b3d904fe0afad176750cd36 ffffffffffffffffffffffffffffffff 52976 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/imgui.o
|
||||
f59d59c9265311119c374c3246ef9d79 8a5ad89d4723baea6372acf1b5f7df19 ffffffffffffffffffffffffffffffff 23148 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/glfont.o
|
||||
c71a5ab164ac60952db5a26d5a9f0590 31b1f2cc3b1a4f8b0bb8569517e5058c ffffffffffffffffffffffffffffffff 19544 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/glfont.o
|
||||
f59d59c9272d66ac9c374c3246efd678 3a2cede702d14f8e771d57b102189336 ffffffffffffffffffffffffffffffff 75968 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/ppc/demo.o
|
||||
c71a5ab165d217282db5a26d5a9f4e91 27e66f56b66c0ba1bb83f2bd1d8e31bc ffffffffffffffffffffffffffffffff 63464 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/build/Recast.build/Release/Recast.build/Objects-normal/i386/demo.o
|
||||
0000000006f483200000000000006242 b63e8074bb55461b20595669310797fc ffffffffffffffffffffffffffffffff 33034860 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-aufjywwofgumyagiibicrmqpuzux/Recast_Prefix.pch.gch
|
||||
0000000006f483200000000000006242 f59d59c92ebf82c49c374c3246ea27d9 ffffffffffffffffffffffffffffffff 1089728 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-crjohvsotxswpnbbxekrtdkkymiw/Recast_Prefix.pch.gch
|
||||
0000000006f483200000000000006242 283ea167e2b5c37b940e5ce444e11218 ffffffffffffffffffffffffffffffff 34620180 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-efiqasnxnlfyhwevqbusabbadeep/Recast_Prefix.pch.gch
|
||||
0000000006f483200000000000006242 c71a5ab16c40f3402db5a26d5a9abf30 ffffffffffffffffffffffffffffffff 1265856 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-aurdautjolsdxqdyoylaiiwujjns/Recast_Prefix.pch.gch
|
||||
00000000000000000000000000000000 7b5a0abd88921079cb0389e2d6bc344c ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app.dSYM
|
||||
39ec41c13ab8799a4658cafd817c24f5 0ada5291fe34e5f3b32357e97a75427f ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app
|
||||
a15d1a671d542ffb31817b093f3370a6 30364f6bfda7b6f3dd56371fb6621936 ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app/Contents/MacOS/Recast
|
||||
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 33034860 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-fmaefsvxjyfjktgudmpswpblyrsy/Recast_Prefix.pch.gch
|
||||
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 1089728 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-gjzeopndiayikvehszqmgtmultpo/Recast_Prefix.pch.gch
|
||||
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 34620180 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-hdbxtokumxgrvkgwiqzezhvwenci/Recast_Prefix.pch.gch
|
||||
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 1265856 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-dvlwjkxzfxjuvofywnbosnlajcll/Recast_Prefix.pch.gch
|
||||
0000000049cf5266000000000001fb6c 9dfa82272acc812a59181379aaacaef4 ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
|
||||
0000000049cf5266000000000000005c 357d96eaf08761b8f3979592a28018a1 ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
00000000000000000000000000000000 e7aa7bc637b605131e4023704c300ffe ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app/Contents/PkgInfo
|
||||
00000000000000000000000000000000 e7aa7bc637b605131e4023704c300ffe ffffffffffffffffffffffffffffffff 0 /Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/../../Examples/Recast.app/Contents/Info.plist
|
||||
0000000049cf5266000000000000008f a664688ba12ce72fcc9041a532e683e2 ffffffffffffffffffffffffffffffff 33034860 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-dpolsqbjcjijhrcvpdsxrkkmnehb/Recast_Prefix.pch.gch
|
||||
0000000049cf5266000000000000008f 0b84545afd8d39f182b434ec9fe45da9 ffffffffffffffffffffffffffffffff 1089728 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-aaukcpnccuxemtgswixxmxhoscum/Recast_Prefix.pch.gch
|
||||
0000000049cf5266000000000000008f f54d864b77fa781f4898849196671e86 ffffffffffffffffffffffffffffffff 34620180 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-dbuweecoyyaxpidaaqifmvzhirmu/Recast_Prefix.pch.gch
|
||||
0000000049cf5266000000000000008f 8742b32199135ad9cf9425bb1b08cf22 ffffffffffffffffffffffffffffffff 1265856 /var/folders/IY/IYl4ZHKWG+iF2zDs8b+piU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Recast_Prefix-gpkiwzdzyslwztgkaxrhsngpqbxq/Recast_Prefix.pch.gch
|
Binary file not shown.
48
RecastDemo/Include/MeshLoaderObj.h
Normal file
48
RecastDemo/Include/MeshLoaderObj.h
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef MESHLOADER_OBJ
|
||||
#define MESHLOADER_OBJ
|
||||
|
||||
class rcMeshLoaderObj
|
||||
{
|
||||
public:
|
||||
rcMeshLoaderObj();
|
||||
~rcMeshLoaderObj();
|
||||
|
||||
bool load(const char* fileName);
|
||||
|
||||
inline const float* getVerts() const { return m_verts; }
|
||||
inline const float* getNormals() const { return m_normals; }
|
||||
inline const int* getTris() const { return m_tris; }
|
||||
inline int getVertCount() const { return m_vertCount; }
|
||||
inline int getTriCount() const { return m_triCount; }
|
||||
|
||||
private:
|
||||
|
||||
void addVertex(float x, float y, float z, int& cap);
|
||||
void addTriangle(int a, int b, int c, int& cap);
|
||||
|
||||
float* m_verts;
|
||||
int* m_tris;
|
||||
float* m_normals;
|
||||
int m_vertCount;
|
||||
int m_triCount;
|
||||
};
|
||||
|
||||
#endif // MESHLOADER_OBJ
|
11
RecastDemo/Include/SDLMain.h
Normal file
11
RecastDemo/Include/SDLMain.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
106
RecastDemo/Include/glfont.h
Normal file
106
RecastDemo/Include/glfont.h
Normal file
@ -0,0 +1,106 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef GLFONT_H
|
||||
#define GLFONT_H
|
||||
|
||||
class GLFont
|
||||
{
|
||||
public:
|
||||
GLFont(int renderVerts = 4096);
|
||||
~GLFont();
|
||||
|
||||
bool create(const char* fileName);
|
||||
|
||||
int getFontSize() const;
|
||||
int getDescender() const;
|
||||
int getAscender() const;
|
||||
float getLineHeight() const;
|
||||
|
||||
float getTextLength(const char* text, float size = -1, float tracking = 0);
|
||||
void drawText(float x, float y, const char* text,
|
||||
unsigned int col, float size = -1, float tracking = 0);
|
||||
|
||||
void render();
|
||||
|
||||
void debugDraw();
|
||||
|
||||
static unsigned int RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255);
|
||||
|
||||
private:
|
||||
bool createFontFromFontData(unsigned char* fd);
|
||||
|
||||
struct KerningPair
|
||||
{
|
||||
inline KerningPair() {}
|
||||
inline KerningPair(unsigned char c_, float dx_) : dx(dx_), c(c_) {}
|
||||
inline void Set(unsigned char c_, float dx_) { dx = dx_; c = c_; }
|
||||
float dx;
|
||||
unsigned char c, pad[3];
|
||||
};
|
||||
|
||||
struct CachedGlyph
|
||||
{
|
||||
inline CachedGlyph() : w(0), h(0), ox(0), oy(0), tx(0), ty(0), adv(0.0f), nkern(0), kern(0) {}
|
||||
int w, h;
|
||||
int ox, oy;
|
||||
int tx, ty;
|
||||
float adv;
|
||||
int nkern;
|
||||
union
|
||||
{
|
||||
KerningPair* kern;
|
||||
int kernOffset;
|
||||
};
|
||||
};
|
||||
|
||||
struct FontData
|
||||
{
|
||||
unsigned int endian;
|
||||
unsigned int version;
|
||||
unsigned int dataSize;
|
||||
unsigned int kernOffset;
|
||||
unsigned int textureOffset;
|
||||
int fontSize;
|
||||
unsigned int texWidth;
|
||||
unsigned int texHeight;
|
||||
int numMipmaps;
|
||||
int ascender;
|
||||
int descender;
|
||||
int lineHeight;
|
||||
int charMin;
|
||||
int charCount;
|
||||
CachedGlyph glyphs[1];
|
||||
};
|
||||
|
||||
FontData* m_fd;
|
||||
unsigned int m_texId;
|
||||
|
||||
struct RenderVertex
|
||||
{
|
||||
inline void set(float x_, float y_, float u_, float v_, unsigned int c) { x=x_; y=y_; u=u_; v=v_; col=c; }
|
||||
float x, y, u, v;
|
||||
unsigned int col;
|
||||
};
|
||||
RenderVertex* m_verts;
|
||||
int m_nverts;
|
||||
const int m_maxVerts;
|
||||
};
|
||||
|
||||
|
||||
#endif // GLFONT_H
|
45
RecastDemo/Include/imgui.h
Normal file
45
RecastDemo/Include/imgui.h
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef IMGUI_H
|
||||
#define IMGUI_H
|
||||
|
||||
#define GENID ((__LINE__) << 16)
|
||||
#define GENID1(x) ((__LINE__) << 16 | (x))
|
||||
|
||||
void imguiBeginFrame();
|
||||
void imguiEndFrame();
|
||||
void imguiRender(void (*drawText)(int x, int y, int dir, const char* text, unsigned int col));
|
||||
|
||||
bool imguiBeginScrollArea(unsigned int id, const char* name, int x, int y, int w, int h, int* scroll);
|
||||
void imguiEndScrollArea();
|
||||
|
||||
void imguiIndent();
|
||||
void imguiUnindent();
|
||||
void imguiSeparator();
|
||||
|
||||
bool imguiButton(unsigned int id, const char* text);
|
||||
bool imguiItem(unsigned int id, const char* text);
|
||||
bool imguiCheck(unsigned int id, const char* text, bool checked);
|
||||
bool imguiCollapse(unsigned int id, const char* text, bool checked);
|
||||
void imguiLabel(unsigned int id, const char* text);
|
||||
void imguiValue(unsigned int id, const char* text);
|
||||
bool imguiSlider(unsigned int id, const char* text, float* val, float vmin, float vmax, float vinc);
|
||||
|
||||
|
||||
#endif // IMGUI_H
|
219
RecastDemo/Source/MeshLoaderObj.cpp
Normal file
219
RecastDemo/Source/MeshLoaderObj.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include "MeshLoaderObj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
rcMeshLoaderObj::rcMeshLoaderObj() :
|
||||
m_verts(0),
|
||||
m_normals(0),
|
||||
m_tris(0),
|
||||
m_vertCount(0),
|
||||
m_triCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
rcMeshLoaderObj::~rcMeshLoaderObj()
|
||||
{
|
||||
delete [] m_verts;
|
||||
delete [] m_normals;
|
||||
delete [] m_tris;
|
||||
}
|
||||
|
||||
void rcMeshLoaderObj::addVertex(float x, float y, float z, int& cap)
|
||||
{
|
||||
if (m_vertCount+1 > cap)
|
||||
{
|
||||
cap = !cap ? 8 : cap*2;
|
||||
float* nv = new float[cap*3];
|
||||
if (m_vertCount)
|
||||
memcpy(nv, m_verts, m_vertCount*3*sizeof(float));
|
||||
delete [] m_verts;
|
||||
m_verts = nv;
|
||||
}
|
||||
float* dst = &m_verts[m_vertCount*3];
|
||||
*dst++ = x;
|
||||
*dst++ = y;
|
||||
*dst++ = z;
|
||||
m_vertCount++;
|
||||
}
|
||||
|
||||
void rcMeshLoaderObj::addTriangle(int a, int b, int c, int& cap)
|
||||
{
|
||||
if (m_triCount+1 > cap)
|
||||
{
|
||||
cap = !cap ? 8 : cap*2;
|
||||
int* nv = new int[cap*3];
|
||||
if (m_triCount)
|
||||
memcpy(nv, m_tris, m_triCount*3*sizeof(int));
|
||||
delete [] m_tris;
|
||||
m_tris = nv;
|
||||
}
|
||||
int* dst = &m_tris[m_triCount*3];
|
||||
*dst++ = a;
|
||||
*dst++ = b;
|
||||
*dst++ = c;
|
||||
m_triCount++;
|
||||
}
|
||||
|
||||
static char* parseRow(char* buf, char* bufEnd, char* row, int len)
|
||||
{
|
||||
bool cont = false;
|
||||
bool start = true;
|
||||
bool done = false;
|
||||
int n = 0;
|
||||
while (!done && buf < bufEnd)
|
||||
{
|
||||
char c = *buf;
|
||||
buf++;
|
||||
// multirow
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
cont = true; // multirow
|
||||
break;
|
||||
case '\n':
|
||||
if (start) break;
|
||||
done = true;
|
||||
break;
|
||||
case '\r':
|
||||
break;
|
||||
case '\t':
|
||||
case ' ':
|
||||
if (start) break;
|
||||
default:
|
||||
start = false;
|
||||
cont = false;
|
||||
row[n++] = c;
|
||||
if (n >= len-1)
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
row[n] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int parseFace(char* row, int* data, int n, int vcnt)
|
||||
{
|
||||
int j = 0;
|
||||
while (*row != '\0')
|
||||
{
|
||||
// Skip initial white space
|
||||
while (*row != '\0' && (*row == ' ' || *row == '\t'))
|
||||
row++;
|
||||
char* s = row;
|
||||
// Find vertex delimiter and terminated the string there for conversion.
|
||||
while (*row != '\0' && *row != ' ' && *row != '\t')
|
||||
{
|
||||
if (*row == '/') *row = '\0';
|
||||
row++;
|
||||
}
|
||||
if (*s == '\0')
|
||||
continue;
|
||||
int vi = atoi(s);
|
||||
data[j++] = vi < 0 ? vi+vcnt : vi-1;
|
||||
if (j >= n) return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
bool rcMeshLoaderObj::load(const char* filename)
|
||||
{
|
||||
char* buf = 0;
|
||||
FILE* fp = fopen(filename, "rb");
|
||||
if (!fp)
|
||||
return false;
|
||||
fseek(fp, 0, SEEK_END);
|
||||
int bufSize = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
buf = new char[bufSize];
|
||||
if (!buf)
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
fread(buf, bufSize, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
char* src = buf;
|
||||
char* srcEnd = buf + bufSize;
|
||||
char row[512];
|
||||
int face[32];
|
||||
float x,y,z;
|
||||
int nv;
|
||||
int vcap = 0;
|
||||
int tcap = 0;
|
||||
|
||||
while (src < srcEnd)
|
||||
{
|
||||
// Parse one row
|
||||
row[0] = '\0';
|
||||
src = parseRow(src, srcEnd, row, sizeof(row)/sizeof(char));
|
||||
// Skip comments
|
||||
if (row[0] == '#') continue;
|
||||
if (row[0] == 'v' && row[1] != 'n' && row[1] != 't')
|
||||
{
|
||||
// Vertex pos
|
||||
sscanf(row+1, "%f %f %f", &x, &y, &z);
|
||||
addVertex(x, y, z, vcap);
|
||||
}
|
||||
if (row[0] == 'f')
|
||||
{
|
||||
// Faces
|
||||
nv = parseFace(row+1, face, 32, m_vertCount);
|
||||
for (int i = 2; i < nv; ++i)
|
||||
addTriangle(face[0], face[i-1], face[i], tcap);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] buf;
|
||||
|
||||
// Calculate normals.
|
||||
m_normals = new float[m_triCount*3];
|
||||
for (int i = 0; i < m_triCount*3; i += 3)
|
||||
{
|
||||
const float* v0 = &m_verts[m_tris[i]*3];
|
||||
const float* v1 = &m_verts[m_tris[i+1]*3];
|
||||
const float* v2 = &m_verts[m_tris[i+2]*3];
|
||||
float e0[3], e1[3];
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
e0[j] = v1[j] - v0[j];
|
||||
e1[j] = v2[j] - v0[j];
|
||||
}
|
||||
float* n = &m_normals[i];
|
||||
n[0] = e0[1]*e1[2] - e0[2]*e1[1];
|
||||
n[1] = e0[2]*e1[0] - e0[0]*e1[2];
|
||||
n[2] = e0[0]*e1[1] - e0[1]*e1[0];
|
||||
float d = sqrtf(n[0]*n[0] + n[1]*n[1] + n[2]*n[2]);
|
||||
if (d > 0)
|
||||
{
|
||||
d = 1.0f/d;
|
||||
n[0] *= d;
|
||||
n[1] *= d;
|
||||
n[2] *= d;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
384
RecastDemo/Source/SDLMain.m
Normal file
384
RecastDemo/Source/SDLMain.m
Normal file
@ -0,0 +1,384 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#import "SDL.h"
|
||||
#import "SDLMain.h"
|
||||
#import <sys/param.h> /* for MAXPATHLEN */
|
||||
#import <unistd.h>
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
but the method still is there and works. To avoid warnings, we declare
|
||||
it ourselves here. */
|
||||
@interface NSApplication(SDL_Missing_Methods)
|
||||
- (void)setAppleMenu:(NSMenu *)menu;
|
||||
@end
|
||||
|
||||
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||
#define SDL_USE_NIB_FILE 0
|
||||
|
||||
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||
#define SDL_USE_CPS 1
|
||||
#ifdef SDL_USE_CPS
|
||||
/* Portions of CPS.h */
|
||||
typedef struct CPSProcessSerNum
|
||||
{
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
} CPSProcessSerNum;
|
||||
|
||||
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
static BOOL gCalledAppMainline = FALSE;
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSString *appName = 0;
|
||||
|
||||
/* Determine the application name */
|
||||
dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||
if (dict)
|
||||
appName = [dict objectForKey: @"CFBundleName"];
|
||||
|
||||
if (![appName length])
|
||||
appName = [[NSProcessInfo processInfo] processName];
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SDLApplication : NSApplication
|
||||
@end
|
||||
|
||||
@implementation SDLApplication
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
if (shouldChdir)
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
|
||||
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
|
||||
}
|
||||
CFRelease(url);
|
||||
CFRelease(url2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
[ aMenu sizeToFit ];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setApplicationMenu(void)
|
||||
{
|
||||
/* warning: this code is very odd */
|
||||
NSMenu *appleMenu;
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
appName = getApplicationName();
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Hide " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
[[NSApp mainMenu] addItem:menuItem];
|
||||
|
||||
/* Tell the application object that this is now the application menu */
|
||||
[NSApp setAppleMenu:appleMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[appleMenu release];
|
||||
[menuItem release];
|
||||
}
|
||||
|
||||
/* Create a window menu */
|
||||
static void setupWindowMenu(void)
|
||||
{
|
||||
NSMenu *windowMenu;
|
||||
NSMenuItem *windowMenuItem;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[windowMenu release];
|
||||
[windowMenuItem release];
|
||||
}
|
||||
|
||||
/* Replacement for NSApplicationMain */
|
||||
static void CustomApplicationMain (int argc, char **argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[SDLApplication sharedApplication];
|
||||
|
||||
#ifdef SDL_USE_CPS
|
||||
{
|
||||
CPSProcessSerNum PSN;
|
||||
/* Tell the dock about us */
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[SDLApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
setupWindowMenu();
|
||||
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
sdlMain = [[SDLMain alloc] init];
|
||||
[NSApp setDelegate:sdlMain];
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
[sdlMain release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Catch document open requests...this lets us notice files when the app
|
||||
* was launched by double-clicking a document, or when a document was
|
||||
* dragged/dropped on the app's icon. You need to have a
|
||||
* CFBundleDocumentsType section in your Info.plist to get this message,
|
||||
* apparently.
|
||||
*
|
||||
* Files are added to gArgv, so to the app, they'll look like command line
|
||||
* arguments. Previously, apps launched from the finder had nothing but
|
||||
* an argv[0].
|
||||
*
|
||||
* This message may be received multiple times to open several docs on launch.
|
||||
*
|
||||
* This message is ignored once the app's mainline has been called.
|
||||
*/
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
const char *temparg;
|
||||
size_t arglen;
|
||||
char *arg;
|
||||
char **newargv;
|
||||
|
||||
if (!gFinderLaunch) /* MacOS is passing command line args. */
|
||||
return FALSE;
|
||||
|
||||
if (gCalledAppMainline) /* app has started, ignore this document. */
|
||||
return FALSE;
|
||||
|
||||
temparg = [filename UTF8String];
|
||||
arglen = SDL_strlen(temparg) + 1;
|
||||
arg = (char *) SDL_malloc(arglen);
|
||||
if (arg == NULL)
|
||||
return FALSE;
|
||||
|
||||
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
|
||||
if (newargv == NULL)
|
||||
{
|
||||
SDL_free(arg);
|
||||
return FALSE;
|
||||
}
|
||||
gArgv = newargv;
|
||||
|
||||
SDL_strlcpy(arg, temparg, arglen);
|
||||
gArgv[gArgc++] = arg;
|
||||
gArgv[gArgc] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
int status;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
/* Hand off to main application code */
|
||||
gCalledAppMainline = TRUE;
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
unsigned int bufferSize;
|
||||
unsigned int selfLen = [self length];
|
||||
unsigned int aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* Copy the arguments into a global variable */
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
|
||||
gArgv[0] = argv[0];
|
||||
gArgv[1] = NULL;
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
int i;
|
||||
gArgc = argc;
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
|
||||
for (i = 0; i <= argc; i++)
|
||||
gArgv[i] = argv[i];
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
[SDLApplication poseAsClass:[NSApplication class]];
|
||||
NSApplicationMain (argc, argv);
|
||||
#else
|
||||
CustomApplicationMain (argc, argv);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
796
RecastDemo/Source/demo.cpp
Normal file
796
RecastDemo/Source/demo.cpp
Normal file
@ -0,0 +1,796 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#include "SDL.h"
|
||||
#include "SDL_Opengl.h"
|
||||
#include "GLFont.h"
|
||||
#include "RecastTimer.h"
|
||||
#include "MeshLoaderObj.h"
|
||||
#include "Recast.h"
|
||||
#include "RecastLog.h"
|
||||
#include "RecastDebugDraw.h"
|
||||
#include "imgui.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
bool intersectSegmentTriangle(const float* sp, const float* sq,
|
||||
const float* a, const float* b, const float* c,
|
||||
float &t)
|
||||
{
|
||||
float v, w;
|
||||
float ab[3], ac[3], qp[3], ap[3], norm[3], e[3];
|
||||
vsub(ab, b, a);
|
||||
vsub(ac, c, a);
|
||||
vsub(qp, sp, sq);
|
||||
|
||||
// Compute triangle normal. Can be precalculated or cached if
|
||||
// intersecting multiple segments against the same triangle
|
||||
vcross(norm, ab, ac);
|
||||
|
||||
// Compute denominator d. If d <= 0, segment is parallel to or points
|
||||
// away from triangle, so exit early
|
||||
float d = vdot(qp, norm);
|
||||
if (d <= 0.0f) return false;
|
||||
|
||||
// Compute intersection t value of pq with plane of triangle. A ray
|
||||
// intersects iff 0 <= t. Segment intersects iff 0 <= t <= 1. Delay
|
||||
// dividing by d until intersection has been found to pierce triangle
|
||||
vsub(ap, sp, a);
|
||||
t = vdot(ap, norm);
|
||||
if (t < 0.0f) return false;
|
||||
if (t > d) return false; // For segment; exclude this code line for a ray test
|
||||
|
||||
// Compute barycentric coordinate components and test if within bounds
|
||||
vcross(e, qp, ap);
|
||||
v = vdot(ac, e);
|
||||
if (v < 0.0f || v > d) return false;
|
||||
w = -vdot(ab, e);
|
||||
if (w < 0.0f || v + w > d) return false;
|
||||
|
||||
// Segment/ray intersects triangle. Perform delayed division
|
||||
t /= d;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool raycast(rcMeshLoaderObj& mesh, float* src, float* dst, float& tmin)
|
||||
{
|
||||
float dir[3];
|
||||
vsub(dir, dst, src);
|
||||
|
||||
int nt = mesh.getTriCount();
|
||||
const float* verts = mesh.getVerts();
|
||||
const float* normals = mesh.getNormals();
|
||||
const int* tris = mesh.getTris();
|
||||
tmin = 1.0f;
|
||||
bool hit = false;
|
||||
|
||||
for (int i = 0; i < nt*3; i += 3)
|
||||
{
|
||||
const float* n = &normals[i];
|
||||
if (vdot(dir, n) > 0)
|
||||
continue;
|
||||
|
||||
float t = 1;
|
||||
if (intersectSegmentTriangle(src, dst,
|
||||
&verts[tris[i]*3],
|
||||
&verts[tris[i+1]*3],
|
||||
&verts[tris[i+2]*3], t))
|
||||
{
|
||||
if (t < tmin)
|
||||
tmin = t;
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
struct FileList
|
||||
{
|
||||
static const int MAX_FILES = 256;
|
||||
inline FileList() : size(0) {}
|
||||
inline ~FileList()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
for (int i = 0; i < size; ++i)
|
||||
delete [] files[i];
|
||||
size = 0;
|
||||
}
|
||||
|
||||
void add(const char* path)
|
||||
{
|
||||
if (size >= MAX_FILES)
|
||||
return;
|
||||
int n = strlen(path);
|
||||
files[size] = new char[n+1];
|
||||
strcpy(files[size], path);
|
||||
size++;
|
||||
}
|
||||
|
||||
char* files[MAX_FILES];
|
||||
int size;
|
||||
};
|
||||
|
||||
void scanDirectory(const char* path, const char* ext, FileList& list)
|
||||
{
|
||||
list.clear();
|
||||
|
||||
#ifdef WIN32
|
||||
_finddata_t dir;
|
||||
char pathWithExt[MAX_PATH];
|
||||
long fh;
|
||||
strcpy(pathWithExt, path);
|
||||
strcat(pathWithExt, "/*");
|
||||
strcat(pathWithExt, ext);
|
||||
fh = _findfirst(pathWithExt, &dir);
|
||||
if (fh == -1L)
|
||||
return;
|
||||
do
|
||||
{
|
||||
list.add(dir.name);
|
||||
}
|
||||
while (_findnext(fh, &dir) == 0);
|
||||
_findclose(fh);
|
||||
#else
|
||||
dirent* current = 0;
|
||||
DIR* dp = opendir(path);
|
||||
if (!dp)
|
||||
return;
|
||||
|
||||
while ((current = readdir(dp)) != 0)
|
||||
{
|
||||
int len = strlen(current->d_name);
|
||||
if (len > 4 && strncmp(current->d_name+len-4, ext, 4) == 0)
|
||||
{
|
||||
list.add(current->d_name);
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
enum DrawMode
|
||||
{
|
||||
DRAWMODE_POLYMESH,
|
||||
DRAWMODE_POLYMESH_TRANS,
|
||||
DRAWMODE_MESH,
|
||||
DRAWMODE_VOXELS,
|
||||
DRAWMODE_VOXELS_WALKABLE,
|
||||
DRAWMODE_COMPACT,
|
||||
DRAWMODE_COMPACT_DISTANCE,
|
||||
DRAWMODE_COMPACT_REGIONS,
|
||||
DRAWMODE_RAW_CONTOURS,
|
||||
DRAWMODE_CONTOURS,
|
||||
MAX_DRAWMODE,
|
||||
};
|
||||
|
||||
|
||||
GLFont g_font;
|
||||
|
||||
void drawText(int x, int y, int dir, const char* text, unsigned int col)
|
||||
{
|
||||
if (dir < 0)
|
||||
g_font.drawText((float)x - g_font.getTextLength(text), (float)y, text, col);
|
||||
else
|
||||
g_font.drawText((float)x, (float)y, text, col);
|
||||
}
|
||||
|
||||
|
||||
rcMeshLoaderObj* g_mesh = 0;
|
||||
unsigned char* g_triangleFlags = 0;
|
||||
rcHeightfield* g_solid = 0;
|
||||
rcCompactHeightfield* g_chf = 0;
|
||||
rcContourSet* g_cset = 0;
|
||||
rcPolyMesh* g_polyMesh = 0;
|
||||
rcConfig g_cfg;
|
||||
rcLog g_log;
|
||||
|
||||
static bool buildNavigation()
|
||||
{
|
||||
delete g_solid;
|
||||
delete g_chf;
|
||||
delete g_cset;
|
||||
delete g_polyMesh;
|
||||
delete [] g_triangleFlags;
|
||||
g_solid = 0;
|
||||
g_chf = 0;
|
||||
g_cset = 0;
|
||||
g_polyMesh = 0;
|
||||
g_triangleFlags = 0;
|
||||
|
||||
g_log.clear();
|
||||
rcSetLog(&g_log);
|
||||
|
||||
if (!g_mesh)
|
||||
{
|
||||
g_log.log(RC_LOG_ERROR, "Input mesh is not valid.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
rcTimeVal startTime = rcGetPerformanceTimer();
|
||||
|
||||
rcCalcBounds(g_mesh->getVerts(), g_mesh->getVertCount(), g_cfg.bmin, g_cfg.bmax);
|
||||
rcCalcGridSize(g_cfg.bmin, g_cfg.bmax, g_cfg.cs, &g_cfg.width, &g_cfg.height);
|
||||
|
||||
g_log.log(RC_LOG_PROGRESS, "Building navigation");
|
||||
g_log.log(RC_LOG_PROGRESS, " - %d x %d", g_cfg.width, g_cfg.height);
|
||||
g_log.log(RC_LOG_PROGRESS, " - %d verts, %d tris", g_mesh->getVertCount(), g_mesh->getTriCount());
|
||||
|
||||
g_triangleFlags = new unsigned char[g_mesh->getTriCount()];
|
||||
memset(g_triangleFlags, 0, g_mesh->getTriCount());
|
||||
rcMarkWalkableTriangles(g_cfg.walkableSlopeAngle,
|
||||
g_mesh->getTris(), g_mesh->getNormals(), g_mesh->getTriCount(),
|
||||
g_triangleFlags);
|
||||
|
||||
g_solid = new rcHeightfield;
|
||||
g_chf = new rcCompactHeightfield;
|
||||
g_cset = new rcContourSet;
|
||||
g_polyMesh = new rcPolyMesh;
|
||||
|
||||
if (!rcBuildNavMesh(g_cfg, g_mesh->getVerts(), g_mesh->getVertCount(),
|
||||
g_mesh->getTris(), g_triangleFlags, g_mesh->getTriCount(),
|
||||
*g_solid, *g_chf, *g_cset, *g_polyMesh))
|
||||
{
|
||||
g_log.log(RC_LOG_ERROR, "Could not build navmesh.");
|
||||
return false;
|
||||
}
|
||||
|
||||
rcTimeVal endTime = rcGetPerformanceTimer();
|
||||
g_log.log(RC_LOG_PROGRESS, "Build time: %.1f ms", rcGetDeltaTimeUsec(startTime, endTime)/1000.0f);
|
||||
g_log.log(RC_LOG_PROGRESS, "NavMesh");
|
||||
g_log.log(RC_LOG_PROGRESS, " - %d verts, %d polys", g_polyMesh->nverts, g_polyMesh->npolys);
|
||||
const int navMeshDataSize = g_polyMesh->nverts*3*sizeof(unsigned short) +
|
||||
g_polyMesh->npolys*g_polyMesh->nvp*2*sizeof(unsigned short);
|
||||
g_log.log(RC_LOG_PROGRESS, " - Approx data size %.1f kB", (float)navMeshDataSize/1024.f);
|
||||
|
||||
for (int i = 0; i < g_log.getMessageCount(); ++i)
|
||||
{
|
||||
printf("%s\n", g_log.getMessageText(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init SDL
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
|
||||
{
|
||||
printf("Could not initialise SDL\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Init OpenGL
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
||||
|
||||
int width = 1200;
|
||||
int height = 700;
|
||||
SDL_Surface* screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL);
|
||||
if (!screen)
|
||||
{
|
||||
printf("Could not initialise SDL opengl\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_WM_SetCaption("Recast Demo", 0);
|
||||
|
||||
if(!g_font.create("font.cfnt"))
|
||||
{
|
||||
printf("Could not load font\n");
|
||||
SDL_Quit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
float cellSize = 0.3f;
|
||||
float cellHeight = 0.2f;
|
||||
float agentHeight = 2.0f;
|
||||
float agentRadius = 0.3f;
|
||||
float agentMaxClimb = 0.9f;
|
||||
float agentMaxSlope = 45.0f;
|
||||
float regionMinSize = 50;
|
||||
float regionMergeSize = 20;
|
||||
float edgeMaxLen = 12.0f;
|
||||
float edgeMaxError = 1.5f;
|
||||
float vertsPerPoly = 6.0f;
|
||||
int drawMode = DRAWMODE_POLYMESH;
|
||||
bool showLevels = false;
|
||||
bool showLog = false;
|
||||
char curLevel[256] = "Choose Level...";
|
||||
bool mouseOverMenu = false;
|
||||
FileList fileList;
|
||||
|
||||
float t = 0.0f;
|
||||
Uint32 lastTime = SDL_GetTicks();
|
||||
int mx = 0, my = 0;
|
||||
float rx = 45;
|
||||
float ry = -45;
|
||||
float moveW = 0, moveS = 0, moveA = 0, moveD = 0;
|
||||
float camx = 0, camy = 0, camz = 0, camr=10;
|
||||
float origrx, origry;
|
||||
int origx, origy;
|
||||
bool rotate = false;
|
||||
float rays[3], raye[3];
|
||||
float spos[3] = {0,0,0};
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
float fogCol[4] = { 0.1f,0.12f,0.14f,1 };
|
||||
glEnable(GL_FOG);
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
glFogf(GL_FOG_START, 0);
|
||||
glFogf(GL_FOG_END, 10);
|
||||
glFogfv(GL_FOG_COLOR, fogCol);
|
||||
|
||||
bool done = false;
|
||||
while(!done)
|
||||
{
|
||||
// Handle input events.
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_KEYDOWN:
|
||||
// Handle any key presses here.
|
||||
if(event.key.keysym.sym == SDLK_ESCAPE)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
// Handle mouse clicks here.
|
||||
if (!mouseOverMenu)
|
||||
{
|
||||
if (event.button.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
// Rotate view
|
||||
rotate = true;
|
||||
origx = mx;
|
||||
origy = my;
|
||||
origrx = rx;
|
||||
origry = ry;
|
||||
}
|
||||
else if (event.button.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
// Hit test mesh.
|
||||
if (g_mesh)
|
||||
{
|
||||
float t;
|
||||
if (raycast(*g_mesh, rays, raye, t))
|
||||
{
|
||||
spos[0] = rays[0] + (raye[0] - rays[0])*t;
|
||||
spos[1] = rays[1] + (raye[1] - rays[1])*t;
|
||||
spos[2] = rays[2] + (raye[2] - rays[2])*t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
// Handle mouse clicks here.
|
||||
if(event.button.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
rotate = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
mx = event.motion.x;
|
||||
my = height - 1 - event.motion.y;
|
||||
if (rotate)
|
||||
{
|
||||
int dx = mx - origx;
|
||||
int dy = my - origy;
|
||||
rx = origrx - dy*0.25f;
|
||||
ry = origry + dx*0.25f;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
done = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 time = SDL_GetTicks();
|
||||
float dt = (time - lastTime) / 1000.0f;
|
||||
lastTime = time;
|
||||
|
||||
t += dt;
|
||||
|
||||
|
||||
// Update and render
|
||||
glViewport(0, 0, width, height);
|
||||
glClearColor(0.3f, 0.3f, 0.32f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
// Render 3d
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(50.0f, (float)width/(float)height, 1.0f, camr);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glRotatef(rx,1,0,0);
|
||||
glRotatef(ry,0,1,0);
|
||||
glTranslatef(-camx, -camy, -camz);
|
||||
|
||||
// Get hit ray position and direction.
|
||||
GLdouble proj[16];
|
||||
GLdouble model[16];
|
||||
GLint view[4];
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, proj);
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, model);
|
||||
glGetIntegerv(GL_VIEWPORT, view);
|
||||
GLdouble x, y, z;
|
||||
gluUnProject(mx, my, 0.0f, model, proj, view, &x, &y, &z);
|
||||
rays[0] = (float)x; rays[1] = (float)y; rays[2] = (float)z;
|
||||
gluUnProject(mx, my, 1.0f, model, proj, view, &x, &y, &z);
|
||||
raye[0] = (float)x; raye[1] = (float)y; raye[2] = (float)z;
|
||||
|
||||
// Handle keyboard movement.
|
||||
Uint8* keystate = SDL_GetKeyState(NULL);
|
||||
moveW = rcClamp(moveW + dt * 4 * (keystate[SDLK_w] ? 1 : -1), 0.0f, 1.0f);
|
||||
moveS = rcClamp(moveS + dt * 4 * (keystate[SDLK_s] ? 1 : -1), 0.0f, 1.0f);
|
||||
moveA = rcClamp(moveA + dt * 4 * (keystate[SDLK_a] ? 1 : -1), 0.0f, 1.0f);
|
||||
moveD = rcClamp(moveD + dt * 4 * (keystate[SDLK_d] ? 1 : -1), 0.0f, 1.0f);
|
||||
|
||||
float keybSpeed = 22.0f;
|
||||
if (SDL_GetModState() & KMOD_SHIFT)
|
||||
keybSpeed *= 4.0f;
|
||||
|
||||
float movex = (moveD - moveA) * keybSpeed * dt;
|
||||
float movey = (moveS - moveW) * keybSpeed * dt;
|
||||
|
||||
camx += movex * (float)model[0];
|
||||
camy += movex * (float)model[4];
|
||||
camz += movex * (float)model[8];
|
||||
|
||||
camx += movey * (float)model[2];
|
||||
camy += movey * (float)model[6];
|
||||
camz += movey * (float)model[10];
|
||||
|
||||
glEnable(GL_FOG);
|
||||
|
||||
if (drawMode == DRAWMODE_MESH)
|
||||
{
|
||||
if (g_mesh)
|
||||
rcDebugDrawMesh(*g_mesh, g_triangleFlags);
|
||||
}
|
||||
else if (drawMode != DRAWMODE_POLYMESH_TRANS)
|
||||
{
|
||||
if (g_mesh)
|
||||
rcDebugDrawMesh(*g_mesh, 0);
|
||||
}
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
if (drawMode == DRAWMODE_POLYMESH || drawMode == DRAWMODE_POLYMESH_TRANS)
|
||||
{
|
||||
if (g_polyMesh)
|
||||
rcDebugDrawPolyMesh(*g_polyMesh, g_cfg.bmin, g_cfg.cs, g_cfg.ch);
|
||||
}
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
if (drawMode == DRAWMODE_COMPACT)
|
||||
{
|
||||
if (g_chf)
|
||||
rcDebugDrawCompactHeightfieldSolid(*g_chf);
|
||||
}
|
||||
if (drawMode == DRAWMODE_COMPACT_DISTANCE)
|
||||
{
|
||||
if (g_chf)
|
||||
rcDebugDrawCompactHeightfieldDistance(*g_chf);
|
||||
}
|
||||
if (drawMode == DRAWMODE_COMPACT_REGIONS)
|
||||
{
|
||||
if (g_chf)
|
||||
rcDebugDrawCompactHeightfieldRegions(*g_chf);
|
||||
}
|
||||
if (drawMode == DRAWMODE_VOXELS)
|
||||
{
|
||||
if (g_solid)
|
||||
rcDebugDrawHeightfieldSolid(*g_solid, g_cfg.bmin, g_cfg.cs, g_cfg.ch);
|
||||
}
|
||||
if (drawMode == DRAWMODE_VOXELS_WALKABLE)
|
||||
{
|
||||
if (g_solid)
|
||||
rcDebugDrawHeightfieldWalkable(*g_solid, g_cfg.bmin, g_cfg.cs, g_cfg.ch);
|
||||
}
|
||||
if (drawMode == DRAWMODE_RAW_CONTOURS)
|
||||
{
|
||||
if (g_cset)
|
||||
rcDebugDrawRawContours(*g_cset, g_cfg.bmin, g_cfg.cs, g_cfg.ch);
|
||||
}
|
||||
if (drawMode == DRAWMODE_CONTOURS)
|
||||
{
|
||||
if (g_cset)
|
||||
rcDebugDrawContours(*g_cset, g_cfg.bmin, g_cfg.cs, g_cfg.ch);
|
||||
}
|
||||
|
||||
glDisable(GL_FOG);
|
||||
|
||||
if (g_mesh)
|
||||
{
|
||||
// Agent dimensions.
|
||||
const float r = agentRadius;
|
||||
const float h = agentHeight;
|
||||
float col[4];
|
||||
col[0] = 0.6f; col[1] = 0.1f; col[2] = 0.1f; col[3] = 0.75f;
|
||||
rcDebugDrawCylinderWire(spos[0]-r, spos[1]+0.02f, spos[2]-r, spos[0]+r, spos[1]+h, spos[2]+r, col);
|
||||
|
||||
glColor4ub(0,0,0,196);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(spos[0], spos[1]-agentMaxClimb, spos[2]);
|
||||
glVertex3f(spos[0], spos[1]+agentMaxClimb, spos[2]);
|
||||
glVertex3f(spos[0]-r/2, spos[1]+0.02f, spos[2]);
|
||||
glVertex3f(spos[0]+r/2, spos[1]+0.02f, spos[2]);
|
||||
glVertex3f(spos[0], spos[1]+0.02f, spos[2]-r/2);
|
||||
glVertex3f(spos[0], spos[1]+0.02f, spos[2]+r/2);
|
||||
glEnd();
|
||||
|
||||
// Mesh bbox.
|
||||
col[0] = 1.0f; col[1] = 1.0f; col[2] = 1.0f; col[3] = 0.25f;
|
||||
rcDebugDrawBoxWire(g_cfg.bmin[0], g_cfg.bmin[1], g_cfg.bmin[2],
|
||||
g_cfg.bmax[0], g_cfg.bmax[1], g_cfg.bmax[2], col);
|
||||
}
|
||||
|
||||
// Render GUI
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluOrtho2D(0, width, 0, height);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
imguiBeginFrame();
|
||||
|
||||
mouseOverMenu = false;
|
||||
|
||||
static int propScroll = 0;
|
||||
if (imguiBeginScrollArea(GENID, "Properties", width - 250 - 10, 10, 250, height-20, &propScroll))
|
||||
mouseOverMenu = true;
|
||||
|
||||
if (imguiButton(GENID, curLevel))
|
||||
{
|
||||
showLevels = true;
|
||||
scanDirectory("meshes", ".obj", fileList);
|
||||
}
|
||||
|
||||
imguiSeparator();
|
||||
|
||||
if (g_mesh)
|
||||
{
|
||||
if (imguiButton(GENID, "Build"))
|
||||
{
|
||||
memset(&g_cfg, 0, sizeof(g_cfg));
|
||||
g_cfg.cs = cellSize;
|
||||
g_cfg.ch = cellHeight;
|
||||
g_cfg.walkableSlopeAngle = agentMaxSlope;
|
||||
g_cfg.walkableHeight = (int)ceilf(agentHeight / g_cfg.ch);
|
||||
g_cfg.walkableClimb = (int)ceilf(agentMaxClimb / g_cfg.ch);
|
||||
g_cfg.walkableRadius = (int)ceilf(agentRadius / g_cfg.cs);
|
||||
g_cfg.maxEdgeLen = (int)(edgeMaxLen / cellSize);
|
||||
g_cfg.maxSimplificationError = edgeMaxError;
|
||||
g_cfg.minRegionSize = (int)rcSqr(regionMinSize);
|
||||
g_cfg.mergeRegionSize = (int)rcSqr(regionMergeSize);
|
||||
g_cfg.maxVertsPerPoly = (int)vertsPerPoly;
|
||||
|
||||
buildNavigation();
|
||||
}
|
||||
}
|
||||
|
||||
imguiSeparator();
|
||||
|
||||
if (imguiCheck(GENID, "Show Log", showLog))
|
||||
showLog = !showLog;
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel(GENID, "Rasterization");
|
||||
imguiSlider(GENID, "Cell Size", &cellSize, 0.1f, 1.0f, 0.01f);
|
||||
imguiSlider(GENID, "Cell Height", &cellHeight, 0.1f, 1.0f, 0.01f);
|
||||
|
||||
if (g_mesh)
|
||||
{
|
||||
int gw = 0, gh = 0;
|
||||
rcCalcGridSize(g_cfg.bmin, g_cfg.bmax, cellSize, &gw, &gh);
|
||||
char text[64];
|
||||
snprintf(text, 64, "Grid %d x %d", gw, gh);
|
||||
imguiValue(GENID, text);
|
||||
}
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel(GENID, "Agent");
|
||||
imguiSlider(GENID, "Height", &agentHeight, 0.1f, 5.0f, 0.1f);
|
||||
imguiSlider(GENID, "Ragius", &agentRadius, 0.1f, 5.0f, 0.1f);
|
||||
imguiSlider(GENID, "Max Climb", &agentMaxClimb, 0.1f, 5.0f, 0.1f);
|
||||
imguiSlider(GENID, "Max Slope", &agentMaxSlope, 0.0f, 90.0f, 1.0f);
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel(GENID, "Region");
|
||||
imguiSlider(GENID, "Min Region Size", ®ionMinSize, 0.0f, 150.0f, 1.0f);
|
||||
imguiSlider(GENID, "Merged Region Size", ®ionMergeSize, 0.0f, 150.0f, 1.0f);
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel(GENID, "Polygonization");
|
||||
imguiSlider(GENID, "Max Edge Length", &edgeMaxLen, 0.0f, 50.0f, 1.0f);
|
||||
imguiSlider(GENID, "Max Edge Error", &edgeMaxError, 0.1f, 3.0f, 0.1f);
|
||||
imguiSlider(GENID, "Verts Per Poly", &vertsPerPoly, 3.0f, 12.0f, 1.0f);
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel(GENID, "Draw");
|
||||
if (imguiCheck(GENID, "Input Mesh", drawMode == DRAWMODE_MESH))
|
||||
drawMode = DRAWMODE_MESH;
|
||||
if (imguiCheck(GENID, "Navmesh", drawMode == DRAWMODE_POLYMESH))
|
||||
drawMode = DRAWMODE_POLYMESH;
|
||||
if (imguiCheck(GENID, "Navmesh Trans", drawMode == DRAWMODE_POLYMESH_TRANS))
|
||||
drawMode = DRAWMODE_POLYMESH_TRANS;
|
||||
if (imguiCheck(GENID, "Voxels", drawMode == DRAWMODE_VOXELS))
|
||||
drawMode = DRAWMODE_VOXELS;
|
||||
if (imguiCheck(GENID, "Walkable Voxels", drawMode == DRAWMODE_VOXELS_WALKABLE))
|
||||
drawMode = DRAWMODE_VOXELS_WALKABLE;
|
||||
if (imguiCheck(GENID, "Compact", drawMode == DRAWMODE_COMPACT))
|
||||
drawMode = DRAWMODE_COMPACT;
|
||||
if (imguiCheck(GENID, "Compact Distance", drawMode == DRAWMODE_COMPACT_DISTANCE))
|
||||
drawMode = DRAWMODE_COMPACT_DISTANCE;
|
||||
if (imguiCheck(GENID, "Compact Regions", drawMode == DRAWMODE_COMPACT_REGIONS))
|
||||
drawMode = DRAWMODE_COMPACT_REGIONS;
|
||||
if (imguiCheck(GENID, "Raw Contours", drawMode == DRAWMODE_RAW_CONTOURS))
|
||||
drawMode = DRAWMODE_RAW_CONTOURS;
|
||||
if (imguiCheck(GENID, "Contours", drawMode == DRAWMODE_CONTOURS))
|
||||
drawMode = DRAWMODE_CONTOURS;
|
||||
|
||||
imguiEndScrollArea();
|
||||
|
||||
// Log
|
||||
if (showLog)
|
||||
{
|
||||
static int logScroll = 0;
|
||||
if (imguiBeginScrollArea(GENID, "Log", 10, 10, width - 300, 200, &logScroll))
|
||||
mouseOverMenu = true;
|
||||
for (int i = 0; i < g_log.getMessageCount(); ++i)
|
||||
imguiLabel(GENID1(i), g_log.getMessageText(i));
|
||||
imguiEndScrollArea();
|
||||
}
|
||||
|
||||
// Level selection dialog.
|
||||
if (showLevels)
|
||||
{
|
||||
static int scroll = 0;
|
||||
if (imguiBeginScrollArea(GENID, "Choose Level", width-10-250-10-200, height-10-250, 200, 250, &scroll))
|
||||
mouseOverMenu = true;
|
||||
|
||||
int levelToLoad = -1;
|
||||
for (int i = 0; i < fileList.size; ++i)
|
||||
{
|
||||
if (imguiItem(GENID1(i), fileList.files[i]))
|
||||
levelToLoad = i;
|
||||
}
|
||||
|
||||
if (levelToLoad != -1)
|
||||
{
|
||||
strncpy(curLevel, fileList.files[levelToLoad], sizeof(curLevel));
|
||||
curLevel[sizeof(curLevel)-1] = '\0';
|
||||
showLevels = false;
|
||||
|
||||
delete g_mesh;
|
||||
delete g_solid;
|
||||
delete g_chf;
|
||||
delete g_cset;
|
||||
delete g_polyMesh;
|
||||
delete [] g_triangleFlags;
|
||||
g_mesh = 0;
|
||||
g_solid = 0;
|
||||
g_chf = 0;
|
||||
g_cset = 0;
|
||||
g_polyMesh = 0;
|
||||
g_triangleFlags = 0;
|
||||
|
||||
g_mesh = new rcMeshLoaderObj;
|
||||
|
||||
char path[256];
|
||||
strcpy(path, "meshes/");
|
||||
strcat(path, curLevel);
|
||||
|
||||
if (!g_mesh->load(path))
|
||||
{
|
||||
printf("Could not load mesh\n");
|
||||
delete g_mesh;
|
||||
g_mesh = 0;
|
||||
}
|
||||
|
||||
if (g_mesh)
|
||||
{
|
||||
rcCalcBounds(g_mesh->getVerts(), g_mesh->getVertCount(), g_cfg.bmin, g_cfg.bmax);
|
||||
|
||||
// Reset camera.
|
||||
camr = sqrtf(rcSqr(g_cfg.bmax[0]-g_cfg.bmin[0]) +
|
||||
rcSqr(g_cfg.bmax[1]-g_cfg.bmin[1]) +
|
||||
rcSqr(g_cfg.bmax[2]-g_cfg.bmin[2])) / 2;
|
||||
camx = (g_cfg.bmax[0] + g_cfg.bmin[0]) / 2 + camr;
|
||||
camy = (g_cfg.bmax[1] + g_cfg.bmin[1]) / 2 + camr;
|
||||
camz = (g_cfg.bmax[2] + g_cfg.bmin[2]) / 2 + camr;
|
||||
camr *= 3;
|
||||
rx = 45;
|
||||
ry = -45;
|
||||
|
||||
glFogf(GL_FOG_START, camr*0.5f);
|
||||
glFogf(GL_FOG_END, camr*2.5f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
imguiEndScrollArea();
|
||||
|
||||
}
|
||||
|
||||
imguiEndFrame();
|
||||
imguiRender(&drawText);
|
||||
|
||||
g_font.drawText(10.0f, (float)height-20.0f, "W/S/A/D: Move LMB: Rotate RMB: Place character", GLFont::RGBA(255,255,255,128));
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
delete g_mesh;
|
||||
delete g_solid;
|
||||
delete g_chf;
|
||||
delete g_cset;
|
||||
delete g_polyMesh;
|
||||
delete [] g_triangleFlags;
|
||||
|
||||
return 0;
|
||||
}
|
285
RecastDemo/Source/glfont.cpp
Normal file
285
RecastDemo/Source/glfont.cpp
Normal file
@ -0,0 +1,285 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include "GlFont.h"
|
||||
#include <stdio.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <SDL_Opengl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
GLFont::GLFont(int renderVerts) :
|
||||
m_fd(0),
|
||||
m_texId(0),
|
||||
m_verts(0),
|
||||
m_nverts(0),
|
||||
m_maxVerts(renderVerts)
|
||||
{
|
||||
}
|
||||
|
||||
GLFont::~GLFont()
|
||||
{
|
||||
if (m_texId)
|
||||
glDeleteTextures(1, (GLuint*)&m_texId);
|
||||
unsigned char* data = (unsigned char*)m_fd;
|
||||
if (data)
|
||||
free(data);
|
||||
if (m_verts)
|
||||
free(m_verts);
|
||||
}
|
||||
|
||||
bool GLFont::create(const char* fileName)
|
||||
{
|
||||
unsigned char* data = 0;
|
||||
|
||||
FILE* fp = fopen(fileName, "rb");
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
// Read cache file
|
||||
fseek(fp, 0, SEEK_END);
|
||||
unsigned n = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
data = (unsigned char*)malloc(n);
|
||||
fread(data, n, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
if (!m_verts)
|
||||
m_verts = (RenderVertex*)malloc(m_maxVerts*sizeof(RenderVertex));
|
||||
|
||||
return createFontFromFontData(data);
|
||||
}
|
||||
|
||||
bool GLFont::createFontFromFontData(unsigned char* data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
printf("GLFont::createFontFromFontData: No input data!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fd = (FontData*)data;
|
||||
|
||||
// Patch kern pointers.
|
||||
for (int i = 0; i < m_fd->charCount; ++i)
|
||||
m_fd->glyphs[i].kern = (KerningPair*)((int)m_fd->glyphs[i].kernOffset + data);
|
||||
|
||||
unsigned char* texData = data + m_fd->textureOffset;
|
||||
|
||||
// Create textures
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glGenTextures(1, (GLuint*)&m_texId);
|
||||
glBindTexture(GL_TEXTURE_2D, m_texId);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, m_fd->texWidth, m_fd->texHeight, 0,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, texData);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GLFont::getFontSize() const
|
||||
{
|
||||
return m_fd ? m_fd->fontSize : 0;
|
||||
}
|
||||
|
||||
int GLFont::getDescender() const
|
||||
{
|
||||
return m_fd ? m_fd->descender : 0;
|
||||
}
|
||||
|
||||
int GLFont::getAscender() const
|
||||
{
|
||||
return m_fd ? m_fd->ascender : 0;
|
||||
}
|
||||
|
||||
float GLFont::getLineHeight() const
|
||||
{
|
||||
return m_fd ? m_fd->lineHeight : 0.0f;
|
||||
}
|
||||
|
||||
float GLFont::getTextLength(const char* text, float size, float tracking)
|
||||
{
|
||||
if (!m_texId) return 0.0f;
|
||||
if (!m_fd) return 0.0f;
|
||||
|
||||
float scale = size < 0 ? 1 : size / (float)m_fd->fontSize;
|
||||
float track = scale * m_fd->ascender * tracking / 1000.0f;
|
||||
|
||||
const unsigned char* src = (const unsigned char*)text;
|
||||
|
||||
int prevc = -1;
|
||||
float len = 0.0f;
|
||||
float tx = 0.0f;
|
||||
|
||||
for (; *src; ++src)
|
||||
{
|
||||
int c = (int)*src - m_fd->charMin;
|
||||
if (c < 0 || c >= m_fd->charCount)
|
||||
{
|
||||
prevc = c;
|
||||
continue;
|
||||
}
|
||||
|
||||
CachedGlyph& cg = m_fd->glyphs[c];
|
||||
if (prevc > 0 && prevc < m_fd->charCount)
|
||||
{
|
||||
CachedGlyph& prevcg = m_fd->glyphs[prevc];
|
||||
if (prevcg.nkern != 0)
|
||||
{
|
||||
for (int i = 0; i < prevcg.nkern; ++i)
|
||||
{
|
||||
if (prevcg.kern[i].c == c)
|
||||
{
|
||||
tx += prevcg.kern[i].dx * scale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = tx + (cg.ox + cg.w) * scale;
|
||||
|
||||
tx += cg.adv * scale + track;
|
||||
prevc = c;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void GLFont::drawText(float tx, float ty, const char* text,
|
||||
unsigned int col, float size, float tracking)
|
||||
{
|
||||
if (!m_fd) return;
|
||||
if (!m_texId) return;
|
||||
if (!m_verts) return;
|
||||
|
||||
float scale = size < 0 ? 1 : size / (float)m_fd->fontSize;
|
||||
float track = scale * m_fd->ascender * tracking / 1000.0f;
|
||||
float su = 1.0f / m_fd->texWidth;
|
||||
float sv = 1.0f / m_fd->texHeight;
|
||||
|
||||
const unsigned char* src = (const unsigned char*)text;
|
||||
|
||||
RenderVertex* v = &m_verts[m_nverts];
|
||||
|
||||
int prevc = -1;
|
||||
|
||||
for (; *src; ++src)
|
||||
{
|
||||
int c = (int)*src - m_fd->charMin;
|
||||
if (c == '\n')
|
||||
{
|
||||
ty -= getLineHeight();
|
||||
prevc = -1;
|
||||
continue;
|
||||
}
|
||||
if (c < 0 || c >= m_fd->charCount)
|
||||
{
|
||||
prevc = c;
|
||||
continue;
|
||||
}
|
||||
|
||||
CachedGlyph& cg = m_fd->glyphs[c];
|
||||
if (prevc > 0 && prevc < m_fd->charCount)
|
||||
{
|
||||
CachedGlyph& prevcg = m_fd->glyphs[prevc];
|
||||
if (prevcg.nkern != 0)
|
||||
{
|
||||
for (int i = 0; i < prevcg.nkern; ++i)
|
||||
{
|
||||
if (prevcg.kern[i].c == c)
|
||||
{
|
||||
tx += prevcg.kern[i].dx * scale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float x0 = floorf(tx + (cg.ox - 1) * scale + 0.5f);
|
||||
float y0 = floorf(ty + (cg.oy - 1) * scale + 0.5f);
|
||||
float x1 = floorf(x0 + (cg.w + 2) * scale + 0.5f);
|
||||
float y1 = floorf(y0 + (cg.h + 2) * scale + 0.5f);
|
||||
|
||||
float u0 = (cg.tx - 1) * su;
|
||||
float v0 = (cg.ty - 1) * sv;
|
||||
float u1 = (cg.tx + cg.w + 1) * su;
|
||||
float v1 = (cg.ty + cg.h + 1) * sv;
|
||||
|
||||
if (m_nverts+6 > m_maxVerts) break;
|
||||
|
||||
v->set(x0, y0, u0, v0, col); v++;
|
||||
v->set(x1, y0, u1, v0, col); v++;
|
||||
v->set(x1, y1, u1, v1, col); v++;
|
||||
|
||||
v->set(x0, y0, u0, v0, col); v++;
|
||||
v->set(x1, y1, u1, v1, col); v++;
|
||||
v->set(x0, y1, u0, v1, col); v++;
|
||||
|
||||
m_nverts += 6;
|
||||
|
||||
tx += cg.adv * scale + track;
|
||||
prevc = c;
|
||||
}
|
||||
|
||||
render();
|
||||
}
|
||||
|
||||
void GLFont::render()
|
||||
{
|
||||
if (!m_fd) return;
|
||||
if (!m_texId) return;
|
||||
if (!m_verts) return;
|
||||
|
||||
// Render
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, m_texId);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(RenderVertex), &m_verts[0].x);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(RenderVertex), &m_verts[0].u);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(RenderVertex), &m_verts[0].col);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_nverts);
|
||||
m_nverts = 0;
|
||||
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
unsigned int GLFont::RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
return (a<<24) | (b<<16) | (g<<8) | r;
|
||||
/*#ifdef WIN32
|
||||
return (a<<24) | (b<<16) | (g<<8) | r;
|
||||
#else
|
||||
return (r<<24) | (g<<16) | (b<<8) | a;
|
||||
#endif*/
|
||||
}
|
851
RecastDemo/Source/imgui.cpp
Normal file
851
RecastDemo/Source/imgui.cpp
Normal file
@ -0,0 +1,851 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <string.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include "imgui.h"
|
||||
#include "SDL.h"
|
||||
#include "SDL_opengl.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
enum GfxCmdType
|
||||
{
|
||||
GFXCMD_RECT,
|
||||
GFXCMD_TRIANGLE,
|
||||
GFXCMD_TEXT,
|
||||
GFXCMD_SCISSOR,
|
||||
};
|
||||
|
||||
struct GfxRect
|
||||
{
|
||||
short x,y,w,h,r;
|
||||
};
|
||||
struct GfxText
|
||||
{
|
||||
short x,y,dir;
|
||||
const char* text;
|
||||
};
|
||||
|
||||
struct GfxCmd
|
||||
{
|
||||
char type;
|
||||
char flags;
|
||||
char pad[2];
|
||||
unsigned int col;
|
||||
union
|
||||
{
|
||||
GfxRect rect;
|
||||
GfxText text;
|
||||
};
|
||||
};
|
||||
|
||||
unsigned int RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
return (r) | (g << 8) | (b << 16) | (a << 24);
|
||||
}
|
||||
|
||||
static const unsigned TEXT_POOL_SIZE = 4096;
|
||||
static char g_textPool[TEXT_POOL_SIZE];
|
||||
static unsigned g_textPoolSize = 0;
|
||||
const char* allocText(const char* text)
|
||||
{
|
||||
unsigned len = strlen(text)+1;
|
||||
if (g_textPoolSize + len >= TEXT_POOL_SIZE)
|
||||
return 0;
|
||||
char* dst = &g_textPool[g_textPoolSize];
|
||||
memcpy(dst, text, len);
|
||||
g_textPoolSize += len;
|
||||
return dst;
|
||||
}
|
||||
|
||||
static const unsigned GFXCMD_QUEUE_SIZE = 1024;
|
||||
static GfxCmd g_gfxCmdQueue[GFXCMD_QUEUE_SIZE];
|
||||
static unsigned g_gfxCmdQueueSize = 0;
|
||||
|
||||
void resetGfxCmdQueue()
|
||||
{
|
||||
g_gfxCmdQueueSize = 0;
|
||||
g_textPoolSize = 0;
|
||||
}
|
||||
|
||||
|
||||
static const unsigned TEMP_COORD_COUNT = 100;
|
||||
static float g_tempCoords[TEMP_COORD_COUNT*2];
|
||||
static float g_tempNormals[TEMP_COORD_COUNT*2];
|
||||
|
||||
static void drawPolygon(const float* coords, unsigned numCoords, float r, unsigned int col)
|
||||
{
|
||||
if (numCoords > TEMP_COORD_COUNT) numCoords = TEMP_COORD_COUNT;
|
||||
|
||||
for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
|
||||
{
|
||||
const float* v0 = &coords[j*2];
|
||||
const float* v1 = &coords[i*2];
|
||||
float dx = v1[0] - v0[0];
|
||||
float dy = v1[1] - v0[1];
|
||||
float d = sqrtf(dx*dx+dy*dy);
|
||||
if (d > 0)
|
||||
{
|
||||
d = 1.0f/d;
|
||||
dx *= d;
|
||||
dy *= d;
|
||||
}
|
||||
g_tempNormals[j*2+0] = dy;
|
||||
g_tempNormals[j*2+1] = -dx;
|
||||
}
|
||||
|
||||
for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
|
||||
{
|
||||
float dlx0 = g_tempNormals[j*2+0];
|
||||
float dly0 = g_tempNormals[j*2+1];
|
||||
float dlx1 = g_tempNormals[i*2+0];
|
||||
float dly1 = g_tempNormals[i*2+1];
|
||||
float dmx = (dlx0 + dlx1) * 0.5f;
|
||||
float dmy = (dly0 + dly1) * 0.5f;
|
||||
float dmr2 = dmx*dmx + dmy*dmy;
|
||||
if (dmr2 > 0.000001f)
|
||||
{
|
||||
float scale = 1.0f / dmr2;
|
||||
if (scale > 10.0f) scale = 10.0f;
|
||||
dmx *= scale;
|
||||
dmy *= scale;
|
||||
}
|
||||
g_tempCoords[i*2+0] = coords[i*2+0]+dmx*r;
|
||||
g_tempCoords[i*2+1] = coords[i*2+1]+dmy*r;
|
||||
}
|
||||
|
||||
unsigned int colTrans = RGBA(col&0xff, (col>>8)&0xff, (col>>16)&0xff, 0);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
glColor4ubv((GLubyte*)&col);
|
||||
|
||||
for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
|
||||
{
|
||||
glVertex2fv(&coords[i*2]);
|
||||
glVertex2fv(&coords[j*2]);
|
||||
glColor4ubv((GLubyte*)&colTrans);
|
||||
glVertex2fv(&g_tempCoords[j*2]);
|
||||
|
||||
glVertex2fv(&g_tempCoords[j*2]);
|
||||
glVertex2fv(&g_tempCoords[i*2]);
|
||||
|
||||
glColor4ubv((GLubyte*)&col);
|
||||
glVertex2fv(&coords[i*2]);
|
||||
}
|
||||
|
||||
glColor4ubv((GLubyte*)&col);
|
||||
for (unsigned i = 2; i < numCoords; ++i)
|
||||
{
|
||||
glVertex2fv(&coords[0]);
|
||||
glVertex2fv(&coords[(i-1)*2]);
|
||||
glVertex2fv(&coords[i*2]);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static const int CIRCLE_VERTS = 8*4;
|
||||
static float g_circleVerts[CIRCLE_VERTS*2];
|
||||
static bool g_circleVertsInitialized = false;
|
||||
|
||||
const float* getCircleVerts()
|
||||
{
|
||||
if (!g_circleVertsInitialized)
|
||||
{
|
||||
g_circleVertsInitialized = true;
|
||||
for (unsigned i = 0; i < CIRCLE_VERTS; ++i)
|
||||
{
|
||||
float a = (float)i/(float)CIRCLE_VERTS * (float)M_PI*2;
|
||||
g_circleVerts[i*2+0] = cosf(a);
|
||||
g_circleVerts[i*2+1] = sinf(a);
|
||||
}
|
||||
}
|
||||
return g_circleVerts;
|
||||
}
|
||||
|
||||
static void drawRect(float x, float y, float w, float h, float fth, unsigned int col)
|
||||
{
|
||||
float verts[4*2] =
|
||||
{
|
||||
x, y,
|
||||
x+w, y,
|
||||
x+w, y+h,
|
||||
x, y+h,
|
||||
};
|
||||
drawPolygon(verts, 4, fth, col);
|
||||
}
|
||||
|
||||
static void drawEllipse(float x, float y, float w, float h, float fth, unsigned int col)
|
||||
{
|
||||
float verts[CIRCLE_VERTS*2];
|
||||
const float* cverts = getCircleVerts();
|
||||
float* v = verts;
|
||||
|
||||
for (unsigned i = 0; i < CIRCLE_VERTS; ++i)
|
||||
{
|
||||
*v++ = x + cverts[i*2]*w;
|
||||
*v++ = y + cverts[i*2+1]*h;
|
||||
}
|
||||
|
||||
drawPolygon(verts, CIRCLE_VERTS, fth, col);
|
||||
}
|
||||
|
||||
static void drawRoundedRect(float x, float y, float w, float h, float r, float fth, unsigned int col)
|
||||
{
|
||||
const unsigned n = CIRCLE_VERTS/4;
|
||||
float verts[(n+1)*4*2];
|
||||
const float* cverts = getCircleVerts();
|
||||
float* v = verts;
|
||||
|
||||
for (unsigned i = 0; i <= n; ++i)
|
||||
{
|
||||
*v++ = x+w-r + cverts[i*2]*r;
|
||||
*v++ = y+h-r + cverts[i*2+1]*r;
|
||||
}
|
||||
|
||||
for (unsigned i = n; i <= n*2; ++i)
|
||||
{
|
||||
*v++ = x+r + cverts[i*2]*r;
|
||||
*v++ = y+h-r + cverts[i*2+1]*r;
|
||||
}
|
||||
|
||||
for (unsigned i = n*2; i <= n*3; ++i)
|
||||
{
|
||||
*v++ = x+r + cverts[i*2]*r;
|
||||
*v++ = y+r + cverts[i*2+1]*r;
|
||||
}
|
||||
|
||||
for (unsigned i = n*3; i < n*4; ++i)
|
||||
{
|
||||
*v++ = x+w-r + cverts[i*2]*r;
|
||||
*v++ = y+r + cverts[i*2+1]*r;
|
||||
}
|
||||
*v++ = x+w-r + cverts[0]*r;
|
||||
*v++ = y+r + cverts[1]*r;
|
||||
|
||||
drawPolygon(verts, (n+1)*4, fth, col);
|
||||
}
|
||||
|
||||
static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, unsigned int col)
|
||||
{
|
||||
float dx = x1-x0;
|
||||
float dy = y1-y0;
|
||||
float d = sqrtf(dx*dx+dy*dy);
|
||||
if (d > 0.0001f)
|
||||
{
|
||||
d = 1.0f/d;
|
||||
dx *= d;
|
||||
dy *= d;
|
||||
}
|
||||
float t = dx;
|
||||
dx = dy;
|
||||
dy = -t;
|
||||
float verts[4*2];
|
||||
r -= fth;
|
||||
r *= 0.5f;
|
||||
if (r < 0.01f) r = 0.01f;
|
||||
dx *= r;
|
||||
dy *= r;
|
||||
|
||||
verts[0] = x0-dx;
|
||||
verts[1] = y0-dy;
|
||||
|
||||
verts[2] = x0+dx;
|
||||
verts[3] = y0+dy;
|
||||
|
||||
verts[4] = x1+dx;
|
||||
verts[5] = y1+dy;
|
||||
|
||||
verts[6] = x1-dx;
|
||||
verts[7] = y1-dy;
|
||||
|
||||
drawPolygon(verts, 4, fth, col);
|
||||
}
|
||||
|
||||
|
||||
void renderGfxCmdQueue(void (*drawText)(int x, int y, int dir, const char* text, unsigned int col))
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
for (unsigned i = 0; i < g_gfxCmdQueueSize; ++i)
|
||||
{
|
||||
const GfxCmd& cmd = g_gfxCmdQueue[i];
|
||||
if (cmd.type == GFXCMD_RECT)
|
||||
{
|
||||
if (cmd.rect.r == 0)
|
||||
{
|
||||
drawRect((float)cmd.rect.x+0.5f, (float)cmd.rect.y+0.5f,
|
||||
(float)cmd.rect.w-1, (float)cmd.rect.h-1,
|
||||
1.0f, cmd.col);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRoundedRect((float)cmd.rect.x+0.5f, (float)cmd.rect.y+0.5f,
|
||||
(float)cmd.rect.w-1, (float)cmd.rect.h-1,
|
||||
(float)cmd.rect.r, 1.0f, cmd.col);
|
||||
}
|
||||
}
|
||||
else if (cmd.type == GFXCMD_TRIANGLE)
|
||||
{
|
||||
glColor4ub(cmd.col&0xff, (cmd.col>>8)&0xff, (cmd.col>>16)&0xff, (cmd.col>>24)&0xff);
|
||||
if (cmd.flags == 1)
|
||||
{
|
||||
const float verts[3*2] =
|
||||
{
|
||||
(float)cmd.rect.x+0.5f, (float)cmd.rect.y+0.5f,
|
||||
(float)cmd.rect.x+0.5f+(float)cmd.rect.w-1, (float)cmd.rect.y+0.5f+(float)cmd.rect.h/2-0.5f,
|
||||
(float)cmd.rect.x+0.5f, (float)cmd.rect.y+0.5f+(float)cmd.rect.h-1,
|
||||
};
|
||||
drawPolygon(verts, 3, 1.0f, cmd.col);
|
||||
}
|
||||
if (cmd.flags == 2)
|
||||
{
|
||||
const float verts[3*2] =
|
||||
{
|
||||
(float)cmd.rect.x+0.5f, (float)cmd.rect.y+(float)cmd.rect.h-1,
|
||||
(float)cmd.rect.x+0.5f+(float)cmd.rect.w/2-0.5f, (float)cmd.rect.y+0.5f,
|
||||
(float)cmd.rect.x+0.5f+(float)cmd.rect.w-1, (float)cmd.rect.y+0.5f+(float)cmd.rect.h-1,
|
||||
};
|
||||
drawPolygon(verts, 3, 1.0f, cmd.col);
|
||||
}
|
||||
}
|
||||
else if (cmd.type == GFXCMD_TEXT)
|
||||
{
|
||||
drawText(cmd.text.x, cmd.text.y, cmd.text.dir, cmd.text.text, cmd.col);
|
||||
}
|
||||
else if (cmd.type == GFXCMD_SCISSOR)
|
||||
{
|
||||
if (cmd.flags)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(cmd.rect.x, cmd.rect.y, cmd.rect.w, cmd.rect.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
void addGfxCmdScissor(int x, int y, int w, int h)
|
||||
{
|
||||
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
|
||||
return;
|
||||
GfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
|
||||
cmd.type = GFXCMD_SCISSOR;
|
||||
cmd.flags = x < 0 ? 0 : 1; // on/off flag.
|
||||
cmd.col = 0;
|
||||
cmd.rect.x = (short)x;
|
||||
cmd.rect.y = (short)y;
|
||||
cmd.rect.w = (short)w;
|
||||
cmd.rect.h = (short)h;
|
||||
}
|
||||
|
||||
void addGfxCmdRect(int x, int y, int w, int h, unsigned int color)
|
||||
{
|
||||
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
|
||||
return;
|
||||
GfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
|
||||
cmd.type = GFXCMD_RECT;
|
||||
cmd.flags = 0;
|
||||
cmd.col = color;
|
||||
cmd.rect.x = (short)x;
|
||||
cmd.rect.y = (short)y;
|
||||
cmd.rect.w = (short)w;
|
||||
cmd.rect.h = (short)h;
|
||||
cmd.rect.r = 0;
|
||||
}
|
||||
|
||||
void addGfxCmdRoundedRect(int x, int y, int w, int h, int r, unsigned int color)
|
||||
{
|
||||
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
|
||||
return;
|
||||
GfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
|
||||
cmd.type = GFXCMD_RECT;
|
||||
cmd.flags = 0;
|
||||
cmd.col = color;
|
||||
cmd.rect.x = (short)x;
|
||||
cmd.rect.y = (short)y;
|
||||
cmd.rect.w = (short)w;
|
||||
cmd.rect.h = (short)h;
|
||||
cmd.rect.r = (short)r;
|
||||
}
|
||||
|
||||
void addGfxCmdTriangle(int x, int y, int w, int h, int flags, unsigned int color)
|
||||
{
|
||||
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
|
||||
return;
|
||||
GfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
|
||||
cmd.type = GFXCMD_TRIANGLE;
|
||||
cmd.flags = (char)flags;
|
||||
cmd.col = color;
|
||||
cmd.rect.x = (short)x;
|
||||
cmd.rect.y = (short)y;
|
||||
cmd.rect.w = (short)w;
|
||||
cmd.rect.h = (short)h;
|
||||
}
|
||||
|
||||
void addGfxCmdText(int x, int y, int dir, const char* text, unsigned int color)
|
||||
{
|
||||
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
|
||||
return;
|
||||
GfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
|
||||
cmd.type = GFXCMD_TEXT;
|
||||
cmd.flags = 0;
|
||||
cmd.col = color;
|
||||
cmd.text.x = (short)x;
|
||||
cmd.text.y = (short)y;
|
||||
cmd.text.dir = (short)dir;
|
||||
cmd.text.text = allocText(text);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct GuiState
|
||||
{
|
||||
GuiState() :
|
||||
mbutPressed(false), mbutReleased(false), mbut(false), mx(-1), my(-1),
|
||||
isHot(false), isActive(false), wentActive(false),
|
||||
dragX(0), dragY(0), dragOrig(0),
|
||||
widgetX(0), widgetY(0), widgetW(100),
|
||||
active(0), hot(0), hotToBe(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool mbutPressed, mbutReleased;
|
||||
bool mbut;
|
||||
int mx,my;
|
||||
unsigned int active;
|
||||
unsigned int hot;
|
||||
unsigned int hotToBe;
|
||||
bool isHot;
|
||||
bool isActive;
|
||||
bool wentActive;
|
||||
int dragX, dragY;
|
||||
float dragOrig;
|
||||
int widgetX, widgetY, widgetW;
|
||||
};
|
||||
|
||||
static GuiState g_state;
|
||||
|
||||
inline bool anyActive()
|
||||
{
|
||||
return g_state.active != 0;
|
||||
}
|
||||
|
||||
inline bool isActive(unsigned int id)
|
||||
{
|
||||
return g_state.active == id;
|
||||
}
|
||||
|
||||
inline bool isHot(unsigned int id)
|
||||
{
|
||||
return g_state.hot == id;
|
||||
}
|
||||
|
||||
inline bool inRect(int x, int y, int w, int h)
|
||||
{
|
||||
return g_state.mx >= x && g_state.mx <= x+w && g_state.my >= y && g_state.my <= y+h;
|
||||
}
|
||||
|
||||
void clearInput()
|
||||
{
|
||||
g_state.mbutPressed = false;
|
||||
g_state.mbutReleased = false;
|
||||
}
|
||||
|
||||
void clearActive(void)
|
||||
{
|
||||
g_state.active = 0;
|
||||
// mark all UI for this frame as processed
|
||||
clearInput();
|
||||
}
|
||||
|
||||
void setActive(unsigned int id)
|
||||
{
|
||||
g_state.active = id;
|
||||
g_state.wentActive = true;
|
||||
}
|
||||
|
||||
void setHot(unsigned int id)
|
||||
{
|
||||
g_state.hotToBe = id;
|
||||
}
|
||||
|
||||
|
||||
bool buttonLogic(unsigned int id, bool over)
|
||||
{
|
||||
bool res = false;
|
||||
// process down
|
||||
if (!anyActive())
|
||||
{
|
||||
if (over)
|
||||
setHot(id);
|
||||
if (isHot(id) && g_state.mbutPressed)
|
||||
setActive(id);
|
||||
}
|
||||
|
||||
// if button is active, then react on left up
|
||||
if (isActive(id))
|
||||
{
|
||||
g_state.isActive = true;
|
||||
if (over)
|
||||
setHot(id);
|
||||
if (g_state.mbutReleased)
|
||||
{
|
||||
if (isHot(id))
|
||||
res = true;
|
||||
clearActive();
|
||||
}
|
||||
}
|
||||
|
||||
if (isHot(id))
|
||||
g_state.isHot = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void updateInput()
|
||||
{
|
||||
int mx, my;
|
||||
Uint8 state = SDL_GetMouseState(&mx, &my);
|
||||
bool mbut = (state & SDL_BUTTON_LMASK) != 0;
|
||||
SDL_Surface* screen = SDL_GetVideoSurface();
|
||||
my = screen->h-1 - my;
|
||||
|
||||
g_state.mx = mx;
|
||||
g_state.my = my;
|
||||
g_state.mbutPressed = !g_state.mbut && mbut;
|
||||
g_state.mbutReleased = g_state.mbut && !mbut;
|
||||
g_state.mbut = mbut;
|
||||
}
|
||||
|
||||
void imguiBeginFrame()
|
||||
{
|
||||
updateInput();
|
||||
|
||||
g_state.hot = g_state.hotToBe;
|
||||
g_state.hotToBe = 0;
|
||||
|
||||
g_state.wentActive = false;
|
||||
g_state.isActive = false;
|
||||
g_state.isHot = false;
|
||||
|
||||
g_state.widgetX = 0;
|
||||
g_state.widgetY = 0;
|
||||
g_state.widgetW = 0;
|
||||
|
||||
resetGfxCmdQueue();
|
||||
}
|
||||
|
||||
void imguiEndFrame()
|
||||
{
|
||||
clearInput();
|
||||
}
|
||||
|
||||
void imguiRender(void (*drawText)(int x, int y, int dir, const char* text, unsigned int col))
|
||||
{
|
||||
renderGfxCmdQueue(drawText);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static const int BUTTON_HEIGHT = 20;
|
||||
static const int SLIDER_HEIGHT = 20;
|
||||
static const int SLIDER_MARKER_WIDTH = 10;
|
||||
static const int CHECK_SIZE = 8;
|
||||
static const int DEFAULT_SPACING = 4;
|
||||
static const int TEXT_HEIGHT = 8;
|
||||
static const int SCROLL_AREA_PADDING = 6;
|
||||
static const int INTEND_SIZE = 16;
|
||||
static const int AREA_HEADER = 28;
|
||||
|
||||
static int g_scrollTop = 0;
|
||||
static int g_scrollBottom = 0;
|
||||
static int g_scrollRight = 0;
|
||||
static int g_scrollAreaTop = 0;
|
||||
static int* g_scrollVal = 0;
|
||||
static int g_focusTop = 0;
|
||||
static int g_focusBottom = 0;
|
||||
static unsigned int g_scrollId = 0;
|
||||
|
||||
bool imguiBeginScrollArea(unsigned int id, const char* name, int x, int y, int w, int h, int* scroll)
|
||||
{
|
||||
g_scrollId = id;
|
||||
|
||||
g_state.widgetX = x + SCROLL_AREA_PADDING;
|
||||
g_state.widgetY = y+h-AREA_HEADER + (*scroll);
|
||||
g_state.widgetW = w - SCROLL_AREA_PADDING*4;
|
||||
g_scrollTop = y-AREA_HEADER+h;
|
||||
g_scrollBottom = y+SCROLL_AREA_PADDING;
|
||||
g_scrollRight = x+w - SCROLL_AREA_PADDING*3;
|
||||
g_scrollVal = scroll;
|
||||
|
||||
g_scrollAreaTop = g_state.widgetY;
|
||||
|
||||
g_focusTop = y-AREA_HEADER;
|
||||
g_focusBottom = y-AREA_HEADER+h;
|
||||
|
||||
addGfxCmdRoundedRect(x, y, w, h, 6, RGBA(0,0,0,192));
|
||||
|
||||
addGfxCmdText(x+AREA_HEADER/2, y+h-AREA_HEADER/2-TEXT_HEIGHT/2, 1, name, RGBA(255,255,255,128));
|
||||
|
||||
addGfxCmdScissor(x+SCROLL_AREA_PADDING, y+SCROLL_AREA_PADDING, w-SCROLL_AREA_PADDING*4, h-AREA_HEADER-SCROLL_AREA_PADDING);
|
||||
|
||||
return inRect(x, y, w, h);
|
||||
}
|
||||
|
||||
void imguiEndScrollArea()
|
||||
{
|
||||
// Disable scissoring.
|
||||
addGfxCmdScissor(-1,-1,-1,-1);
|
||||
|
||||
// Draw scroll bar
|
||||
int x = g_scrollRight+SCROLL_AREA_PADDING/2;
|
||||
int y = g_scrollBottom;
|
||||
int w = SCROLL_AREA_PADDING*2;
|
||||
int h = g_scrollTop - g_scrollBottom;
|
||||
|
||||
int stop = g_scrollAreaTop;
|
||||
int sbot = g_state.widgetY;
|
||||
int sh = stop - sbot; // The scrollable area height.
|
||||
|
||||
float barHeight = (float)h/(float)sh;
|
||||
|
||||
if (barHeight < 1)
|
||||
{
|
||||
float barY = (float)(y - sbot)/(float)sh;
|
||||
if (barY < 0) barY = 0;
|
||||
if (barY > 1) barY = 1;
|
||||
|
||||
// Handle scroll bar logic.
|
||||
unsigned int hid = g_scrollId;
|
||||
int hx = x;
|
||||
int hy = y + (int)(barY*h);
|
||||
int hw = w;
|
||||
int hh = (int)(barHeight*h);
|
||||
|
||||
const int range = h - (hh-1);
|
||||
bool over = inRect(hx, hy, hw, hh);
|
||||
buttonLogic(hid, over);
|
||||
if (isActive(hid))
|
||||
{
|
||||
float u = (float)(hy-y) / (float)range;
|
||||
if (g_state.wentActive)
|
||||
{
|
||||
g_state.dragY = g_state.my;
|
||||
g_state.dragOrig = u;
|
||||
}
|
||||
if (g_state.dragY != g_state.my)
|
||||
{
|
||||
u = g_state.dragOrig + (g_state.my - g_state.dragY) / (float)range;
|
||||
if (u < 0) u = 0;
|
||||
if (u > 1) u = 1;
|
||||
*g_scrollVal = (int)((1-u) * (sh - h));
|
||||
}
|
||||
}
|
||||
|
||||
// BG
|
||||
addGfxCmdRoundedRect(x, y, w, h, w/2-1, RGBA(0,0,0,196));
|
||||
// Bar
|
||||
if (isActive(hid))
|
||||
addGfxCmdRoundedRect(hx, hy, hw, hh, w/2-1, RGBA(255,196,0,196));
|
||||
else
|
||||
addGfxCmdRoundedRect(hx, hy, hw, hh, w/2-1, isHot(hid) ? RGBA(255,196,0,96) : RGBA(255,255,255,64));
|
||||
}
|
||||
}
|
||||
|
||||
bool imguiButton(unsigned int id, const char* text)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
int w = g_state.widgetW;
|
||||
int h = BUTTON_HEIGHT;
|
||||
g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
|
||||
|
||||
bool over = inRect(x, y, w, h);
|
||||
bool res = buttonLogic(id, over);
|
||||
|
||||
addGfxCmdRoundedRect(x, y, w, h, BUTTON_HEIGHT/2-1, RGBA(128,128,128, isActive(id)?196:96));
|
||||
addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, 1, text, isHot(id) ? RGBA(255,196,0,255) : RGBA(255,255,255,200));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool imguiItem(unsigned int id, const char* text)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
int w = g_state.widgetW;
|
||||
int h = BUTTON_HEIGHT;
|
||||
g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
|
||||
|
||||
bool over = inRect(x, y, w, h);
|
||||
bool res = buttonLogic(id, over);
|
||||
|
||||
if (isHot(id))
|
||||
addGfxCmdRoundedRect(x, y, w, h, 2, RGBA(255,196,0,isActive(id)?196:96));
|
||||
addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, 1, text, RGBA(255,255,255,200));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool imguiCheck(unsigned int id, const char* text, bool checked)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
int w = g_state.widgetW;
|
||||
int h = BUTTON_HEIGHT;
|
||||
g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
|
||||
|
||||
bool over = inRect(x, y, w, h);
|
||||
bool res = buttonLogic(id, over);
|
||||
|
||||
const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2;
|
||||
const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2;
|
||||
addGfxCmdRoundedRect(cx-3, cy-3, CHECK_SIZE+6, CHECK_SIZE+6, 4, RGBA(128,128,128, isActive(id)?196:96));
|
||||
if (checked)
|
||||
addGfxCmdRoundedRect(cx, cy, CHECK_SIZE, CHECK_SIZE, CHECK_SIZE/2-1, RGBA(255,255,255,isActive(id)?255:200));
|
||||
|
||||
addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, 1, text, isHot(id) ? RGBA(255,196,0,255) : RGBA(255,255,255,200));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool imguiCollapse(unsigned int id, const char* text, bool checked)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
int w = g_state.widgetW;
|
||||
int h = BUTTON_HEIGHT;
|
||||
g_state.widgetY -= BUTTON_HEIGHT; // + DEFAULT_SPACING;
|
||||
|
||||
const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2;
|
||||
const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2;
|
||||
|
||||
bool over = inRect(x, y, w, h);
|
||||
bool res = buttonLogic(id, over);
|
||||
|
||||
if (checked)
|
||||
addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, RGBA(255,255,255,isActive(id)?255:200));
|
||||
else
|
||||
addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, RGBA(255,255,255,isActive(id)?255:200));
|
||||
|
||||
addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, 1, text, isHot(id) ? RGBA(255,196,0,255) : RGBA(255,255,255,200));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void imguiLabel(unsigned int /*id*/, const char* text)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
g_state.widgetY -= BUTTON_HEIGHT;
|
||||
addGfxCmdText(x, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, 1, text, RGBA(255,255,255,255));
|
||||
}
|
||||
|
||||
void imguiValue(unsigned int /*id*/, const char* text)
|
||||
{
|
||||
const int x = g_state.widgetX;
|
||||
const int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
const int w = g_state.widgetW;
|
||||
g_state.widgetY -= BUTTON_HEIGHT;
|
||||
|
||||
addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, -1, text, RGBA(255,255,255,200));
|
||||
}
|
||||
|
||||
bool imguiSlider(unsigned int id, const char* text, float* val, float vmin, float vmax, float vinc)
|
||||
{
|
||||
int x = g_state.widgetX;
|
||||
int y = g_state.widgetY - BUTTON_HEIGHT;
|
||||
int w = g_state.widgetW;
|
||||
int h = SLIDER_HEIGHT;
|
||||
g_state.widgetY -= SLIDER_HEIGHT + DEFAULT_SPACING;
|
||||
|
||||
addGfxCmdRoundedRect(x, y, w, h, 4, RGBA(0,0,0,128));
|
||||
|
||||
const int range = w - SLIDER_MARKER_WIDTH;
|
||||
|
||||
float u = (*val - vmin) / (vmax-vmin);
|
||||
if (u < 0) u = 0;
|
||||
if (u > 1) u = 1;
|
||||
int m = (int)(u * range);
|
||||
|
||||
bool over = inRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT);
|
||||
bool res = buttonLogic(id, over);
|
||||
bool valChanged = false;
|
||||
|
||||
if (isActive(id))
|
||||
{
|
||||
if (g_state.wentActive)
|
||||
{
|
||||
g_state.dragX = g_state.mx;
|
||||
g_state.dragOrig = u;
|
||||
}
|
||||
if (g_state.dragX != g_state.mx)
|
||||
{
|
||||
u = g_state.dragOrig + (float)(g_state.mx - g_state.dragX) / (float)range;
|
||||
if (u < 0) u = 0;
|
||||
if (u > 1) u = 1;
|
||||
*val = vmin + u*(vmax-vmin);
|
||||
*val = floorf(*val / vinc)*vinc; // Snap to vinc
|
||||
m = (int)(u * range);
|
||||
valChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isActive(id))
|
||||
addGfxCmdRoundedRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT, 4, RGBA(255,255,255,255));
|
||||
else
|
||||
addGfxCmdRoundedRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT, 4, isHot(id) ? RGBA(255,196,0,128) : RGBA(255,255,255,64));
|
||||
|
||||
int digits = (int)(ceilf(log10f(vinc)));
|
||||
char fmt[16];
|
||||
snprintf(fmt, 16, "%%.%df", digits >= 0 ? 0 : -digits);
|
||||
char msg[128];
|
||||
snprintf(msg, 128, fmt, *val);
|
||||
|
||||
addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, 1, text, isHot(id) ? RGBA(255,196,0,255) : RGBA(255,255,255,200));
|
||||
addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, -1, msg, isHot(id) ? RGBA(255,196,0,255) : RGBA(255,255,255,200));
|
||||
|
||||
return res || valChanged;
|
||||
}
|
||||
|
||||
|
||||
void imguiIndent()
|
||||
{
|
||||
g_state.widgetX += INTEND_SIZE;
|
||||
g_state.widgetW -= INTEND_SIZE;
|
||||
}
|
||||
|
||||
void imguiUnindent()
|
||||
{
|
||||
g_state.widgetX -= INTEND_SIZE;
|
||||
g_state.widgetW += INTEND_SIZE;
|
||||
}
|
||||
|
||||
void imguiSeparator()
|
||||
{
|
||||
g_state.widgetY -= DEFAULT_SPACING*3;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user