initial commit
This commit is contained in:
parent
f0c987d601
commit
d7333804aa
293 changed files with 91066 additions and 0 deletions
101
APPma.sln
Normal file
101
APPma.sln
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29806.167
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppManager", "Sourse\AppManager\AppManager.vcxproj", "{7B2BC414-2A04-41AC-AACF-B372F8542B20}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Data", "Sourse\Data\Data.vcxproj", "{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Main", "Sourse\Main\Main.vcxproj", "{C7118CBB-48B7-4353-B622-2DB4B0EB134A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Operator", "Sourse\Operator\Operator.vcxproj", "{03916D7C-9C52-44E9-B420-31B9F45CF8B9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Render", "Sourse\Render\Render.vcxproj", "{094B0FB2-DB22-4176-AB30-3986D60279C4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WM", "Sourse\WM\WM.vcxproj", "{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataStruct", "intern\DataStruct\DataStruct.vcxproj", "{3B7ACA3B-9394-496C-953C-B5B412555A4E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Math", "Sourse\Math\Math.vcxproj", "{95A51000-709F-4D51-B71D-4FF3D7348A42}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Debug|x64.Build.0 = Debug|x64
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Debug|x86.Build.0 = Debug|Win32
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Release|x64.ActiveCfg = Release|x64
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Release|x64.Build.0 = Release|x64
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Release|x86.ActiveCfg = Release|Win32
|
||||
{7B2BC414-2A04-41AC-AACF-B372F8542B20}.Release|x86.Build.0 = Release|Win32
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Debug|x64.Build.0 = Debug|x64
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Release|x64.ActiveCfg = Release|x64
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Release|x64.Build.0 = Release|x64
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}.Release|x86.Build.0 = Release|Win32
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Debug|x64.Build.0 = Debug|x64
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Release|x64.ActiveCfg = Release|x64
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Release|x64.Build.0 = Release|x64
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C7118CBB-48B7-4353-B622-2DB4B0EB134A}.Release|x86.Build.0 = Release|Win32
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Debug|x64.Build.0 = Debug|x64
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Debug|x86.Build.0 = Debug|Win32
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Release|x64.ActiveCfg = Release|x64
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Release|x64.Build.0 = Release|x64
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Release|x86.ActiveCfg = Release|Win32
|
||||
{03916D7C-9C52-44E9-B420-31B9F45CF8B9}.Release|x86.Build.0 = Release|Win32
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Debug|x64.Build.0 = Debug|x64
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Release|x64.ActiveCfg = Release|x64
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Release|x64.Build.0 = Release|x64
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{094B0FB2-DB22-4176-AB30-3986D60279C4}.Release|x86.Build.0 = Release|Win32
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Debug|x64.Build.0 = Debug|x64
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Release|x64.ActiveCfg = Release|x64
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Release|x64.Build.0 = Release|x64
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}.Release|x86.Build.0 = Release|Win32
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Debug|x64.Build.0 = Debug|x64
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Release|x64.ActiveCfg = Release|x64
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Release|x64.Build.0 = Release|x64
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{3B7ACA3B-9394-496C-953C-B5B412555A4E}.Release|x86.Build.0 = Release|Win32
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Debug|x64.Build.0 = Debug|x64
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Debug|x86.Build.0 = Debug|Win32
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Release|x64.ActiveCfg = Release|x64
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Release|x64.Build.0 = Release|x64
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Release|x86.ActiveCfg = Release|Win32
|
||||
{95A51000-709F-4D51-B71D-4FF3D7348A42}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8955CC8E-27B8-43B2-8744-D5C4AAEAF0D8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
179
Sourse/AppManager/AppManager.vcxproj
Normal file
179
Sourse/AppManager/AppManager.vcxproj
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{7B2BC414-2A04-41AC-AACF-B372F8542B20}</ProjectGuid>
|
||||
<RootNamespace>eventhandler</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>AppManager</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Data\sourse\;$(SolutionDir)\Sourse\Math\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Data\sourse\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Data\sourse\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Data\sourse\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\AppManager.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\AppManager.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.vcxproj">
|
||||
<Project>{e4451015-f74a-41bb-bc31-a55ffddc6af7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
27
Sourse/AppManager/AppManager.vcxproj.filters
Normal file
27
Sourse/AppManager/AppManager.vcxproj.filters
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\AppManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\AppManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/AppManager/AppManager.vcxproj.user
Normal file
6
Sourse/AppManager/AppManager.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
54
Sourse/AppManager/sourse/AppManager.cpp
Normal file
54
Sourse/AppManager/sourse/AppManager.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
|
||||
#define DBG_NEW new ( _CLIENT_BLOCK , __FILE__ , __LINE__ )
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
|
||||
#include "AppManager.h"
|
||||
|
||||
//#include <stdlib.h>
|
||||
//#include <crtdbg.h>
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
_AppManager* APM_p;
|
||||
|
||||
DLLEXPORT void APM_OnStart(_AppManager* APM)
|
||||
{
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
APM_p = APM;
|
||||
|
||||
}
|
||||
|
||||
DLLEXPORT void APM_OnEnd()
|
||||
{
|
||||
_CrtDumpMemoryLeaks();
|
||||
}
|
||||
|
||||
DLLEXPORT void APM_LoopIn()
|
||||
{
|
||||
APM_p->FPS.time_LoopIn = float(clock());
|
||||
}
|
||||
|
||||
DLLEXPORT void APM_LoopOut()
|
||||
{
|
||||
APM_p->FPS.time_LoopOut = float(clock());
|
||||
float wait_time_ms = 100/6 - (APM_p->FPS.time_LoopOut - APM_p->FPS.time_LoopIn);
|
||||
if (wait_time_ms > 0)
|
||||
{
|
||||
Sleep(DWORD(wait_time_ms));
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("FPS is less than 60\n");
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT bool APM_allocateMem()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
14
Sourse/AppManager/sourse/AppManager.h
Normal file
14
Sourse/AppManager/sourse/AppManager.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Data.h"
|
||||
|
||||
|
||||
DLLEXPORT void APM_OnStart(_AppManager *);
|
||||
|
||||
DLLEXPORT void APM_OnEnd();
|
||||
|
||||
DLLEXPORT void APM_LoopIn();
|
||||
|
||||
DLLEXPORT void APM_LoopOut();
|
||||
196
Sourse/Data/Data.vcxproj
Normal file
196
Sourse/Data/Data.vcxproj
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{E4451015-F74A-41BB-BC31-A55FFDDC6AF7}</ProjectGuid>
|
||||
<RootNamespace>Context</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Types</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\DataStruct\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\Sourse\Data\sourse\mesh;$(SolutionDir)\Sourse\Data\sourse\primitives;$(SolutionDir)\Sourse\Data\sourse\objects;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\DataStruct\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\DataStruct\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\Sourse\Data\sourse\mesh;$(SolutionDir)\Sourse\Data\sourse\primitives;$(SolutionDir)\Sourse\Data\sourse\objects;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\extern\include;$(SolutionDir)\DataStruct\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\mesh\Trig.cpp" />
|
||||
<ClCompile Include="sourse\mesh\Edge.cpp" />
|
||||
<ClCompile Include="sourse\mesh\Face.cpp" />
|
||||
<ClCompile Include="sourse\mesh\Vertex.cpp" />
|
||||
<ClCompile Include="sourse\objects\DT_Object.cpp" />
|
||||
<ClCompile Include="sourse\primitives\ray.cpp" />
|
||||
<ClCompile Include="sourse\primitives\timer.cpp" />
|
||||
<ClCompile Include="sourse\primitives\vec3f.cpp" />
|
||||
<ClCompile Include="sourse\RND_engine.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Data.h" />
|
||||
<ClInclude Include="sourse\mesh\Trig.h" />
|
||||
<ClInclude Include="sourse\mesh\Mesh.h" />
|
||||
<ClInclude Include="sourse\mesh\Edge.h" />
|
||||
<ClInclude Include="sourse\mesh\Face.h" />
|
||||
<ClInclude Include="sourse\mesh\Vertex.h" />
|
||||
<ClInclude Include="sourse\objects\DT_Object.h" />
|
||||
<ClInclude Include="sourse\primitives\ray.h" />
|
||||
<ClInclude Include="sourse\primitives\timer.h" />
|
||||
<ClInclude Include="sourse\primitives\vec3f.h" />
|
||||
<ClInclude Include="sourse\RND_engine.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStruct\DataStruct.vcxproj">
|
||||
<Project>{3b7aca3b-9394-496c-953c-b5b412555a4e}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
81
Sourse/Data/Data.vcxproj.filters
Normal file
81
Sourse/Data/Data.vcxproj.filters
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\primitives\vec3f.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\objects\DT_Object.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\mesh\Vertex.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\mesh\Face.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\mesh\Edge.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\mesh\Trig.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\primitives\timer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\RND_engine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\primitives\ray.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\primitives\vec3f.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\objects\DT_Object.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\mesh\Vertex.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\mesh\Face.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\mesh\Edge.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\mesh\Mesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\mesh\Trig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\primitives\timer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\RND_engine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\primitives\ray.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/Data/Data.vcxproj.user
Normal file
6
Sourse/Data/Data.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
87
Sourse/Data/sourse/Data.h
Normal file
87
Sourse/Data/sourse/Data.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#pragma once
|
||||
|
||||
#include "objects/DT_Object.h"
|
||||
|
||||
#include "primitives/timer.h"
|
||||
#include "primitives/ray.h"
|
||||
#include "RND_engine.h"
|
||||
#include <GLFW/glfw3.h> // Get rid of this some time
|
||||
|
||||
// ------------------Struct Data------------------------ //
|
||||
|
||||
struct _WinManager //HMMM structs
|
||||
{
|
||||
GLFWwindow* window_p = NULL;
|
||||
GLFWwindow* win_current_P = NULL;
|
||||
|
||||
int win_xpos = 0;
|
||||
int win_ypos = 0;
|
||||
int win_width = 0;
|
||||
int win_height = 0;
|
||||
|
||||
double mouse_x = 0;
|
||||
double mouse_y = 0;
|
||||
double mouse_befor_x = 0;
|
||||
double mouse_befor_y = 0;
|
||||
|
||||
|
||||
int eventID = 0;
|
||||
int action = 0;
|
||||
|
||||
|
||||
bool of = 1;
|
||||
//bool start = true;
|
||||
//float FocusFactor = 0.5;
|
||||
bool relesse = false;
|
||||
};
|
||||
|
||||
struct _FPS
|
||||
{
|
||||
int fps_val = 0;
|
||||
float time_LoopIn = 0;
|
||||
float time_LoopOut = 0;
|
||||
};
|
||||
|
||||
struct _AppManager
|
||||
{
|
||||
_FPS FPS;
|
||||
float total_memory = 0;
|
||||
};
|
||||
|
||||
struct _Gizmo
|
||||
{
|
||||
float Gizmo_Position[3]{ 0, 0, 0 };
|
||||
float Scale = 1;
|
||||
};
|
||||
|
||||
struct _3DViewport
|
||||
{
|
||||
float Position[3]{ 0, 0, 0 };
|
||||
float width = 0;
|
||||
float hiegth = 0;
|
||||
_Camera View;
|
||||
_Gizmo Gizmo;
|
||||
float* depth_buff = nullptr;
|
||||
};
|
||||
|
||||
struct _UI
|
||||
{
|
||||
_3DViewport Viewport;
|
||||
};
|
||||
|
||||
struct _Light
|
||||
{
|
||||
int index = 0;
|
||||
vec3f Dir;
|
||||
vec3f pos;
|
||||
};
|
||||
|
||||
struct _Data
|
||||
{
|
||||
_UI UI;
|
||||
_RND_cycle RND_cycle;
|
||||
_AppManager APM;
|
||||
_WinManager WM;
|
||||
_DA_MeshObjects DA_MeshObjects;
|
||||
_Light Light;
|
||||
};
|
||||
62
Sourse/Data/sourse/RND_engine.cpp
Normal file
62
Sourse/Data/sourse/RND_engine.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#include "RND_engine.h"
|
||||
|
||||
void _RND_cycle::update(_Camera* camera, int width, int height) {
|
||||
|
||||
timer.reset_start();
|
||||
timer.set_timer(100.f/6);
|
||||
|
||||
//if (restart)
|
||||
{
|
||||
|
||||
//printf("init cycle\n");
|
||||
cycle_complete = false;
|
||||
|
||||
pxlx = 1;
|
||||
pxly = 1;
|
||||
y_iteration_num = 0;
|
||||
|
||||
cam = camera;
|
||||
|
||||
vec3f tmp1 = vec3f(cam->x_unit_v);
|
||||
vec3f tmp2 = vec3f(cam->y_unit_v);
|
||||
vec3f tmp3 = vec3f(cam->z_unit_v);
|
||||
|
||||
tmp3 *= cam->near_plane;
|
||||
|
||||
camera_ray = tmp1 += (tmp2 += tmp3);
|
||||
|
||||
step_x = vec3f(cam->x_unit_v);
|
||||
step_y = vec3f(cam->y_unit_v);
|
||||
|
||||
//resolution = 5;
|
||||
resolution = cam->simplify;
|
||||
|
||||
step_x *= (resolution / width) * 2.f;
|
||||
step_y *= (resolution / height) * 2.f;
|
||||
|
||||
//restart = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool _RND_cycle::timeout() {
|
||||
if (timer.timeout()) {
|
||||
printf("time out\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
_RND_cycle::_RND_cycle()
|
||||
{
|
||||
resolution = 10;
|
||||
pxlx = 1;
|
||||
pxly = 1;
|
||||
y_iteration_num = 0;
|
||||
restart = true;
|
||||
cycle_complete = false;
|
||||
}
|
||||
|
||||
_RND_cycle::~_RND_cycle()
|
||||
{
|
||||
}
|
||||
42
Sourse/Data/sourse/RND_engine.h
Normal file
42
Sourse/Data/sourse/RND_engine.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include "primitives/vec3f.h"
|
||||
#include "primitives/timer.h"
|
||||
#include <stdio.h>
|
||||
|
||||
struct _Camera
|
||||
{
|
||||
vec3f CameraPos = vec3f(0, 2, 0);
|
||||
vec3f x_unit_v = vec3f(1, 0, 0);
|
||||
vec3f y_unit_v = vec3f(0, 0, 1);
|
||||
vec3f z_unit_v = vec3f(0, -1, 0);
|
||||
vec3f FocalPoint = vec3f(0.5f, 0.f, 0.5f);
|
||||
float near_plane = 2.f;
|
||||
float simplify = 10;
|
||||
};
|
||||
|
||||
|
||||
class _RND_cycle
|
||||
{
|
||||
public:
|
||||
_Time timer;
|
||||
|
||||
float resolution;
|
||||
int pxlx, pxly;
|
||||
bool restart;
|
||||
bool cycle_complete;
|
||||
int y_iteration_num;
|
||||
|
||||
_Camera* cam = nullptr;
|
||||
vec3f step_y;
|
||||
vec3f step_x;
|
||||
vec3f camera_ray;
|
||||
|
||||
_RND_cycle();
|
||||
~_RND_cycle();
|
||||
bool timeout();
|
||||
void update(_Camera* cam, int w, int h);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
202
Sourse/Data/sourse/mesh/Edge.cpp
Normal file
202
Sourse/Data/sourse/mesh/Edge.cpp
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
#include "Edge.h"
|
||||
|
||||
// ----------------------------- Edge --------------------------- //
|
||||
|
||||
// ---------------- DAI -------------------- //
|
||||
|
||||
_DAI_Edge::_DAI_Edge(_DAI_Edge* lastItem, int i)
|
||||
{
|
||||
DAI_Edge_prev_p = lastItem;
|
||||
DAI_Edge_index = i;
|
||||
}
|
||||
|
||||
_DAI_Edge::~_DAI_Edge()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------- DA -------------------- //
|
||||
|
||||
_DA_Edges::_DA_Edges() { }
|
||||
|
||||
void _DA_Edges::DAI_Edge_Add()
|
||||
{
|
||||
if (!DA_Edge_length)
|
||||
{
|
||||
DAP_Edge_First = new _DAI_Edge(DAP_Edge_Last, DA_Edge_length);
|
||||
DAP_Edge_Last = DAP_Edge_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
DAP_Edge_Last->DAI_Edge_next_p = new _DAI_Edge(DAP_Edge_Last, DA_Edge_length);
|
||||
DAP_Edge_Last = DAP_Edge_Last->DAI_Edge_next_p;
|
||||
}
|
||||
DA_Edge_length += 1;
|
||||
}
|
||||
|
||||
_DAI_Edge* _DA_Edges::DAI_Edge_GetItem(int index)
|
||||
{
|
||||
_DAI_Edge* item = DAI_Edge_Search(index);
|
||||
DAP_Edge_Buffer = item->DAI_Edge_next_p;
|
||||
return item;
|
||||
}
|
||||
|
||||
_DAI_Edge* _DA_Edges::DAI_Edge_Search(int index)
|
||||
{
|
||||
if (!(index >= DA_Edge_length or index < 0))
|
||||
{
|
||||
if (index == 0) // Spetial case
|
||||
{
|
||||
return DAP_Edge_First;
|
||||
}
|
||||
if (index == DA_Edge_length - 1) // Spetial case
|
||||
{
|
||||
return DAP_Edge_Last;
|
||||
}
|
||||
if (DAP_Edge_Buffer)
|
||||
{
|
||||
if (index == DAP_Edge_Buffer->DAI_Edge_index)
|
||||
{
|
||||
return DAP_Edge_Buffer;
|
||||
}
|
||||
}
|
||||
if (index <= DA_Edge_length / 2) // Start with furst item
|
||||
{
|
||||
_DAI_Edge* item = DAP_Edge_First;
|
||||
while (item->DAI_Edge_index != index)
|
||||
{
|
||||
item = item->DAI_Edge_next_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
else // last item
|
||||
{
|
||||
_DAI_Edge* item = DAP_Edge_Last;
|
||||
while (item->DAI_Edge_index != index)
|
||||
{
|
||||
item = item->DAI_Edge_prev_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr; //TODO make error
|
||||
}
|
||||
}
|
||||
|
||||
void _DA_Edges::DAI_Edge_Delete(int index_start = -1, int index_end = -1)
|
||||
{
|
||||
_DAI_Edge* DATempP_Edge_first;
|
||||
_DAI_Edge* DATempP_Edge_last;
|
||||
_DAI_Edge* DATempP_Edge_next;
|
||||
_DAI_Edge* DATempP_Edge_prev;
|
||||
_DAI_Edge* DATempP_Edge_del;
|
||||
|
||||
if (index_start < -1 or index_end < -1) { return; }
|
||||
if (index_end >= DA_Edge_length) { index_end = DA_Edge_length - 1; }
|
||||
|
||||
if (index_start == -1 and index_end == -1)
|
||||
{
|
||||
DATempP_Edge_first = DAP_Edge_First;
|
||||
DATempP_Edge_last = DAP_Edge_Last;
|
||||
index_start = 0;
|
||||
index_end = DA_Edge_length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Edge_first = DAI_Edge_Search(index_start); // Worst Time(n) ~ n
|
||||
|
||||
if (index_end == -1)
|
||||
{
|
||||
DATempP_Edge_last = DATempP_Edge_first;
|
||||
index_end = index_start;
|
||||
}
|
||||
else
|
||||
{ // Searching
|
||||
DATempP_Edge_last = DAI_Edge_Search(index_end);
|
||||
}
|
||||
}
|
||||
|
||||
int DATemp_Edge_IndexDifference = index_end - index_start;
|
||||
|
||||
|
||||
if (DATempP_Edge_last and DATempP_Edge_first)
|
||||
{
|
||||
DATempP_Edge_next = DATempP_Edge_last->DAI_Edge_next_p;
|
||||
DATempP_Edge_prev = DATempP_Edge_first->DAI_Edge_prev_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Edge_next = DATempP_Edge_prev = 0;
|
||||
}
|
||||
|
||||
// Deleting Items
|
||||
DAP_Edge_Buffer = DATempP_Edge_first;
|
||||
if (DAP_Edge_Buffer)
|
||||
{
|
||||
for (int i = index_start; i <= index_end; i++)
|
||||
{
|
||||
DATempP_Edge_del = DAP_Edge_Buffer;
|
||||
DAP_Edge_Buffer = DAP_Edge_Buffer->DAI_Edge_next_p;
|
||||
delete DATempP_Edge_del;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconect Links
|
||||
if (DATempP_Edge_next and DATempP_Edge_prev)
|
||||
{
|
||||
DATempP_Edge_next->DAI_Edge_prev_p = DATempP_Edge_prev;
|
||||
DATempP_Edge_prev->DAI_Edge_next_p = DATempP_Edge_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(DATempP_Edge_next or DATempP_Edge_prev)) // Array is completle çèðî
|
||||
{
|
||||
DAP_Edge_Last = DAP_Edge_First = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DATempP_Edge_next)
|
||||
{
|
||||
DATempP_Edge_prev->DAI_Edge_next_p = nullptr;
|
||||
DAP_Edge_Last = DATempP_Edge_prev;
|
||||
}
|
||||
else // Here is no prev item
|
||||
{
|
||||
DATempP_Edge_next->DAI_Edge_prev_p = nullptr;
|
||||
DAP_Edge_First = DATempP_Edge_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Changing indexes
|
||||
if (DATempP_Edge_next)
|
||||
{
|
||||
for (int i = index_end + 1; i < DA_Edge_length - 1; i++)
|
||||
{
|
||||
DATempP_Edge_next->DAI_Edge_index -= (DATemp_Edge_IndexDifference + 1);
|
||||
DATempP_Edge_next = DATempP_Edge_next->DAI_Edge_next_p;
|
||||
}
|
||||
}
|
||||
|
||||
DA_Edge_length -= (DATemp_Edge_IndexDifference + 1);
|
||||
}
|
||||
|
||||
void _DA_Edges::DA_Edge_Pop()
|
||||
{
|
||||
_DAI_Edge* DATemp_Edge_previtem = DAP_Edge_Last->DAI_Edge_prev_p;
|
||||
delete DAP_Edge_Last;
|
||||
DAP_Edge_Last = DATemp_Edge_previtem;
|
||||
DATemp_Edge_previtem->DAI_Edge_next_p = 0;
|
||||
DA_Edge_length -= 1;
|
||||
}
|
||||
|
||||
int _DA_Edges::DA_Edge_GetLength()
|
||||
{
|
||||
return DA_Edge_length;
|
||||
}
|
||||
|
||||
_DA_Edges::~_DA_Edges()
|
||||
{
|
||||
DAI_Edge_Delete();
|
||||
}
|
||||
41
Sourse/Data/sourse/mesh/Edge.h
Normal file
41
Sourse/Data/sourse/mesh/Edge.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Vertex.h"
|
||||
|
||||
// ----------------------------- Edge --------------------------- //
|
||||
|
||||
class _DAI_Edge
|
||||
{
|
||||
public:
|
||||
_DAI_Vertex* DAI_Vrt_Head;
|
||||
_DAI_Vertex* DAI_Vrt_Tail;
|
||||
|
||||
public:
|
||||
_DAI_Edge* DAI_Edge_next_p = nullptr;
|
||||
_DAI_Edge* DAI_Edge_prev_p;
|
||||
int DAI_Edge_index;
|
||||
|
||||
public:
|
||||
_DAI_Edge(_DAI_Edge* lastItem, int i);
|
||||
~_DAI_Edge();
|
||||
};
|
||||
|
||||
class _DA_Edges
|
||||
{
|
||||
private:
|
||||
_DAI_Edge* DAP_Edge_First = nullptr;
|
||||
_DAI_Edge* DAP_Edge_Last = nullptr;
|
||||
_DAI_Edge* DAP_Edge_Buffer = nullptr;
|
||||
int DA_Edge_length = 0;
|
||||
|
||||
public:
|
||||
DLLEXPORT _DA_Edges();
|
||||
DLLEXPORT ~_DA_Edges();
|
||||
DLLEXPORT void DAI_Edge_Add();
|
||||
DLLEXPORT _DAI_Edge* DAI_Edge_GetItem(int index);
|
||||
DLLEXPORT void DA_Edge_Pop();
|
||||
DLLEXPORT int DA_Edge_GetLength();
|
||||
DLLEXPORT void DAI_Edge_Delete(int index_start, int index_end);
|
||||
_DAI_Edge* DAI_Edge_Search(int index);
|
||||
};
|
||||
202
Sourse/Data/sourse/mesh/Face.cpp
Normal file
202
Sourse/Data/sourse/mesh/Face.cpp
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
#include "Face.h"
|
||||
|
||||
// ----------------------------- Face --------------------------- //
|
||||
|
||||
// ---------------- DAI -------------------- //
|
||||
|
||||
_DAI_Face_::_DAI_Face_(_DAI_Face_* lastItem, int i)
|
||||
{
|
||||
DAI_Face_prev_p = lastItem;
|
||||
DAI_Face_index = i;
|
||||
}
|
||||
|
||||
_DAI_Face_::~_DAI_Face_()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------- DA -------------------- //
|
||||
|
||||
_DA_Faces::_DA_Faces() { }
|
||||
|
||||
void _DA_Faces::DAI_Face_Add(char Objname)
|
||||
{
|
||||
if (!DA_Faces_length)
|
||||
{
|
||||
DAP_Face_First = new _DAI_Face_(DAP_Face_Last, DA_Faces_length);
|
||||
DAP_Face_Last = DAP_Face_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
DAP_Face_Last->DAI_Face_next_p = new _DAI_Face_(DAP_Face_Last, DA_Faces_length);
|
||||
DAP_Face_Last = DAP_Face_Last->DAI_Face_next_p;
|
||||
}
|
||||
DA_Faces_length += 1;
|
||||
}
|
||||
|
||||
_DAI_Face_* _DA_Faces::DAI_Face_GetItem(int index)
|
||||
{
|
||||
_DAI_Face_* item = DAI_Face_Search(index);
|
||||
DAP_Face_Buffer = item->DAI_Face_next_p;
|
||||
return item;
|
||||
}
|
||||
|
||||
_DAI_Face_* _DA_Faces::DAI_Face_Search(int index)
|
||||
{
|
||||
if (!(index >= DA_Faces_length or index < 0))
|
||||
{
|
||||
if (index == 0) // Spetial case
|
||||
{
|
||||
return DAP_Face_First;
|
||||
}
|
||||
if (index == DA_Faces_length - 1) // Spetial case
|
||||
{
|
||||
return DAP_Face_Last;
|
||||
}
|
||||
if (DAP_Face_Buffer)
|
||||
{
|
||||
if (index == DAP_Face_Buffer->DAI_Face_index)
|
||||
{
|
||||
return DAP_Face_Buffer;
|
||||
}
|
||||
}
|
||||
if (index <= DA_Faces_length / 2) // Start with furst item
|
||||
{
|
||||
_DAI_Face_* item = DAP_Face_First;
|
||||
while (item->DAI_Face_index != index)
|
||||
{
|
||||
item = item->DAI_Face_next_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
else // last item
|
||||
{
|
||||
_DAI_Face_* item = DAP_Face_Last;
|
||||
while (item->DAI_Face_index != index)
|
||||
{
|
||||
item = item->DAI_Face_prev_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr; //TODO make error
|
||||
}
|
||||
}
|
||||
|
||||
void _DA_Faces::DAI_Face_Delete(int index_start = -1, int index_end = -1)
|
||||
{
|
||||
_DAI_Face_* DATempP_Face_first;
|
||||
_DAI_Face_* DATempP_Face_last;
|
||||
_DAI_Face_* DATempP_Face_next;
|
||||
_DAI_Face_* DATempP_Face_prev;
|
||||
_DAI_Face_* DATempP_Face_del;
|
||||
|
||||
if (index_start < -1 or index_end < -1) { return; }
|
||||
if (index_end >= DA_Faces_length) { index_end = DA_Faces_length - 1; }
|
||||
|
||||
if (index_start == -1 and index_end == -1)
|
||||
{
|
||||
DATempP_Face_first = DAP_Face_First;
|
||||
DATempP_Face_last = DAP_Face_Last;
|
||||
index_start = 0;
|
||||
index_end = DA_Faces_length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Face_first = DAI_Face_Search(index_start); // Worst Time(n) ~ n
|
||||
|
||||
if (index_end == -1)
|
||||
{
|
||||
DATempP_Face_last = DATempP_Face_first;
|
||||
index_end = index_start;
|
||||
}
|
||||
else
|
||||
{ // Searching
|
||||
DATempP_Face_last = DAI_Face_Search(index_end);
|
||||
}
|
||||
}
|
||||
|
||||
int DATemp_IndexDifference = index_end - index_start;
|
||||
|
||||
|
||||
if (DATempP_Face_last and DATempP_Face_first)
|
||||
{
|
||||
DATempP_Face_next = DATempP_Face_last->DAI_Face_next_p;
|
||||
DATempP_Face_prev = DATempP_Face_first->DAI_Face_prev_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Face_next = DATempP_Face_prev = 0;
|
||||
}
|
||||
|
||||
// Deleting Items
|
||||
DAP_Face_Buffer = DATempP_Face_first;
|
||||
if (DAP_Face_Buffer)
|
||||
{
|
||||
for (int i = index_start; i <= index_end; i++)
|
||||
{
|
||||
DATempP_Face_del = DAP_Face_Buffer;
|
||||
DAP_Face_Buffer = DAP_Face_Buffer->DAI_Face_next_p;
|
||||
delete DATempP_Face_del;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconect Links
|
||||
if (DATempP_Face_next and DATempP_Face_prev)
|
||||
{
|
||||
DATempP_Face_next->DAI_Face_prev_p = DATempP_Face_prev;
|
||||
DATempP_Face_prev->DAI_Face_next_p = DATempP_Face_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(DATempP_Face_next or DATempP_Face_prev)) // Array is completle çèðî
|
||||
{
|
||||
DAP_Face_Last = DAP_Face_First = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DATempP_Face_next)
|
||||
{
|
||||
DATempP_Face_prev->DAI_Face_next_p = nullptr;
|
||||
DAP_Face_Last = DATempP_Face_prev;
|
||||
}
|
||||
else // Here is no prev item
|
||||
{
|
||||
DATempP_Face_next->DAI_Face_prev_p = nullptr;
|
||||
DAP_Face_First = DATempP_Face_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Changing indexes
|
||||
if (DATempP_Face_next)
|
||||
{
|
||||
for (int i = index_end + 1; i < DA_Faces_length - 1; i++)
|
||||
{
|
||||
DATempP_Face_next->DAI_Face_index -= (DATemp_IndexDifference + 1);
|
||||
DATempP_Face_next = DATempP_Face_next->DAI_Face_next_p;
|
||||
}
|
||||
}
|
||||
|
||||
DA_Faces_length -= (DATemp_IndexDifference + 1);
|
||||
}
|
||||
|
||||
void _DA_Faces::DA_Face_Pop()
|
||||
{
|
||||
_DAI_Face_* DATemp_Face_previtem = DAP_Face_Last->DAI_Face_prev_p;
|
||||
delete DAP_Face_Last;
|
||||
DAP_Face_Last = DATemp_Face_previtem;
|
||||
DATemp_Face_previtem->DAI_Face_next_p = 0;
|
||||
DA_Faces_length -= 1;
|
||||
}
|
||||
|
||||
int _DA_Faces::DA_Faces_GetLength()
|
||||
{
|
||||
return DA_Faces_length;
|
||||
}
|
||||
|
||||
_DA_Faces::~_DA_Faces()
|
||||
{
|
||||
DAI_Face_Delete();
|
||||
}
|
||||
45
Sourse/Data/sourse/mesh/Face.h
Normal file
45
Sourse/Data/sourse/mesh/Face.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Trig.h"
|
||||
|
||||
// ----------------------------- Face --------------------------- //
|
||||
|
||||
// ----------------------------- DynArrayItem --------------------------
|
||||
|
||||
class _DAI_Face_
|
||||
{
|
||||
public:
|
||||
_DAI_Trig* DAI_Trig_Left = nullptr;
|
||||
_DAI_Trig* DAI_Trig_Right = nullptr;
|
||||
|
||||
public:
|
||||
_DAI_Face_* DAI_Face_next_p = nullptr;
|
||||
_DAI_Face_* DAI_Face_prev_p;
|
||||
int DAI_Face_index;
|
||||
|
||||
public:
|
||||
_DAI_Face_(_DAI_Face_* lastItem, int i);
|
||||
~_DAI_Face_();
|
||||
};
|
||||
|
||||
// ----------------------------- DynArrayHead --------------------------
|
||||
|
||||
class _DA_Faces
|
||||
{
|
||||
private:
|
||||
_DAI_Face_* DAP_Face_First = nullptr;
|
||||
_DAI_Face_* DAP_Face_Last = nullptr;
|
||||
_DAI_Face_* DAP_Face_Buffer = nullptr;
|
||||
int DA_Faces_length = 0;
|
||||
|
||||
public:
|
||||
DLLEXPORT _DA_Faces();
|
||||
DLLEXPORT ~_DA_Faces();
|
||||
DLLEXPORT void DAI_Face_Add(char Objname); //FIXME
|
||||
DLLEXPORT _DAI_Face_* DAI_Face_GetItem(int index);
|
||||
DLLEXPORT void DA_Face_Pop();
|
||||
DLLEXPORT int DA_Faces_GetLength();
|
||||
DLLEXPORT void DAI_Face_Delete(int index_start, int index_end);
|
||||
_DAI_Face_* DAI_Face_Search(int index);
|
||||
};
|
||||
16
Sourse/Data/sourse/mesh/Mesh.h
Normal file
16
Sourse/Data/sourse/mesh/Mesh.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "Vertex.h"
|
||||
#include "Edge.h"
|
||||
#include "Trig.h"
|
||||
#include "Face.h"
|
||||
|
||||
/* --------------------------- Mesh -------------------------------- */
|
||||
|
||||
struct _Mesh
|
||||
{
|
||||
_DA_Vertices* DA_Vertices = nullptr;
|
||||
_DA_Edges* DA_Edges = nullptr;
|
||||
_DA_Trigs* DA_Trigs = nullptr;
|
||||
_DA_Faces* DA_Faces = nullptr;
|
||||
};
|
||||
216
Sourse/Data/sourse/mesh/Trig.cpp
Normal file
216
Sourse/Data/sourse/mesh/Trig.cpp
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
|
||||
#include "Trig.h"
|
||||
|
||||
// ----------------------------- Trig --------------------------- //
|
||||
|
||||
// ---------------- DAI -------------------- //
|
||||
|
||||
_DAI_Trig::_DAI_Trig(_DAI_Trig* lastItem, int i)
|
||||
{
|
||||
DAI_Trig_prev_p = lastItem;
|
||||
DAI_Trig_index = i;
|
||||
}
|
||||
|
||||
void _DAI_Trig::norm(vec3f* vec)
|
||||
{
|
||||
vec3f vec1 = vec3f(v2->vec);
|
||||
vec3f vec2 = vec3f(v3->vec);
|
||||
|
||||
vec1 -= v1->vec;
|
||||
vec2 -= v1->vec;
|
||||
|
||||
vec1.cross(&vec2, vec);
|
||||
*vec /= vec->mod();
|
||||
}
|
||||
|
||||
_DAI_Trig::~_DAI_Trig()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------- DA -------------------- //
|
||||
|
||||
_DA_Trigs::_DA_Trigs() { }
|
||||
|
||||
void _DA_Trigs::DAI_Trig_Add()
|
||||
{
|
||||
if (!DA_Trigs_length)
|
||||
{
|
||||
DAP_Trig_First = new _DAI_Trig(DAP_Trig_Last, DA_Trigs_length);
|
||||
DAP_Trig_Last = DAP_Trig_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
DAP_Trig_Last->DAI_Trig_next_p = new _DAI_Trig(DAP_Trig_Last, DA_Trigs_length);
|
||||
DAP_Trig_Last = DAP_Trig_Last->DAI_Trig_next_p;
|
||||
}
|
||||
DA_Trigs_length += 1;
|
||||
}
|
||||
|
||||
_DAI_Trig* _DA_Trigs::DAI_Trig_GetItem(int index)
|
||||
{
|
||||
_DAI_Trig* item = DAI_Trig_Search(index);
|
||||
DAP_Trig_Buffer = item->DAI_Trig_next_p;
|
||||
return item;
|
||||
}
|
||||
|
||||
_DAI_Trig* _DA_Trigs::DAI_Trig_Search(int index)
|
||||
{
|
||||
if (!(index >= DA_Trigs_length or index < 0))
|
||||
{
|
||||
if (index == 0) // Spetial case
|
||||
{
|
||||
return DAP_Trig_First;
|
||||
}
|
||||
if (index == DA_Trigs_length - 1) // Spetial case
|
||||
{
|
||||
return DAP_Trig_Last;
|
||||
}
|
||||
if (DAP_Trig_Buffer)
|
||||
{
|
||||
if (index == DAP_Trig_Buffer->DAI_Trig_index)
|
||||
{
|
||||
return DAP_Trig_Buffer;
|
||||
}
|
||||
}
|
||||
if (index <= DA_Trigs_length / 2) // Start with furst item
|
||||
{
|
||||
_DAI_Trig* item = DAP_Trig_First;
|
||||
while (item->DAI_Trig_index != index)
|
||||
{
|
||||
item = item->DAI_Trig_next_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
else // last item
|
||||
{
|
||||
_DAI_Trig* item = DAP_Trig_Last;
|
||||
while (item->DAI_Trig_index != index)
|
||||
{
|
||||
item = item->DAI_Trig_prev_p;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr; //TODO make error
|
||||
}
|
||||
}
|
||||
|
||||
void _DA_Trigs::DAI_Trig_Delete(int index_start = -1, int index_end = -1)
|
||||
{
|
||||
_DAI_Trig* DATempP_Trig_first;
|
||||
_DAI_Trig* DATempP_Trig_last;
|
||||
_DAI_Trig* DATempP_Trig_next;
|
||||
_DAI_Trig* DATempP_Trig_prev;
|
||||
_DAI_Trig* DATempP_Trig_del;
|
||||
|
||||
if (index_start < -1 or index_end < -1) { return; }
|
||||
if (index_end >= DA_Trigs_length) { index_end = DA_Trigs_length - 1; }
|
||||
|
||||
if (index_start == -1 and index_end == -1)
|
||||
{
|
||||
DATempP_Trig_first = DAP_Trig_First;
|
||||
DATempP_Trig_last = DAP_Trig_Last;
|
||||
index_start = 0;
|
||||
index_end = DA_Trigs_length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Trig_first = DAI_Trig_Search(index_start); // Worst Time(n) ~ n
|
||||
|
||||
if (index_end == -1)
|
||||
{
|
||||
DATempP_Trig_last = DATempP_Trig_first;
|
||||
index_end = index_start;
|
||||
}
|
||||
else
|
||||
{ // Searching
|
||||
DATempP_Trig_last = DAI_Trig_Search(index_end);
|
||||
}
|
||||
}
|
||||
|
||||
int DATemp_Trig_IndexDifference = index_end - index_start;
|
||||
|
||||
|
||||
if (DATempP_Trig_last and DATempP_Trig_first)
|
||||
{
|
||||
DATempP_Trig_next = DATempP_Trig_last->DAI_Trig_next_p;
|
||||
DATempP_Trig_prev = DATempP_Trig_first->DAI_Trig_prev_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
DATempP_Trig_next = DATempP_Trig_prev = 0;
|
||||
}
|
||||
|
||||
// Deleting Items
|
||||
DAP_Trig_Buffer = DATempP_Trig_first;
|
||||
if (DAP_Trig_Buffer)
|
||||
{
|
||||
for (int i = index_start; i <= index_end; i++)
|
||||
{
|
||||
DATempP_Trig_del = DAP_Trig_Buffer;
|
||||
DAP_Trig_Buffer = DAP_Trig_Buffer->DAI_Trig_next_p;
|
||||
delete DATempP_Trig_del;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconect Links
|
||||
if (DATempP_Trig_next and DATempP_Trig_prev)
|
||||
{
|
||||
DATempP_Trig_next->DAI_Trig_prev_p = DATempP_Trig_prev;
|
||||
DATempP_Trig_prev->DAI_Trig_next_p = DATempP_Trig_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(DATempP_Trig_next or DATempP_Trig_prev)) // Array is completle çèðî
|
||||
{
|
||||
DAP_Trig_Last = DAP_Trig_First = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DATempP_Trig_next)
|
||||
{
|
||||
DATempP_Trig_prev->DAI_Trig_next_p = nullptr;
|
||||
DAP_Trig_Last = DATempP_Trig_prev;
|
||||
}
|
||||
else // Here is no prev item
|
||||
{
|
||||
DATempP_Trig_next->DAI_Trig_prev_p = nullptr;
|
||||
DAP_Trig_First = DATempP_Trig_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Changing indexes
|
||||
if (DATempP_Trig_next)
|
||||
{
|
||||
for (int i = index_end + 1; i < DA_Trigs_length - 1; i++)
|
||||
{
|
||||
DATempP_Trig_next->DAI_Trig_index -= (DATemp_Trig_IndexDifference + 1);
|
||||
DATempP_Trig_next = DATempP_Trig_next->DAI_Trig_next_p;
|
||||
}
|
||||
}
|
||||
|
||||
DA_Trigs_length -= (DATemp_Trig_IndexDifference + 1);
|
||||
}
|
||||
|
||||
void _DA_Trigs::DA_Trig_Pop()
|
||||
{
|
||||
_DAI_Trig* DATemp_Trig_previtem = DAP_Trig_Last->DAI_Trig_prev_p;
|
||||
delete DAP_Trig_Last;
|
||||
DAP_Trig_Last = DATemp_Trig_previtem;
|
||||
DATemp_Trig_previtem->DAI_Trig_next_p = 0;
|
||||
DA_Trigs_length -= 1;
|
||||
}
|
||||
|
||||
int _DA_Trigs::DA_Trigs_GetLength()
|
||||
{
|
||||
return DA_Trigs_length;
|
||||
}
|
||||
|
||||
_DA_Trigs::~_DA_Trigs()
|
||||
{
|
||||
DAI_Trig_Delete();
|
||||
}
|
||||
|
||||
45
Sourse/Data/sourse/mesh/Trig.h
Normal file
45
Sourse/Data/sourse/mesh/Trig.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Edge.h"
|
||||
|
||||
// ----------------------------- Trig --------------------------- //
|
||||
|
||||
class _DAI_Trig
|
||||
{
|
||||
public:
|
||||
_DAI_Vertex* v1;
|
||||
_DAI_Vertex* v2;
|
||||
_DAI_Vertex* v3;
|
||||
|
||||
public:
|
||||
_DAI_Trig* DAI_Trig_next_p = nullptr;
|
||||
_DAI_Trig* DAI_Trig_prev_p;
|
||||
int DAI_Trig_index;
|
||||
|
||||
public:
|
||||
_DAI_Trig(_DAI_Trig* lastItem, int i);
|
||||
void norm(vec3f * vec);
|
||||
~_DAI_Trig();
|
||||
};
|
||||
|
||||
class _DA_Trigs
|
||||
{
|
||||
private:
|
||||
_DAI_Trig* DAP_Trig_First = nullptr;
|
||||
_DAI_Trig* DAP_Trig_Last = nullptr;
|
||||
_DAI_Trig* DAP_Trig_Buffer = nullptr;
|
||||
int DA_Trigs_length = 0;
|
||||
|
||||
public:
|
||||
DLLEXPORT _DA_Trigs();
|
||||
DLLEXPORT ~_DA_Trigs();
|
||||
DLLEXPORT void DAI_Trig_Add();
|
||||
DLLEXPORT _DAI_Trig* DAI_Trig_GetItem(int index);
|
||||
DLLEXPORT void DA_Trig_Pop();
|
||||
DLLEXPORT int DA_Trigs_GetLength();
|
||||
DLLEXPORT void DAI_Trig_Delete(int index_start, int index_end);
|
||||
_DAI_Trig* DAI_Trig_Search(int index);
|
||||
};
|
||||
|
||||
|
||||
246
Sourse/Data/sourse/mesh/Vertex.cpp
Normal file
246
Sourse/Data/sourse/mesh/Vertex.cpp
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
#include "Vertex.h"
|
||||
|
||||
// ----------------------------- Vertex --------------------------- //
|
||||
|
||||
_DAI_Vertex::_DAI_Vertex(_DAI_Vertex* lastItem, int i, float init_val[3])
|
||||
{
|
||||
P_Vrtx_prev = lastItem;
|
||||
Vrtx_index = i;
|
||||
vec.x = init_val[0];
|
||||
vec.y = init_val[1];
|
||||
vec.z = init_val[2];
|
||||
}
|
||||
|
||||
_DAI_Vertex::_DAI_Vertex(_DAI_Vertex* lastItem, int i, _DAI_Vertex* vert)
|
||||
{
|
||||
P_Vrtx_prev = lastItem;
|
||||
Vrtx_index = i;
|
||||
vec = vert->vec;
|
||||
}
|
||||
|
||||
_DAI_Vertex::_DAI_Vertex(_DAI_Vertex* lastItem, int i)
|
||||
{
|
||||
P_Vrtx_prev = lastItem;
|
||||
Vrtx_index = i;
|
||||
vec.x = 0;
|
||||
vec.y = 0;
|
||||
vec.z = 0;
|
||||
}
|
||||
|
||||
_DAI_Vertex::~_DAI_Vertex()
|
||||
{
|
||||
}
|
||||
|
||||
_DA_Vertices::_DA_Vertices() { }
|
||||
|
||||
void _DA_Vertices::Vertex_Add(float init_val[3])
|
||||
{
|
||||
if (!Vrtx_length)
|
||||
{
|
||||
P_Vrtx_First = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length, init_val);
|
||||
P_Vrtx_Last = P_Vrtx_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
P_Vrtx_Last->P_Vrtx_next = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length, init_val);
|
||||
P_Vrtx_Last = P_Vrtx_Last->P_Vrtx_next;
|
||||
}
|
||||
Vrtx_length += 1;
|
||||
}
|
||||
|
||||
void _DA_Vertices::Vertex_Add()
|
||||
{
|
||||
if (!Vrtx_length)
|
||||
{
|
||||
P_Vrtx_First = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length);
|
||||
P_Vrtx_Last = P_Vrtx_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
P_Vrtx_Last->P_Vrtx_next = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length);
|
||||
P_Vrtx_Last = P_Vrtx_Last->P_Vrtx_next;
|
||||
}
|
||||
Vrtx_length += 1;
|
||||
}
|
||||
|
||||
void _DA_Vertices::Vertex_Add(_DAI_Vertex *vert)
|
||||
{
|
||||
if (!Vrtx_length)
|
||||
{
|
||||
P_Vrtx_First = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length, vert);
|
||||
P_Vrtx_Last = P_Vrtx_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
P_Vrtx_Last->P_Vrtx_next = new _DAI_Vertex(P_Vrtx_Last, Vrtx_length, vert);
|
||||
P_Vrtx_Last = P_Vrtx_Last->P_Vrtx_next;
|
||||
}
|
||||
Vrtx_length += 1;
|
||||
}
|
||||
|
||||
_DAI_Vertex* _DA_Vertices::Vrt_GetItem(int index)
|
||||
{
|
||||
_DAI_Vertex* item = Vertex_Search(index);
|
||||
P_Vrtx_buffer = item->P_Vrtx_next;
|
||||
return item;
|
||||
}
|
||||
|
||||
_DAI_Vertex* _DA_Vertices::Vertex_Search(int index)
|
||||
{
|
||||
if (!(index >= Vrtx_length or index < 0))
|
||||
{
|
||||
if (index == 0) // Spetial case
|
||||
{
|
||||
return P_Vrtx_First;
|
||||
}
|
||||
if (index == Vrtx_length - 1) // Spetial case
|
||||
{
|
||||
return P_Vrtx_Last;
|
||||
}
|
||||
if (P_Vrtx_buffer)
|
||||
{
|
||||
if (index == P_Vrtx_buffer->Vrtx_index)
|
||||
{
|
||||
return P_Vrtx_buffer;
|
||||
}
|
||||
}
|
||||
if (index <= Vrtx_length / 2) // Start with furst item
|
||||
{
|
||||
_DAI_Vertex* item = P_Vrtx_First;
|
||||
while (item->Vrtx_index != index)
|
||||
{
|
||||
item = item->P_Vrtx_next;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
else // last item
|
||||
{
|
||||
_DAI_Vertex* item = P_Vrtx_Last;
|
||||
while (item->Vrtx_index != index)
|
||||
{
|
||||
item = item->P_Vrtx_prev;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr; //TODO make error
|
||||
}
|
||||
}
|
||||
|
||||
void _DA_Vertices::Vertex_Delete(int index_start = -1, int index_end = -1)
|
||||
{
|
||||
_DAI_Vertex* TP_Trig_First;
|
||||
_DAI_Vertex* TP_Trig_Last;
|
||||
_DAI_Vertex* TP_Trig_next;
|
||||
_DAI_Vertex* TP_Trig_prev;
|
||||
_DAI_Vertex* TP_Trig_del;
|
||||
|
||||
if (index_start < -1 or index_end < -1) { return; }
|
||||
if (index_end >= Vrtx_length) { index_end = Vrtx_length - 1; }
|
||||
|
||||
if (index_start == -1 and index_end == -1)
|
||||
{
|
||||
TP_Trig_First = P_Vrtx_First;
|
||||
TP_Trig_Last = P_Vrtx_Last;
|
||||
index_start = 0;
|
||||
index_end = Vrtx_length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TP_Trig_First = Vertex_Search(index_start); // Worst Time(n) ~ n
|
||||
|
||||
if (index_end == -1)
|
||||
{
|
||||
TP_Trig_Last = TP_Trig_First;
|
||||
index_end = index_start;
|
||||
}
|
||||
else
|
||||
{ // Searching
|
||||
TP_Trig_Last = Vertex_Search(index_end);
|
||||
}
|
||||
}
|
||||
|
||||
int index_difference = index_end - index_start;
|
||||
|
||||
|
||||
if (TP_Trig_Last and TP_Trig_First)
|
||||
{
|
||||
TP_Trig_next = TP_Trig_Last->P_Vrtx_next;
|
||||
TP_Trig_prev = TP_Trig_First->P_Vrtx_prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
TP_Trig_next = TP_Trig_prev = 0;
|
||||
}
|
||||
|
||||
// Deleting Items
|
||||
P_Vrtx_buffer = TP_Trig_First;
|
||||
if (P_Vrtx_buffer)
|
||||
{
|
||||
for (int i = index_start; i <= index_end; i++)
|
||||
{
|
||||
TP_Trig_del = P_Vrtx_buffer;
|
||||
P_Vrtx_buffer = P_Vrtx_buffer->P_Vrtx_next;
|
||||
delete TP_Trig_del;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconect Links
|
||||
if (TP_Trig_next and TP_Trig_prev)
|
||||
{
|
||||
TP_Trig_next->P_Vrtx_prev = TP_Trig_prev;
|
||||
TP_Trig_prev->P_Vrtx_next = TP_Trig_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(TP_Trig_next or TP_Trig_prev)) // Array is completle çèðî
|
||||
{
|
||||
P_Vrtx_Last = P_Vrtx_First = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TP_Trig_next)
|
||||
{
|
||||
TP_Trig_prev->P_Vrtx_next = nullptr;
|
||||
P_Vrtx_Last = TP_Trig_prev;
|
||||
}
|
||||
else // Here is no prev item
|
||||
{
|
||||
TP_Trig_next->P_Vrtx_prev = nullptr;
|
||||
P_Vrtx_First = TP_Trig_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Changing indexes
|
||||
if (TP_Trig_next)
|
||||
{
|
||||
for (int i = index_end + 1; i < Vrtx_length - 1; i++)
|
||||
{
|
||||
TP_Trig_next->Vrtx_index -= (index_difference + 1);
|
||||
TP_Trig_next = TP_Trig_next->P_Vrtx_next;
|
||||
}
|
||||
}
|
||||
|
||||
Vrtx_length -= (index_difference + 1);
|
||||
}
|
||||
|
||||
void _DA_Vertices::Vertex_Pop()
|
||||
{
|
||||
_DAI_Vertex* prev_item = P_Vrtx_Last->P_Vrtx_prev;
|
||||
delete P_Vrtx_Last;
|
||||
P_Vrtx_Last = prev_item;
|
||||
prev_item->P_Vrtx_next = 0;
|
||||
Vrtx_length -= 1;
|
||||
}
|
||||
|
||||
int _DA_Vertices::Vertices_GetLength()
|
||||
{
|
||||
return Vrtx_length;
|
||||
}
|
||||
|
||||
_DA_Vertices::~_DA_Vertices() { Vertex_Delete(); }
|
||||
|
||||
|
||||
43
Sourse/Data/sourse/mesh/Vertex.h
Normal file
43
Sourse/Data/sourse/mesh/Vertex.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#include "..\primitives\vec3f.h"
|
||||
|
||||
// ---------------- Vrts ----------------------- //
|
||||
class _DAI_Vertex
|
||||
{
|
||||
public:
|
||||
vec3f vec;
|
||||
public:
|
||||
_DAI_Vertex(_DAI_Vertex* prevItem, int i, float init_val[3]);
|
||||
_DAI_Vertex(_DAI_Vertex* prevItem, int i, _DAI_Vertex* vert);
|
||||
_DAI_Vertex(_DAI_Vertex* prevItem, int i);
|
||||
~_DAI_Vertex();
|
||||
public: //TODO: make privat
|
||||
_DAI_Vertex* P_Vrtx_next = nullptr;
|
||||
_DAI_Vertex* P_Vrtx_prev;
|
||||
int Vrtx_index;
|
||||
};
|
||||
|
||||
class _DA_Vertices
|
||||
{
|
||||
public:
|
||||
//TODO: add methods for Vrt
|
||||
|
||||
private:
|
||||
_DAI_Vertex* P_Vrtx_First = nullptr;
|
||||
_DAI_Vertex* P_Vrtx_Last = nullptr;
|
||||
_DAI_Vertex* P_Vrtx_buffer = nullptr;
|
||||
int Vrtx_length = 0;
|
||||
|
||||
public:
|
||||
_DA_Vertices();
|
||||
~_DA_Vertices();
|
||||
DLLEXPORT void Vertex_Add(float init_val[3]);
|
||||
DLLEXPORT void Vertex_Add();
|
||||
DLLEXPORT void Vertex_Add(_DAI_Vertex * vert);
|
||||
DLLEXPORT _DAI_Vertex* Vrt_GetItem(int index);
|
||||
DLLEXPORT void Vertex_Pop();
|
||||
DLLEXPORT int Vertices_GetLength();
|
||||
DLLEXPORT void Vertex_Delete(int index_start, int index_end);
|
||||
_DAI_Vertex* Vertex_Search(int index);
|
||||
};
|
||||
283
Sourse/Data/sourse/objects/DT_Object.cpp
Normal file
283
Sourse/Data/sourse/objects/DT_Object.cpp
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
#include "DT_Object.h"
|
||||
#include "Math.h"
|
||||
|
||||
// ---------------- _DAI_ -------------------- //
|
||||
|
||||
_DAI_Object::_DAI_Object(_DAI_Object* obj, _DAI_Object* lastItem, int i)
|
||||
{
|
||||
P_Obj_prev = lastItem;
|
||||
Obj_index = i;
|
||||
|
||||
Mesh.DA_Vertices = new _DA_Vertices;
|
||||
Mesh.DA_Trigs = new _DA_Trigs;
|
||||
|
||||
for (int i = 0; i < obj->Mesh.DA_Vertices->Vertices_GetLength(); i++) {
|
||||
Mesh.DA_Vertices->Vertex_Add();
|
||||
_DAI_Vertex *vert1 = Mesh.DA_Vertices->Vrt_GetItem(i);
|
||||
_DAI_Vertex* vert2 = obj->Mesh.DA_Vertices->Vrt_GetItem(i);
|
||||
vert1->vec = vert2->vec;
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj->Mesh.DA_Trigs->DA_Trigs_GetLength(); i++) {
|
||||
Mesh.DA_Trigs->DAI_Trig_Add();
|
||||
_DAI_Trig* trig1 = Mesh.DA_Trigs->DAI_Trig_GetItem(i);
|
||||
_DAI_Trig* trig2 = obj->Mesh.DA_Trigs->DAI_Trig_GetItem(i);
|
||||
trig1->v1 = trig2->v1;
|
||||
trig1->v2 = trig2->v2;
|
||||
trig1->v3 = trig2->v3;
|
||||
}
|
||||
|
||||
vec3f displ = vec3f(0.5f, 0.5f, 0.5f);
|
||||
|
||||
Position = obj->Position;
|
||||
Position += displ;
|
||||
unit_vx = obj->unit_vx;
|
||||
unit_vy = obj->unit_vy;
|
||||
unit_vz = obj->unit_vz;
|
||||
|
||||
name = obj->name + 'a';
|
||||
}
|
||||
|
||||
_DAI_Object::_DAI_Object(char Objname, _DAI_Object* lastItem, int i)
|
||||
{
|
||||
Position.assing(0.0f, 0.0f, 0.0f);
|
||||
unit_vx.assing(1.f, 0.0f, 0.0f);
|
||||
unit_vy.assing(0.0f, 1.0f, 0.0f);
|
||||
unit_vz.assing(0.0f, 0.0f, 1.0f);
|
||||
|
||||
name = Objname;
|
||||
P_Obj_prev = lastItem;
|
||||
Obj_index = i;
|
||||
Mesh.DA_Vertices = new _DA_Vertices; //TODO Obj item type init val
|
||||
Mesh.DA_Trigs = new _DA_Trigs;
|
||||
}
|
||||
|
||||
void _DAI_Object::rot(vec3f* axs_dir, vec3f* axs_pos, float angle)
|
||||
{
|
||||
printf("");
|
||||
for (int i = 0; i < 3; i++) {
|
||||
(&unit_vx)[i] += Position;
|
||||
vec3f* vec = &(&unit_vx)[i];
|
||||
MATH_RotateArbAxes(&axs_dir->x, &axs_pos->x, &((&unit_vx)[i].x), angle);
|
||||
(&unit_vx)[i] -= Position;
|
||||
}
|
||||
}
|
||||
|
||||
void _DAI_Object::scale(float factor)
|
||||
{
|
||||
unit_vx *= factor;
|
||||
unit_vy *= factor;
|
||||
unit_vz *= factor;
|
||||
}
|
||||
|
||||
void _DAI_Object::move(vec3f* displacement)
|
||||
{
|
||||
Position += displacement;
|
||||
}
|
||||
|
||||
_DAI_Object::~_DAI_Object()
|
||||
{
|
||||
Mesh.DA_Vertices->~_DA_Vertices();
|
||||
} //FIXME delete item
|
||||
|
||||
// ---------------- _DA_Obj -------------------- //
|
||||
|
||||
_DA_MeshObjects::_DA_MeshObjects() { }
|
||||
|
||||
void _DA_MeshObjects::Obj_Add(char Objname)
|
||||
{
|
||||
if (!CI_length)
|
||||
{
|
||||
P_Obj_First = new _DAI_Object(Objname, P_Obj_Last, CI_length);
|
||||
P_Obj_Last = P_Obj_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
P_Obj_Last->P_Obj_next = new _DAI_Object(Objname, P_Obj_Last, CI_length);
|
||||
P_Obj_Last = P_Obj_Last->P_Obj_next;
|
||||
}
|
||||
CI_length += 1;
|
||||
}
|
||||
|
||||
void _DA_MeshObjects::Obj_Add(_DAI_Object *obj)
|
||||
{
|
||||
if (!CI_length)
|
||||
{
|
||||
P_Obj_First = new _DAI_Object(obj, P_Obj_Last, CI_length);
|
||||
P_Obj_Last = P_Obj_First;
|
||||
}
|
||||
else
|
||||
{
|
||||
P_Obj_Last->P_Obj_next = new _DAI_Object(obj, P_Obj_Last, CI_length);
|
||||
P_Obj_Last = P_Obj_Last->P_Obj_next;
|
||||
}
|
||||
CI_length += 1;
|
||||
}
|
||||
|
||||
_DAI_Object* _DA_MeshObjects::Obj_GetItem(int index)
|
||||
{
|
||||
_DAI_Object* item = Obj_Search(index);
|
||||
P_Obj_buffer = item->P_Obj_next;
|
||||
return item;
|
||||
}
|
||||
|
||||
_DAI_Object* _DA_MeshObjects::Obj_Search(int index)
|
||||
{
|
||||
if (!(index >= CI_length or index < 0)) //HMMM check bounds and maybe add DAH_Middel item
|
||||
{
|
||||
if (index == 0) // Spetial case
|
||||
{
|
||||
return P_Obj_First;
|
||||
}
|
||||
if (index == CI_length - 1) // Spetial case
|
||||
{
|
||||
return P_Obj_Last;
|
||||
}
|
||||
if (P_Obj_buffer)
|
||||
{
|
||||
if (index == P_Obj_buffer->Obj_index)
|
||||
{
|
||||
return P_Obj_buffer;
|
||||
}
|
||||
}
|
||||
if (index <= CI_length / 2) // Start with furst item
|
||||
{
|
||||
_DAI_Object* item = P_Obj_First;
|
||||
while (item->Obj_index != index)
|
||||
{
|
||||
item = item->P_Obj_next;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
else // last item
|
||||
{
|
||||
_DAI_Object* item = P_Obj_Last;
|
||||
while (item->Obj_index != index)
|
||||
{
|
||||
item = item->P_Obj_prev;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr; //TODO make error
|
||||
}
|
||||
}
|
||||
|
||||
void _DA_MeshObjects::Obj_Delete(int index_start = -1, int index_end = -1)
|
||||
{
|
||||
_DAI_Object* TP_Obj_First;
|
||||
_DAI_Object* TP_Obj_Last;
|
||||
_DAI_Object* TP_Obj_next;
|
||||
_DAI_Object* TP_Obj_prev;
|
||||
_DAI_Object* TP_Obj_del;
|
||||
|
||||
if (index_start < -1 or index_end < -1) { return; }
|
||||
if (index_end >= CI_length) { index_end = CI_length - 1; }
|
||||
|
||||
if (index_start == -1 and index_end == -1)
|
||||
{
|
||||
TP_Obj_First = P_Obj_First;
|
||||
TP_Obj_Last = P_Obj_Last;
|
||||
index_start = 0;
|
||||
index_end = CI_length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TP_Obj_First = Obj_Search(index_start); // Worst Time(n) ~ n
|
||||
|
||||
if (index_end == -1)
|
||||
{
|
||||
TP_Obj_Last = TP_Obj_First;
|
||||
index_end = index_start;
|
||||
}
|
||||
else
|
||||
{ // Searching
|
||||
TP_Obj_Last = Obj_Search(index_end);
|
||||
}
|
||||
}
|
||||
|
||||
int index_difference = index_end - index_start;
|
||||
|
||||
|
||||
if (TP_Obj_Last and TP_Obj_First)
|
||||
{
|
||||
TP_Obj_next = TP_Obj_Last->P_Obj_next;
|
||||
TP_Obj_prev = TP_Obj_First->P_Obj_prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
TP_Obj_next = TP_Obj_prev = 0;
|
||||
}
|
||||
|
||||
// Deleting Items
|
||||
P_Obj_buffer = TP_Obj_First;
|
||||
if (P_Obj_buffer)
|
||||
{
|
||||
for (int i = index_start; i <= index_end; i++)
|
||||
{
|
||||
TP_Obj_del = P_Obj_buffer;
|
||||
P_Obj_buffer = P_Obj_buffer->P_Obj_next;
|
||||
delete TP_Obj_del;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconect Links
|
||||
if (TP_Obj_next and TP_Obj_prev)
|
||||
{
|
||||
TP_Obj_next->P_Obj_prev = TP_Obj_prev;
|
||||
TP_Obj_prev->P_Obj_next = TP_Obj_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(TP_Obj_next or TP_Obj_prev)) // Array is completle çèðî
|
||||
{
|
||||
P_Obj_Last = P_Obj_First = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TP_Obj_next)
|
||||
{
|
||||
TP_Obj_prev->P_Obj_next = nullptr;
|
||||
P_Obj_Last = TP_Obj_prev;
|
||||
}
|
||||
else // Here is no prev item
|
||||
{
|
||||
TP_Obj_next->P_Obj_prev = nullptr;
|
||||
P_Obj_First = TP_Obj_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Changing indexes
|
||||
if (TP_Obj_next)
|
||||
{
|
||||
for (int i = index_end + 1; i < CI_length - 1; i++)
|
||||
{
|
||||
TP_Obj_next->Obj_index -= (index_difference + 1);
|
||||
TP_Obj_next = TP_Obj_next->P_Obj_next;
|
||||
}
|
||||
}
|
||||
|
||||
CI_length -= (index_difference + 1);
|
||||
}
|
||||
|
||||
void _DA_MeshObjects::Obj_Pop()
|
||||
{
|
||||
_DAI_Object* prev_item = P_Obj_Last->P_Obj_prev;
|
||||
delete P_Obj_Last;
|
||||
P_Obj_Last = prev_item;
|
||||
prev_item->P_Obj_next = 0;
|
||||
CI_length -= 1;
|
||||
}
|
||||
|
||||
int _DA_MeshObjects::Obj_GetLength()
|
||||
{
|
||||
return CI_length;
|
||||
}
|
||||
|
||||
_DA_MeshObjects::~_DA_MeshObjects()
|
||||
{
|
||||
Obj_Delete();
|
||||
}
|
||||
52
Sourse/Data/sourse/objects/DT_Object.h
Normal file
52
Sourse/Data/sourse/objects/DT_Object.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#pragma once
|
||||
#include "..\mesh\Mesh.h"
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
// ---------------- Object --------------------- //
|
||||
|
||||
class _DAI_Object
|
||||
{
|
||||
public:
|
||||
_Mesh Mesh;
|
||||
|
||||
vec3f Position;
|
||||
vec3f unit_vx;
|
||||
vec3f unit_vy;
|
||||
vec3f unit_vz;
|
||||
|
||||
char name = 'o';
|
||||
|
||||
public:
|
||||
_DAI_Object* P_Obj_next = nullptr;
|
||||
_DAI_Object* P_Obj_prev;
|
||||
int Obj_index;
|
||||
public:
|
||||
_DAI_Object(_DAI_Object* obj, _DAI_Object* lastItem, int i);
|
||||
_DAI_Object(const char Objname, _DAI_Object* lastItem, int i);
|
||||
void move(vec3f *displacement);
|
||||
void rot(vec3f *axs_dir, vec3f* axs_pos, float angle);
|
||||
void scale(float factor);
|
||||
~_DAI_Object();
|
||||
};
|
||||
|
||||
class _DA_MeshObjects
|
||||
{
|
||||
public:
|
||||
_DAI_Object* active = nullptr;
|
||||
|
||||
private:
|
||||
_DAI_Object* P_Obj_First = nullptr;
|
||||
_DAI_Object* P_Obj_Last = nullptr;
|
||||
_DAI_Object* P_Obj_buffer = nullptr;
|
||||
int CI_length = 0;
|
||||
|
||||
public:
|
||||
DLLEXPORT _DA_MeshObjects();
|
||||
DLLEXPORT ~_DA_MeshObjects();
|
||||
DLLEXPORT void Obj_Add(char Objname); //FIXME
|
||||
DLLEXPORT void Obj_Add(_DAI_Object* obj);
|
||||
DLLEXPORT _DAI_Object* Obj_GetItem(int index);
|
||||
DLLEXPORT void Obj_Pop();
|
||||
DLLEXPORT int Obj_GetLength();
|
||||
DLLEXPORT void Obj_Delete(int index_start, int index_end);
|
||||
_DAI_Object* Obj_Search(int index);
|
||||
};
|
||||
122
Sourse/Data/sourse/primitives/ray.cpp
Normal file
122
Sourse/Data/sourse/primitives/ray.cpp
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
#include "ray.h"
|
||||
#include "Math.h"
|
||||
|
||||
|
||||
|
||||
|
||||
float trig_area(vec3f* p1, vec3f* p2, vec3f* p3) {
|
||||
|
||||
vec3f v1 = vec3f(p2);
|
||||
vec3f v2 = vec3f(p3);
|
||||
|
||||
v1 -= *p1;
|
||||
v2 -= *p1;
|
||||
|
||||
vec3f cross_prd;
|
||||
v1.cross(&v2, &cross_prd);
|
||||
return cross_prd.mod() / 2.f;
|
||||
}
|
||||
|
||||
Ray::Ray()
|
||||
{
|
||||
intersect = false;
|
||||
obj = nullptr;
|
||||
}
|
||||
|
||||
Ray::~Ray()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void apply_transformation(vec3f *vec, vec3f* iv, vec3f* jv, vec3f* kv, vec3f *pos) {
|
||||
|
||||
vec3f i = vec3f(iv);
|
||||
vec3f j = vec3f(jv);
|
||||
vec3f k = vec3f(kv);
|
||||
|
||||
i *= vec->x;
|
||||
j *= vec->y;
|
||||
k *= vec->z;
|
||||
|
||||
*vec = (k += (i += j));
|
||||
|
||||
*vec += *pos;
|
||||
}
|
||||
|
||||
void norm(vec3f* v1, vec3f* v2, vec3f* v3, vec3f* out)
|
||||
{
|
||||
vec3f vec1 = vec3f(v2);
|
||||
vec3f vec2 = vec3f(v3);
|
||||
|
||||
vec1 -= v1;
|
||||
vec2 -= v1;
|
||||
|
||||
vec1.cross(&vec2, out);
|
||||
*out /= out->mod();
|
||||
}
|
||||
|
||||
void Ray::shoot(_DA_MeshObjects* DA_MeshObjects) {
|
||||
|
||||
float magnitude = INF;
|
||||
vec3f trig_norm = vec3f();
|
||||
vec3f intersect_point = vec3f(Dir);
|
||||
_DAI_Object* Obj = nullptr;
|
||||
|
||||
int Objlen = DA_MeshObjects->Obj_GetLength();
|
||||
for (int obj_idx = 0; obj_idx < Objlen; obj_idx++) {
|
||||
_DAI_Object* tmp_Obj = DA_MeshObjects->Obj_GetItem(obj_idx);
|
||||
int triglen = tmp_Obj->Mesh.DA_Trigs->DA_Trigs_GetLength();
|
||||
for (int trig_idx = 0; trig_idx < triglen; trig_idx++) {
|
||||
_DAI_Trig* trig = tmp_Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(trig_idx);
|
||||
|
||||
vec3f v1 = vec3f(trig->v1->vec);
|
||||
vec3f v2 = vec3f(trig->v2->vec);
|
||||
vec3f v3 = vec3f(trig->v3->vec);
|
||||
|
||||
apply_transformation(&v1, &tmp_Obj->unit_vx, &tmp_Obj->unit_vy, &tmp_Obj->unit_vz, &tmp_Obj->Position);
|
||||
apply_transformation(&v2, &tmp_Obj->unit_vx, &tmp_Obj->unit_vy, &tmp_Obj->unit_vz, &tmp_Obj->Position);
|
||||
apply_transformation(&v3, &tmp_Obj->unit_vx, &tmp_Obj->unit_vy, &tmp_Obj->unit_vz, &tmp_Obj->Position);
|
||||
|
||||
vec3f tmp_trig_norm = vec3f();
|
||||
norm(&v1, &v2, &v3, &tmp_trig_norm);
|
||||
|
||||
|
||||
if (tmp_trig_norm * Dir >= 0) {
|
||||
tmp_trig_norm.invert();
|
||||
}
|
||||
|
||||
vec3f tmp = vec3f(Pos);
|
||||
tmp -= v1;
|
||||
|
||||
float tmp_magnitude = (tmp_trig_norm * tmp) / -(tmp_trig_norm * Dir);
|
||||
|
||||
vec3f tmp_intrsect_p = vec3f(Dir);
|
||||
tmp_intrsect_p *= tmp_magnitude;
|
||||
tmp_intrsect_p += Pos;
|
||||
|
||||
if (trig_area(&v1, &v2, &v3) >=
|
||||
trig_area(&tmp_intrsect_p, &v2, &v3) +
|
||||
trig_area(&v1, &tmp_intrsect_p, &v3) +
|
||||
trig_area(&v1, &v2, &tmp_intrsect_p) - 0.00001f) {
|
||||
|
||||
if (magnitude > tmp_magnitude && tmp_magnitude > 0)
|
||||
{
|
||||
Obj = tmp_Obj;
|
||||
trig_norm = tmp_trig_norm;
|
||||
intersect_point = tmp_intrsect_p;
|
||||
magnitude = tmp_magnitude;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (magnitude == INF) {
|
||||
intersect = false;
|
||||
return;
|
||||
}
|
||||
|
||||
intersect = true;
|
||||
obj = Obj;
|
||||
intersect_p = intersect_point;
|
||||
Norm = trig_norm;
|
||||
}
|
||||
22
Sourse/Data/sourse/primitives/ray.h
Normal file
22
Sourse/Data/sourse/primitives/ray.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "..\objects\DT_Object.h"
|
||||
|
||||
class Ray
|
||||
{
|
||||
public:
|
||||
Ray();
|
||||
~Ray();
|
||||
void shoot(_DA_MeshObjects* DA_MeshObjects);
|
||||
|
||||
vec3f Dir;
|
||||
vec3f Pos;
|
||||
|
||||
bool intersect;
|
||||
_DAI_Object* obj;
|
||||
vec3f intersect_p;
|
||||
vec3f Norm;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
48
Sourse/Data/sourse/primitives/timer.cpp
Normal file
48
Sourse/Data/sourse/primitives/timer.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "timer.h"
|
||||
|
||||
|
||||
_Time::_Time()
|
||||
{
|
||||
start = clock();
|
||||
timer = -1;
|
||||
}
|
||||
|
||||
_Time::_Time(double timer_ms)
|
||||
{
|
||||
start = clock();
|
||||
timer = timer_ms;
|
||||
}
|
||||
|
||||
_Time::~_Time()
|
||||
{
|
||||
}
|
||||
|
||||
bool _Time::timeout()
|
||||
{
|
||||
float time = clock();
|
||||
if (start + timer <= clock()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void _Time::reset_start()
|
||||
{
|
||||
start = clock();
|
||||
}
|
||||
|
||||
void _Time::set_timer(double time)
|
||||
{
|
||||
timer = time;
|
||||
}
|
||||
|
||||
long _Time::time_pased()
|
||||
{
|
||||
|
||||
return clock() - start;
|
||||
}
|
||||
|
||||
void _Time::sleep(double ms)
|
||||
{
|
||||
Sleep(DWORD(ms));
|
||||
}
|
||||
22
Sourse/Data/sourse/primitives/timer.h
Normal file
22
Sourse/Data/sourse/primitives/timer.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <ctime>
|
||||
#include <windows.h>
|
||||
|
||||
class _Time
|
||||
{
|
||||
public:
|
||||
_Time();
|
||||
_Time(double timer);
|
||||
~_Time();
|
||||
|
||||
bool timeout();
|
||||
void reset_start();
|
||||
void set_timer(double time);
|
||||
long time_pased();
|
||||
void sleep(double ms);
|
||||
|
||||
private:
|
||||
long start;
|
||||
long timer;
|
||||
};
|
||||
119
Sourse/Data/sourse/primitives/vec3f.cpp
Normal file
119
Sourse/Data/sourse/primitives/vec3f.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#include "vec3f.h"
|
||||
#include "MAth.h"
|
||||
|
||||
vec3f& vec3f::operator*=(float val)
|
||||
{
|
||||
x *= val;
|
||||
y *= val;
|
||||
z *= val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
vec3f& vec3f::operator/=(float val)
|
||||
{
|
||||
x /= val;
|
||||
y /= val;
|
||||
z /= val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
vec3f& vec3f::operator+=(const vec3f& vec)
|
||||
{
|
||||
x += vec.x;
|
||||
y += vec.y;
|
||||
z += vec.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
vec3f& vec3f::operator-=(const vec3f& vec)
|
||||
{
|
||||
x -= vec.x;
|
||||
y -= vec.y;
|
||||
z -= vec.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float vec3f::operator*(vec3f& vec) {
|
||||
return MATH_DotProduct(&(this->x), &(vec.x));
|
||||
}
|
||||
|
||||
void vec3f::cross(vec3f* vec, vec3f* vec_out) {
|
||||
MATH_CrossProduct(&(vec_out->x), &(this->x), &(vec->x));
|
||||
}
|
||||
|
||||
vec3f& vec3f::operator=(const vec3f& vec)
|
||||
{
|
||||
x = vec.x;
|
||||
y = vec.y;
|
||||
z = vec.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float vec3f::mod() {
|
||||
return MATH_VectorMagnetude(&(this->x));
|
||||
}
|
||||
|
||||
void vec3f::unitv(vec3f* vec) {
|
||||
*vec = *this;
|
||||
*vec /= vec->mod();
|
||||
}
|
||||
|
||||
void vec3f::assing(float v[3])
|
||||
{
|
||||
x = v[0];
|
||||
y = v[1];
|
||||
z = v[2];
|
||||
}
|
||||
|
||||
void vec3f::assing(float v1, float v2, float v3)
|
||||
{
|
||||
x = v1;
|
||||
y = v2;
|
||||
z = v3;
|
||||
}
|
||||
|
||||
void vec3f::clear()
|
||||
{
|
||||
x = y = z = 0;
|
||||
}
|
||||
|
||||
void vec3f::print()
|
||||
{
|
||||
printf("floats: %9.9f %9.9f %9.9f \n", x, y, z);
|
||||
}
|
||||
|
||||
void vec3f::invert()
|
||||
{
|
||||
x = -x;
|
||||
y = -y;
|
||||
z = -z;
|
||||
}
|
||||
|
||||
vec3f::vec3f(float x_val, float y_val, float z_val)
|
||||
{
|
||||
x = x_val;
|
||||
y = y_val;
|
||||
z = z_val;
|
||||
}
|
||||
|
||||
vec3f::vec3f(float array[3])
|
||||
{
|
||||
x = array[0];
|
||||
y = array[1];
|
||||
z = array[2];
|
||||
}
|
||||
vec3f::vec3f()
|
||||
{
|
||||
x = y = z = 0;
|
||||
}
|
||||
|
||||
vec3f::vec3f(vec3f* vec)
|
||||
{
|
||||
x = vec->x;
|
||||
y = vec->y;
|
||||
z = vec->z;
|
||||
}
|
||||
|
||||
vec3f::~vec3f()
|
||||
{
|
||||
}
|
||||
29
Sourse/Data/sourse/primitives/vec3f.h
Normal file
29
Sourse/Data/sourse/primitives/vec3f.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
class vec3f
|
||||
{
|
||||
public:
|
||||
float x, y, z;
|
||||
|
||||
vec3f(vec3f* vec);
|
||||
vec3f(float x, float y, float z);
|
||||
vec3f(float array[3]);
|
||||
vec3f();
|
||||
~vec3f();
|
||||
|
||||
vec3f& operator*=(float val);
|
||||
vec3f& operator/=(float val);
|
||||
float operator*(vec3f& vec);
|
||||
void cross(vec3f* vec, vec3f* vec_out);
|
||||
vec3f& operator+=(const vec3f& vec);
|
||||
vec3f& operator-=(const vec3f& vec);
|
||||
vec3f& operator=(const vec3f& vec);
|
||||
void unitv(vec3f* vec);
|
||||
void assing(float v[3]);
|
||||
void assing(float v1, float v2, float v3);
|
||||
void clear();
|
||||
void print();
|
||||
void invert();
|
||||
float mod();
|
||||
private:
|
||||
};
|
||||
187
Sourse/Main/Main.vcxproj
Normal file
187
Sourse/Main/Main.vcxproj
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{C7118CBB-48B7-4353-B622-2DB4B0EB134A}</ProjectGuid>
|
||||
<RootNamespace>ControlDep</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Main</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\WM\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\AppManager\sourse;$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Math\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Debug;$(SolutionDir)\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\WM\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\AppManager\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\WM\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\AppManager\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Debug;$(SolutionDir)\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\WM\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\AppManager\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AppManager\AppManager.vcxproj">
|
||||
<Project>{7b2bc414-2a04-41ac-aacf-b372f8542b20}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Data\Data.vcxproj">
|
||||
<Project>{e4451015-f74a-41bb-bc31-a55ffddc6af7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Operator\Operator.vcxproj">
|
||||
<Project>{03916d7c-9c52-44e9-b420-31b9f45cf8b9}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Render\Render.vcxproj">
|
||||
<Project>{094b0fb2-db22-4176-ab30-3986d60279c4}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WM\WM.vcxproj">
|
||||
<Project>{809a9cfa-7d32-40fb-84f6-dab932ba7f5d}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
Sourse/Main/Main.vcxproj.filters
Normal file
22
Sourse/Main/Main.vcxproj.filters
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/Main/Main.vcxproj.user
Normal file
6
Sourse/Main/Main.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
55
Sourse/Main/sourse/Main.cpp
Normal file
55
Sourse/Main/sourse/Main.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
#include "AppManager.h"
|
||||
#include "WM.h"
|
||||
#include "Render.h"
|
||||
#include "Data.h"
|
||||
#include "Math.h"
|
||||
#include "Operator.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/*
|
||||
keymap
|
||||
rotate
|
||||
move
|
||||
gizmo
|
||||
fbuffer
|
||||
outline
|
||||
matrices
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
_Data DATA;
|
||||
APM_OnStart(&DATA.APM);
|
||||
|
||||
printf("Fuuuuuck here ");
|
||||
|
||||
{
|
||||
|
||||
OPS_init(&DATA);
|
||||
WM_Init(&DATA);
|
||||
RND_init(&DATA);
|
||||
|
||||
ResetCamera();
|
||||
OPSAddcoords();
|
||||
|
||||
while (!WM_close_command())
|
||||
{
|
||||
APM_LoopIn();
|
||||
|
||||
if (WM_input() || !DATA.RND_cycle.cycle_complete)
|
||||
{
|
||||
//RND_Render();
|
||||
WM_output();
|
||||
}
|
||||
|
||||
APM_LoopOut();
|
||||
}
|
||||
|
||||
WM_CloseWindow();
|
||||
}
|
||||
|
||||
APM_OnEnd();
|
||||
}
|
||||
11
Sourse/Math/Debug/Math.Build.CppClean.log
Normal file
11
Sourse/Math/Debug/Math.Build.CppClean.log
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.pdb
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.idb
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.obj
|
||||
c:\main\dev\ma\appma _v2.02_refactor\debug\math.lib
|
||||
c:\main\dev\ma\appma _v2.02_refactor\debug\math.pdb
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\cl.command.1.tlog
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\cl.read.1.tlog
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\cl.write.1.tlog
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\lib-link.read.1.tlog
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\lib-link.write.1.tlog
|
||||
c:\main\dev\ma\appma _v2.02_refactor\math\debug\math.tlog\lib.command.1.tlog
|
||||
BIN
Sourse/Math/Debug/Math.idb
Normal file
BIN
Sourse/Math/Debug/Math.idb
Normal file
Binary file not shown.
13
Sourse/Math/Debug/Math.log
Normal file
13
Sourse/Math/Debug/Math.log
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Math.cpp
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(35,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(36,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(45,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(46,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(56,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(57,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(67,16): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(70,17): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(76,14): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(80,16): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
|
||||
C:\main\DEV\Ma\APPma _v2.02_refactor\Sourse\Math\sourse\Math.cpp(151,13): warning C4244: 'return': conversion from 'double' to 'float', possible loss of data
|
||||
Math.vcxproj -> C:\main\DEV\Ma\APPma _v2.02_refactor\Debug\Math.lib
|
||||
BIN
Sourse/Math/Debug/Math.pdb
Normal file
BIN
Sourse/Math/Debug/Math.pdb
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/CL.command.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/CL.read.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/CL.write.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/Lib-link.read.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/Lib-link.read.1.tlog
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/Lib-link.write.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/Lib-link.write.1.tlog
Normal file
Binary file not shown.
BIN
Sourse/Math/Debug/Math.tlog/Lib.command.1.tlog
Normal file
BIN
Sourse/Math/Debug/Math.tlog/Lib.command.1.tlog
Normal file
Binary file not shown.
2
Sourse/Math/Debug/Math.tlog/Math.lastbuildstate
Normal file
2
Sourse/Math/Debug/Math.tlog/Math.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0
|
||||
Debug|Win32|C:\main\DEV\Ma\APPma _v2.02_refactor\|
|
||||
BIN
Sourse/Math/Debug/math.obj.enc
Normal file
BIN
Sourse/Math/Debug/math.obj.enc
Normal file
Binary file not shown.
157
Sourse/Math/Math.vcxproj
Normal file
157
Sourse/Math/Math.vcxproj
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{95A51000-709F-4D51-B71D-4FF3D7348A42}</ProjectGuid>
|
||||
<RootNamespace>Math</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Math.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Math.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
27
Sourse/Math/Math.vcxproj.filters
Normal file
27
Sourse/Math/Math.vcxproj.filters
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Math.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Math.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/Math/Math.vcxproj.user
Normal file
6
Sourse/Math/Math.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
184
Sourse/Math/sourse/Math.cpp
Normal file
184
Sourse/Math/sourse/Math.cpp
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
#include "Math.h"
|
||||
#include <math.h>
|
||||
|
||||
float MATH_abs(float val)
|
||||
{
|
||||
if (val > 0)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -val;
|
||||
}
|
||||
}
|
||||
void MATH_clamp(float* val, float min, float max) {
|
||||
if (*val > max)
|
||||
*val = max;
|
||||
if (*val < min)
|
||||
*val = min;
|
||||
}
|
||||
void MATH_CrossProduct(float v[3], float v1[3], float v2[3])
|
||||
{
|
||||
v[0] = v1[1] * v2[2] - v1[2] * v2[1];
|
||||
v[1] = v1[2] * v2[0] - v1[0] * v2[2];
|
||||
v[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
||||
}
|
||||
float MATH_DotProduct(float v1[3], float v2[3])
|
||||
{
|
||||
return float(v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]);
|
||||
}
|
||||
void MATH_ScalarMultiplication(float v1[3], float s)
|
||||
{
|
||||
v1[0] *= s;
|
||||
v1[1] *= s;
|
||||
v1[2] *= s;
|
||||
}
|
||||
void MATH_VectorSum(float v[3], float v1[3], float v2[3])
|
||||
{
|
||||
v[0] = v1[0] + v2[0];
|
||||
v[1] = v1[1] + v2[1];
|
||||
v[2] = v1[2] + v2[2];
|
||||
}
|
||||
void MATH_VectorDifference(float v[3], float v1[3], float v2[3])
|
||||
{
|
||||
v[0] = v1[0] - v2[0];
|
||||
v[1] = v1[1] - v2[1];
|
||||
v[2] = v1[2] - v2[2];
|
||||
}
|
||||
void MATH_RotateZAroundCenter(float v1[3], float angel)
|
||||
{
|
||||
float sinx = float(sin(angel));
|
||||
float cosx = float(cos(angel));
|
||||
float vnew[2];
|
||||
vnew[0] = v1[0] * cosx - v1[1] * sinx;
|
||||
vnew[1] = v1[0] * sinx + v1[1] * cosx;
|
||||
v1[0] = vnew[0];
|
||||
v1[1] = vnew[1];
|
||||
}
|
||||
void MATH_RotateYAroundCenter(float v1[3], float angel)
|
||||
{
|
||||
float sinx = float(sin(angel));
|
||||
float cosx = float(cos(angel));
|
||||
float vnew[2];
|
||||
vnew[0] = v1[0] * cosx - v1[2] * sinx;
|
||||
vnew[1] = v1[0] * sinx + v1[2] * cosx;
|
||||
v1[0] = vnew[0];
|
||||
v1[2] = vnew[1];
|
||||
}
|
||||
void MATH_RotateXAroundCenter(float v1[3], float angel)
|
||||
{
|
||||
float vnew[2];
|
||||
float sinx = float(sin(angel));
|
||||
float cosx = float(cos(angel));
|
||||
vnew[0] = v1[1] * cosx - v1[2] * sinx;
|
||||
vnew[1] = v1[1] * sinx + v1[2] * cosx;
|
||||
v1[1] = vnew[0];
|
||||
v1[2] = vnew[1];
|
||||
}
|
||||
|
||||
void MATH_RotateArbAxes(float RotVector[3], float axs_pos[3], float Point[3], float rot_angel)
|
||||
{
|
||||
|
||||
MATH_VectorDifference(Point, Point, axs_pos);
|
||||
|
||||
float z_angel = float(atan(RotVector[1] / RotVector[0]));
|
||||
if (RotVector[1] > 0 and RotVector[0] < 0)
|
||||
{
|
||||
z_angel = (Pi + z_angel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RotVector[1] < 0 and RotVector[0] < 0)
|
||||
{
|
||||
z_angel = -(Pi - z_angel);
|
||||
}
|
||||
}
|
||||
|
||||
float c = float(RotVector[0] * RotVector[0] + RotVector[1] * RotVector[1]);
|
||||
float y_angel = float(atan(RotVector[2] / sqrt(c)));
|
||||
|
||||
MATH_RotateZAroundCenter(Point, -z_angel);
|
||||
MATH_RotateYAroundCenter(Point, -y_angel);
|
||||
|
||||
MATH_RotateXAroundCenter(Point, rot_angel);
|
||||
|
||||
MATH_RotateYAroundCenter(Point, y_angel);
|
||||
MATH_RotateZAroundCenter(Point, z_angel);
|
||||
|
||||
MATH_VectorSum(Point, Point, axs_pos);
|
||||
}
|
||||
float MATH_VectorMagnetude(float v[3])
|
||||
{
|
||||
float s = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
|
||||
return float( sqrt(s));
|
||||
}
|
||||
void MATH_CopyVector(float v1[3], float v2[3])
|
||||
{
|
||||
v1[0] = v2[0];
|
||||
v1[1] = v2[1];
|
||||
v1[2] = v2[2];
|
||||
}
|
||||
void MATH_MakeUnitVector(float v[3])
|
||||
{
|
||||
MATH_ScalarMultiplication(v, 1 / MATH_VectorMagnetude(v));
|
||||
}
|
||||
void MATH_ScalarSum(float v[3], float s)
|
||||
{
|
||||
v[0] += s;
|
||||
v[1] += s;
|
||||
v[2] += s;
|
||||
}
|
||||
float MATH_AngelBetweenTwoVectors(float v1[3], float v2[3])
|
||||
{
|
||||
return float(acos(MATH_DotProduct(v1, v2) / (MATH_VectorMagnetude(v1) * MATH_VectorMagnetude(v2))));
|
||||
}
|
||||
int MATH_factorial(int n)
|
||||
{
|
||||
int answ = 1;
|
||||
for (int i = 2; i < n+1; i++) { answ *= i; }
|
||||
return answ;
|
||||
}
|
||||
float MATH_Power(float x, float n)
|
||||
{
|
||||
float answ = 1;
|
||||
for (int i = 0; i < n; i++) { answ *= x; }
|
||||
return answ;
|
||||
}
|
||||
float MATH_sinf(float x)
|
||||
{
|
||||
float power[4];
|
||||
|
||||
power[0] = x * x * x;
|
||||
power[1] = power[0] * x * x;
|
||||
power[2] = power[1] * x * x;
|
||||
power[3] = power[2] * x * x;
|
||||
|
||||
return (x - (power[0] / 6)
|
||||
+ (power[1] / 120)
|
||||
- (power[2] / 5040)
|
||||
+ (power[3] / 362880));
|
||||
|
||||
/*return (x - MATH_Power(x, 3) / MATH_factorial(3)
|
||||
+ MATH_Power(x, 5) / MATH_factorial(5)
|
||||
- MATH_Power(x, 7) / MATH_factorial(7)
|
||||
+ MATH_Power(x, 9) / MATH_factorial(9));*/
|
||||
}
|
||||
//float MATH_own_cosF(float x)
|
||||
//{
|
||||
//float sin = MATH_sinf(x);
|
||||
//return sqrt(1.0 - sin * sin);
|
||||
//}
|
||||
//float MATH_own_tanF(float x)
|
||||
//{
|
||||
//float sin = MATH_sinf(x);
|
||||
//return (sin/(1 - sin*sin));
|
||||
//}
|
||||
double MATH_sin(float s) { return sin(s); }
|
||||
double MATH_log(float s) { return log(s); }
|
||||
double MATH_asin(float s) { return asin(s); }
|
||||
double MATH_cos(float s) { return cos(s); }
|
||||
double MATH_acos(float s) { return acos(s); }
|
||||
double MATH_tan(float s) { return tan(s); }
|
||||
double MATH_atan(float s) { return atan(s); }
|
||||
double MATH_sqrt(float s) { return sqrt(s); }
|
||||
37
Sourse/Math/sourse/Math.h
Normal file
37
Sourse/Math/sourse/Math.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
#include <stdio.h>
|
||||
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#define Pi float(3.1415926535897932384626433832795)
|
||||
#define INF long long int (4611686018427387904)
|
||||
|
||||
void MATH_clamp(float* val, float min, float max);
|
||||
float MATH_abs(float val);
|
||||
void MATH_CrossProduct(float v[3], float v1[3], float v2[3]);
|
||||
float MATH_DotProduct(float v1[3], float v2[3]);
|
||||
void MATH_ScalarMultiplication(float v1[3], float s);
|
||||
void MATH_VectorSum(float v[3], float v1[3], float v2[3]);
|
||||
void MATH_VectorDifference(float v[3], float v1[3], float v2[3]);
|
||||
void MATH_RotateZAroundCenter(float v1[3], float angel);
|
||||
void MATH_RotateYAroundCenter(float v1[3], float angel);
|
||||
void MATH_RotateXAroundCenter(float v1[3], float angel);
|
||||
float MATH_VectorMagnetude(float v[3]);
|
||||
void MATH_CopyVector(float v1[3], float v2[3]);
|
||||
void MATH_ScalarSum(float v[3], float s);
|
||||
float MATH_AngelBetweenTwoVectors(float v1[3], float v2[3]);
|
||||
int MATH_factorial(int n);
|
||||
void MATH_MakeUnitVector(float v[3]);
|
||||
float MATH_Power(float x, float n);
|
||||
float MATH_sinf(float x);
|
||||
float MATH_own_cosF(float x);
|
||||
float MATH_own_tanF(float x);
|
||||
double MATH_sin(float s);
|
||||
double MATH_asin(float s);
|
||||
double MATH_cos(float s);
|
||||
double MATH_acos(float s);
|
||||
double MATH_tan(float s);
|
||||
double MATH_atan(float s);
|
||||
double MATH_sqrt(float s);
|
||||
double MATH_log(float s);
|
||||
void MATH_RotateArbAxes(float RotVector[3], float axs_pos[3], float RotPoint[3], float rot_angel);
|
||||
180
Sourse/Operator/Operator.vcxproj
Normal file
180
Sourse/Operator/Operator.vcxproj
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{03916D7C-9C52-44E9-B420-31B9F45CF8B9}</ProjectGuid>
|
||||
<RootNamespace>Operator</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse\;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse\;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse\;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse\;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Operator.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Operator.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.vcxproj">
|
||||
<Project>{e4451015-f74a-41bb-bc31-a55ffddc6af7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
30
Sourse/Operator/Operator.vcxproj.filters
Normal file
30
Sourse/Operator/Operator.vcxproj.filters
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Operator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Operator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/Operator/Operator.vcxproj.user
Normal file
6
Sourse/Operator/Operator.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
4
Sourse/Operator/cpp.hint
Normal file
4
Sourse/Operator/cpp.hint
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
398
Sourse/Operator/sourse/Operator.cpp
Normal file
398
Sourse/Operator/sourse/Operator.cpp
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
#include "Operator.h"
|
||||
|
||||
_Data* Data_p;
|
||||
|
||||
DLLEXPORT void OPS_init(_Data* Data)
|
||||
{
|
||||
Data_p = Data;
|
||||
}
|
||||
|
||||
DLLEXPORT void OPselect(int mx, int my, int width, int height)
|
||||
{
|
||||
_Camera* cam = &Data_p->UI.Viewport.View;
|
||||
Ray ray = Ray();
|
||||
ray.Pos = cam->CameraPos;
|
||||
|
||||
vec3f tmp = vec3f(cam->z_unit_v);
|
||||
tmp *= cam->near_plane;
|
||||
ray.Dir += tmp;
|
||||
|
||||
tmp = cam->x_unit_v;
|
||||
tmp *= (width / 2.f - mx) / (width / 2.f);
|
||||
ray.Dir += tmp;
|
||||
|
||||
tmp = cam->y_unit_v;
|
||||
tmp *= (-height / 2.f + my) / (height / 2.f);
|
||||
ray.Dir += tmp;
|
||||
|
||||
ray.Dir.unitv(&ray.Dir);
|
||||
ray.shoot(&Data_p->DA_MeshObjects);
|
||||
Data_p->DA_MeshObjects.active = ray.obj;
|
||||
}
|
||||
|
||||
DLLEXPORT void OPSAddcoords()
|
||||
{
|
||||
if (!Data_p->DA_MeshObjects.Obj_GetLength())
|
||||
{
|
||||
|
||||
{
|
||||
float init_val[3]{ 0, 0, 0 };
|
||||
|
||||
Data_p->DA_MeshObjects.Obj_Add('cube');
|
||||
_DAI_Object* Obj = Data_p->DA_MeshObjects.Obj_GetItem(0);
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Obj->Mesh.DA_Vertices->Vertex_Add(init_val);
|
||||
if (i < 4) {
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(i)->vec.y = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(1)->vec.x = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(2)->vec.x = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(5)->vec.x = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(6)->vec.x = 1;
|
||||
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(2)->vec.z = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(3)->vec.z = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(6)->vec.z = 1;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(7)->vec.z = 1;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(i)->vec.x -= 0.5f;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(i)->vec.y -= 0.5f;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(i)->vec.z -= 0.5f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_Add();
|
||||
}
|
||||
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(3);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(2)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(2)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(3);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(2)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(7);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(3)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(3)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(7);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(3)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(4);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(4)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(4);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(4)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(6);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(4)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(5);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(5)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(4);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(5)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(7);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(5)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(6);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(6)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(4);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(6)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(6)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(7)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(4);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(7)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(5);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(7)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(8)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(8)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(6);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(8)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(9)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(9)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(5);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(9)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(6);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(10)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(10)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(7);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(10)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(3);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(11)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(11)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(6);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(11)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(7);
|
||||
}
|
||||
|
||||
{
|
||||
float init_val[3]{ 0, 0, 0 };
|
||||
|
||||
Data_p->DA_MeshObjects.Obj_Add('plan');
|
||||
_DAI_Object* Obj = Data_p->DA_MeshObjects.Obj_GetItem(1);
|
||||
|
||||
Obj->unit_vx.assing(1.f, 0.0f, 0.0f);
|
||||
Obj->unit_vy.assing(0.0f, 1.0f, 0.0f);
|
||||
Obj->unit_vz.assing(0.0f, 0.0f, 1.0f);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Obj->Mesh.DA_Vertices->Vertex_Add(init_val);
|
||||
}
|
||||
|
||||
float size = 2;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(0)->vec.y = size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(1)->vec.y = size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(2)->vec.y = -size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(3)->vec.y = -size;
|
||||
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(0)->vec.x = -size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(1)->vec.x = size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(2)->vec.x = -size;
|
||||
Obj->Mesh.DA_Vertices->Vrt_GetItem(3)->vec.x = size;
|
||||
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_Add();
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_Add();
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(0);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(0)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v1 = Obj->Mesh.DA_Vertices->Vrt_GetItem(3);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v2 = Obj->Mesh.DA_Vertices->Vrt_GetItem(1);
|
||||
Obj->Mesh.DA_Trigs->DAI_Trig_GetItem(1)->v3 = Obj->Mesh.DA_Vertices->Vrt_GetItem(2);
|
||||
}
|
||||
|
||||
Data_p->Light.Dir.x = -1.f;
|
||||
Data_p->Light.Dir.y = -2;
|
||||
Data_p->Light.Dir.z = -3;
|
||||
Data_p->Light.Dir.unitv(&Data_p->Light.Dir);
|
||||
|
||||
Data_p->Light.pos.x = 3;
|
||||
Data_p->Light.pos.y = 3;
|
||||
Data_p->Light.pos.z = 4;
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void rotObj(const char direction, float angel)
|
||||
{
|
||||
_DAI_Object* Obj = Data_p->DA_MeshObjects.Obj_GetItem(1);
|
||||
int len = Obj->Mesh.DA_Vertices->Vertices_GetLength();
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 'x':
|
||||
for (int pnt = 0; pnt < len; pnt++)
|
||||
{
|
||||
MATH_RotateXAroundCenter(&(Obj->Mesh.DA_Vertices->Vrt_GetItem(pnt)->vec.x), angel);
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
for (int pnt = 0; pnt < len; pnt++)
|
||||
{
|
||||
MATH_RotateYAroundCenter(&(Obj->Mesh.DA_Vertices->Vrt_GetItem(pnt)->vec.x), angel);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
for (int pnt = 0; pnt < len; pnt++)
|
||||
{
|
||||
MATH_RotateZAroundCenter(&(Obj->Mesh.DA_Vertices->Vrt_GetItem(pnt)->vec.x), angel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void RelativeRotate(float rot_angel, float focusScale) //FIXME
|
||||
{
|
||||
|
||||
_DAI_Object* Obj = Data_p->DA_MeshObjects.Obj_GetItem(1);
|
||||
int len = Obj->Mesh.DA_Vertices->Vertices_GetLength();
|
||||
|
||||
float Copy[3]{ 1, -1, -1 };
|
||||
|
||||
MATH_MakeUnitVector(Copy);
|
||||
|
||||
for (int pnt = 0; pnt < len; pnt++)
|
||||
{
|
||||
//MATH_RotateArbAxes(&(Data_p->UI.Viewport.View.z_unit_v.x), &(Obj->Mesh.DA_Vertices->Vrt_GetItem(pnt)->vec.x), rot_angel);
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void OPSdelete()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.active) {
|
||||
int del_idx = Data_p->DA_MeshObjects.active->Obj_index;
|
||||
Data_p->DA_MeshObjects.Obj_Delete(del_idx, del_idx);
|
||||
Data_p->DA_MeshObjects.active = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void OPSclear()
|
||||
{
|
||||
Data_p->DA_MeshObjects.Obj_Delete(-1, -1);
|
||||
Data_p->DA_MeshObjects.active = nullptr;
|
||||
}
|
||||
|
||||
DLLEXPORT void ResetCamera()
|
||||
{
|
||||
_Camera* cam = &Data_p->UI.Viewport.View;
|
||||
cam->x_unit_v.assing(0.93f, -0.34f, 0.01);
|
||||
cam->y_unit_v.assing(-.11f, -.25f, 0.95f);
|
||||
cam->z_unit_v.assing(-0.33f, -0.9f, -.27f);
|
||||
cam->CameraPos.assing(1.88f, 3.95f, 1.58);
|
||||
cam->FocalPoint.assing(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
//DLLEXPORT void RotCamera(float angel, char axes, float focusScale)
|
||||
|
||||
DLLEXPORT void RotCamera(float angel, char axes, float focusScale) //TODO: replace with orbital rotate
|
||||
{
|
||||
_Camera* cam = &Data_p->UI.Viewport.View;
|
||||
MATH_VectorDifference(&(cam->CameraPos.x), &(cam->CameraPos.x), &(cam->FocalPoint.x));
|
||||
|
||||
float vec[3]{ 0,0,0 };
|
||||
switch (axes)
|
||||
{
|
||||
case 'x':
|
||||
|
||||
MATH_RotateArbAxes(&(cam->x_unit_v.x), vec, &(cam->y_unit_v.x), angel);
|
||||
MATH_RotateArbAxes(&(cam->x_unit_v.x), vec, &(cam->z_unit_v.x), angel);
|
||||
MATH_RotateArbAxes(&(cam->x_unit_v.x), vec, &(cam->CameraPos.x), angel);
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
|
||||
MATH_RotateZAroundCenter(&(cam->x_unit_v.x), angel);
|
||||
MATH_RotateZAroundCenter(&(cam->y_unit_v.x), angel);
|
||||
MATH_RotateZAroundCenter(&(cam->z_unit_v.x), angel);
|
||||
MATH_RotateZAroundCenter(&(cam->CameraPos.x), angel);
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
MATH_RotateArbAxes(&(cam->z_unit_v.x), vec, &(cam->x_unit_v.x), angel);
|
||||
MATH_RotateArbAxes(&(cam->z_unit_v.x), vec, &(cam->y_unit_v.x), angel);
|
||||
MATH_RotateArbAxes(&(cam->z_unit_v.x), vec, &(cam->CameraPos.x), angel);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
MATH_VectorSum(&(cam->CameraPos.x), &(cam->CameraPos.x), &(cam->FocalPoint.x));
|
||||
}
|
||||
|
||||
DLLEXPORT void RotObj(float angel, char axes) //TODO: replace with orbital rotate
|
||||
{
|
||||
|
||||
switch (axes)
|
||||
{
|
||||
case 'x':
|
||||
//MATH_RotateArbAxes(&(Data_p->UI.Viewport.View.x_unit_v.x), &(Data_p->Light.Dir.x), angel);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
//MATH_RotateArbAxes(&(Data_p->UI.Viewport.View.y_unit_v.x), &(Data_p->Light.Dir.x), angel);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
//MATH_RotateArbAxes(&(Data_p->UI.Viewport.View.z_unit_v.x), &(Data_p->Light.Dir.x), angel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void CameraMove(float displacement, const char direction)
|
||||
{
|
||||
_Camera* cam = &Data_p->UI.Viewport.View;
|
||||
float h = float(Data_p->WM.win_height);
|
||||
float w = float(Data_p->WM.win_width);
|
||||
float Movefactor = 0;
|
||||
if (h > w)
|
||||
{
|
||||
Movefactor = (w / h) * 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
Movefactor = (h / w) * 10;
|
||||
}
|
||||
float displV[3];
|
||||
float distance[3];
|
||||
MATH_VectorDifference(distance, &(cam->CameraPos.x), &(cam->FocalPoint.x));
|
||||
distance[0] = MATH_VectorMagnetude(distance);
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 'x':
|
||||
displacement *= distance[0] / Movefactor;
|
||||
MATH_CopyVector(displV, &(cam->x_unit_v.x));
|
||||
MATH_ScalarMultiplication(displV, displacement);
|
||||
MATH_VectorSum(&(cam->FocalPoint.x), &(cam->FocalPoint.x), displV);
|
||||
break;
|
||||
case 'y':
|
||||
displacement *= distance[0] / Movefactor;
|
||||
MATH_CopyVector(displV, &(cam->y_unit_v.x));
|
||||
MATH_ScalarMultiplication(displV, displacement);
|
||||
MATH_VectorSum(&(cam->FocalPoint.x), &(cam->FocalPoint.x), displV);
|
||||
break;
|
||||
case 'z':
|
||||
|
||||
displacement *= (distance[0] / 3);
|
||||
MATH_CopyVector(displV, &(cam->z_unit_v.x));
|
||||
MATH_ScalarMultiplication(displV, displacement);
|
||||
break;
|
||||
}
|
||||
MATH_VectorSum(&(cam->CameraPos.x), &(cam->CameraPos.x), displV);
|
||||
}
|
||||
|
||||
// ------------------- trash --------------- //
|
||||
/*
|
||||
DLLEXPORT void MoveYInvert()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[0] += 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[1] -= float(0.001);
|
||||
}
|
||||
}
|
||||
DLLEXPORT void MoveY()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[0] -= 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[1] += float(0.001);
|
||||
}
|
||||
}
|
||||
DLLEXPORT void MoveZInvert()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[1] += 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[2] -= float(0.001);
|
||||
}
|
||||
}
|
||||
DLLEXPORT void MoveZ()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[1] -= 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[2] += float(0.001);
|
||||
}
|
||||
}
|
||||
DLLEXPORT void MoveXInvert()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[2] += 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[0] -= float(0.001);
|
||||
}
|
||||
}
|
||||
DLLEXPORT void MoveX()
|
||||
{
|
||||
if (Data_p->DA_MeshObjects.Obj_GetLength() and Data_p->DA_MeshObjects.Obj_GetItem(0)->Mesh.DA_Vertices->Vertices_GetLength())
|
||||
{
|
||||
//Data_p->DA_Collection.operator[](0)->Position[2] -= 0.1;
|
||||
Data_p->UI.Viewport.View.CameraPos[0] += float(0.001);
|
||||
}
|
||||
}
|
||||
*/
|
||||
36
Sourse/Operator/sourse/Operator.h
Normal file
36
Sourse/Operator/sourse/Operator.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
|
||||
//#include "AppManager.h"
|
||||
#include "Data.h"
|
||||
#include "Math.h"
|
||||
|
||||
DLLEXPORT void OPselect(int mx, int my, int width, int height);
|
||||
DLLEXPORT void RotCamera(float angel, char dir, float focusScale);
|
||||
DLLEXPORT void OPSdelete();
|
||||
DLLEXPORT void OPSAddcoords();
|
||||
|
||||
DLLEXPORT void rotObj(const char direction, float angel);
|
||||
|
||||
DLLEXPORT void OPS_init(_Data* Data);
|
||||
|
||||
DLLEXPORT void OPSclear();
|
||||
|
||||
DLLEXPORT void CameraMove(float displacement, const char direction);
|
||||
DLLEXPORT void RotObj(float angel, char axes);
|
||||
DLLEXPORT void MoveXInvert();
|
||||
|
||||
DLLEXPORT void MoveYInvert();
|
||||
|
||||
DLLEXPORT void MoveZInvert();
|
||||
|
||||
DLLEXPORT void MoveX();
|
||||
|
||||
DLLEXPORT void MoveY();
|
||||
|
||||
DLLEXPORT void MoveZ();
|
||||
|
||||
DLLEXPORT void ResetCamera();
|
||||
|
||||
DLLEXPORT void RelativeRotate(float rot_angel, float focusScale);
|
||||
182
Sourse/Render/Render.vcxproj
Normal file
182
Sourse/Render/Render.vcxproj
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{094B0FB2-DB22-4176-AB30-3986D60279C4}</ProjectGuid>
|
||||
<RootNamespace>Render</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Render\sourse\ray;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\Sourse\Data;$(SolutionDir)\Sourse\Math;$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Data\sourse\primitives;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\Sourse\Data;$(SolutionDir)\Sourse\Math;$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;$(SolutionDir)\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\Sourse\Math\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Render.cpp" />
|
||||
<ClCompile Include="sourse\shader\shader.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.vcxproj">
|
||||
<Project>{e4451015-f74a-41bb-bc31-a55ffddc6af7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Operator\Operator.vcxproj">
|
||||
<Project>{03916d7c-9c52-44e9-b420-31b9f45cf8b9}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Render.h" />
|
||||
<ClInclude Include="sourse\shader\shader.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
33
Sourse/Render/Render.vcxproj.filters
Normal file
33
Sourse/Render/Render.vcxproj.filters
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Render.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\shader\shader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Render.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\shader\shader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/Render/Render.vcxproj.user
Normal file
6
Sourse/Render/Render.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
92
Sourse/Render/sourse/Render.cpp
Normal file
92
Sourse/Render/sourse/Render.cpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
|
||||
#include "Render.h"
|
||||
#include "Math.h"
|
||||
#include "../sourse/primitives/ray.h"
|
||||
|
||||
_Data* Data_p;
|
||||
|
||||
DLLEXPORT void RND_init(_Data* Data)
|
||||
{
|
||||
Data_p = Data;
|
||||
|
||||
}
|
||||
|
||||
DLLEXPORT void RND_Render()
|
||||
{
|
||||
_RND_cycle* Cycle = &Data_p->RND_cycle;
|
||||
|
||||
Cycle->update(&Data_p->UI.Viewport.View, Data_p->WM.win_width, Data_p->WM.win_height);
|
||||
|
||||
int size = Cycle->resolution;
|
||||
if (size > 5){
|
||||
size -= 1;
|
||||
}
|
||||
glPointSize(size);
|
||||
glBegin(GL_POINTS);
|
||||
|
||||
Ray ray = Ray();
|
||||
Ray ray_to_light = Ray();
|
||||
|
||||
for (int x = Cycle->pxlx; x < Data_p->WM.win_width; x += Cycle->resolution) {
|
||||
Cycle->camera_ray -= Cycle->step_x;
|
||||
|
||||
int i = Cycle->y_iteration_num;
|
||||
for (int y = Cycle->pxly; y < Data_p->WM.win_height; y += Cycle->resolution, i++) {
|
||||
Cycle->camera_ray -= Cycle->step_y;
|
||||
|
||||
ray.Pos = Cycle->cam->CameraPos;
|
||||
ray.Dir = Cycle->camera_ray;
|
||||
ray.Dir.unitv(&ray.Dir);
|
||||
|
||||
ray.shoot(&Data_p->DA_MeshObjects);
|
||||
|
||||
|
||||
if (ray.intersect) {
|
||||
|
||||
float color = 0;
|
||||
|
||||
ray_to_light.Pos = ray.intersect_p;
|
||||
ray_to_light.Dir = Data_p->Light.Dir;
|
||||
ray_to_light.Dir.invert();
|
||||
|
||||
vec3f tmp = vec3f(ray.Norm);
|
||||
tmp *= 0.00001f;
|
||||
ray_to_light.Pos += tmp;
|
||||
ray_to_light.shoot(&Data_p->DA_MeshObjects);
|
||||
|
||||
|
||||
if (!ray_to_light.intersect) {
|
||||
|
||||
vec3f point_ray = vec3f(ray.intersect_p);
|
||||
point_ray -= Data_p->Light.pos;
|
||||
color = 1.f / MATH_Power((point_ray.mod() + 1), 1);
|
||||
color = (color - (Data_p->Light.Dir * ray.Norm)) / 2.f;
|
||||
}
|
||||
else {
|
||||
color = 0.1f;
|
||||
}
|
||||
|
||||
glColor3f(color, color, color);
|
||||
|
||||
glVertex2d(double((x * 2.f) / Data_p->WM.win_width) - 1.f, -double((y * 2.f) / Data_p->WM.win_height) + 1.f);
|
||||
}
|
||||
|
||||
//Cycle->timeout()
|
||||
if (0) {
|
||||
Cycle->y_iteration_num = i;
|
||||
Cycle->pxly = y;
|
||||
Cycle->pxlx = x;
|
||||
Cycle->cycle_complete = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vec3f reset_ypos = vec3f(Cycle->step_y);
|
||||
reset_ypos *= i;
|
||||
Cycle->camera_ray += reset_ypos;
|
||||
}
|
||||
|
||||
//printf("cycle've been completed congrats\n");
|
||||
Cycle->cycle_complete = true;
|
||||
}
|
||||
8
Sourse/Render/sourse/Render.h
Normal file
8
Sourse/Render/sourse/Render.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Data.h"
|
||||
|
||||
|
||||
DLLEXPORT void RND_init(_Data* Data);
|
||||
DLLEXPORT void RND_Render();
|
||||
0
Sourse/Render/sourse/shader/shader.cpp
Normal file
0
Sourse/Render/sourse/shader/shader.cpp
Normal file
1
Sourse/Render/sourse/shader/shader.h
Normal file
1
Sourse/Render/sourse/shader/shader.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#pragma once
|
||||
186
Sourse/WM/WM.vcxproj
Normal file
186
Sourse/WM/WM.vcxproj
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{809A9CFA-7D32-40FB-84F6-DAB932BA7F5D}</ProjectGuid>
|
||||
<RootNamespace>eventhandler</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\bin_intermediate\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Math\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\extern\include;$(SolutionDir)\Sourse\Math\sourse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\Sourse\Operator\sourse;$(SolutionDir)\Sourse\Render\sourse;$(SolutionDir)\Sourse\Data\sourse;$(SolutionDir)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>shell32.lib;gdi32.lib;glfw3.lib;opengl32.lib;user32.lib;</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\bin\Debug;$(SolutionDir)\extern\lib-vc2019;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\Input.cpp" />
|
||||
<ClCompile Include="sourse\WM.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\Input.h" />
|
||||
<ClInclude Include="sourse\KeyConfig.h" />
|
||||
<ClInclude Include="sourse\WM.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.vcxproj">
|
||||
<Project>{e4451015-f74a-41bb-bc31-a55ffddc6af7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Math\Math.vcxproj">
|
||||
<Project>{95a51000-709f-4d51-b71d-4ff3d7348a42}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Operator\Operator.vcxproj">
|
||||
<Project>{2f90c1b5-b3b8-41f2-8e13-ff2f122007fe}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Render\Render.vcxproj">
|
||||
<Project>{094b0fb2-db22-4176-ab30-3986d60279c4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
36
Sourse/WM/WM.vcxproj.filters
Normal file
36
Sourse/WM/WM.vcxproj.filters
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="sourse\WM.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sourse\Input.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="sourse\WM.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\KeyConfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sourse\Input.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Sourse/WM/WM.vcxproj.user
Normal file
6
Sourse/WM/WM.vcxproj.user
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
17
Sourse/WM/sourse/Input.cpp
Normal file
17
Sourse/WM/sourse/Input.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "Input.h"
|
||||
|
||||
WM_EV_Input::WM_EV_Input()
|
||||
{
|
||||
for (int i = 0; i < 120; i++) {
|
||||
(&MOUSE_BUTTON_1)[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
WM_EV_Input::~WM_EV_Input()
|
||||
{
|
||||
}
|
||||
|
||||
void WM_EV_Input::update()
|
||||
{
|
||||
|
||||
}
|
||||
132
Sourse/WM/sourse/Input.h
Normal file
132
Sourse/WM/sourse/Input.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#pragma once
|
||||
|
||||
class WM_EV_Input
|
||||
{
|
||||
public:
|
||||
WM_EV_Input();
|
||||
~WM_EV_Input();
|
||||
|
||||
void update();
|
||||
|
||||
bool MOUSE_BUTTON_1;
|
||||
bool MOUSE_BUTTON_2;
|
||||
bool MOUSE_BUTTON_3;
|
||||
bool MOUSE_BUTTON_4;
|
||||
bool MOUSE_BUTTON_5;
|
||||
bool MOUSE_BUTTON_6;
|
||||
bool MOUSE_BUTTON_7;
|
||||
bool MOUSE_BUTTON_8;
|
||||
bool KEY_1;
|
||||
bool KEY_2;
|
||||
bool KEY_3;
|
||||
bool KEY_4;
|
||||
bool KEY_5;
|
||||
bool KEY_6;
|
||||
bool KEY_7;
|
||||
bool KEY_8;
|
||||
bool KEY_9;
|
||||
bool KEY_A;
|
||||
bool KEY_B;
|
||||
bool KEY_C;
|
||||
bool KEY_D;
|
||||
bool KEY_E;
|
||||
bool KEY_F;
|
||||
bool KEY_G;
|
||||
bool KEY_H;
|
||||
bool KEY_I;
|
||||
bool KEY_J;
|
||||
bool KEY_K;
|
||||
bool KEY_L;
|
||||
bool KEY_M;
|
||||
bool KEY_N;
|
||||
bool KEY_O;
|
||||
bool KEY_P;
|
||||
bool KEY_Q;
|
||||
bool KEY_R;
|
||||
bool KEY_S;
|
||||
bool KEY_T;
|
||||
bool KEY_U;
|
||||
bool KEY_V;
|
||||
bool KEY_W;
|
||||
bool KEY_X;
|
||||
bool KEY_Y;
|
||||
bool KEY_Z;
|
||||
bool KEY_SEMICOLON;
|
||||
bool KEY_EQUAL;
|
||||
bool KEY_LEFT_BRACKET;
|
||||
bool KEY_BACKSLASH;
|
||||
bool KEY_RIGHT_BRACKET;
|
||||
bool KEY_GRAVE_ACCENT;
|
||||
bool KEY_WORLD_1;
|
||||
bool KEY_WORLD_2;
|
||||
bool KEY_ESCAPE;
|
||||
bool KEY_ENTER;
|
||||
bool KEY_TAB;
|
||||
bool KEY_BACKSPACE;
|
||||
bool KEY_INSERT;
|
||||
bool KEY_DELETE;
|
||||
bool KEY_RIGHT;
|
||||
bool KEY_LEFT;
|
||||
bool KEY_DOWN;
|
||||
bool KEY_UP;
|
||||
bool KEY_PAGE_UP;
|
||||
bool KEY_PAGE_DOWN;
|
||||
bool KEY_HOME;
|
||||
bool KEY_END;
|
||||
bool KEY_CAPS_LOCK;
|
||||
bool KEY_SCROLL_LOCK;
|
||||
bool KEY_NUM_LOCK;
|
||||
bool KEY_PRINT_SCREEN;
|
||||
bool KEY_PAUSE;
|
||||
bool KEY_F1;
|
||||
bool KEY_F2;
|
||||
bool KEY_F3;
|
||||
bool KEY_F4;
|
||||
bool KEY_F5;
|
||||
bool KEY_F6;
|
||||
bool KEY_F7;
|
||||
bool KEY_F8;
|
||||
bool KEY_F9;
|
||||
bool KEY_F10;
|
||||
bool KEY_F11;
|
||||
bool KEY_F12;
|
||||
bool KEY_F13;
|
||||
bool KEY_F14;
|
||||
bool KEY_F15;
|
||||
bool KEY_F16;
|
||||
bool KEY_F17;
|
||||
bool KEY_F18;
|
||||
bool KEY_F19;
|
||||
bool KEY_F20;
|
||||
bool KEY_F21;
|
||||
bool KEY_F22;
|
||||
bool KEY_F23;
|
||||
bool KEY_F24;
|
||||
bool KEY_F25;
|
||||
bool KEY_KP_0;
|
||||
bool KEY_KP_1;
|
||||
bool KEY_KP_2;
|
||||
bool KEY_KP_3;
|
||||
bool KEY_KP_4;
|
||||
bool KEY_KP_5;
|
||||
bool KEY_KP_6;
|
||||
bool KEY_KP_7;
|
||||
bool KEY_KP_8;
|
||||
bool KEY_KP_9;
|
||||
bool KEY_KP_DECIMAL;
|
||||
bool KEY_KP_DIVIDE;
|
||||
bool KEY_KP_MULTIPLY;
|
||||
bool KEY_KP_SUBTRACT;
|
||||
bool KEY_KP_ADD;
|
||||
bool KEY_KP_ENTER;
|
||||
bool KEY_KP_EQUAL;
|
||||
bool KEY_LEFT_SHIFT;
|
||||
bool KEY_LEFT_CONTROL;
|
||||
bool KEY_LEFT_ALT;
|
||||
bool KEY_LEFT_SUPER;
|
||||
bool KEY_RIGHT_SHIFT;
|
||||
bool KEY_RIGHT_CONTROL;
|
||||
bool KEY_RIGHT_ALT;
|
||||
bool KEY_RIGHT_SUPER;
|
||||
bool KEY_MENU;
|
||||
};
|
||||
162
Sourse/WM/sourse/KeyConfig.h
Normal file
162
Sourse/WM/sourse/KeyConfig.h
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#define WINDOW_TRANSFORM 555
|
||||
|
||||
|
||||
|
||||
|
||||
#define EV_ST_IN_ACTION 0
|
||||
#define EV_ST_REALESED 1
|
||||
#define EV_ST_PRESED 2
|
||||
#define EV_ST_DOWN 3
|
||||
#define EV_ST_UP 4
|
||||
#define EV_ST_MOUSE_MOVE 5
|
||||
#define EV_ST_APPLY 6
|
||||
#define EV_ST_CANCEL 7
|
||||
|
||||
#define EV_SELECT (GLFW_MOUSE_BUTTON_1)
|
||||
|
||||
#define EV_SCALE (GLFW_KEY_S)
|
||||
#define EV_MOVE (GLFW_KEY_G)
|
||||
#define EV_ROTATE (GLFW_KEY_R)
|
||||
|
||||
#define EV_CAMERA_MOVE (GLFW_KEY_SPACE)
|
||||
#define EV_CAMERA_ROTATE (GLFW_MOUSE_BUTTON_3)
|
||||
#define EV_CAMERA_ZOOM (GLFW_MOUSE_BUTTON_2)
|
||||
|
||||
#define EV_DELETE (GLFW_KEY_DELETE)
|
||||
#define EV_ADD (GLFW_KEY_ENTER)
|
||||
#define EV_CLEAR_ALL (GLFW_KEY_END)
|
||||
|
||||
#define EV_INCREASE_RESOLUTION (GLFW_KEY_UP)
|
||||
#define EV_DECREASE_RESOLUTION (GLFW_KEY_DOWN)
|
||||
|
||||
|
||||
|
||||
#define EVENT_NONE -1
|
||||
|
||||
#define GLFW_MOUSE_BUTTON_1 0
|
||||
#define GLFW_MOUSE_BUTTON_2 1
|
||||
#define GLFW_MOUSE_BUTTON_3 2
|
||||
#define GLFW_MOUSE_BUTTON_4 3
|
||||
#define GLFW_MOUSE_BUTTON_5 4
|
||||
#define GLFW_MOUSE_BUTTON_6 5
|
||||
#define GLFW_MOUSE_BUTTON_7 6
|
||||
#define GLFW_MOUSE_BUTTON_8 7
|
||||
|
||||
#define WINDOW_TRANSFORM 555
|
||||
|
||||
#define GLFW_KEY_1 49
|
||||
#define GLFW_KEY_2 50
|
||||
#define GLFW_KEY_3 51
|
||||
#define GLFW_KEY_4 52
|
||||
#define GLFW_KEY_5 53
|
||||
#define GLFW_KEY_6 54
|
||||
#define GLFW_KEY_7 55
|
||||
#define GLFW_KEY_8 56
|
||||
#define GLFW_KEY_9 57
|
||||
#define GLFW_KEY_SEMICOLON 59
|
||||
#define GLFW_KEY_EQUAL 61
|
||||
#define GLFW_KEY_A 65
|
||||
#define GLFW_KEY_B 66
|
||||
#define GLFW_KEY_C 67
|
||||
#define GLFW_KEY_D 68
|
||||
#define GLFW_KEY_E 69
|
||||
#define GLFW_KEY_F 70
|
||||
#define GLFW_KEY_G 71
|
||||
#define GLFW_KEY_H 72
|
||||
#define GLFW_KEY_I 73
|
||||
#define GLFW_KEY_J 74
|
||||
#define GLFW_KEY_K 75
|
||||
#define GLFW_KEY_L 76
|
||||
#define GLFW_KEY_M 77
|
||||
#define GLFW_KEY_N 78
|
||||
#define GLFW_KEY_O 79
|
||||
#define GLFW_KEY_P 80
|
||||
#define GLFW_KEY_Q 81
|
||||
#define GLFW_KEY_R 82
|
||||
#define GLFW_KEY_S 83
|
||||
#define GLFW_KEY_T 84
|
||||
#define GLFW_KEY_U 85
|
||||
#define GLFW_KEY_V 86
|
||||
#define GLFW_KEY_W 87
|
||||
#define GLFW_KEY_X 88
|
||||
#define GLFW_KEY_Y 89
|
||||
#define GLFW_KEY_Z 90
|
||||
#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
|
||||
#define GLFW_KEY_BACKSLASH 92 /* \ */
|
||||
#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
|
||||
#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
|
||||
#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
|
||||
#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
|
||||
#define GLFW_KEY_ESCAPE 256
|
||||
#define GLFW_KEY_ENTER 257
|
||||
#define GLFW_KEY_TAB 258
|
||||
#define GLFW_KEY_BACKSPACE 259
|
||||
#define GLFW_KEY_INSERT 260
|
||||
#define GLFW_KEY_DELETE 261
|
||||
#define GLFW_KEY_RIGHT 262
|
||||
#define GLFW_KEY_LEFT 263
|
||||
#define GLFW_KEY_DOWN 264
|
||||
#define GLFW_KEY_UP 265
|
||||
#define GLFW_KEY_PAGE_UP 266
|
||||
#define GLFW_KEY_PAGE_DOWN 267
|
||||
#define GLFW_KEY_HOME 268
|
||||
#define GLFW_KEY_END 269
|
||||
#define GLFW_KEY_CAPS_LOCK 280
|
||||
#define GLFW_KEY_SCROLL_LOCK 281
|
||||
#define GLFW_KEY_NUM_LOCK 282
|
||||
#define GLFW_KEY_PRINT_SCREEN 283
|
||||
#define GLFW_KEY_PAUSE 284
|
||||
#define GLFW_KEY_F1 290
|
||||
#define GLFW_KEY_F2 291
|
||||
#define GLFW_KEY_F3 292
|
||||
#define GLFW_KEY_F4 293
|
||||
#define GLFW_KEY_F5 294
|
||||
#define GLFW_KEY_F6 295
|
||||
#define GLFW_KEY_F7 296
|
||||
#define GLFW_KEY_F8 297
|
||||
#define GLFW_KEY_F9 298
|
||||
#define GLFW_KEY_F10 299
|
||||
#define GLFW_KEY_F11 300
|
||||
#define GLFW_KEY_F12 301
|
||||
#define GLFW_KEY_F13 302
|
||||
#define GLFW_KEY_F14 303
|
||||
#define GLFW_KEY_F15 304
|
||||
#define GLFW_KEY_F16 305
|
||||
#define GLFW_KEY_F17 306
|
||||
#define GLFW_KEY_F18 307
|
||||
#define GLFW_KEY_F19 308
|
||||
#define GLFW_KEY_F20 309
|
||||
#define GLFW_KEY_F21 310
|
||||
#define GLFW_KEY_F22 311
|
||||
#define GLFW_KEY_F23 312
|
||||
#define GLFW_KEY_F24 313
|
||||
#define GLFW_KEY_F25 314
|
||||
#define GLFW_KEY_KP_0 320
|
||||
#define GLFW_KEY_KP_1 321
|
||||
#define GLFW_KEY_KP_2 322
|
||||
#define GLFW_KEY_KP_3 323
|
||||
#define GLFW_KEY_KP_4 324
|
||||
#define GLFW_KEY_KP_5 325
|
||||
#define GLFW_KEY_KP_6 326
|
||||
#define GLFW_KEY_KP_7 327
|
||||
#define GLFW_KEY_KP_8 328
|
||||
#define GLFW_KEY_KP_9 329
|
||||
#define GLFW_KEY_KP_DECIMAL 330
|
||||
#define GLFW_KEY_KP_DIVIDE 331
|
||||
#define GLFW_KEY_KP_MULTIPLY 332
|
||||
#define GLFW_KEY_KP_SUBTRACT 333
|
||||
#define GLFW_KEY_KP_ADD 334
|
||||
#define GLFW_KEY_KP_ENTER 335
|
||||
#define GLFW_KEY_KP_EQUAL 336
|
||||
#define GLFW_KEY_LEFT_SHIFT 340
|
||||
#define GLFW_KEY_LEFT_CONTROL 341
|
||||
#define GLFW_KEY_LEFT_ALT 342
|
||||
#define GLFW_KEY_LEFT_SUPER 343
|
||||
#define GLFW_KEY_RIGHT_SHIFT 344
|
||||
#define GLFW_KEY_RIGHT_CONTROL 345
|
||||
#define GLFW_KEY_RIGHT_ALT 346
|
||||
#define GLFW_KEY_RIGHT_SUPER 347
|
||||
#define GLFW_KEY_MENU 348
|
||||
216
Sourse/WM/sourse/WM.cpp
Normal file
216
Sourse/WM/sourse/WM.cpp
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
|
||||
#include "WM.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "Math.h"
|
||||
#include "Render.h"
|
||||
#include "Operator.h"
|
||||
#include "KeyConfig.h"
|
||||
|
||||
_WinManager* WM_p;
|
||||
_Data* Data_p;
|
||||
|
||||
DLLEXPORT bool WM_close_command()
|
||||
{
|
||||
return WM_p->of;
|
||||
}
|
||||
|
||||
DLLEXPORT void WM_CloseWindow()
|
||||
{
|
||||
glfwTerminate();
|
||||
OPSclear();
|
||||
}
|
||||
|
||||
// --------------------------------------- //
|
||||
|
||||
DLLEXPORT bool WM_input()
|
||||
{
|
||||
{
|
||||
glfwGetWindowSize(WM_p->window_p, &WM_p->win_width, &WM_p->win_height);
|
||||
glfwGetWindowPos(WM_p->window_p, &WM_p->win_xpos, &WM_p->win_ypos);
|
||||
glfwGetCursorPos(WM_p->window_p, &WM_p->mouse_x, &WM_p->mouse_y);
|
||||
glfwPollEvents();
|
||||
WM_p->of = glfwWindowShouldClose(WM_p->window_p);
|
||||
}
|
||||
|
||||
bool answ = event_evaluete();
|
||||
|
||||
WM_p->mouse_befor_y = WM_p->mouse_y;
|
||||
WM_p->mouse_befor_x = WM_p->mouse_x; //FIXME: wtf
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
bool event_evaluete() //FIXME: wtf
|
||||
{
|
||||
|
||||
_DAI_Object* obj = Data_p->DA_MeshObjects.active;
|
||||
_Camera* cam = &Data_p->UI.Viewport.View;
|
||||
|
||||
float disply;
|
||||
float displx;
|
||||
displx = (WM_p->mouse_x - WM_p->mouse_befor_x) / 100;
|
||||
disply = (WM_p->mouse_y - WM_p->mouse_befor_y) / 100;
|
||||
|
||||
if (WM_p->action == GLFW_RELEASE)
|
||||
{
|
||||
if (!WM_p->relesse) {
|
||||
WM_p->relesse = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
else if (WM_p->relesse) {
|
||||
|
||||
if (WM_p->eventID == GLFW_KEY_D) {
|
||||
|
||||
if (obj) {
|
||||
printf("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
Data_p->DA_MeshObjects.Obj_Add(obj);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
WM_p->relesse = false;
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
WM_p->relesse = false;
|
||||
|
||||
if (WM_p->eventID == GLFW_KEY_D) {
|
||||
|
||||
if (obj) {
|
||||
printf("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n");
|
||||
Data_p->DA_MeshObjects.Obj_Add(obj);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_CAMERA_MOVE)
|
||||
{
|
||||
CameraMove(disply, 'y');
|
||||
CameraMove(displx, 'x');
|
||||
}
|
||||
if (WM_p->eventID == EV_CAMERA_ZOOM)
|
||||
{
|
||||
CameraMove(-disply, 'z');
|
||||
}
|
||||
if (WM_p->eventID == EV_CAMERA_ROTATE)
|
||||
{
|
||||
RotCamera(disply, 'x', 2);
|
||||
RotCamera(-displx, 'y', 2);
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_SELECT)
|
||||
{
|
||||
int my = WM_p->win_height - WM_p->mouse_y;
|
||||
printf("selected\n");
|
||||
OPselect(WM_p->mouse_x, my, WM_p->win_width, WM_p->win_height);
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_ROTATE) {
|
||||
|
||||
if (obj) {
|
||||
vec3f tmp = vec3f(cam->x_unit_v);
|
||||
//tmp.invert();
|
||||
tmp *= -1;
|
||||
obj->rot(&tmp, &obj->Position, disply);
|
||||
obj->rot(&cam->y_unit_v, &obj->Position, displx);
|
||||
}
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_MOVE) {
|
||||
|
||||
if (obj) {
|
||||
vec3f displst = vec3f(cam->x_unit_v);
|
||||
displst *= -displx;
|
||||
obj->move(&displst);
|
||||
|
||||
displst = cam->y_unit_v;
|
||||
displst *= -disply;
|
||||
obj->move(&displst);
|
||||
}
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_SCALE) {
|
||||
if (obj) {
|
||||
obj->scale(1 + displx);
|
||||
}
|
||||
}
|
||||
|
||||
if (WM_p->eventID == EV_CLEAR_ALL and WM_p->action == 1) { OPSclear(); }
|
||||
if (WM_p->eventID == EV_DELETE and WM_p->action == 1) { OPSdelete(); printf("del dat shit\n"); }
|
||||
if (WM_p->eventID == EV_ADD and WM_p->action == 1) { OPSAddcoords(); }
|
||||
|
||||
if (WM_p->eventID == EV_DECREASE_RESOLUTION) {
|
||||
Data_p->UI.Viewport.View.simplify += 2;
|
||||
printf("EV_DECREASE_RESOLUTION\n");
|
||||
}
|
||||
if (WM_p->eventID == EV_INCREASE_RESOLUTION) {
|
||||
Data_p->UI.Viewport.View.simplify -= 2;
|
||||
printf("EV_INCREASE_RESOLUTION\n");
|
||||
}
|
||||
|
||||
|
||||
//if (WM_p->eventID == GLFW_KEY_Y) { rotObj('y', 0.1f); }
|
||||
//if (WM_p->eventID == GLFW_KEY_Z) { rotObj('z', 0.1f); }
|
||||
//if (WM_p->eventID == GLFW_KEY_G) { RelativeRotate(0.1f, 2); }
|
||||
//if (WM_p->eventID == GLFW_KEY_H) { RotCamera(0.005f, 'z', 2); }
|
||||
//if (WM_p->eventID == GLFW_KEY_J) { RotCamera(0.005f, 'x', 2); }//HMM: why so small
|
||||
//if (WM_p->eventID == GLFW_KEY_R) { ResetCamera(); }
|
||||
|
||||
Data_p->RND_cycle.restart = true;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void WM_output()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glViewport(0.0f, 0.0f, Data_p->WM.win_width, Data_p->WM.win_height);
|
||||
|
||||
RND_Render();
|
||||
|
||||
glEnd();
|
||||
|
||||
glfwSwapBuffers(Data_p->WM.window_p);
|
||||
}
|
||||
|
||||
// --------------------------------------- //
|
||||
|
||||
DLLEXPORT void WM_Init(_Data* Data)
|
||||
{
|
||||
Data_p = Data;
|
||||
WM_p = &Data_p->WM;
|
||||
if (WM_p->of)
|
||||
{
|
||||
glfwInit();
|
||||
|
||||
WM_p->window_p = glfwCreateWindow(API_WIDTH, API_WIDTH, "Ma", NULL, NULL);
|
||||
//glfwMaximizeWindow(WM_p->window_p);
|
||||
glfwMakeContextCurrent(WM_p->window_p);
|
||||
glfwSetKeyCallback(WM_p->window_p, on_key);
|
||||
glfwSetMouseButtonCallback(WM_p->window_p, on_mouse);
|
||||
glfwSetWindowRefreshCallback(WM_p->window_p, window_transform);
|
||||
//glfwSetWindowPosCallback(WM.window_p, window_transform);
|
||||
|
||||
WM_p->of = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void window_transform(GLFWwindow* window)
|
||||
{
|
||||
WM_p->eventID = WINDOW_TRANSFORM;
|
||||
}
|
||||
void on_key(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
WM_p->eventID = key;
|
||||
WM_p->action = action;
|
||||
}
|
||||
void on_mouse(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
WM_p->eventID = button;
|
||||
WM_p->action = action;
|
||||
}
|
||||
22
Sourse/WM/sourse/WM.h
Normal file
22
Sourse/WM/sourse/WM.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#define API_TITLE "MA"
|
||||
#define API_HEIGHT 400
|
||||
#define API_WIDTH 800
|
||||
#define API_SWAPINTERVAL 10
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
|
||||
#include "Data.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
DLLEXPORT void WM_Init(_Data* Data);
|
||||
DLLEXPORT bool WM_input();
|
||||
DLLEXPORT void WM_output();
|
||||
DLLEXPORT bool WM_close_command();
|
||||
DLLEXPORT void WM_CloseWindow();
|
||||
|
||||
bool event_evaluete();
|
||||
|
||||
void on_key(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
void on_mouse(GLFWwindow* window, int button, int action, int mods);
|
||||
void window_transform(GLFWwindow* window);
|
||||
38
extern/blendlib/BLI_alloca.h
vendored
Normal file
38
extern/blendlib/BLI_alloca.h
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ALLOCA_H__
|
||||
#define __BLI_ALLOCA_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* Defines alloca and utility macro BLI_array_alloca
|
||||
*/
|
||||
|
||||
/* BLI_array_alloca / alloca */
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# if defined(__cplusplus) && (__cplusplus > 199711L)
|
||||
# define BLI_array_alloca(arr, realsize) (decltype(arr)) alloca(sizeof(*arr) * (realsize))
|
||||
# else
|
||||
# define BLI_array_alloca(arr, realsize) (typeof(arr)) alloca(sizeof(*arr) * (realsize))
|
||||
# endif
|
||||
#else
|
||||
# define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize))
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_ALLOCA_H__ */
|
||||
129
extern/blendlib/BLI_allocator.h
vendored
Normal file
129
extern/blendlib/BLI_allocator.h
vendored
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef __BLI_ALLOCATOR_H__
|
||||
#define __BLI_ALLOCATOR_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* This file offers a couple of memory allocators that can be used with containers such as Vector
|
||||
* and Map. Note that these allocators are not designed to work with standard containers like
|
||||
* std::vector.
|
||||
*
|
||||
* Also see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html for why the standard
|
||||
* allocators are not a good fit applications like Blender. The current implementations in this
|
||||
* file are fairly simple still, more complexity can be added when necessary. For now they do their
|
||||
* job good enough.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_temporary_allocator.h"
|
||||
|
||||
namespace BLI {
|
||||
|
||||
/**
|
||||
* Use Blenders guarded allocator (aka MEM_malloc). This should always be used except there is a
|
||||
* good reason not to use it.
|
||||
*/
|
||||
class GuardedAllocator {
|
||||
public:
|
||||
void *allocate(uint size, const char *name)
|
||||
{
|
||||
return MEM_mallocN(size, name);
|
||||
}
|
||||
|
||||
void *allocate_aligned(uint size, uint alignment, const char *name)
|
||||
{
|
||||
alignment = std::max<uint>(alignment, 8);
|
||||
return MEM_mallocN_aligned(size, alignment, name);
|
||||
}
|
||||
|
||||
void deallocate(void *ptr)
|
||||
{
|
||||
MEM_freeN(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a simple wrapper around malloc/free. Only use this when the GuardedAllocator cannot be
|
||||
* used. This can be the case when the allocated element might live longer than Blenders Allocator.
|
||||
*/
|
||||
class RawAllocator {
|
||||
private:
|
||||
struct MemHead {
|
||||
int offset;
|
||||
};
|
||||
|
||||
public:
|
||||
void *allocate(uint size, const char *UNUSED(name))
|
||||
{
|
||||
void *ptr = malloc(size + sizeof(MemHead));
|
||||
((MemHead *)ptr)->offset = sizeof(MemHead);
|
||||
return POINTER_OFFSET(ptr, sizeof(MemHead));
|
||||
}
|
||||
|
||||
void *allocate_aligned(uint size, uint alignment, const char *UNUSED(name))
|
||||
{
|
||||
BLI_assert(is_power_of_2_i((int)alignment));
|
||||
void *ptr = malloc(size + alignment + sizeof(MemHead));
|
||||
void *used_ptr = (void *)((uintptr_t)POINTER_OFFSET(ptr, alignment + sizeof(MemHead)) &
|
||||
~((uintptr_t)alignment - 1));
|
||||
uint offset = (uint)((uintptr_t)used_ptr - (uintptr_t)ptr);
|
||||
BLI_assert(offset >= sizeof(MemHead));
|
||||
((MemHead *)used_ptr - 1)->offset = (int)offset;
|
||||
return used_ptr;
|
||||
}
|
||||
|
||||
void deallocate(void *ptr)
|
||||
{
|
||||
MemHead *head = (MemHead *)ptr - 1;
|
||||
int offset = -head->offset;
|
||||
void *actual_pointer = POINTER_OFFSET(ptr, offset);
|
||||
free(actual_pointer);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Use this only under specific circumstances as described in BLI_temporary_allocator.h.
|
||||
*/
|
||||
class TemporaryAllocator {
|
||||
public:
|
||||
void *allocate(uint size, const char *UNUSED(name))
|
||||
{
|
||||
return BLI_temporary_allocate(size);
|
||||
}
|
||||
|
||||
void *allocate_aligned(uint size, uint alignment, const char *UNUSED(name))
|
||||
{
|
||||
BLI_assert(alignment <= 64);
|
||||
UNUSED_VARS_NDEBUG(alignment);
|
||||
return BLI_temporary_allocate(size);
|
||||
}
|
||||
|
||||
void deallocate(void *ptr)
|
||||
{
|
||||
BLI_temporary_deallocate(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace BLI
|
||||
|
||||
#endif /* __BLI_ALLOCATOR_H__ */
|
||||
74
extern/blendlib/BLI_args.h
vendored
Normal file
74
extern/blendlib/BLI_args.h
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARGS_H__
|
||||
#define __BLI_ARGS_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief A general argument parsing module.
|
||||
*/
|
||||
|
||||
struct bArgs;
|
||||
typedef struct bArgs bArgs;
|
||||
|
||||
/**
|
||||
* Returns the number of extra arguments consumed by the function.
|
||||
* - 0 is normal value,
|
||||
* - -1 stops parsing arguments, other negative indicates skip
|
||||
*/
|
||||
typedef int (*BA_ArgCallback)(int argc, const char **argv, void *data);
|
||||
|
||||
struct bArgs *BLI_argsInit(int argc, const char **argv);
|
||||
void BLI_argsFree(struct bArgs *ba);
|
||||
|
||||
/**
|
||||
* Pass starts at 1, -1 means valid all the time
|
||||
* short_arg or long_arg can be null to specify no short or long versions
|
||||
*/
|
||||
void BLI_argsAdd(struct bArgs *ba,
|
||||
int pass,
|
||||
const char *short_arg,
|
||||
const char *long_arg,
|
||||
const char *doc,
|
||||
BA_ArgCallback cb,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* Short_case and long_case specify if those arguments are case specific
|
||||
*/
|
||||
void BLI_argsAddCase(struct bArgs *ba,
|
||||
int pass,
|
||||
const char *short_arg,
|
||||
int short_case,
|
||||
const char *long_arg,
|
||||
int long_case,
|
||||
const char *doc,
|
||||
BA_ArgCallback cb,
|
||||
void *data);
|
||||
|
||||
void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *data);
|
||||
|
||||
void BLI_argsPrintArgDoc(struct bArgs *ba, const char *arg);
|
||||
void BLI_argsPrintOtherDoc(struct bArgs *ba);
|
||||
|
||||
void BLI_argsPrint(struct bArgs *ba);
|
||||
const char **BLI_argsArgv(struct bArgs *ba);
|
||||
|
||||
#endif
|
||||
177
extern/blendlib/BLI_array.h
vendored
Normal file
177
extern/blendlib/BLI_array.h
vendored
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARRAY_H__
|
||||
#define __BLI_ARRAY_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief A (mainly) macro array library.
|
||||
*/
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Internal defines
|
||||
* \{ */
|
||||
|
||||
/** this returns the entire size of the array, including any buffering. */
|
||||
#define _bli_array_totalsize_dynamic(arr) \
|
||||
(((arr) == NULL) ? 0 : MEM_allocN_len(arr) / sizeof(*(arr)))
|
||||
|
||||
#define _bli_array_totalsize_static(arr) (sizeof(_##arr##_static) / sizeof(*(arr)))
|
||||
|
||||
#define _bli_array_totalsize(arr) \
|
||||
((size_t)(((void *)(arr) == (void *)_##arr##_static && (void *)(arr) != NULL) ? \
|
||||
_bli_array_totalsize_static(arr) : \
|
||||
_bli_array_totalsize_dynamic(arr)))
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* BLI_array.c
|
||||
*
|
||||
* Doing the realloc in a macro isn't so simple,
|
||||
* so use a function the macros can use.
|
||||
*/
|
||||
void _bli_array_grow_func(void **arr_p,
|
||||
const void *arr_static,
|
||||
const int sizeof_arr_p,
|
||||
const int arr_len,
|
||||
const int num,
|
||||
const char *alloc_str);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Public defines
|
||||
* \{ */
|
||||
|
||||
/** use ``sizeof(*(arr))`` to ensure the array exists and is an array */
|
||||
#define BLI_array_declare(arr) \
|
||||
int _##arr##_len = ((void)(sizeof(*(arr))), 0); \
|
||||
void *_##arr##_static = NULL
|
||||
|
||||
/**
|
||||
* this will use stack space, up to maxstatic array elements, before
|
||||
* switching to dynamic heap allocation */
|
||||
#define BLI_array_staticdeclare(arr, maxstatic) \
|
||||
int _##arr##_len = 0; \
|
||||
char _##arr##_static[maxstatic * sizeof(*(arr))]
|
||||
|
||||
/** returns the logical size of the array, not including buffering. */
|
||||
#define BLI_array_len(arr) ((void)0, _##arr##_len)
|
||||
|
||||
/**
|
||||
* Grow the array by a fixed number of items.
|
||||
*
|
||||
* Allow for a large 'num' value when the new size is more than double
|
||||
* to allocate the exact sized array. */
|
||||
#define BLI_array_reserve(arr, num) \
|
||||
(void)((((void *)(arr) == NULL) && \
|
||||
((void *)(_##arr##_static) != \
|
||||
NULL) && /* don't add _##arr##_len below because it must be zero */ \
|
||||
(_bli_array_totalsize_static(arr) >= \
|
||||
(size_t)(_##arr##_len + \
|
||||
(num)))) ? /* we have an empty array and a static var big enough */ \
|
||||
(void)(arr = (void *)_##arr##_static) : /* use existing static array or allocate */ \
|
||||
(LIKELY(_bli_array_totalsize(arr) >= (size_t)(_##arr##_len + (num))) ? \
|
||||
(void)0 /* do nothing */ : \
|
||||
_bli_array_grow_func((void **)&(arr), \
|
||||
_##arr##_static, \
|
||||
sizeof(*(arr)), \
|
||||
_##arr##_len, \
|
||||
num, \
|
||||
"BLI_array." #arr)))
|
||||
|
||||
/** returns length of array */
|
||||
#define BLI_array_grow_items(arr, num) (BLI_array_reserve(arr, num), (_##arr##_len += num))
|
||||
|
||||
#define BLI_array_grow_one(arr) BLI_array_grow_items(arr, 1)
|
||||
|
||||
/** appends an item to the array. */
|
||||
#define BLI_array_append(arr, item) \
|
||||
((void)BLI_array_grow_one(arr), (void)(arr[_##arr##_len - 1] = item))
|
||||
|
||||
/**
|
||||
* appends an item to the array and returns a pointer to the item in the array.
|
||||
* item is not a pointer, but actual data value.*/
|
||||
#define BLI_array_append_r(arr, item) \
|
||||
((void)BLI_array_grow_one(arr), (void)(arr[_##arr##_len - 1] = item), (&arr[_##arr##_len - 1]))
|
||||
|
||||
/** appends (grows) & returns a pointer to the uninitialized memory */
|
||||
#define BLI_array_append_ret(arr) (BLI_array_reserve(arr, 1), &arr[(_##arr##_len++)])
|
||||
|
||||
#define BLI_array_free(arr) \
|
||||
{ \
|
||||
if (arr && (char *)arr != _##arr##_static) { \
|
||||
BLI_array_fake_user(arr); \
|
||||
MEM_freeN(arr); \
|
||||
} \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
#define BLI_array_pop(arr) ((arr && _##arr##_len) ? arr[--_##arr##_len] : NULL)
|
||||
|
||||
/**
|
||||
* Resets the logical size of an array to zero, but doesn't
|
||||
* free the memory. */
|
||||
#define BLI_array_clear(arr) \
|
||||
{ \
|
||||
_##arr##_len = 0; \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
/**
|
||||
* Set the length of the array, doesn't actually increase the allocated array
|
||||
* size. don't use this unless you know what you're doing. */
|
||||
#define BLI_array_len_set(arr, len) \
|
||||
{ \
|
||||
_##arr##_len = (len); \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
/** only to prevent unused warnings */
|
||||
#define BLI_array_fake_user(arr) ((void)_##arr##_len, (void)_##arr##_static)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Generic Array Utils
|
||||
* other useful defines
|
||||
* (unrelated to the main array macros)
|
||||
*
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* not part of the 'API' but handy funcs,
|
||||
* same purpose as #BLI_array_staticdeclare()
|
||||
* but use when the max size is known ahead of time */
|
||||
#define BLI_array_fixedstack_declare(arr, maxstatic, realsize, allocstr) \
|
||||
char _##arr##_static[maxstatic * sizeof(*(arr))]; \
|
||||
const bool _##arr##_is_static = ((void *)_##arr##_static) != \
|
||||
(arr = ((realsize) <= maxstatic) ? \
|
||||
(void *)_##arr##_static : \
|
||||
MEM_mallocN(sizeof(*(arr)) * (realsize), allocstr))
|
||||
|
||||
#define BLI_array_fixedstack_free(arr) \
|
||||
if (_##arr##_is_static) { \
|
||||
MEM_freeN(arr); \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __BLI_ARRAY_H__ */
|
||||
197
extern/blendlib/BLI_array_cxx.h
vendored
Normal file
197
extern/blendlib/BLI_array_cxx.h
vendored
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef __BLI_ARRAY_CXX_H__
|
||||
#define __BLI_ARRAY_CXX_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* This is a container that contains a fixed size array. Note however, the size of the array is not
|
||||
* a template argument. Instead it can be specified at the construction time.
|
||||
*/
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_allocator.h"
|
||||
#include "BLI_array_ref.h"
|
||||
#include "BLI_memory_utils_cxx.h"
|
||||
|
||||
namespace BLI {
|
||||
|
||||
template<typename T, typename Allocator = GuardedAllocator> class Array {
|
||||
private:
|
||||
T *m_data;
|
||||
uint m_size;
|
||||
Allocator m_allocator;
|
||||
|
||||
public:
|
||||
Array()
|
||||
{
|
||||
m_data = nullptr;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
Array(ArrayRef<T> values)
|
||||
{
|
||||
m_size = values.size();
|
||||
m_data = this->allocate(m_size);
|
||||
uninitialized_copy_n(values.begin(), m_size, m_data);
|
||||
}
|
||||
|
||||
Array(const std::initializer_list<T> &values) : Array(ArrayRef<T>(values))
|
||||
{
|
||||
}
|
||||
|
||||
explicit Array(uint size)
|
||||
{
|
||||
m_data = this->allocate(size);
|
||||
m_size = size;
|
||||
|
||||
for (uint i = 0; i < m_size; i++) {
|
||||
new (m_data + i) T();
|
||||
}
|
||||
}
|
||||
|
||||
Array(uint size, const T &value)
|
||||
{
|
||||
m_data = this->allocate(size);
|
||||
m_size = size;
|
||||
uninitialized_fill_n(m_data, m_size, value);
|
||||
}
|
||||
|
||||
Array(const Array &other)
|
||||
{
|
||||
m_size = other.size();
|
||||
m_allocator = other.m_allocator;
|
||||
|
||||
if (m_size == 0) {
|
||||
m_data = nullptr;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
m_data = this->allocate(m_size);
|
||||
copy_n(other.begin(), m_size, m_data);
|
||||
}
|
||||
}
|
||||
|
||||
Array(Array &&other) noexcept
|
||||
{
|
||||
m_data = other.m_data;
|
||||
m_size = other.m_size;
|
||||
m_allocator = other.m_allocator;
|
||||
|
||||
other.m_data = nullptr;
|
||||
other.m_size = 0;
|
||||
}
|
||||
|
||||
~Array()
|
||||
{
|
||||
destruct_n(m_data, m_size);
|
||||
if (m_data != nullptr) {
|
||||
m_allocator.deallocate((void *)m_data);
|
||||
}
|
||||
}
|
||||
|
||||
Array &operator=(const Array &other)
|
||||
{
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->~Array();
|
||||
new (this) Array(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Array &operator=(Array &&other)
|
||||
{
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->~Array();
|
||||
new (this) Array(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator ArrayRef<T>() const
|
||||
{
|
||||
return ArrayRef<T>(m_data, m_size);
|
||||
}
|
||||
|
||||
operator MutableArrayRef<T>()
|
||||
{
|
||||
return MutableArrayRef<T>(m_data, m_size);
|
||||
}
|
||||
|
||||
ArrayRef<T> as_ref() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
T &operator[](uint index)
|
||||
{
|
||||
BLI_assert(index < m_size);
|
||||
return m_data[index];
|
||||
}
|
||||
|
||||
uint size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
void fill(const T &value)
|
||||
{
|
||||
MutableArrayRef<T>(*this).fill(value);
|
||||
}
|
||||
|
||||
void fill_indices(ArrayRef<uint> indices, const T &value)
|
||||
{
|
||||
MutableArrayRef<T>(*this).fill_indices(indices, value);
|
||||
}
|
||||
|
||||
const T *begin() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
const T *end() const
|
||||
{
|
||||
return m_data + m_size;
|
||||
}
|
||||
|
||||
T *begin()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
T *end()
|
||||
{
|
||||
return m_data + m_size;
|
||||
}
|
||||
|
||||
private:
|
||||
T *allocate(uint size)
|
||||
{
|
||||
return (T *)m_allocator.allocate_aligned(
|
||||
size * sizeof(T), std::alignment_of<T>::value, __func__);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> using TemporaryArray = Array<T, TemporaryAllocator>;
|
||||
|
||||
} // namespace BLI
|
||||
|
||||
#endif /* __BLI_ARRAY_CXX_H__ */
|
||||
426
extern/blendlib/BLI_array_ref.h
vendored
Normal file
426
extern/blendlib/BLI_array_ref.h
vendored
Normal file
|
|
@ -0,0 +1,426 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARRAY_REF_H__
|
||||
#define __BLI_ARRAY_REF_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* These classes offer a convenient way to work with continuous chunks of memory of a certain type.
|
||||
* We differentiate #ArrayRef and #MutableArrayRef. The elements in the former are const while the
|
||||
* elements in the other are not.
|
||||
*
|
||||
* Passing array references as parameters has multiple benefits:
|
||||
* - Less templates are used because the function does not have to work with different
|
||||
* container types.
|
||||
* - It encourages an Struct-of-Arrays data layout which is often beneficial when
|
||||
* writing high performance code. Also it makes it easier to reuse code.
|
||||
* - Array references offer convenient ways of slicing and other operations.
|
||||
*
|
||||
* The instances of #ArrayRef and #MutableArrayRef are very small and should be passed by value.
|
||||
* Since array references do not own any memory, it is generally not save to store them.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_memory_utils_cxx.h"
|
||||
#include "BLI_index_range.h"
|
||||
|
||||
namespace BLI {
|
||||
|
||||
/**
|
||||
* References an array of data. The elements in the array should not be changed.
|
||||
*/
|
||||
template<typename T> class ArrayRef {
|
||||
private:
|
||||
const T *m_start = nullptr;
|
||||
uint m_size = 0;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a reference to an empty array.
|
||||
* The pointer is allowed to be nullptr.
|
||||
*/
|
||||
ArrayRef() = default;
|
||||
|
||||
ArrayRef(const T *start, uint size) : m_start(start), m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
ArrayRef(const std::initializer_list<T> &list) : ArrayRef(list.begin(), list.size())
|
||||
{
|
||||
}
|
||||
|
||||
ArrayRef(const std::vector<T> &vector) : ArrayRef(vector.data(), vector.size())
|
||||
{
|
||||
}
|
||||
|
||||
template<std::size_t N> ArrayRef(const std::array<T, N> &array) : ArrayRef(array.data(), N)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a continuous part of the array.
|
||||
* Asserts that the slice stays within the array.
|
||||
*/
|
||||
ArrayRef slice(uint start, uint size) const
|
||||
{
|
||||
BLI_assert(start + size <= this->size() || size == 0);
|
||||
return ArrayRef(m_start + start, size);
|
||||
}
|
||||
|
||||
ArrayRef slice(IndexRange range) const
|
||||
{
|
||||
return this->slice(range.start(), range.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new ArrayRef with n elements removed from the beginning.
|
||||
* Asserts that the array contains enough elements.
|
||||
*/
|
||||
ArrayRef drop_front(uint n = 1) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(n, this->size() - n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new ArrayRef with n elements removed from the beginning.
|
||||
* Asserts that the array contains enough elements.
|
||||
*/
|
||||
ArrayRef drop_back(uint n = 1) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(0, this->size() - n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new ArrayRef that only contains the first n elements.
|
||||
* Asserts that the array contains enough elements.
|
||||
*/
|
||||
ArrayRef take_front(uint n) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(0, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new ArrayRef that only contains the last n elements.
|
||||
* Asserts that the array contains enough elements.
|
||||
*/
|
||||
ArrayRef take_back(uint n) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(this->size() - n, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the values in this array to another array.
|
||||
*/
|
||||
void copy_to(T *ptr) const
|
||||
{
|
||||
BLI::copy_n(m_start, m_size, ptr);
|
||||
}
|
||||
|
||||
const T *begin() const
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
|
||||
const T *end() const
|
||||
{
|
||||
return m_start + m_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access an element in the array.
|
||||
* Asserts that the index is in the bounds of the array.
|
||||
*/
|
||||
const T &operator[](uint index) const
|
||||
{
|
||||
BLI_assert(index < m_size);
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of elements in the referenced array.
|
||||
*/
|
||||
uint size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of bytes referenced by this ArrayRef.
|
||||
*/
|
||||
uint byte_size() const
|
||||
{
|
||||
return sizeof(T) * m_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a linear search to see of the value is in the array.
|
||||
* Return true if it is, otherwise false.
|
||||
*/
|
||||
bool contains(const T &value) const
|
||||
{
|
||||
for (const T &element : *this) {
|
||||
if (element == value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a constant time check to see if the pointer is within the referenced array.
|
||||
* Return true if it is, otherwise false.
|
||||
*/
|
||||
bool contains_ptr(const T *ptr) const
|
||||
{
|
||||
return (this->begin() <= ptr) && (ptr < this->end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a linear search to count how often the value is in the array.
|
||||
* Returns the number of occurrences.
|
||||
*/
|
||||
uint count(const T &value) const
|
||||
{
|
||||
uint counter = 0;
|
||||
for (const T &element : *this) {
|
||||
if (element == value) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a reference to the first element in the array.
|
||||
* Asserts that the array is not empty.
|
||||
*/
|
||||
const T &first() const
|
||||
{
|
||||
BLI_assert(m_size > 0);
|
||||
return m_start[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a reference to the last element in the array.
|
||||
* Asserts that the array is not empty.
|
||||
*/
|
||||
const T &last() const
|
||||
{
|
||||
BLI_assert(m_size > 0);
|
||||
return m_start[m_size - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element at the given index. If the index is out of range, return the fallback value.
|
||||
*/
|
||||
T get(uint index, const T &fallback) const
|
||||
{
|
||||
if (index < m_size) {
|
||||
return m_start[index];
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new array ref to the same underlying memory buffer. No conversions are done.
|
||||
* Asserts when the sizes of the types don't match.
|
||||
*/
|
||||
template<typename NewT> ArrayRef<NewT> cast() const
|
||||
{
|
||||
/* Can be adjusted to allow different type sizes when necessary. */
|
||||
BLI_STATIC_ASSERT(sizeof(T) == sizeof(NewT), "");
|
||||
return ArrayRef<NewT>((NewT *)m_start, m_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* A debug utility to print the content of the array ref. Every element will be printed on a
|
||||
* separate line using the given callback.
|
||||
*/
|
||||
template<typename PrintLineF> void print_as_lines(std::string name, PrintLineF print_line) const
|
||||
{
|
||||
std::cout << "ArrayRef: " << name << " \tSize:" << m_size << '\n';
|
||||
for (const T &value : *this) {
|
||||
std::cout << " ";
|
||||
print_line(value);
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mostly the same as ArrayRef, except that one can change the array elements via this reference.
|
||||
*/
|
||||
template<typename T> class MutableArrayRef {
|
||||
private:
|
||||
T *m_start;
|
||||
uint m_size;
|
||||
|
||||
public:
|
||||
MutableArrayRef() = default;
|
||||
|
||||
MutableArrayRef(T *start, uint size) : m_start(start), m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
MutableArrayRef(std::initializer_list<T> &list) : MutableArrayRef(list.begin(), list.size())
|
||||
{
|
||||
}
|
||||
|
||||
MutableArrayRef(std::vector<T> &vector) : MutableArrayRef(vector.data(), vector.size())
|
||||
{
|
||||
}
|
||||
|
||||
template<std::size_t N>
|
||||
MutableArrayRef(std::array<T, N> &array) : MutableArrayRef(array.data(), N)
|
||||
{
|
||||
}
|
||||
|
||||
operator ArrayRef<T>()
|
||||
{
|
||||
return ArrayRef<T>(m_start, m_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of elements in the array.
|
||||
*/
|
||||
uint size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all elements in the referenced array with the given value.
|
||||
*/
|
||||
void fill(const T &element)
|
||||
{
|
||||
std::fill_n(m_start, m_size, element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a subset of all elements with the given value.
|
||||
*/
|
||||
void fill_indices(ArrayRef<uint> indices, const T &element)
|
||||
{
|
||||
for (uint i : indices) {
|
||||
m_start[i] = element;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the values from another array into the references array.
|
||||
*/
|
||||
void copy_from(const T *ptr)
|
||||
{
|
||||
BLI::copy_n(ptr, m_size, m_start);
|
||||
}
|
||||
|
||||
void copy_from(ArrayRef<T> other)
|
||||
{
|
||||
BLI_assert(this->size() == other.size());
|
||||
this->copy_from(other.begin());
|
||||
}
|
||||
|
||||
T *begin() const
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
|
||||
T *end() const
|
||||
{
|
||||
return m_start + m_size;
|
||||
}
|
||||
|
||||
T &operator[](uint index) const
|
||||
{
|
||||
BLI_assert(index < this->size());
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a continuous part of the array.
|
||||
* Asserts that the slice stays in the array bounds.
|
||||
*/
|
||||
MutableArrayRef slice(uint start, uint length) const
|
||||
{
|
||||
BLI_assert(start + length <= this->size());
|
||||
return MutableArrayRef(m_start + start, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new MutableArrayRef with n elements removed from the beginning.
|
||||
*/
|
||||
MutableArrayRef drop_front(uint n = 1) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(n, this->size() - n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new MutableArrayRef with n elements removed from the beginning.
|
||||
*/
|
||||
MutableArrayRef drop_back(uint n = 1) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(0, this->size() - n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new MutableArrayRef that only contains the first n elements.
|
||||
*/
|
||||
MutableArrayRef take_front(uint n) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(0, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new MutableArrayRef that only contains the last n elements.
|
||||
*/
|
||||
MutableArrayRef take_back(uint n) const
|
||||
{
|
||||
BLI_assert(n <= this->size());
|
||||
return this->slice(this->size() - n, n);
|
||||
}
|
||||
|
||||
ArrayRef<T> as_ref() const
|
||||
{
|
||||
return ArrayRef<T>(m_start, m_size);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Shorthand to make use of automatic template parameter deduction.
|
||||
*/
|
||||
template<typename T> ArrayRef<T> ref_c_array(const T *array, uint size)
|
||||
{
|
||||
return ArrayRef<T>(array, size);
|
||||
}
|
||||
|
||||
} /* namespace BLI */
|
||||
|
||||
#endif /* __BLI_ARRAY_REF_H__ */
|
||||
49
extern/blendlib/BLI_array_store.h
vendored
Normal file
49
extern/blendlib/BLI_array_store.h
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARRAY_STORE_H__
|
||||
#define __BLI_ARRAY_STORE_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief Efficient in-memory storage of multiple similar arrays.
|
||||
*/
|
||||
|
||||
typedef struct BArrayState BArrayState;
|
||||
typedef struct BArrayStore BArrayStore;
|
||||
|
||||
BArrayStore *BLI_array_store_create(unsigned int stride, unsigned int chunk_count);
|
||||
void BLI_array_store_destroy(BArrayStore *bs);
|
||||
void BLI_array_store_clear(BArrayStore *bs);
|
||||
|
||||
/* find the memory used by all states (expanded & real) */
|
||||
size_t BLI_array_store_calc_size_expanded_get(const BArrayStore *bs);
|
||||
size_t BLI_array_store_calc_size_compacted_get(const BArrayStore *bs);
|
||||
|
||||
BArrayState *BLI_array_store_state_add(BArrayStore *bs,
|
||||
const void *data,
|
||||
const size_t data_len,
|
||||
const BArrayState *state_reference);
|
||||
void BLI_array_store_state_remove(BArrayStore *bs, BArrayState *state);
|
||||
|
||||
size_t BLI_array_store_state_size_get(BArrayState *state);
|
||||
void BLI_array_store_state_data_get(BArrayState *state, void *data);
|
||||
void *BLI_array_store_state_data_get_alloc(BArrayState *state, size_t *r_data_len);
|
||||
|
||||
/* only for tests */
|
||||
bool BLI_array_store_is_valid(BArrayStore *bs);
|
||||
|
||||
#endif /* __BLI_ARRAY_STORE_H__ */
|
||||
43
extern/blendlib/BLI_array_store_utils.h
vendored
Normal file
43
extern/blendlib/BLI_array_store_utils.h
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARRAY_STORE_UTILS_H__
|
||||
#define __BLI_ARRAY_STORE_UTILS_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
struct BArrayStore;
|
||||
|
||||
struct BArrayStore_AtSize {
|
||||
struct BArrayStore **stride_table;
|
||||
int stride_table_len;
|
||||
};
|
||||
|
||||
BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride,
|
||||
const int stride,
|
||||
const int chunk_size);
|
||||
|
||||
BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, const int stride);
|
||||
|
||||
void BLI_array_store_at_size_clear(struct BArrayStore_AtSize *bs_stride);
|
||||
|
||||
void BLI_array_store_at_size_calc_memory_usage(struct BArrayStore_AtSize *bs_stride,
|
||||
size_t *r_size_expanded,
|
||||
size_t *r_size_compacted);
|
||||
|
||||
#endif /* __BLI_ARRAY_STORE_UTILS_H__ */
|
||||
88
extern/blendlib/BLI_array_utils.h
vendored
Normal file
88
extern/blendlib/BLI_array_utils.h
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ARRAY_UTILS_H__
|
||||
#define __BLI_ARRAY_UTILS_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief Generic array manipulation API.
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_typecheck.h"
|
||||
|
||||
void _bli_array_reverse(void *arr, unsigned int arr_len, size_t arr_stride);
|
||||
#define BLI_array_reverse(arr, arr_len) _bli_array_reverse(arr, arr_len, sizeof(*(arr)))
|
||||
|
||||
void _bli_array_wrap(void *arr, unsigned int arr_len, size_t arr_stride, int dir);
|
||||
#define BLI_array_wrap(arr, arr_len, dir) _bli_array_wrap(arr, arr_len, sizeof(*(arr)), dir)
|
||||
|
||||
void _bli_array_permute(void *arr,
|
||||
const unsigned int arr_len,
|
||||
const size_t arr_stride,
|
||||
const unsigned int *index,
|
||||
void *arr_temp);
|
||||
#define BLI_array_permute(arr, arr_len, order) \
|
||||
_bli_array_permute(arr, arr_len, sizeof(*(arr)), order, NULL)
|
||||
#define BLI_array_permute_ex(arr, arr_len, order, arr_temp) \
|
||||
_bli_array_permute(arr, arr_len, sizeof(*(arr)), order, arr_temp)
|
||||
|
||||
int _bli_array_findindex(const void *arr, unsigned int arr_len, size_t arr_stride, const void *p);
|
||||
#define BLI_array_findindex(arr, arr_len, p) _bli_array_findindex(arr, arr_len, sizeof(*(arr)), p)
|
||||
|
||||
int _bli_array_rfindindex(const void *arr, unsigned int arr_len, size_t arr_stride, const void *p);
|
||||
#define BLI_array_rfindindex(arr, arr_len, p) \
|
||||
_bli_array_rfindindex(arr, arr_len, sizeof(*(arr)), p)
|
||||
|
||||
void _bli_array_binary_and(
|
||||
void *arr, const void *arr_a, const void *arr_b, unsigned int arr_len, size_t arr_stride);
|
||||
#define BLI_array_binary_and(arr, arr_a, arr_b, arr_len) \
|
||||
(CHECK_TYPE_PAIR_INLINE(*(arr), *(arr_a)), \
|
||||
CHECK_TYPE_PAIR_INLINE(*(arr), *(arr_b)), \
|
||||
_bli_array_binary_and(arr, arr_a, arr_b, arr_len, sizeof(*(arr))))
|
||||
|
||||
void _bli_array_binary_or(
|
||||
void *arr, const void *arr_a, const void *arr_b, unsigned int arr_len, size_t arr_stride);
|
||||
#define BLI_array_binary_or(arr, arr_a, arr_b, arr_len) \
|
||||
(CHECK_TYPE_PAIR_INLINE(*(arr), *(arr_a)), \
|
||||
CHECK_TYPE_PAIR_INLINE(*(arr), *(arr_b)), \
|
||||
_bli_array_binary_or(arr, arr_a, arr_b, arr_len, sizeof(*(arr))))
|
||||
|
||||
bool _bli_array_iter_span(const void *arr,
|
||||
unsigned int arr_len,
|
||||
size_t arr_stride,
|
||||
bool use_wrap,
|
||||
bool use_delimit_bounds,
|
||||
bool (*test_fn)(const void *arr_item, void *user_data),
|
||||
void *user_data,
|
||||
unsigned int span_step[2],
|
||||
unsigned int *r_span_len);
|
||||
#define BLI_array_iter_span( \
|
||||
arr, arr_len, use_wrap, use_delimit_bounds, test_fn, user_data, span_step, r_span_len) \
|
||||
_bli_array_iter_span(arr, \
|
||||
arr_len, \
|
||||
sizeof(*(arr)), \
|
||||
use_wrap, \
|
||||
use_delimit_bounds, \
|
||||
test_fn, \
|
||||
user_data, \
|
||||
span_step, \
|
||||
r_span_len)
|
||||
|
||||
bool _bli_array_is_zeroed(const void *arr, unsigned int arr_len, size_t arr_stride);
|
||||
#define BLI_array_is_zeroed(arr, arr_len) _bli_array_is_zeroed(arr, arr_len, sizeof(*(arr)))
|
||||
|
||||
#endif /* __BLI_ARRAY_UTILS_H__ */
|
||||
115
extern/blendlib/BLI_assert.h
vendored
Normal file
115
extern/blendlib/BLI_assert.h
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ASSERT_H__
|
||||
#define __BLI_ASSERT_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* Defines:
|
||||
* - #BLI_assert
|
||||
* - #BLI_STATIC_ASSERT
|
||||
* - #BLI_STATIC_ASSERT_ALIGN
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG /* for BLI_assert */
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <crtdbg.h> /* for _STATIC_ASSERT */
|
||||
#endif
|
||||
|
||||
/* BLI_assert(), default only to print
|
||||
* for aborting need to define WITH_ASSERT_ABORT
|
||||
*/
|
||||
/* For 'abort' only. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
# include "BLI_system.h"
|
||||
/* _BLI_ASSERT_PRINT_POS */
|
||||
# if defined(__GNUC__)
|
||||
# define _BLI_ASSERT_PRINT_POS(a) \
|
||||
fprintf(stderr, \
|
||||
"BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
__func__, \
|
||||
#a)
|
||||
# elif defined(_MSC_VER)
|
||||
# define _BLI_ASSERT_PRINT_POS(a) \
|
||||
fprintf(stderr, \
|
||||
"BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
__FUNCTION__, \
|
||||
#a)
|
||||
# else
|
||||
# define _BLI_ASSERT_PRINT_POS(a) \
|
||||
fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a)
|
||||
# endif
|
||||
/* _BLI_ASSERT_ABORT */
|
||||
# ifdef WITH_ASSERT_ABORT
|
||||
# define _BLI_ASSERT_ABORT abort
|
||||
# else
|
||||
# define _BLI_ASSERT_ABORT() (void)0
|
||||
# endif
|
||||
/* BLI_assert */
|
||||
# define BLI_assert(a) \
|
||||
(void)((!(a)) ? ((BLI_system_backtrace(stderr), \
|
||||
_BLI_ASSERT_PRINT_POS(a), \
|
||||
_BLI_ASSERT_ABORT(), \
|
||||
NULL)) : \
|
||||
NULL)
|
||||
#else
|
||||
# define BLI_assert(a) ((void)0)
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
/* C++11 */
|
||||
# define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg);
|
||||
#elif defined(_MSC_VER)
|
||||
/* Visual Studio */
|
||||
# if (_MSC_VER > 1910) && !defined(__clang__)
|
||||
# define BLI_STATIC_ASSERT(a, msg) static_assert(a, msg);
|
||||
# else
|
||||
# define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a);
|
||||
# endif
|
||||
#elif defined(__COVERITY__)
|
||||
/* Workaround error with coverity */
|
||||
# define BLI_STATIC_ASSERT(a, msg)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
/* C11 */
|
||||
# define BLI_STATIC_ASSERT(a, msg) _Static_assert(a, msg);
|
||||
#else
|
||||
/* Old unsupported compiler */
|
||||
# define BLI_STATIC_ASSERT(a, msg)
|
||||
#endif
|
||||
|
||||
#define BLI_STATIC_ASSERT_ALIGN(st, align) \
|
||||
BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned")
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_ASSERT_H__ */
|
||||
117
extern/blendlib/BLI_astar.h
vendored
Normal file
117
extern/blendlib/BLI_astar.h
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2014 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ASTAR_H__
|
||||
#define __BLI_ASTAR_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief An implementation of the A* (AStar) algorithm to solve shortest path problem.
|
||||
*/
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
typedef struct BLI_AStarGNLink {
|
||||
int nodes[2];
|
||||
float cost;
|
||||
|
||||
void *custom_data;
|
||||
} BLI_AStarGNLink;
|
||||
|
||||
typedef struct BLI_AStarGNode {
|
||||
struct ListBase neighbor_links;
|
||||
|
||||
void *custom_data;
|
||||
} BLI_AStarGNode;
|
||||
|
||||
typedef struct BLI_AStarSolution {
|
||||
/* Final 'most useful' data. */
|
||||
/** Number of steps (i.e. walked links) in path
|
||||
* (nodes num, including start and end, is steps + 1). */
|
||||
int steps;
|
||||
/** Store the path, in reversed order (from destination to source node), as indices. */
|
||||
int *prev_nodes;
|
||||
/** Indices are nodes' ones, as prev_nodes, but they map to relevant link. */
|
||||
BLI_AStarGNLink **prev_links;
|
||||
|
||||
void *custom_data;
|
||||
|
||||
/* Mostly runtime data. */
|
||||
BLI_bitmap *done_nodes;
|
||||
float *g_costs;
|
||||
int *g_steps;
|
||||
|
||||
struct MemArena *mem; /* Memory arena. */
|
||||
} BLI_AStarSolution;
|
||||
|
||||
typedef struct BLI_AStarGraph {
|
||||
int node_num;
|
||||
BLI_AStarGNode *nodes;
|
||||
|
||||
void *custom_data;
|
||||
|
||||
struct MemArena *mem; /* Memory arena. */
|
||||
} BLI_AStarGraph;
|
||||
|
||||
void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *custom_data);
|
||||
void BLI_astar_node_link_add(BLI_AStarGraph *as_graph,
|
||||
const int node1_index,
|
||||
const int node2_index,
|
||||
const float cost,
|
||||
void *custom_data);
|
||||
int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, const int idx);
|
||||
|
||||
void BLI_astar_solution_init(BLI_AStarGraph *as_graph,
|
||||
BLI_AStarSolution *as_solution,
|
||||
void *custom_data);
|
||||
void BLI_astar_solution_clear(BLI_AStarSolution *as_solution);
|
||||
void BLI_astar_solution_free(BLI_AStarSolution *as_solution);
|
||||
|
||||
/**
|
||||
* Callback computing the current cost (distance) to next node,
|
||||
* and the estimated overall cost to destination node
|
||||
* (A* expects this estimation to always be less or equal than actual shortest path
|
||||
* from next node to destination one).
|
||||
*
|
||||
* \param link: the graph link between current node and next one.
|
||||
* \param node_idx_curr: current node index.
|
||||
* \param node_idx_next: next node index.
|
||||
* \param node_idx_dst: destination node index.
|
||||
*/
|
||||
typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph,
|
||||
BLI_AStarSolution *as_solution,
|
||||
BLI_AStarGNLink *link,
|
||||
const int node_idx_curr,
|
||||
const int node_idx_next,
|
||||
const int node_idx_dst);
|
||||
|
||||
void BLI_astar_graph_init(BLI_AStarGraph *as_graph, const int node_num, void *custom_data);
|
||||
void BLI_astar_graph_free(BLI_AStarGraph *as_graph);
|
||||
bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph,
|
||||
const int node_index_src,
|
||||
const int node_index_dst,
|
||||
astar_f_cost f_cost_cb,
|
||||
BLI_AStarSolution *r_solution,
|
||||
const int max_steps);
|
||||
|
||||
#endif /* __BLI_ASTAR_H__ */
|
||||
112
extern/blendlib/BLI_bitmap.h
vendored
Normal file
112
extern/blendlib/BLI_bitmap.h
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_BITMAP_H__
|
||||
#define __BLI_BITMAP_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
typedef unsigned int BLI_bitmap;
|
||||
|
||||
/* warning: the bitmap does not keep track of its own size or check
|
||||
* for out-of-bounds access */
|
||||
|
||||
/* internal use */
|
||||
/* 2^5 = 32 (bits) */
|
||||
#define _BITMAP_POWER 5
|
||||
/* 0b11111 */
|
||||
#define _BITMAP_MASK 31
|
||||
|
||||
/* number of blocks needed to hold '_tot' bits */
|
||||
#define _BITMAP_NUM_BLOCKS(_tot) (((_tot) >> _BITMAP_POWER) + 1)
|
||||
|
||||
/* size (in bytes) used to hold '_tot' bits */
|
||||
#define BLI_BITMAP_SIZE(_tot) ((size_t)(_BITMAP_NUM_BLOCKS(_tot)) * sizeof(BLI_bitmap))
|
||||
|
||||
/* allocate memory for a bitmap with '_tot' bits; free with MEM_freeN() */
|
||||
#define BLI_BITMAP_NEW(_tot, _alloc_string) \
|
||||
((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_tot), _alloc_string))
|
||||
|
||||
/* allocate a bitmap on the stack */
|
||||
#define BLI_BITMAP_NEW_ALLOCA(_tot) \
|
||||
((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_tot)), 0, BLI_BITMAP_SIZE(_tot)))
|
||||
|
||||
/* Allocate using given MemArena */
|
||||
#define BLI_BITMAP_NEW_MEMARENA(_mem, _tot) \
|
||||
(CHECK_TYPE_INLINE(_mem, MemArena *), \
|
||||
((BLI_bitmap *)BLI_memarena_calloc(_mem, BLI_BITMAP_SIZE(_tot))))
|
||||
|
||||
/* get the value of a single bit at '_index' */
|
||||
#define BLI_BITMAP_TEST(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
((_bitmap)[(_index) >> _BITMAP_POWER] & (1u << ((_index)&_BITMAP_MASK))))
|
||||
|
||||
#define BLI_BITMAP_TEST_AND_SET_ATOMIC(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
(atomic_fetch_and_or_uint32((uint32_t *)&(_bitmap)[(_index) >> _BITMAP_POWER], \
|
||||
(1u << ((_index)&_BITMAP_MASK))) & \
|
||||
(1u << ((_index)&_BITMAP_MASK))))
|
||||
|
||||
#define BLI_BITMAP_TEST_BOOL(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
(BLI_BITMAP_TEST(_bitmap, _index) != 0))
|
||||
|
||||
/* set the value of a single bit at '_index' */
|
||||
#define BLI_BITMAP_ENABLE(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
((_bitmap)[(_index) >> _BITMAP_POWER] |= (1u << ((_index)&_BITMAP_MASK))))
|
||||
|
||||
/* clear the value of a single bit at '_index' */
|
||||
#define BLI_BITMAP_DISABLE(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
((_bitmap)[(_index) >> _BITMAP_POWER] &= ~(1u << ((_index)&_BITMAP_MASK))))
|
||||
|
||||
/* flip the value of a single bit at '_index' */
|
||||
#define BLI_BITMAP_FLIP(_bitmap, _index) \
|
||||
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
|
||||
((_bitmap)[(_index) >> _BITMAP_POWER] ^= (1u << ((_index)&_BITMAP_MASK))))
|
||||
|
||||
/* set or clear the value of a single bit at '_index' */
|
||||
#define BLI_BITMAP_SET(_bitmap, _index, _set) \
|
||||
{ \
|
||||
CHECK_TYPE(_bitmap, BLI_bitmap *); \
|
||||
if (_set) \
|
||||
BLI_BITMAP_ENABLE(_bitmap, _index); \
|
||||
else \
|
||||
BLI_BITMAP_DISABLE(_bitmap, _index); \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/* resize bitmap to have space for '_tot' bits */
|
||||
#define BLI_BITMAP_RESIZE(_bitmap, _tot) \
|
||||
{ \
|
||||
CHECK_TYPE(_bitmap, BLI_bitmap *); \
|
||||
(_bitmap) = MEM_reallocN(_bitmap, BLI_BITMAP_SIZE(_tot)); \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits);
|
||||
void BLI_bitmap_flip_all(BLI_bitmap *bitmap, size_t bits);
|
||||
void BLI_bitmap_copy_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
|
||||
void BLI_bitmap_and_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
|
||||
void BLI_bitmap_or_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
|
||||
|
||||
#endif
|
||||
44
extern/blendlib/BLI_bitmap_draw_2d.h
vendored
Normal file
44
extern/blendlib/BLI_bitmap_draw_2d.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_BITMAP_DRAW_2D_H__
|
||||
#define __BLI_BITMAP_DRAW_2D_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
void BLI_bitmap_draw_2d_line_v2v2i(const int p1[2],
|
||||
const int p2[2],
|
||||
bool (*callback)(int, int, void *),
|
||||
void *user_data);
|
||||
|
||||
void BLI_bitmap_draw_2d_tri_v2i(const int p1[2],
|
||||
const int p2[2],
|
||||
const int p3[2],
|
||||
void (*callback)(int x, int x_end, int y, void *),
|
||||
void *user_data);
|
||||
|
||||
void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin,
|
||||
const int ymin,
|
||||
const int xmax,
|
||||
const int ymax,
|
||||
const int verts[][2],
|
||||
const int verts_len,
|
||||
void (*callback)(int x, int x_end, int y, void *),
|
||||
void *user_data);
|
||||
|
||||
#endif /* __BLI_BITMAP_DRAW_2D_H__ */
|
||||
75
extern/blendlib/BLI_blenlib.h
vendored
Normal file
75
extern/blendlib/BLI_blenlib.h
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* \section aboutbli Blender LIbrary external interface
|
||||
*
|
||||
* \subsection about About the BLI module
|
||||
*
|
||||
* This is the external interface of the Blender Library. If you find
|
||||
* a call to a BLI function that is not prototyped here, please add a
|
||||
* prototype here. The library offers mathematical operations (mainly
|
||||
* vector and matrix calculus), an abstraction layer for file i/o,
|
||||
* functions for calculating Perlin noise, scanfilling services for
|
||||
* triangles, and a system for guarded memory
|
||||
* allocation/deallocation. There is also a patch to make MS Windows
|
||||
* behave more or less Posix-compliant.
|
||||
*
|
||||
* \subsection issues Known issues with BLI
|
||||
*
|
||||
* - blenlib is written in C.
|
||||
* - The posix-compliance may move to a separate lib that deals with
|
||||
* platform dependencies. (There are other platform-dependent
|
||||
* fixes as well.)
|
||||
* - The file i/o has some redundant code. It should be cleaned.
|
||||
*
|
||||
* \subsection dependencies Dependencies
|
||||
*
|
||||
* - The blenlib uses type defines from \ref DNA, and functions from
|
||||
* standard libraries.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_BLENLIB_H__
|
||||
#define __BLI_BLENLIB_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLI_string_utf8.h"
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
47
extern/blendlib/BLI_boxpack_2d.h
vendored
Normal file
47
extern/blendlib/BLI_boxpack_2d.h
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_BOXPACK_2D_H__
|
||||
#define __BLI_BOXPACK_2D_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
/* Box Packer */
|
||||
|
||||
typedef struct BoxPack {
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
|
||||
/* Verts this box uses
|
||||
* (BL,TR,TL,BR) / 0,1,2,3 */
|
||||
struct BoxVert *v[4];
|
||||
|
||||
int index;
|
||||
} BoxPack;
|
||||
|
||||
void BLI_box_pack_2d(BoxPack *boxarray,
|
||||
const unsigned int len,
|
||||
float *tot_width,
|
||||
float *tot_height);
|
||||
|
||||
#endif /* __BLI_BOXPACK_2D_H__ */
|
||||
96
extern/blendlib/BLI_buffer.h
vendored
Normal file
96
extern/blendlib/BLI_buffer.h
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_BUFFER_H__
|
||||
#define __BLI_BUFFER_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
typedef struct BLI_Buffer {
|
||||
void *data;
|
||||
const size_t elem_size;
|
||||
size_t count, alloc_count;
|
||||
int flag;
|
||||
} BLI_Buffer;
|
||||
|
||||
enum {
|
||||
BLI_BUFFER_NOP = 0,
|
||||
BLI_BUFFER_USE_STATIC = (1 << 0),
|
||||
};
|
||||
|
||||
#define BLI_buffer_declare_static(type_, name_, flag_, static_count_) \
|
||||
char name_##user; /* warn for free only */ \
|
||||
type_ name_##_static_[static_count_]; \
|
||||
BLI_Buffer name_ = { \
|
||||
(name_##_static_), sizeof(type_), 0, static_count_, BLI_BUFFER_USE_STATIC | (flag_)}
|
||||
|
||||
/* never use static*/
|
||||
#define BLI_buffer_declare(type_, name_, flag_) \
|
||||
bool name_##user; /* warn for free only */ \
|
||||
BLI_Buffer name_ = {NULL, sizeof(type_), 0, 0, (flag_)}
|
||||
|
||||
#define BLI_buffer_at(buffer_, type_, index_) \
|
||||
((((type_ *)(buffer_) \
|
||||
->data)[(BLI_assert(sizeof(type_) == (buffer_)->elem_size)), \
|
||||
(BLI_assert((int)(index_) >= 0 && (size_t)(index_) < (buffer_)->count)), \
|
||||
index_]))
|
||||
|
||||
#define BLI_buffer_array(buffer_, type_) (&(BLI_buffer_at(buffer_, type_, 0)))
|
||||
|
||||
#define BLI_buffer_resize_data(buffer_, type_, new_count_) \
|
||||
((BLI_buffer_resize(buffer_, new_count_), new_count_ ? BLI_buffer_array(buffer_, type_) : NULL))
|
||||
|
||||
#define BLI_buffer_reinit_data(buffer_, type_, new_count_) \
|
||||
((BLI_buffer_reinit(buffer_, new_count_), new_count_ ? BLI_buffer_array(buffer_, type_) : NULL))
|
||||
|
||||
#define BLI_buffer_append(buffer_, type_, val_) \
|
||||
(BLI_buffer_resize(buffer_, (buffer_)->count + 1), \
|
||||
(BLI_buffer_at(buffer_, type_, (buffer_)->count - 1) = val_))
|
||||
|
||||
#define BLI_buffer_clear(buffer_) \
|
||||
{ \
|
||||
(buffer_)->count = 0; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/* Never decreases the amount of memory allocated */
|
||||
void BLI_buffer_resize(BLI_Buffer *buffer, const size_t new_count);
|
||||
|
||||
/* Ensure size, throwing away old data, respecting BLI_BUFFER_USE_CALLOC */
|
||||
void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t new_count);
|
||||
|
||||
/* Does not free the buffer structure itself */
|
||||
void _bli_buffer_free(BLI_Buffer *buffer);
|
||||
#define BLI_buffer_free(name_) \
|
||||
{ \
|
||||
_bli_buffer_free(name_); \
|
||||
(void)name_##user; /* ensure we free */ \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/* A buffer embedded in a struct. Using memcpy is allowed until first resize. */
|
||||
#define BLI_buffer_field_init(name_, type_) \
|
||||
{ \
|
||||
memset(name_, 0, sizeof(*name_)); \
|
||||
*(size_t *)&((name_)->elem_size) = sizeof(type_); \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
#define BLI_buffer_field_free(name_) _bli_buffer_free(name_)
|
||||
|
||||
#endif /* __BLI_BUFFER_H__ */
|
||||
103
extern/blendlib/BLI_compiler_attrs.h
vendored
Normal file
103
extern/blendlib/BLI_compiler_attrs.h
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2013 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_COMPILER_ATTRS_H__
|
||||
#define __BLI_COMPILER_ATTRS_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
/* hint to make sure function result is actually used */
|
||||
#ifdef __GNUC__
|
||||
# define ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
# define ATTR_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
/* hint to mark function arguments expected to be non-null
|
||||
* if no arguments are given to the macro, all of pointer
|
||||
* arguments would be expected to be non-null
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define ATTR_NONNULL(args...) __attribute__((nonnull(args)))
|
||||
#else
|
||||
# define ATTR_NONNULL(...)
|
||||
#endif
|
||||
|
||||
/* never returns NULL */
|
||||
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 /* gcc4.9+ only */
|
||||
# define ATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
|
||||
#else
|
||||
# define ATTR_RETURNS_NONNULL
|
||||
#endif
|
||||
|
||||
/* hint to mark function as it wouldn't return */
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define ATTR_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
# define ATTR_NORETURN
|
||||
#endif
|
||||
|
||||
/* hint to treat any non-null function return value cannot alias any other pointer */
|
||||
#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403))
|
||||
# define ATTR_MALLOC __attribute__((malloc))
|
||||
#else
|
||||
# define ATTR_MALLOC
|
||||
#endif
|
||||
|
||||
/* the function return value points to memory (2 args for 'size * tot') */
|
||||
#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403))
|
||||
# define ATTR_ALLOC_SIZE(args...) __attribute__((alloc_size(args)))
|
||||
#else
|
||||
# define ATTR_ALLOC_SIZE(...)
|
||||
#endif
|
||||
|
||||
/* ensures a NULL terminating argument as the n'th last argument of a variadic function */
|
||||
#ifdef __GNUC__
|
||||
# define ATTR_SENTINEL(arg_pos) __attribute__((sentinel(arg_pos)))
|
||||
#else
|
||||
# define ATTR_SENTINEL(arg_pos)
|
||||
#endif
|
||||
|
||||
/* hint to compiler that function uses printf-style format string */
|
||||
#ifdef __GNUC__
|
||||
# define ATTR_PRINTF_FORMAT(format_param, dots_param) \
|
||||
__attribute__((format(printf, format_param, dots_param)))
|
||||
#else
|
||||
# define ATTR_PRINTF_FORMAT(format_param, dots_param)
|
||||
#endif
|
||||
|
||||
/* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */
|
||||
#ifndef ATTR_FALLTHROUGH
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */
|
||||
# define ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||
# else
|
||||
# define ATTR_FALLTHROUGH ((void)0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Declare the memory alignment in Bytes. */
|
||||
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||
# define ATTR_ALIGN(x) __declspec(align(x))
|
||||
#else
|
||||
# define ATTR_ALIGN(x) __attribute__((aligned(x)))
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_COMPILER_ATTRS_H__ */
|
||||
54
extern/blendlib/BLI_compiler_compat.h
vendored
Normal file
54
extern/blendlib/BLI_compiler_compat.h
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_COMPILER_COMPAT_H__
|
||||
#define __BLI_COMPILER_COMPAT_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* Use to help with cross platform portability.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define alloca _alloca
|
||||
#endif
|
||||
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && defined(__cplusplus)
|
||||
extern "C++" {
|
||||
/* Some magic to be sure we don't have reference in the type. */
|
||||
template<typename T> static inline T decltype_helper(T x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
# define typeof(x) decltype(decltype_helper(x))
|
||||
}
|
||||
#endif
|
||||
|
||||
/* little macro so inline keyword works */
|
||||
#if defined(_MSC_VER)
|
||||
# define BLI_INLINE static __forceinline
|
||||
#else
|
||||
# define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define BLI_NOINLINE __attribute__((noinline))
|
||||
#else
|
||||
# define BLI_NOINLINE
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_COMPILER_COMPAT_H__ */
|
||||
694
extern/blendlib/BLI_compiler_typecheck.h
vendored
Normal file
694
extern/blendlib/BLI_compiler_typecheck.h
vendored
Normal file
|
|
@ -0,0 +1,694 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_COMPILER_TYPECHECK_H__
|
||||
#define __BLI_COMPILER_TYPECHECK_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* Type checking macros (often used to ensure valid use of macro args).
|
||||
* These depend on compiler extensions and c11 in some cases.
|
||||
*/
|
||||
|
||||
/* Causes warning:
|
||||
* incompatible types when assigning to type 'Foo' from type 'Bar'
|
||||
* ... the compiler optimizes away the temp var */
|
||||
#ifdef __GNUC__
|
||||
# define CHECK_TYPE(var, type) \
|
||||
{ \
|
||||
typeof(var) *__tmp; \
|
||||
__tmp = (type *)NULL; \
|
||||
(void)__tmp; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
# define CHECK_TYPE_PAIR(var_a, var_b) \
|
||||
{ \
|
||||
const typeof(var_a) *__tmp; \
|
||||
__tmp = (typeof(var_b) *)NULL; \
|
||||
(void)__tmp; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
# define CHECK_TYPE_PAIR_INLINE(var_a, var_b) \
|
||||
((void)({ \
|
||||
const typeof(var_a) *__tmp; \
|
||||
__tmp = (typeof(var_b) *)NULL; \
|
||||
(void)__tmp; \
|
||||
}))
|
||||
|
||||
#else
|
||||
# define CHECK_TYPE(var, type) \
|
||||
{ \
|
||||
EXPR_NOP(var); \
|
||||
} \
|
||||
(void)0
|
||||
# define CHECK_TYPE_PAIR(var_a, var_b) \
|
||||
{ \
|
||||
(EXPR_NOP(var_a), EXPR_NOP(var_b)); \
|
||||
} \
|
||||
(void)0
|
||||
# define CHECK_TYPE_PAIR_INLINE(var_a, var_b) (EXPR_NOP(var_a), EXPR_NOP(var_b))
|
||||
#endif
|
||||
|
||||
/* can be used in simple macros */
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
# define CHECK_TYPE_INLINE(val, type) \
|
||||
(void)((void)(((type)0) != (0 ? (val) : ((type)0))), _Generic((val), type : 0, const type : 0))
|
||||
#else
|
||||
# define CHECK_TYPE_INLINE(val, type) ((void)(((type)0) != (0 ? (val) : ((type)0))))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define CHECK_TYPE_NONCONST(var) \
|
||||
__extension__({ \
|
||||
void *non_const = 0 ? (var) : NULL; \
|
||||
(void)non_const; \
|
||||
})
|
||||
#else
|
||||
# define CHECK_TYPE_NONCONST(var) EXPR_NOP(var)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* CHECK_TYPE_ANY: handy macro, eg:
|
||||
* ``CHECK_TYPE_ANY(var, Foo *, Bar *, Baz *)``
|
||||
*
|
||||
* excuse ridiculously long generated args.
|
||||
* \code{.py}
|
||||
* for i in range(63):
|
||||
* args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)]
|
||||
* print("#define _VA_CHECK_TYPE_ANY%d(v, %s) \\" % (i + 2, ", ".join(args)))
|
||||
* print(" ((void)_Generic((v), %s))" % (": 0, ".join(args) + ": 0"))
|
||||
* \endcode
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
/* Over wrapped args. */
|
||||
/* clang-format off */
|
||||
#define _VA_CHECK_TYPE_ANY2(v, a0) \
|
||||
((void)_Generic((v), a0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY3(v, a0, b0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY4(v, a0, b0, c0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY5(v, a0, b0, c0, d0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY6(v, a0, b0, c0, d0, e0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY7(v, a0, b0, c0, d0, e0, f0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY8(v, a0, b0, c0, d0, e0, f0, g0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY9(v, a0, b0, c0, d0, e0, f0, g0, h0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY10(v, a0, b0, c0, d0, e0, f0, g0, h0, i0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY11(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY12(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY13(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY14(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY15(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY16(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY17(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY18(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY19(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY20(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY21(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY22(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY23(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY24(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY25(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY26(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY27(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0))
|
||||
#define _VA_CHECK_TYPE_ANY28(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY29(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY30(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY31(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY32(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY33(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY34(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY35(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY36(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY37(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY38(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY39(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY40(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY41(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY42(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY43(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY44(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY45(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY46(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY47(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY48(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY49(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY50(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY51(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY52(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY53(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0))
|
||||
#define _VA_CHECK_TYPE_ANY54(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY55(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY56(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY57(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY58(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY59(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY60(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY61(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY62(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY63(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \
|
||||
j2: 0))
|
||||
#define _VA_CHECK_TYPE_ANY64(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \
|
||||
v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \
|
||||
x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \
|
||||
((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \
|
||||
n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \
|
||||
d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \
|
||||
t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \
|
||||
j2: 0, k2: 0))
|
||||
# define CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__)
|
||||
/* clang-format on */
|
||||
#else
|
||||
# define CHECK_TYPE_ANY(...) (void)0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GENERIC_TYPE_ANY: handy macro to reuse a single expression for multiple types, eg:
|
||||
*
|
||||
* \code{.c}
|
||||
* _Generic(value,
|
||||
* GENERIC_TYPE_ANY(result_a, Foo *, Bar *, Baz *),
|
||||
* GENERIC_TYPE_ANY(result_b, Spam *, Spaz *, Spot *),
|
||||
* )
|
||||
* \endcode
|
||||
*
|
||||
* excuse ridiculously long generated args.
|
||||
* \code{.py}
|
||||
* for i in range(63):
|
||||
* args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)]
|
||||
* print("#define _VA_GENERIC_TYPE_ANY%d(r, %s) \\" % (i + 2, ", ".join(args)))
|
||||
* print(" %s: r " % (": r, ".join(args)))
|
||||
* \endcode
|
||||
*/
|
||||
/* Over wrapped args. */
|
||||
/* clang-format off */
|
||||
#define _VA_GENERIC_TYPE_ANY2(r, a0) \
|
||||
a0: r
|
||||
#define _VA_GENERIC_TYPE_ANY3(r, a0, b0) \
|
||||
a0: r, b0: r
|
||||
#define _VA_GENERIC_TYPE_ANY4(r, a0, b0, c0) \
|
||||
a0: r, b0: r, c0: r
|
||||
#define _VA_GENERIC_TYPE_ANY5(r, a0, b0, c0, d0) \
|
||||
a0: r, b0: r, c0: r, d0: r
|
||||
#define _VA_GENERIC_TYPE_ANY6(r, a0, b0, c0, d0, e0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r
|
||||
#define _VA_GENERIC_TYPE_ANY7(r, a0, b0, c0, d0, e0, f0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r
|
||||
#define _VA_GENERIC_TYPE_ANY8(r, a0, b0, c0, d0, e0, f0, g0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r
|
||||
#define _VA_GENERIC_TYPE_ANY9(r, a0, b0, c0, d0, e0, f0, g0, h0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r
|
||||
#define _VA_GENERIC_TYPE_ANY10(r, a0, b0, c0, d0, e0, f0, g0, h0, i0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r
|
||||
#define _VA_GENERIC_TYPE_ANY11(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r
|
||||
#define _VA_GENERIC_TYPE_ANY12(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r
|
||||
#define _VA_GENERIC_TYPE_ANY13(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r
|
||||
#define _VA_GENERIC_TYPE_ANY14(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r
|
||||
#define _VA_GENERIC_TYPE_ANY15(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r
|
||||
#define _VA_GENERIC_TYPE_ANY16(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r
|
||||
#define _VA_GENERIC_TYPE_ANY17(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r
|
||||
#define _VA_GENERIC_TYPE_ANY18(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r
|
||||
#define _VA_GENERIC_TYPE_ANY19(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r
|
||||
#define _VA_GENERIC_TYPE_ANY20(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r
|
||||
#define _VA_GENERIC_TYPE_ANY21(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r
|
||||
#define _VA_GENERIC_TYPE_ANY22(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r
|
||||
#define _VA_GENERIC_TYPE_ANY23(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r
|
||||
#define _VA_GENERIC_TYPE_ANY24(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r
|
||||
#define _VA_GENERIC_TYPE_ANY25(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r
|
||||
#define _VA_GENERIC_TYPE_ANY26(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r
|
||||
#define _VA_GENERIC_TYPE_ANY27(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r
|
||||
#define _VA_GENERIC_TYPE_ANY28(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r
|
||||
#define _VA_GENERIC_TYPE_ANY29(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r
|
||||
#define _VA_GENERIC_TYPE_ANY30(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r
|
||||
#define _VA_GENERIC_TYPE_ANY31(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r
|
||||
#define _VA_GENERIC_TYPE_ANY32(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r
|
||||
#define _VA_GENERIC_TYPE_ANY33(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r
|
||||
#define _VA_GENERIC_TYPE_ANY34(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r
|
||||
#define _VA_GENERIC_TYPE_ANY35(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r
|
||||
#define _VA_GENERIC_TYPE_ANY36(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r
|
||||
#define _VA_GENERIC_TYPE_ANY37(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r
|
||||
#define _VA_GENERIC_TYPE_ANY38(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r
|
||||
#define _VA_GENERIC_TYPE_ANY39(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r
|
||||
#define _VA_GENERIC_TYPE_ANY40(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r
|
||||
#define _VA_GENERIC_TYPE_ANY41(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r
|
||||
#define _VA_GENERIC_TYPE_ANY42(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r
|
||||
#define _VA_GENERIC_TYPE_ANY43(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r
|
||||
#define _VA_GENERIC_TYPE_ANY44(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r
|
||||
#define _VA_GENERIC_TYPE_ANY45(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r
|
||||
#define _VA_GENERIC_TYPE_ANY46(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r
|
||||
#define _VA_GENERIC_TYPE_ANY47(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r
|
||||
#define _VA_GENERIC_TYPE_ANY48(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r
|
||||
#define _VA_GENERIC_TYPE_ANY49(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r
|
||||
#define _VA_GENERIC_TYPE_ANY50(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r
|
||||
#define _VA_GENERIC_TYPE_ANY51(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r
|
||||
#define _VA_GENERIC_TYPE_ANY52(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r
|
||||
#define _VA_GENERIC_TYPE_ANY53(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r
|
||||
#define _VA_GENERIC_TYPE_ANY54(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r
|
||||
#define _VA_GENERIC_TYPE_ANY55(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r
|
||||
#define _VA_GENERIC_TYPE_ANY56(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r
|
||||
#define _VA_GENERIC_TYPE_ANY57(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r
|
||||
#define _VA_GENERIC_TYPE_ANY58(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r
|
||||
#define _VA_GENERIC_TYPE_ANY59(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r
|
||||
#define _VA_GENERIC_TYPE_ANY60(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r
|
||||
#define _VA_GENERIC_TYPE_ANY61(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r
|
||||
#define _VA_GENERIC_TYPE_ANY62(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r
|
||||
#define _VA_GENERIC_TYPE_ANY63(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r
|
||||
#define _VA_GENERIC_TYPE_ANY64(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
|
||||
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
|
||||
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \
|
||||
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
|
||||
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
|
||||
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
|
||||
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r, k2: r
|
||||
/* clang-format on */
|
||||
|
||||
#define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__)
|
||||
|
||||
#endif /* __BLI_COMPILER_TYPECHECK_H__ */
|
||||
44
extern/blendlib/BLI_console.h
vendored
Normal file
44
extern/blendlib/BLI_console.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2018 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_CONSOLE_H__
|
||||
#define __BLI_CONSOLE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief Set of utility functions and constants to work with consoles.
|
||||
*/
|
||||
|
||||
/* Format string where one could BLI_snprintf() R, G and B values
|
||||
* and get proper marker to start colored output in the console.
|
||||
*/
|
||||
#define TRUECOLOR_ANSI_COLOR_FORMAT "\x1b[38;2;%d;%d;%dm"
|
||||
|
||||
/* Marker which indicates that colored output is finished. */
|
||||
#define TRUECOLOR_ANSI_COLOR_FINISH "\x1b[0m"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_CONSOLE_H__ */
|
||||
30
extern/blendlib/BLI_convexhull_2d.h
vendored
Normal file
30
extern/blendlib/BLI_convexhull_2d.h
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_CONVEXHULL_2D_H__
|
||||
#define __BLI_CONVEXHULL_2D_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]);
|
||||
int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]);
|
||||
|
||||
float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], unsigned int n);
|
||||
float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n);
|
||||
|
||||
#endif /* __BLI_CONVEXHULL_2D_H__ */
|
||||
199
extern/blendlib/BLI_delaunay_2d.h
vendored
Normal file
199
extern/blendlib/BLI_delaunay_2d.h
vendored
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_DELAUNAY_2D_H__
|
||||
#define __BLI_DELAUNAY_2D_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for Constrained Delaunay Triangulation (CDT) in 2D.
|
||||
*
|
||||
* The input is a set of vertices, edges between those vertices,
|
||||
* and faces using those vertices.
|
||||
* Those inputs are called "constraints". The output must contain
|
||||
* those constraints, or at least edges, points, and vertices that
|
||||
* may be pieced together to form the constraints. Part of the
|
||||
* work of doing the CDT is to detect intersections and mergers
|
||||
* among the input elements, so these routines are also useful
|
||||
* for doing 2D intersection.
|
||||
*
|
||||
* The output is a triangulation of the plane that includes the
|
||||
* constraints in the above sense, and also satisfies the
|
||||
* "Delaunay condition" as modified to take into account that
|
||||
* the constraints must be there: for every non-constrained edge
|
||||
* in the output, there is a circle through the endpoints that
|
||||
* does not contain any of the vertices directly connected to
|
||||
* those endpoints. What this means in practice is that as
|
||||
* much as possible the triangles look "nice" -- not too long
|
||||
* and skinny.
|
||||
*
|
||||
* Optionally, the output can be a subset of the triangulation
|
||||
* (but still containing all of the constraints), to get the
|
||||
* effect of 2D intersection.
|
||||
*
|
||||
* The underlying method is incremental, but we need to know
|
||||
* beforehand a bounding box for all of the constraints.
|
||||
* This code can be extended in the future to allow for
|
||||
* deletion of constraints, if there is a use in Blender
|
||||
* for dynamically maintaining a triangulation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Input to Constrained Delaunay Triangulation.
|
||||
* There are verts_len vertices, whose coordinates
|
||||
* are given by vert_coords. For the rest of the input,
|
||||
* vertices are referred to by indices into that array.
|
||||
* Edges and Faces are optional. If provided, they will
|
||||
* appear in the output triangulation ("constraints").
|
||||
* One can provide faces and not edges -- the edges
|
||||
* implied by the faces will be inferred.
|
||||
*
|
||||
* The edges are given by pairs of vertex indices.
|
||||
* The faces are given in a triple `(faces, faces_start_table, faces_len_table)`
|
||||
* to represent a list-of-lists as follows:
|
||||
* the vertex indices for a counterclockwise traversal of
|
||||
* face number `i` starts at `faces_start_table[i]` and has `faces_len_table[i]`
|
||||
* elements.
|
||||
*
|
||||
* The edges implied by the faces are automatically added
|
||||
* and need not be put in the edges array, which is intended
|
||||
* as a way to specify edges that are not part of any face.
|
||||
*
|
||||
* Some notes about some special cases and how they are handled:
|
||||
* - Input faces can have any number of vertices greater than 2. Depending
|
||||
* on the output option, ngons may be triangulated or they may remain
|
||||
* as ngons.
|
||||
* - Input faces may have repeated vertices. Output faces will not,
|
||||
* except when the CDT_CONSTRAINTS output option is used.
|
||||
* - Input faces may have edges that self-intersect, but currently the labeling
|
||||
* of which output faces have which input faces may not be done correctly,
|
||||
* since the labeling relies on the inside being on the left of edges
|
||||
* as one traverses the face. Output faces will not self-intersect.
|
||||
* - Input edges, including those implied by the input faces, may have
|
||||
* zero-length or near-zero-length edges (nearness as determined by epsilon),
|
||||
* but those edges will not be in the output.
|
||||
* - Input edges (including face edges) can overlap or nearly overlap each other.
|
||||
* The output edges will not overlap, but instead be divided into as many
|
||||
* edges as necessary to represent each overlap regime.
|
||||
* - Input vertices may be coincide with, or nearly coincide with (as determined
|
||||
* by epsilon) other input vertices. Only one representative will survive
|
||||
* in the output. If an input vertex is within epsilon of an edge (including
|
||||
* an added triangulation edge), it will be snapped to that edge, so the
|
||||
* output coordinates may not exactly match the input coordinates in all cases.
|
||||
* - Wire edges (those not part of faces) and isolated vertices are allowed in
|
||||
* the input. If they are inside faces, they will be incorporated into the
|
||||
* triangulation of those faces.
|
||||
*
|
||||
* Epsilon is used for "is it near enough" distance calculations.
|
||||
* If zero is supplied for epsilon, an internal value of 1e-8 used
|
||||
* instead, since this code will not work correctly if it is not allowed
|
||||
* to merge "too near" vertices.
|
||||
*/
|
||||
typedef struct CDT_input {
|
||||
int verts_len;
|
||||
int edges_len;
|
||||
int faces_len;
|
||||
float (*vert_coords)[2];
|
||||
int (*edges)[2];
|
||||
int *faces;
|
||||
int *faces_start_table;
|
||||
int *faces_len_table;
|
||||
float epsilon;
|
||||
} CDT_input;
|
||||
|
||||
/**
|
||||
* A representation of the triangulation for output.
|
||||
* See #CDT_input for the representation of the output
|
||||
* vertices, edges, and faces, all represented in
|
||||
* a similar way to the input.
|
||||
*
|
||||
* The output may have merged some input vertices together,
|
||||
* if they were closer than some epsilon distance.
|
||||
* The output edges may be overlapping sub-segments of some
|
||||
* input edges; or they may be new edges for the triangulation.
|
||||
* The output faces may be pieces of some input faces, or they
|
||||
* may be new.
|
||||
*
|
||||
* In the same way that faces lists-of-lists were represented by
|
||||
* a run-together array and a "start" and "len" extra array,
|
||||
* similar triples are used to represent the output to input
|
||||
* mapping of vertices, edges, and faces.
|
||||
*
|
||||
* Those triples are:
|
||||
* - verts_orig, verts_orig_start_table, verts_orig_len_table
|
||||
* - edges_orig, edges_orig_start_table, edges_orig_len_table
|
||||
* - faces_orig, faces_orig_start_table, faces_orig_len_table
|
||||
*
|
||||
* For edges, the edges_orig triple can also say which original face
|
||||
* edge is part of a given output edge. If an index in edges_orig
|
||||
* is greater than the input's edges_len, then subtract input's edges_len
|
||||
* from it to some number i: then the face edge that starts from the
|
||||
* input vertex at input's faces[i] is the corresponding face edge.
|
||||
* for convenience, face_edge_offset in the result will be the input's
|
||||
* edges_len, so that this conversion can be easily done by the caller.
|
||||
*/
|
||||
typedef struct CDT_result {
|
||||
int verts_len;
|
||||
int edges_len;
|
||||
int faces_len;
|
||||
int face_edge_offset;
|
||||
float (*vert_coords)[2];
|
||||
int (*edges)[2];
|
||||
int *faces;
|
||||
int *faces_start_table;
|
||||
int *faces_len_table;
|
||||
int *verts_orig;
|
||||
int *verts_orig_start_table;
|
||||
int *verts_orig_len_table;
|
||||
int *edges_orig;
|
||||
int *edges_orig_start_table;
|
||||
int *edges_orig_len_table;
|
||||
int *faces_orig;
|
||||
int *faces_orig_start_table;
|
||||
int *faces_orig_len_table;
|
||||
} CDT_result;
|
||||
|
||||
/** What triangles and edges of CDT are desired when getting output? */
|
||||
typedef enum CDT_output_type {
|
||||
/** All triangles, outer boundary is convex hull. */
|
||||
CDT_FULL,
|
||||
/** All triangles fully enclosed by constraint edges or faces. */
|
||||
CDT_INSIDE,
|
||||
/** Only point, edge, and face constraints, and their intersections. */
|
||||
CDT_CONSTRAINTS,
|
||||
/**
|
||||
* Like CDT_CONSTRAINTS, but keep enough
|
||||
* edges so that any output faces that came from input faces can be made as valid
|
||||
* #BMesh faces in Blender: that is,
|
||||
* no vertex appears more than once and no isolated holes in faces.
|
||||
*/
|
||||
CDT_CONSTRAINTS_VALID_BMESH
|
||||
} CDT_output_type;
|
||||
|
||||
/**
|
||||
* API interface to CDT.
|
||||
* This returns a pointer to an allocated CDT_result.
|
||||
* When the caller is finished with it, the caller
|
||||
* should use #BLI_delaunay_2d_cdt_free() to free it.
|
||||
*/
|
||||
CDT_result *BLI_delaunay_2d_cdt_calc(const CDT_input *input, const CDT_output_type output_type);
|
||||
|
||||
void BLI_delaunay_2d_cdt_free(CDT_result *result);
|
||||
|
||||
#endif /* __BLI_DELAUNAY_2D_H__ */
|
||||
55
extern/blendlib/BLI_dial_2d.h
vendored
Normal file
55
extern/blendlib/BLI_dial_2d.h
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_DIAL_2D_H__
|
||||
#define __BLI_DIAL_2D_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*
|
||||
* \note dials act similar to old rotation based phones and output an angle.
|
||||
*
|
||||
* They just are initialized with the center of the dial and a threshold value as input.
|
||||
*
|
||||
* When the distance of the current position of the dial from the center
|
||||
* exceeds the threshold, this position is used to calculate the initial direction.
|
||||
* After that, the angle from the initial direction is calculated based on
|
||||
* current and previous directions of the digit, and returned to the user.
|
||||
*
|
||||
* Usage examples:
|
||||
*
|
||||
* \code{.c}
|
||||
* float start_position[2] = {0.0f, 0.0f};
|
||||
* float current_position[2];
|
||||
* float threshold = 0.5f;
|
||||
* float angle;
|
||||
* Dial *dial;
|
||||
*
|
||||
* dial = BLI_dial_initialize(start_position, threshold);
|
||||
*
|
||||
* angle = BLI_dial_angle(dial, current_position);
|
||||
*
|
||||
* MEM_freeN(dial);
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
typedef struct Dial Dial;
|
||||
|
||||
Dial *BLI_dial_initialize(const float start_position[2], float threshold);
|
||||
|
||||
float BLI_dial_angle(Dial *dial, const float current_position[2]);
|
||||
|
||||
#endif /* __BLI_DIAL_2D_H__ */
|
||||
162
extern/blendlib/BLI_dlrbTree.h
vendored
Normal file
162
extern/blendlib/BLI_dlrbTree.h
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_DLRBTREE_H__
|
||||
#define __BLI_DLRBTREE_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
/* Double-Linked Red-Black Tree Implementation:
|
||||
*
|
||||
* This is simply a Red-Black Tree implementation whose nodes can later
|
||||
* be arranged + retrieved as elements in a Double-Linked list (i.e. ListBase).
|
||||
* The Red-Black Tree implementation is based on the methods defined by Wikipedia.
|
||||
*/
|
||||
|
||||
/* ********************************************** */
|
||||
/* Data Types and Type Defines */
|
||||
|
||||
/* Base Structs --------------------------------- */
|
||||
|
||||
/* Basic Layout for a Node */
|
||||
typedef struct DLRBT_Node {
|
||||
/* ListBase capabilities */
|
||||
struct DLRBT_Node *next, *prev;
|
||||
|
||||
/* Tree Associativity settings */
|
||||
struct DLRBT_Node *left, *right;
|
||||
struct DLRBT_Node *parent;
|
||||
|
||||
char tree_col;
|
||||
/* ... for nice alignment, next item should usually be a char too... */
|
||||
} DLRBT_Node;
|
||||
|
||||
/* Red/Black defines for tree_col */
|
||||
typedef enum eDLRBT_Colors {
|
||||
DLRBT_BLACK = 0,
|
||||
DLRBT_RED,
|
||||
} eDLRBT_Colors;
|
||||
|
||||
/* -------- */
|
||||
|
||||
/* The Tree Data */
|
||||
typedef struct DLRBT_Tree {
|
||||
/* ListBase capabilities */
|
||||
void *first, *last; /* these should be based on DLRBT_Node-s */
|
||||
|
||||
/* Root Node */
|
||||
void *root; /* this should be based on DLRBT_Node-s */
|
||||
} DLRBT_Tree;
|
||||
|
||||
/* Callback Types --------------------------------- */
|
||||
|
||||
/* Return -1, 0, 1 for whether the given data is less than,
|
||||
* equal to, or greater than the given node.
|
||||
* - node: <DLRBT_Node> the node to compare to
|
||||
* - data: pointer to the relevant data or values stored in the bitpattern
|
||||
* dependent on the function.
|
||||
*/
|
||||
typedef short (*DLRBT_Comparator_FP)(void *node, void *data);
|
||||
|
||||
/* Return a new node instance wrapping the given data
|
||||
* - data: Pointer to the relevant data to create a subclass of node from
|
||||
*/
|
||||
typedef DLRBT_Node *(*DLRBT_NAlloc_FP)(void *data);
|
||||
|
||||
/* Update an existing node instance accordingly to be in sync with the given data *
|
||||
* - node: <DLRBT_Node> the node to update.
|
||||
* - data: Pointer to the relevant data or values stored in the bitpattern
|
||||
* dependent on the function.
|
||||
*/
|
||||
typedef void (*DLRBT_NUpdate_FP)(void *node, void *data);
|
||||
|
||||
/* ********************************************** */
|
||||
/* Public API */
|
||||
|
||||
/* ADT Management ------------------------------- */
|
||||
|
||||
/* Create a new tree, and initialize as necessary */
|
||||
DLRBT_Tree *BLI_dlrbTree_new(void);
|
||||
|
||||
/* Initializes some given trees */
|
||||
void BLI_dlrbTree_init(DLRBT_Tree *tree);
|
||||
|
||||
/* Free some tree */
|
||||
void BLI_dlrbTree_free(DLRBT_Tree *tree);
|
||||
|
||||
/* Make sure the tree's Double-Linked list representation is valid */
|
||||
void BLI_dlrbTree_linkedlist_sync(DLRBT_Tree *tree);
|
||||
|
||||
/* Searching ------------------------------------ */
|
||||
|
||||
/* Find the node which matches or is the closest to the requested node */
|
||||
DLRBT_Node *BLI_dlrbTree_search(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data);
|
||||
|
||||
/* Find the node which exactly matches the required data */
|
||||
DLRBT_Node *BLI_dlrbTree_search_exact(DLRBT_Tree *tree,
|
||||
DLRBT_Comparator_FP cmp_cb,
|
||||
void *search_data);
|
||||
|
||||
/* Find the node which occurs immediately before the best matching node */
|
||||
DLRBT_Node *BLI_dlrbTree_search_prev(DLRBT_Tree *tree,
|
||||
DLRBT_Comparator_FP cmp_cb,
|
||||
void *search_data);
|
||||
|
||||
/* Find the node which occurs immediately after the best matching node */
|
||||
DLRBT_Node *BLI_dlrbTree_search_next(DLRBT_Tree *tree,
|
||||
DLRBT_Comparator_FP cmp_cb,
|
||||
void *search_data);
|
||||
|
||||
/* Check whether there is a node matching the requested node */
|
||||
short BLI_dlrbTree_contains(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data);
|
||||
|
||||
/* Node Operations (Managed) --------------------- */
|
||||
/* These methods automate the process of adding/removing nodes from the BST,
|
||||
* using the supplied data and callbacks
|
||||
*/
|
||||
|
||||
/* Add the given data to the tree, and return the node added */
|
||||
// NOTE: for duplicates, the update_cb is called (if available), and the existing node is returned
|
||||
DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree,
|
||||
DLRBT_Comparator_FP cmp_cb,
|
||||
DLRBT_NAlloc_FP new_cb,
|
||||
DLRBT_NUpdate_FP update_cb,
|
||||
void *data);
|
||||
|
||||
/* Remove the given element from the tree and balance again */
|
||||
// FIXME: this is not implemented yet...
|
||||
// void BLI_dlrbTree_remove(DLRBT_Tree *tree, DLRBT_Node *node);
|
||||
|
||||
/* Node Operations (Manual) --------------------- */
|
||||
/* These methods require custom code for creating BST nodes and adding them to the
|
||||
* tree in special ways, such that the node can then be balanced.
|
||||
*
|
||||
* It is recommended that these methods are only used where the other method is too cumbersome...
|
||||
*/
|
||||
|
||||
/* Balance the tree after the given node has been added to it
|
||||
* (using custom code, in the Binary Tree way).
|
||||
*/
|
||||
void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node);
|
||||
|
||||
/* ********************************************** */
|
||||
|
||||
#endif /* __BLI_DLRBTREE_H__ */
|
||||
34
extern/blendlib/BLI_dynlib.h
vendored
Normal file
34
extern/blendlib/BLI_dynlib.h
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#ifndef __BLI_DYNLIB_H__
|
||||
#define __BLI_DYNLIB_H__
|
||||
|
||||
typedef struct DynamicLibrary DynamicLibrary;
|
||||
|
||||
DynamicLibrary *BLI_dynlib_open(const char *name);
|
||||
void *BLI_dynlib_find_symbol(DynamicLibrary *lib, const char *symname);
|
||||
char *BLI_dynlib_get_error_as_string(DynamicLibrary *lib);
|
||||
void BLI_dynlib_close(DynamicLibrary *lib);
|
||||
|
||||
#endif /* __BLI_DYNLIB_H__ */
|
||||
60
extern/blendlib/BLI_dynstr.h
vendored
Normal file
60
extern/blendlib/BLI_dynstr.h
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_DYNSTR_H__
|
||||
#define __BLI_DYNSTR_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
* \brief A dynamically sized string ADT.
|
||||
* \section aboutdynstr Dynamic String
|
||||
* This ADT is designed purely for dynamic string creation
|
||||
* through appending, not for general usage, the intent is
|
||||
* to build up dynamic strings using a DynStr object, then
|
||||
* convert it to a c-string and work with that.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
struct DynStr;
|
||||
|
||||
/** The abstract DynStr type */
|
||||
typedef struct DynStr DynStr;
|
||||
|
||||
DynStr *BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
DynStr *BLI_dynstr_new_memarena(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL();
|
||||
void BLI_dynstr_nappend(DynStr *__restrict ds, const char *cstr, int len) ATTR_NONNULL();
|
||||
|
||||
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, ...)
|
||||
ATTR_PRINTF_FORMAT(2, 3) ATTR_NONNULL(1, 2);
|
||||
void BLI_dynstr_vappendf(DynStr *__restrict ds, const char *__restrict format, va_list args)
|
||||
ATTR_PRINTF_FORMAT(2, 0) ATTR_NONNULL(1, 2);
|
||||
|
||||
int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
char *BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict str) ATTR_NONNULL();
|
||||
|
||||
void BLI_dynstr_clear(DynStr *ds) ATTR_NONNULL();
|
||||
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL();
|
||||
|
||||
#endif /* __BLI_DYNSTR_H__ */
|
||||
84
extern/blendlib/BLI_easing.h
vendored
Normal file
84
extern/blendlib/BLI_easing.h
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the author nor the names of contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Copyright (c) 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_EASING_H__
|
||||
#define __BLI_EASING_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
float BLI_easing_back_ease_in(
|
||||
float time, float begin, float change, float duration, float overshoot);
|
||||
float BLI_easing_back_ease_out(
|
||||
float time, float begin, float change, float duration, float overshoot);
|
||||
float BLI_easing_back_ease_in_out(
|
||||
float time, float begin, float change, float duration, float overshoot);
|
||||
float BLI_easing_bounce_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_bounce_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_bounce_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_circ_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_circ_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_circ_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_cubic_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_cubic_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_cubic_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_elastic_ease_in(
|
||||
float time, float begin, float change, float duration, float amplitude, float period);
|
||||
float BLI_easing_elastic_ease_out(
|
||||
float time, float begin, float change, float duration, float amplitude, float period);
|
||||
float BLI_easing_elastic_ease_in_out(
|
||||
float time, float begin, float change, float duration, float amplitude, float period);
|
||||
float BLI_easing_expo_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_expo_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_expo_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_linear_ease(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quad_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quad_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quad_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quart_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quart_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quart_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quint_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quint_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_quint_ease_in_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_sine_ease_in(float time, float begin, float change, float duration);
|
||||
float BLI_easing_sine_ease_out(float time, float begin, float change, float duration);
|
||||
float BLI_easing_sine_ease_in_out(float time, float begin, float change, float duration);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BLI_EASING_H__ */
|
||||
153
extern/blendlib/BLI_edgehash.h
vendored
Normal file
153
extern/blendlib/BLI_edgehash.h
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_EDGEHASH_H__
|
||||
#define __BLI_EDGEHASH_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
struct EdgeHash;
|
||||
typedef struct EdgeHash EdgeHash;
|
||||
|
||||
struct _EdgeHash_Edge {
|
||||
uint v_low, v_high;
|
||||
};
|
||||
|
||||
struct _EdgeHash_Entry {
|
||||
struct _EdgeHash_Edge edge;
|
||||
void *value;
|
||||
};
|
||||
|
||||
typedef struct EdgeHashIterator {
|
||||
struct _EdgeHash_Entry *entries;
|
||||
uint length;
|
||||
uint index;
|
||||
} EdgeHashIterator;
|
||||
|
||||
typedef void (*EdgeHashFreeFP)(void *key);
|
||||
|
||||
enum {
|
||||
EDGEHASH_FLAG_ALLOW_DUPES = (1 << 0), /* only checked for in debug mode */
|
||||
};
|
||||
|
||||
EdgeHash *BLI_edgehash_new_ex(const char *info, const unsigned int nentries_reserve);
|
||||
EdgeHash *BLI_edgehash_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp);
|
||||
void BLI_edgehash_print(EdgeHash *eh);
|
||||
void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
|
||||
bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
|
||||
void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
void *BLI_edgehash_lookup_default(EdgeHash *eh,
|
||||
unsigned int v0,
|
||||
unsigned int v1,
|
||||
void *val_default) ATTR_WARN_UNUSED_RESULT;
|
||||
void **BLI_edgehash_lookup_p(EdgeHash *eh,
|
||||
unsigned int v0,
|
||||
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgehash_ensure_p(EdgeHash *eh, unsigned int v0, unsigned int v1, void ***r_val)
|
||||
ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgehash_remove(EdgeHash *eh, unsigned int v0, unsigned int v1, EdgeHashFreeFP valfreefp);
|
||||
|
||||
void *BLI_edgehash_popkey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgehash_len(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehash_clear_ex(EdgeHash *eh,
|
||||
EdgeHashFreeFP valfreefp,
|
||||
const unsigned int nentries_reserve);
|
||||
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp);
|
||||
|
||||
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehashIterator_init(EdgeHashIterator *ehi, EdgeHash *eh);
|
||||
void BLI_edgehashIterator_free(EdgeHashIterator *ehi);
|
||||
|
||||
BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
|
||||
{
|
||||
ehi->index++;
|
||||
}
|
||||
BLI_INLINE bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
|
||||
{
|
||||
return ehi->index >= ehi->length;
|
||||
}
|
||||
BLI_INLINE void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi,
|
||||
unsigned int *r_v0,
|
||||
unsigned int *r_v1)
|
||||
{
|
||||
struct _EdgeHash_Edge edge = ehi->entries[ehi->index].edge;
|
||||
*r_v0 = edge.v_low;
|
||||
*r_v1 = edge.v_high;
|
||||
}
|
||||
BLI_INLINE void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
|
||||
{
|
||||
return ehi->entries[ehi->index].value;
|
||||
}
|
||||
BLI_INLINE void **BLI_edgehashIterator_getValue_p(EdgeHashIterator *ehi)
|
||||
{
|
||||
return &ehi->entries[ehi->index].value;
|
||||
}
|
||||
BLI_INLINE void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val)
|
||||
{
|
||||
ehi->entries[ehi->index].value = val;
|
||||
}
|
||||
|
||||
#define BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS(totloop) ((totloop) / 2)
|
||||
#define BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(totpoly) ((totpoly)*2)
|
||||
|
||||
/* *** EdgeSet *** */
|
||||
|
||||
struct EdgeSet;
|
||||
typedef struct EdgeSet EdgeSet;
|
||||
|
||||
typedef struct EdgeSetIterator {
|
||||
struct _EdgeHash_Edge *edges;
|
||||
uint length;
|
||||
uint index;
|
||||
} EdgeSetIterator;
|
||||
|
||||
EdgeSet *BLI_edgeset_new_ex(const char *info, const unsigned int nentries_reserve)
|
||||
ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgeset_len(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgeset_free(EdgeSet *es);
|
||||
|
||||
/* rely on inline api for now */
|
||||
EdgeSetIterator *BLI_edgesetIterator_new(EdgeSet *gs);
|
||||
void BLI_edgesetIterator_free(EdgeSetIterator *esi);
|
||||
|
||||
BLI_INLINE void BLI_edgesetIterator_getKey(EdgeSetIterator *esi,
|
||||
unsigned int *r_v0,
|
||||
unsigned int *r_v1)
|
||||
{
|
||||
struct _EdgeHash_Edge edge = esi->edges[esi->index];
|
||||
*r_v0 = edge.v_low;
|
||||
*r_v1 = edge.v_high;
|
||||
}
|
||||
BLI_INLINE void BLI_edgesetIterator_step(EdgeSetIterator *esi)
|
||||
{
|
||||
esi->index++;
|
||||
}
|
||||
BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi)
|
||||
{
|
||||
return esi->index >= esi->length;
|
||||
}
|
||||
|
||||
#endif /* __BLI_EDGEHASH_H__ */
|
||||
48
extern/blendlib/BLI_endian_switch.h
vendored
Normal file
48
extern/blendlib/BLI_endian_switch.h
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BLI_ENDIAN_SWITCH_H__
|
||||
#define __BLI_ENDIAN_SWITCH_H__
|
||||
|
||||
/** \file
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
/* BLI_endian_switch_inline.h */
|
||||
BLI_INLINE void BLI_endian_switch_int16(short *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_int32(int *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_uint32(unsigned int *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_float(float *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_int64(int64_t *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_uint64(uint64_t *val) ATTR_NONNULL(1);
|
||||
BLI_INLINE void BLI_endian_switch_double(double *val) ATTR_NONNULL(1);
|
||||
|
||||
/* endian_switch.c */
|
||||
void BLI_endian_switch_int16_array(short *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_uint16_array(unsigned short *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_int32_array(int *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_uint32_array(unsigned int *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_float_array(float *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_int64_array(int64_t *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_uint64_array(uint64_t *val, const int size) ATTR_NONNULL(1);
|
||||
void BLI_endian_switch_double_array(double *val, const int size) ATTR_NONNULL(1);
|
||||
|
||||
#include "BLI_endian_switch_inline.h"
|
||||
|
||||
#endif /* __BLI_ENDIAN_SWITCH_H__ */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue