port from perforce
This commit is contained in:
23
4kgfx/4k.sln
Normal file
23
4kgfx/4k.sln
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "4k", "src\4k.vcproj", "{478863DD-1156-47FF-8AE2-F7A923BB3998}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Crinkler|Win32 = Crinkler|Win32
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Crinkler|Win32.ActiveCfg = Crinkler|Win32
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Crinkler|Win32.Build.0 = Crinkler|Win32
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{478863DD-1156-47FF-8AE2-F7A923BB3998}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
23
4kgfx/4kgfx.sln
Normal file
23
4kgfx/4kgfx.sln
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "4kgfx", "4kgfx.vcxproj", "{27D5C038-72A5-4FCE-84C5-F02BCA628E50}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Crinkler|Win32 = Crinkler|Win32
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Crinkler|Win32.ActiveCfg = Crinkler|Win32
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Crinkler|Win32.Build.0 = Crinkler|Win32
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{27D5C038-72A5-4FCE-84C5-F02BCA628E50}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
4kgfx/4kgfx.suo
Normal file
BIN
4kgfx/4kgfx.suo
Normal file
Binary file not shown.
166
4kgfx/4kgfx.vcxproj
Normal file
166
4kgfx/4kgfx.vcxproj
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Crinkler|Win32">
|
||||
<Configuration>Crinkler</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{27D5C038-72A5-4FCE-84C5-F02BCA628E50}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>My4kgfx</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Crinkler|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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 Condition="'$(Configuration)|$(Platform)'=='Crinkler|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Crinkler|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ShowIncludes>true</ShowIncludes>
|
||||
<OmitDefaultLibName>true</OmitDefaultLibName>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>opengl32.lib;kernel32.lib;user32.lib;gdi32.lib</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ShowIncludes>true</ShowIncludes>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>opengl32.lib;kernel32.lib;user32.lib;gdi32.lib</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Crinkler|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ShowIncludes>true</ShowIncludes>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>opengl32.lib;kernel32.lib;user32.lib;gdi32.lib</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<AdditionalOptions>/CRINKLER /COMPMODE:SLOW /PROGRESSGUI /ORDERTRIES:3000 /HASHSIZE:300 /RANGE:opengl32 /TRANSFORM:CALLS /REPORT:Report.html %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="mesh.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Crinkler|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vecmath.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="glext.h" />
|
||||
<ClInclude Include="mesh.h" />
|
||||
<ClInclude Include="ogl3.h" />
|
||||
<ClInclude Include="small.h" />
|
||||
<ClInclude Include="smallwin.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="vecmath.h" />
|
||||
<ClInclude Include="wglext.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
57
4kgfx/4kgfx.vcxproj.filters
Normal file
57
4kgfx/4kgfx.vcxproj.filters
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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;hpp;hxx;hm;inl;inc;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="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vecmath.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mesh.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="small.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="glext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="smallwin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wglext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ogl3.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vecmath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
4kgfx/4kgfx.vcxproj.user
Normal file
3
4kgfx/4kgfx.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
BIN
4kgfx/Crinkler/4kgfx.exe
Normal file
BIN
4kgfx/Crinkler/4kgfx.exe
Normal file
Binary file not shown.
2
4kgfx/Crinkler/4kgfx.lastbuildstate
Normal file
2
4kgfx/Crinkler/4kgfx.lastbuildstate
Normal file
@@ -0,0 +1,2 @@
|
||||
#v4.0:v100:false
|
||||
Crinkler|Win32|E:\Private\Frank\Code\blu-flame.org\4kgfx\|
|
||||
109
4kgfx/Crinkler/4kgfx.log
Normal file
109
4kgfx/Crinkler/4kgfx.log
Normal file
@@ -0,0 +1,109 @@
|
||||
Build started 2011-04-12 22:49:00.
|
||||
1>Project "E:\Private\Frank\Code\blu-flame.org\4kgfx\4kgfx.vcxproj" on node 2 (build target(s)).
|
||||
1>InitializeBuildStatus:
|
||||
Touching "Crinkler\4kgfx.unsuccessfulbuild".
|
||||
ClCompile:
|
||||
All outputs are up-to-date.
|
||||
D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /nologo /W0 /WX- /O1 /Os /Oy /GT /D WIN32 /D NDEBUG /D _CONSOLE /Gm- /MD /GS- /Gy- /fp:precise /fp:except- /Zc:wchar_t /Zc:forScope /GR- /openmp- /Yu"StdAfx.h" /Fp"Crinkler\4kgfx.pch" /FAs /Fa"Crinkler\\" /Fo"Crinkler\\" /Fd"Crinkler\vc100.pdb" /Gd /TP /showIncludes /analyze- /errorReport:prompt main.cpp
|
||||
main.cpp
|
||||
Link:
|
||||
E:\Private\Frank\Code\blu-flame.org\4kgfx\link.exe /ERRORREPORT:PROMPT /OUT:"E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.exe" /INCREMENTAL:NO /NOLOGO opengl32.lib kernel32.lib user32.lib gdi32.lib /NODEFAULTLIB /MANIFEST:NO /PDB:"E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /ENTRY:"main" /DYNAMICBASE /NXCOMPAT /IMPLIB:"E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.lib" /MACHINE:X86 Crinkler\main.obj
|
||||
Crinkler\mesh.obj
|
||||
Crinkler\stdafx.obj
|
||||
Crinkler\vecmath.obj /CRINKLER /COMPMODE:SLOW /PROGRESSGUI /ORDERTRIES:3000 /HASHSIZE:300 /RANGE:opengl32 /TRANSFORM:CALLS /REPORT:Report.html
|
||||
Crinkler 1.3 (Mar 5 2011) (c) 2005-2011 Aske Simon Christensen & Rune Stubbe
|
||||
|
||||
Ignoring unknown argument '/ERRORREPORT:PROMPT'
|
||||
Ignoring unknown argument '/INCREMENTAL:NO'
|
||||
Ignoring unknown argument '/NOLOGO'
|
||||
Ignoring unknown argument '/NODEFAULTLIB'
|
||||
Ignoring unknown argument '/MANIFEST:NO'
|
||||
Ignoring unknown argument '/PDB:E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.pdb'
|
||||
Ignoring unknown argument '/TLBID:1'
|
||||
Ignoring unknown argument '/DYNAMICBASE'
|
||||
Ignoring unknown argument '/NXCOMPAT'
|
||||
Ignoring unknown argument '/IMPLIB:E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.lib'
|
||||
Ignoring unknown argument '/MACHINE:X86'
|
||||
Target: E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.exe
|
||||
Subsystem type: CONSOLE
|
||||
Compression mode: SLOW
|
||||
Hash size: 300 MB
|
||||
Hash tries: 20
|
||||
Order tries: 3000
|
||||
Report: Report.html
|
||||
Transforms: CALLS
|
||||
Replace DLLs: NONE
|
||||
Range DLLs: opengl32
|
||||
|
||||
loading:
|
||||
opengl32.lib kernel32.lib user32.lib gdi32.lib
|
||||
Crinkler\main.obj Crinkler\mesh.obj Crinkler\stdafx.obj Crinkler\vecmath.obj
|
||||
|
||||
|
||||
Calls transformed: 147
|
||||
|
||||
Uncompressed size of code: 11496
|
||||
Uncompressed size of data: 440
|
||||
|
||||
|-- Estimating models for code ----------------------------|
|
||||
............................................................ 1m16s
|
||||
Ideal compressed size: 4607
|
||||
|
||||
|-- Estimating models for data ----------------------------|
|
||||
............................................................ 0m00s
|
||||
Ideal compressed size: 131
|
||||
|
||||
Estimated ideal compressed total size: 4739
|
||||
|
||||
|
||||
Reordering sections...
|
||||
Iteration: 0 Size: 4746.16
|
||||
Iteration: 1 Size: 4744.91
|
||||
Iteration: 32 Size: 4744.05
|
||||
Iteration: 47 Size: 4743.70
|
||||
Iteration: 57 Size: 4742.23
|
||||
Iteration: 61 Size: 4740.29
|
||||
Iteration: 66 Size: 4736.51
|
||||
Iteration: 144 Size: 4736.33
|
||||
Iteration: 198 Size: 4735.81
|
||||
Iteration: 248 Size: 4735.76
|
||||
Iteration: 514 Size: 4735.73
|
||||
Iteration: 516 Size: 4735.55
|
||||
Iteration: 561 Size: 4735.52
|
||||
Iteration: 916 Size: 4735.20
|
||||
Iteration: 1671 Size: 4735.17
|
||||
Iteration: 1996 Size: 4735.00
|
||||
Iteration: 2291 Size: 4734.95
|
||||
Iteration: 2541 Size: 4734.45
|
||||
Iteration: 2861 Size: 4733.36
|
||||
Time spent: 1m36s
|
||||
|
||||
Calls transformed: 147
|
||||
|
||||
|-- Reestimating models for code --------------------------|
|
||||
............................................................ 1m53s
|
||||
Ideal compressed size: 4554
|
||||
|
||||
|-- Reestimating models for data --------------------------|
|
||||
............................................................ 0m01s
|
||||
Ideal compressed size: 127
|
||||
|
||||
Reestimated ideal compressed total size: 4682
|
||||
|
||||
|-- Optimizing hash table size ----------------------------|
|
||||
............................................................ 0m03s
|
||||
Real compressed total size: 4701
|
||||
Bytes lost to hashing: 19
|
||||
|
||||
Final file size: 5096
|
||||
|
||||
time spent: 4m53s
|
||||
4kgfx.vcxproj -> E:\Private\Frank\Code\blu-flame.org\4kgfx\Crinkler\4kgfx.exe
|
||||
FinalizeBuildStatus:
|
||||
Deleting file "Crinkler\4kgfx.unsuccessfulbuild".
|
||||
Touching "Crinkler\4kgfx.lastbuildstate".
|
||||
1>Done Building Project "E:\Private\Frank\Code\blu-flame.org\4kgfx\4kgfx.vcxproj" (build target(s)).
|
||||
|
||||
Build succeeded.
|
||||
|
||||
Time Elapsed 00:04:53.29
|
||||
BIN
4kgfx/Crinkler/4kgfx.pch
Normal file
BIN
4kgfx/Crinkler/4kgfx.pch
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/CL.read.1.tlog
Normal file
BIN
4kgfx/Crinkler/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/CL.write.1.tlog
Normal file
BIN
4kgfx/Crinkler/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/cl.command.1.tlog
Normal file
BIN
4kgfx/Crinkler/cl.command.1.tlog
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/link.command.1.tlog
Normal file
BIN
4kgfx/Crinkler/link.command.1.tlog
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/link.read.1.tlog
Normal file
BIN
4kgfx/Crinkler/link.read.1.tlog
Normal file
Binary file not shown.
1
4kgfx/Crinkler/link.read.4.tlog
Normal file
1
4kgfx/Crinkler/link.read.4.tlog
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
BIN
4kgfx/Crinkler/link.write.1.tlog
Normal file
BIN
4kgfx/Crinkler/link.write.1.tlog
Normal file
Binary file not shown.
218
4kgfx/Crinkler/main.asm
Normal file
218
4kgfx/Crinkler/main.asm
Normal file
@@ -0,0 +1,218 @@
|
||||
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.40219.01
|
||||
|
||||
TITLE E:\Private\Frank\Code\blu-flame.org\4kgfx\main.cpp
|
||||
.686P
|
||||
.XMM
|
||||
include listing.inc
|
||||
.model flat
|
||||
|
||||
INCLUDELIB MSVCRT
|
||||
INCLUDELIB OLDNAMES
|
||||
|
||||
CONST SEGMENT
|
||||
_pfd DW 00H
|
||||
DW 01H
|
||||
DD 021H
|
||||
DB 00H
|
||||
DB 020H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 00H
|
||||
DB 08H
|
||||
ORG $+17
|
||||
_attribs DD 02091H
|
||||
DD 03H
|
||||
DD 02092H
|
||||
DD 03H
|
||||
DD 02094H
|
||||
DD 02H
|
||||
DD 00H
|
||||
CONST ENDS
|
||||
screenSettings SEGMENT
|
||||
_screenSettings DB 00H
|
||||
ORG $+31
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 07cH
|
||||
DW 00H
|
||||
DD 01c0000H
|
||||
DW 00H
|
||||
ORG $+14
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DB 00H
|
||||
ORG $+31
|
||||
DW 00H
|
||||
DD 020H
|
||||
DD 0500H
|
||||
DD 02d0H
|
||||
DD 00H
|
||||
DD 00H
|
||||
screenSettings ENDS
|
||||
PUBLIC ??_C@_0BL@PDDHMPGF@wglCreateContextAttribsARB?$AA@ ; `string'
|
||||
PUBLIC ??_C@_06GGHJAEBN@static?$AA@ ; `string'
|
||||
PUBLIC _main
|
||||
EXTRN __imp__ExitProcess@4:PROC
|
||||
EXTRN __imp__GetAsyncKeyState@4:PROC
|
||||
EXTRN __imp__SwapBuffers@4:PROC
|
||||
EXTRN ?Render@Mesh@@QAEXXZ:PROC ; Mesh::Render
|
||||
EXTRN __imp__wglGetProcAddress@4:PROC
|
||||
EXTRN __imp__wglMakeCurrent@8:PROC
|
||||
EXTRN __imp__wglCreateContext@4:PROC
|
||||
EXTRN __imp__SetPixelFormat@12:PROC
|
||||
EXTRN __imp__ChoosePixelFormat@8:PROC
|
||||
EXTRN __imp__GetDC@4:PROC
|
||||
EXTRN __imp__CreateWindowExA@48:PROC
|
||||
EXTRN __imp__ShowCursor@4:PROC
|
||||
EXTRN __imp__ChangeDisplaySettingsA@8:PROC
|
||||
; COMDAT ??_C@_0BL@PDDHMPGF@wglCreateContextAttribsARB?$AA@
|
||||
; File e:\private\frank\code\blu-flame.org\4kgfx\main.cpp
|
||||
CONST SEGMENT
|
||||
??_C@_0BL@PDDHMPGF@wglCreateContextAttribsARB?$AA@ DB 'wglCreateContextAt'
|
||||
DB 'tribsARB', 00H ; `string'
|
||||
CONST ENDS
|
||||
; COMDAT ??_C@_06GGHJAEBN@static?$AA@
|
||||
CONST SEGMENT
|
||||
??_C@_06GGHJAEBN@static?$AA@ DB 'static', 00H ; `string'
|
||||
; Function compile flags: /Ogspy
|
||||
CONST ENDS
|
||||
func_main SEGMENT
|
||||
_main PROC
|
||||
|
||||
; 8 : {
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
; 9 : #ifndef _DEBUG
|
||||
; 10 : ChangeDisplaySettingsA(&screenSettings, CDS_FULLSCREEN);
|
||||
|
||||
push 4
|
||||
push OFFSET _screenSettings
|
||||
call DWORD PTR __imp__ChangeDisplaySettingsA@8
|
||||
|
||||
; 11 : ShowCursor(0);
|
||||
|
||||
xor edi, edi
|
||||
push edi
|
||||
call DWORD PTR __imp__ShowCursor@4
|
||||
|
||||
; 12 : #endif
|
||||
; 13 : HDC hDC=GetDC(CreateWindowExA(0, "static", 0,WS_VISIBLE|WS_POPUP|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,0,0,XRES,YRES,0,0,0,0));
|
||||
|
||||
push edi
|
||||
push edi
|
||||
push edi
|
||||
push edi
|
||||
push 720 ; 000002d0H
|
||||
push 1280 ; 00000500H
|
||||
push edi
|
||||
push edi
|
||||
push -1778384896 ; 96000000H
|
||||
push edi
|
||||
push OFFSET ??_C@_06GGHJAEBN@static?$AA@
|
||||
push edi
|
||||
call DWORD PTR __imp__CreateWindowExA@48
|
||||
push eax
|
||||
call DWORD PTR __imp__GetDC@4
|
||||
mov esi, eax
|
||||
|
||||
; 14 : SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
|
||||
|
||||
mov eax, OFFSET _pfd
|
||||
push eax
|
||||
push eax
|
||||
push esi
|
||||
call DWORD PTR __imp__ChoosePixelFormat@8
|
||||
push eax
|
||||
push esi
|
||||
call DWORD PTR __imp__SetPixelFormat@12
|
||||
|
||||
; 15 : wglMakeCurrent(hDC, wglCreateContext(hDC));
|
||||
|
||||
push esi
|
||||
call DWORD PTR __imp__wglCreateContext@4
|
||||
mov ebx, DWORD PTR __imp__wglMakeCurrent@8
|
||||
push eax
|
||||
push esi
|
||||
call ebx
|
||||
|
||||
; 16 : wglMakeCurrent(hDC, ((PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"))(hDC, 0, attribs));
|
||||
|
||||
push OFFSET _attribs
|
||||
push edi
|
||||
push esi
|
||||
push OFFSET ??_C@_0BL@PDDHMPGF@wglCreateContextAttribsARB?$AA@
|
||||
call DWORD PTR __imp__wglGetProcAddress@4
|
||||
call eax
|
||||
push eax
|
||||
push esi
|
||||
call ebx
|
||||
|
||||
; 17 :
|
||||
; 18 : #ifdef _DEBUG
|
||||
; 19 : ((PFNGLDEBUGMESSAGECALLBACKAMDPROC)wglGetProcAddress("glDebugMessageCallbackAMD"))(glDebugOutputAMD, 0);
|
||||
; 20 : #endif
|
||||
; 21 :
|
||||
; 22 : cube.Render();
|
||||
|
||||
mov ecx, OFFSET _cube
|
||||
call ?Render@Mesh@@QAEXXZ ; Mesh::Render
|
||||
|
||||
; 23 : SwapBuffers(hDC);
|
||||
|
||||
push esi
|
||||
call DWORD PTR __imp__SwapBuffers@4
|
||||
$LL2@main:
|
||||
|
||||
; 24 :
|
||||
; 25 : while (!GetAsyncKeyState(27));
|
||||
|
||||
push 27 ; 0000001bH
|
||||
call DWORD PTR __imp__GetAsyncKeyState@4
|
||||
test ax, ax
|
||||
je SHORT $LL2@main
|
||||
|
||||
; 26 : ExitProcess(0);
|
||||
|
||||
push edi
|
||||
call DWORD PTR __imp__ExitProcess@4
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
$LN7@main:
|
||||
$LN6@main:
|
||||
_main ENDP
|
||||
func_main ENDS
|
||||
EXTRN ??0Mesh@@QAE@XZ:PROC ; Mesh::Mesh
|
||||
; Function compile flags: /Ogspy
|
||||
; COMDAT ??__Ecube@@YAXXZ
|
||||
compile SEGMENT
|
||||
??__Ecube@@YAXXZ PROC ; `dynamic initializer for 'cube'', COMDAT
|
||||
|
||||
; 4 : static Mesh cube;
|
||||
|
||||
mov ecx, OFFSET _cube
|
||||
jmp ??0Mesh@@QAE@XZ ; Mesh::Mesh
|
||||
??__Ecube@@YAXXZ ENDP ; `dynamic initializer for 'cube''
|
||||
compile ENDS
|
||||
_BSS SEGMENT
|
||||
_cube DB 0488040H DUP (?)
|
||||
_BSS ENDS
|
||||
CRT$XCU SEGMENT
|
||||
_cube$initializer$ DD FLAT:??__Ecube@@YAXXZ
|
||||
CRT$XCU ENDS
|
||||
END
|
||||
BIN
4kgfx/Crinkler/main.obj
Normal file
BIN
4kgfx/Crinkler/main.obj
Normal file
Binary file not shown.
2978
4kgfx/Crinkler/mesh.asm
Normal file
2978
4kgfx/Crinkler/mesh.asm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
4kgfx/Crinkler/mesh.obj
Normal file
BIN
4kgfx/Crinkler/mesh.obj
Normal file
Binary file not shown.
176
4kgfx/Crinkler/stdafx.asm
Normal file
176
4kgfx/Crinkler/stdafx.asm
Normal file
@@ -0,0 +1,176 @@
|
||||
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.40219.01
|
||||
|
||||
TITLE E:\Private\Frank\Code\blu-flame.org\4kgfx\stdafx.cpp
|
||||
.686P
|
||||
.XMM
|
||||
include listing.inc
|
||||
.model flat
|
||||
|
||||
INCLUDELIB MSVCRT
|
||||
INCLUDELIB OLDNAMES
|
||||
|
||||
PUBLIC ?glShaderSource@@3P6GXIHPAPBDPBH@ZA ; glShaderSource
|
||||
PUBLIC ?glCreateProgram@@3P6GIXZA ; glCreateProgram
|
||||
PUBLIC ?glGenBuffers@@3P6GXHPAI@ZA ; glGenBuffers
|
||||
PUBLIC ?glUseProgram@@3P6GXI@ZA ; glUseProgram
|
||||
PUBLIC ?glBindBuffer@@3P6GXII@ZA ; glBindBuffer
|
||||
PUBLIC ?glLinkProgram@@3P6GXI@ZA ; glLinkProgram
|
||||
PUBLIC ?glVertexAttribPointer@@3P6GXIHIEHPBX@ZA ; glVertexAttribPointer
|
||||
PUBLIC ?glCreateShader@@3P6GII@ZA ; glCreateShader
|
||||
PUBLIC ?glEnableVertexAttribArray@@3P6GXI@ZA ; glEnableVertexAttribArray
|
||||
PUBLIC ?glBindVertexArray@@3P6GXI@ZA ; glBindVertexArray
|
||||
PUBLIC ?glMapBuffer@@3P6GPAXII@ZA ; glMapBuffer
|
||||
PUBLIC ?glCompileShader@@3P6GXI@ZA ; glCompileShader
|
||||
PUBLIC ?glUnmapBuffer@@3P6GEI@ZA ; glUnmapBuffer
|
||||
PUBLIC ?glGetAttribLocation@@3P6GHIPBD@ZA ; glGetAttribLocation
|
||||
PUBLIC ?glAttachShader@@3P6GXII@ZA ; glAttachShader
|
||||
PUBLIC ?glBufferData@@3P6GXI_JPBXI@ZA ; glBufferData
|
||||
PUBLIC ?glGenVertexArrays@@3P6GXHPAI@ZA ; glGenVertexArrays
|
||||
PUBLIC ?currentProgramId@@3IA ; currentProgramId
|
||||
PUBLIC ?MaxVertexBuffer@Mesh@@2HB ; Mesh::MaxVertexBuffer
|
||||
PUBLIC ?MaxIndexBuffer@Mesh@@2HB ; Mesh::MaxIndexBuffer
|
||||
_BSS SEGMENT
|
||||
?glShaderSource@@3P6GXIHPAPBDPBH@ZA DD 01H DUP (?) ; glShaderSource
|
||||
?glCreateProgram@@3P6GIXZA DD 01H DUP (?) ; glCreateProgram
|
||||
?glGenBuffers@@3P6GXHPAI@ZA DD 01H DUP (?) ; glGenBuffers
|
||||
?glUseProgram@@3P6GXI@ZA DD 01H DUP (?) ; glUseProgram
|
||||
?glBindBuffer@@3P6GXII@ZA DD 01H DUP (?) ; glBindBuffer
|
||||
?glLinkProgram@@3P6GXI@ZA DD 01H DUP (?) ; glLinkProgram
|
||||
?glVertexAttribPointer@@3P6GXIHIEHPBX@ZA DD 01H DUP (?) ; glVertexAttribPointer
|
||||
?glCreateShader@@3P6GII@ZA DD 01H DUP (?) ; glCreateShader
|
||||
?glEnableVertexAttribArray@@3P6GXI@ZA DD 01H DUP (?) ; glEnableVertexAttribArray
|
||||
?glBindVertexArray@@3P6GXI@ZA DD 01H DUP (?) ; glBindVertexArray
|
||||
?glMapBuffer@@3P6GPAXII@ZA DD 01H DUP (?) ; glMapBuffer
|
||||
?glCompileShader@@3P6GXI@ZA DD 01H DUP (?) ; glCompileShader
|
||||
?glUnmapBuffer@@3P6GEI@ZA DD 01H DUP (?) ; glUnmapBuffer
|
||||
?glGetAttribLocation@@3P6GHIPBD@ZA DD 01H DUP (?) ; glGetAttribLocation
|
||||
?glAttachShader@@3P6GXII@ZA DD 01H DUP (?) ; glAttachShader
|
||||
?glBufferData@@3P6GXI_JPBXI@ZA DD 01H DUP (?) ; glBufferData
|
||||
?glGenVertexArrays@@3P6GXHPAI@ZA DD 01H DUP (?) ; glGenVertexArrays
|
||||
?currentProgramId@@3IA DD 01H DUP (?) ; currentProgramId
|
||||
_BSS ENDS
|
||||
; COMDAT ?MaxIndexBuffer@Mesh@@2HB
|
||||
CONST SEGMENT
|
||||
?MaxIndexBuffer@Mesh@@2HB DD 048000H ; Mesh::MaxIndexBuffer
|
||||
CONST ENDS
|
||||
; COMDAT ?MaxVertexBuffer@Mesh@@2HB
|
||||
CONST SEGMENT
|
||||
?MaxVertexBuffer@Mesh@@2HB DD 010000H ; Mesh::MaxVertexBuffer
|
||||
CONST ENDS
|
||||
screenSettings SEGMENT
|
||||
_screenSettings DB 00H
|
||||
ORG $+31
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 07cH
|
||||
DW 00H
|
||||
DD 01c0000H
|
||||
DW 00H
|
||||
ORG $+14
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DW 00H
|
||||
DB 00H
|
||||
ORG $+31
|
||||
DW 00H
|
||||
DD 020H
|
||||
DD 0500H
|
||||
DD 02d0H
|
||||
DD 00H
|
||||
DD 00H
|
||||
screenSettings ENDS
|
||||
PUBLIC ?compileShader@@YAIPBD0@Z ; compileShader
|
||||
; Function compile flags: /Ogspy
|
||||
; File e:\private\frank\code\blu-flame.org\4kgfx\ogl3.h
|
||||
compile SEGMENT
|
||||
_vsh$ = 8 ; size = 4
|
||||
_fsh$ = 12 ; size = 4
|
||||
?compileShader@@YAIPBD0@Z PROC ; compileShader
|
||||
|
||||
; 36 : {
|
||||
|
||||
push esi
|
||||
push edi
|
||||
|
||||
; 37 : GLuint s,p;
|
||||
; 38 : p = glCreateProgram();
|
||||
|
||||
call DWORD PTR ?glCreateProgram@@3P6GIXZA ; glCreateProgram
|
||||
|
||||
; 39 : s = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
push 35633 ; 00008b31H
|
||||
mov esi, eax
|
||||
call DWORD PTR ?glCreateShader@@3P6GII@ZA ; glCreateShader
|
||||
mov edi, eax
|
||||
|
||||
; 40 : glShaderSource(s, 1, &vsh, NULL);
|
||||
|
||||
push 0
|
||||
lea eax, DWORD PTR _vsh$[esp+8]
|
||||
push eax
|
||||
push 1
|
||||
push edi
|
||||
call DWORD PTR ?glShaderSource@@3P6GXIHPAPBDPBH@ZA ; glShaderSource
|
||||
|
||||
; 41 : glCompileShader(s);
|
||||
|
||||
push edi
|
||||
call DWORD PTR ?glCompileShader@@3P6GXI@ZA ; glCompileShader
|
||||
|
||||
; 42 : glAttachShader(p, s);
|
||||
|
||||
push edi
|
||||
push esi
|
||||
call DWORD PTR ?glAttachShader@@3P6GXII@ZA ; glAttachShader
|
||||
|
||||
; 43 : s = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
push 35632 ; 00008b30H
|
||||
call DWORD PTR ?glCreateShader@@3P6GII@ZA ; glCreateShader
|
||||
mov edi, eax
|
||||
|
||||
; 44 : glShaderSource(s, 1, &fsh, NULL);
|
||||
|
||||
push 0
|
||||
lea eax, DWORD PTR _fsh$[esp+8]
|
||||
push eax
|
||||
push 1
|
||||
push edi
|
||||
call DWORD PTR ?glShaderSource@@3P6GXIHPAPBDPBH@ZA ; glShaderSource
|
||||
|
||||
; 45 : glCompileShader(s);
|
||||
|
||||
push edi
|
||||
call DWORD PTR ?glCompileShader@@3P6GXI@ZA ; glCompileShader
|
||||
|
||||
; 46 : glAttachShader(p, s);
|
||||
|
||||
push edi
|
||||
push esi
|
||||
call DWORD PTR ?glAttachShader@@3P6GXII@ZA ; glAttachShader
|
||||
|
||||
; 47 : glLinkProgram(p);
|
||||
|
||||
push esi
|
||||
call DWORD PTR ?glLinkProgram@@3P6GXI@ZA ; glLinkProgram
|
||||
|
||||
; 48 : glUseProgram(p);
|
||||
|
||||
push esi
|
||||
call DWORD PTR ?glUseProgram@@3P6GXI@ZA ; glUseProgram
|
||||
pop edi
|
||||
|
||||
; 49 : return p;
|
||||
|
||||
mov eax, esi
|
||||
pop esi
|
||||
|
||||
; 50 : };
|
||||
|
||||
ret 0
|
||||
?compileShader@@YAIPBD0@Z ENDP ; compileShader
|
||||
compile ENDS
|
||||
END
|
||||
BIN
4kgfx/Crinkler/stdafx.obj
Normal file
BIN
4kgfx/Crinkler/stdafx.obj
Normal file
Binary file not shown.
BIN
4kgfx/Crinkler/vc100.pdb
Normal file
BIN
4kgfx/Crinkler/vc100.pdb
Normal file
Binary file not shown.
4155
4kgfx/Crinkler/vecmath.asm
Normal file
4155
4kgfx/Crinkler/vecmath.asm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
4kgfx/Crinkler/vecmath.obj
Normal file
BIN
4kgfx/Crinkler/vecmath.obj
Normal file
Binary file not shown.
11022
4kgfx/glext.h
Normal file
11022
4kgfx/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
4kgfx/link.exe
Normal file
BIN
4kgfx/link.exe
Normal file
Binary file not shown.
27
4kgfx/main.cpp
Normal file
27
4kgfx/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#pragma data_seg(".cube")
|
||||
static Mesh cube;
|
||||
|
||||
#pragma code_seg(".func_main")
|
||||
void __cdecl main(void)
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
ChangeDisplaySettingsA(&screenSettings, CDS_FULLSCREEN);
|
||||
ShowCursor(0);
|
||||
#endif
|
||||
HDC hDC=GetDC(CreateWindowExA(0, "static", 0,WS_VISIBLE|WS_POPUP|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,0,0,XRES,YRES,0,0,0,0));
|
||||
SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
|
||||
wglMakeCurrent(hDC, wglCreateContext(hDC));
|
||||
wglMakeCurrent(hDC, ((PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"))(hDC, 0, attribs));
|
||||
|
||||
#ifdef _DEBUG
|
||||
((PFNGLDEBUGMESSAGECALLBACKAMDPROC)wglGetProcAddress("glDebugMessageCallbackAMD"))(glDebugOutputAMD, 0);
|
||||
#endif
|
||||
|
||||
cube.Render();
|
||||
SwapBuffers(hDC);
|
||||
|
||||
while (!GetAsyncKeyState(27));
|
||||
ExitProcess(0);
|
||||
}
|
||||
465
4kgfx/mesh.cpp
Normal file
465
4kgfx/mesh.cpp
Normal file
@@ -0,0 +1,465 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
Mesh::Mesh()
|
||||
: IndexCount(0)
|
||||
, VertexCount(0)
|
||||
{
|
||||
glGenVertexArrays(1, &VertexArrayObject);
|
||||
glBindVertexArray(VertexArrayObject);
|
||||
|
||||
glGenBuffers(1, &VertexArrayBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexArrayBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, MaxVertexBuffer * sizeof(MeshVertex), 0, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &IndexBufferObject);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexBufferObject);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, MaxIndexBuffer * sizeof(unsigned short), NULL, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Render()
|
||||
{
|
||||
glBindVertexArray(VertexArrayObject);
|
||||
|
||||
unsigned int positionId = glGetAttribLocation(currentProgramId, "inPosition");
|
||||
unsigned int normalId = glGetAttribLocation(currentProgramId, "inNormal");
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexBufferObject);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexArrayBuffer);
|
||||
|
||||
glEnableVertexAttribArray(positionId);
|
||||
glVertexAttribPointer(positionId, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), (const GLvoid*)0);
|
||||
|
||||
glEnableVertexAttribArray(normalId);
|
||||
glVertexAttribPointer(normalId, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), (const GLvoid*)16);
|
||||
|
||||
glDrawElements(GL_TRIANGLES, IndexCount, GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Lock()
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexBufferObject);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexArrayBuffer);
|
||||
|
||||
IndexBuffer = (unsigned short*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_WRITE);
|
||||
VertexBuffer = (MeshVertex*)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Unlock()
|
||||
{
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::GenerateNormals()
|
||||
{
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
VertexBuffer[i].Normal = vec4(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < IndexCount; )
|
||||
{
|
||||
int count = IndexBuffer[i];
|
||||
++i;
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
int index = IndexBuffer[i + j];
|
||||
int indexPrev = IndexBuffer[i + ((j + count - 1) % count)];
|
||||
int indexNext = IndexBuffer[i + ((j + 1) % count)];
|
||||
vec4 p1(VertexBuffer[indexPrev].Position - VertexBuffer[index].Position);
|
||||
vec4 p2(VertexBuffer[indexNext].Position - VertexBuffer[index].Position);
|
||||
VertexBuffer[index].Normal += cross(p1, p2);
|
||||
}
|
||||
i += count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mesh::NormalizeNormals()
|
||||
{
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
VertexBuffer[i].Normal = normalize(VertexBuffer[i].Normal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Triangulate() // Converts polygons into triangle fans
|
||||
{
|
||||
OP.Reset();
|
||||
OP.NextVertexCount = 0;
|
||||
OP.NextFaceCount = 0;
|
||||
for (int i = 0; i < IndexCount;)
|
||||
{
|
||||
int count = IndexBuffer[i++];
|
||||
int firstVertex = IndexBuffer[i++];
|
||||
int secondVertex = IndexBuffer[i++];
|
||||
int j = 0;
|
||||
do
|
||||
{
|
||||
OP.NextIB[OP.NextIndexCount++] = firstVertex;
|
||||
OP.NextIB[OP.NextIndexCount++] = secondVertex;
|
||||
OP.NextIB[OP.NextIndexCount++] = IndexBuffer[i + j];
|
||||
OP.NextFaceCount++;
|
||||
secondVertex = IndexBuffer[i + j++];
|
||||
} while (j < count - 2);
|
||||
i += count - 2;
|
||||
}
|
||||
|
||||
memcpy(IndexBuffer, OP.NextIB, MaxIndexBuffer * sizeof(unsigned short));
|
||||
IndexCount = OP.NextIndexCount;
|
||||
FaceCount = OP.NextFaceCount;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::CatmullClarkSubdivide()
|
||||
{
|
||||
if (IndexCount >= MaxIndexBuffer / 4 || VertexCount >= MaxVertexBuffer * 9 / 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// neuer VB ist so:
|
||||
// alter VB bzw. verschobene Originalpunkte
|
||||
// ein Vertex pro Face (FacePunkte)
|
||||
// ein Vertex pro Edge (EdgePunkte)
|
||||
|
||||
//neuer IB ist so:
|
||||
// 4 / alte Ecke0 / EdgePunkt / FaceFacePunkt / EdgePunkt
|
||||
// 4 / alte Ecke1 / EdgePunkt / FaceFacePunkt / EdgePunkt
|
||||
//...
|
||||
// 4 / alte EckeN / EdgePunkt / FaceFacePunkt / EdgePunkt (N = = Vertexcount)
|
||||
//beim kopieren dann ueberall noch 4
|
||||
|
||||
OP.Reset();
|
||||
OP.NextVertexCount = VertexCount + FaceCount; //Basis Vertices sind die alte Ecken und die neuen FacePunkte
|
||||
|
||||
int face = 0;
|
||||
for (int i = 0; i < IndexCount;)
|
||||
{
|
||||
int count = IndexBuffer[i++];
|
||||
vec4& fp = OP.NextVB[VertexCount + face].Position;
|
||||
unsigned short int* ib = OP.NextIB + OP.NextIndexCount;
|
||||
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
int index = IndexBuffer[i + j];
|
||||
fp += VertexBuffer[index].Position;
|
||||
ib[j * 5] = 4;
|
||||
ib[j * 5 + 1] = index;
|
||||
ib[j * 5 + 3] = VertexCount + face; // erste Haelfte IB fertig
|
||||
}
|
||||
fp /= (float)count; // jetzt ist der FacePunkt fertig
|
||||
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
int index = IndexBuffer[i + j];
|
||||
int indexNext = IndexBuffer[i + ((j + 1) % count)];
|
||||
int Edge = OP.MakeEdgeID(index, indexNext);
|
||||
OP.NextVB[OP.EdgeID[Edge]].Position += fp; // Summe aller FacePunkte zu dieser Ecke sind hier
|
||||
|
||||
ib[j * 5 + 2] = OP.EdgeID[Edge];
|
||||
ib[(j * 5 + 9) % (count * 5)] = OP.EdgeID[Edge]; // IB fertig!
|
||||
|
||||
OP.NextVB[index].Position += fp; //Summe aller FacePunkte die an diesen Originalpunkt grenzen
|
||||
}
|
||||
|
||||
i += count;
|
||||
face++;
|
||||
OP.NextIndexCount += count * 5;
|
||||
OP.NextFaceCount += count;
|
||||
}
|
||||
|
||||
// Originalpunkte verschieben
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
bool openEdges = false; // gab es offene Kanten (d.h. einseitig benutze?)
|
||||
vec4 edgesVector(0,0,0,0);
|
||||
vec4 openEdgesVector(0,0,0,0);
|
||||
int edgeCount = 0;
|
||||
int openEdgeCount = 0;
|
||||
|
||||
for (int j = 0; j < OP.EdgeCount; ++j)
|
||||
{
|
||||
int V1 = (OP.EdgeConfiguration[j] & 0x0000ffff);
|
||||
int V2 = (OP.EdgeConfiguration[j] & 0xffff0000) >> 16;
|
||||
if (V1 == i || V2 == i)
|
||||
{
|
||||
vec4 mid = VertexBuffer[V1].Position + VertexBuffer[V2].Position;
|
||||
if (OP.EdgeUsage[j] == 1)
|
||||
{
|
||||
openEdges = true;
|
||||
openEdgeCount++;
|
||||
openEdgesVector += mid;
|
||||
}
|
||||
edgeCount++;
|
||||
edgesVector += mid;
|
||||
}
|
||||
}
|
||||
|
||||
if (openEdges)
|
||||
{
|
||||
OP.NextVB[i].Position = openEdgesVector / (float)(openEdgeCount * 4) + VertexBuffer[i].Position * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
OP.NextVB[i].Position =
|
||||
OP.NextVB[i].Position / (float)edgeCount +
|
||||
edgesVector / (float)edgeCount +
|
||||
VertexBuffer[i].Position * (float)(edgeCount - 3);
|
||||
OP.NextVB[i].Position /= (float)edgeCount;
|
||||
}
|
||||
}
|
||||
|
||||
//EdgePunkte anpassen
|
||||
for (int j = 0; j < OP.EdgeCount; ++j)
|
||||
{
|
||||
int V1 = (OP.EdgeConfiguration[j] & 0x0000ffff);
|
||||
int V2 = (OP.EdgeConfiguration[j] & 0xffff0000) >> 16;
|
||||
if (OP.EdgeUsage[j] < 2)
|
||||
{
|
||||
OP.NextVB[OP.EdgeID[j]].Position = vec4(0,0,0,0);
|
||||
OP.EdgeUsage[j] = 0;
|
||||
}
|
||||
|
||||
OP.NextVB[OP.EdgeID[j]].Position += VertexBuffer[V1].Position;
|
||||
OP.NextVB[OP.EdgeID[j]].Position += VertexBuffer[V2].Position;
|
||||
OP.NextVB[OP.EdgeID[j]].Position /= (float)(OP.EdgeUsage[j] + 2);
|
||||
}
|
||||
|
||||
memcpy(VertexBuffer, OP.NextVB, MaxVertexBuffer * sizeof(MeshVertex));
|
||||
memcpy(IndexBuffer, OP.NextIB, MaxIndexBuffer * sizeof(unsigned short));
|
||||
VertexCount = OP.NextVertexCount;
|
||||
IndexCount = OP.NextIndexCount;
|
||||
FaceCount = OP.NextFaceCount;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Extrude(float fExtend)
|
||||
{
|
||||
OP.Reset();
|
||||
|
||||
for (int i = 0; i < IndexCount;)
|
||||
{
|
||||
int count = IndexBuffer[i];
|
||||
IndexBuffer[i + IndexCount] = count;
|
||||
++i;
|
||||
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
int index = IndexBuffer[i + j];
|
||||
int indexNext = IndexBuffer[i + ((j + 1) % count)];
|
||||
int ID = OP.MakeEdgeID(index, indexNext);
|
||||
if (index > indexNext)
|
||||
{
|
||||
OP.EdgeUsage[ID] += 0x80;
|
||||
}
|
||||
IndexBuffer[i + IndexCount + count - j - 1] = index + VertexCount;
|
||||
}
|
||||
i += count;
|
||||
}
|
||||
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
VertexBuffer[i + VertexCount].Position = VertexBuffer[i].Position;
|
||||
VertexBuffer[i].Position.z -= fExtend;
|
||||
VertexBuffer[i + VertexCount].Position.z += fExtend;
|
||||
}
|
||||
|
||||
IndexCount *= 2;
|
||||
FaceCount *= 2;
|
||||
|
||||
for (int i = 0; i < OP.EdgeCount; ++i)
|
||||
{
|
||||
if ((OP.EdgeUsage[i] & 0x7f) == 1)
|
||||
{
|
||||
int iAdd = OP.EdgeUsage[i] == 1 ? 0 : VertexCount;
|
||||
int V1 = (OP.EdgeConfiguration[i] & 0x0000ffff);
|
||||
int V2 = (OP.EdgeConfiguration[i] & 0xffff0000) >> 16;
|
||||
IndexBuffer[IndexCount++] = 4;
|
||||
IndexBuffer[IndexCount++] = V1 + iAdd;
|
||||
iAdd = VertexCount - iAdd;
|
||||
IndexBuffer[IndexCount++] = V1 + iAdd;
|
||||
IndexBuffer[IndexCount++] = V2 + iAdd;
|
||||
iAdd = VertexCount - iAdd;
|
||||
IndexBuffer[IndexCount++] = V2 + iAdd;
|
||||
FaceCount += 1;
|
||||
}
|
||||
}
|
||||
VertexCount *= 2;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::OpInfo::Reset()
|
||||
{
|
||||
memclear(NextVB, sizeof (NextVB));
|
||||
memclear(NextIB, sizeof (NextIB));
|
||||
memclear(EdgeConfiguration, sizeof (EdgeConfiguration));
|
||||
memclear(EdgeUsage, sizeof (EdgeUsage));
|
||||
memclear(EdgeID, sizeof (EdgeID));
|
||||
|
||||
NextVertexCount = 0;
|
||||
NextIndexCount = 0;
|
||||
NextFaceCount = 0;
|
||||
|
||||
EdgeCount = 0;
|
||||
}
|
||||
|
||||
|
||||
int Mesh::OpInfo::MakeEdgeID (unsigned short VertexA, unsigned short VertexB)
|
||||
{
|
||||
unsigned int edgeConfiguration = VertexA > VertexB ? (VertexA << 16 | VertexB) : (VertexB << 16 | VertexA);
|
||||
|
||||
for (int i = 0; i < EdgeCount; ++i)
|
||||
{
|
||||
if (EdgeConfiguration[i] == edgeConfiguration)
|
||||
{
|
||||
EdgeUsage[i]++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
EdgeConfiguration[EdgeCount] = edgeConfiguration;
|
||||
EdgeUsage[EdgeCount]++;
|
||||
EdgeID[EdgeCount] = NextVertexCount;
|
||||
NextVertexCount++;
|
||||
|
||||
return EdgeCount++;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::StandardSubdivide()
|
||||
{
|
||||
OP.Reset();
|
||||
memcpy(OP.NextVB, VertexBuffer, VertexCount * sizeof(MeshVertex));
|
||||
OP.NextVertexCount = VertexCount;
|
||||
|
||||
int face = 0;
|
||||
for (int i = 0; i < IndexCount; ++face)
|
||||
{
|
||||
int count = IndexBuffer[i++];
|
||||
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
int prevIndex = j - 1;
|
||||
if (prevIndex < 0)
|
||||
prevIndex += count;
|
||||
prevIndex = IndexBuffer[i + prevIndex];
|
||||
int index = IndexBuffer[i + j];
|
||||
int nextIndex = IndexBuffer[i + ((j + 1) % count)];
|
||||
int prevEdgeID = OP.EdgeID[OP.MakeEdgeID(prevIndex, index)];
|
||||
int nextEdgeID = OP.EdgeID[OP.MakeEdgeID(index, nextIndex)];
|
||||
OP.NextVB[prevEdgeID].Position = (VertexBuffer[prevIndex].Position + VertexBuffer[index].Position) / 2;
|
||||
OP.NextVB[nextEdgeID].Position = (VertexBuffer[nextIndex].Position + VertexBuffer[index].Position) / 2;
|
||||
OP.NextIB[OP.NextIndexCount + 0] = 4;
|
||||
OP.NextIB[OP.NextIndexCount + 1] = 0; // will be set later (face offset)
|
||||
OP.NextIB[OP.NextIndexCount + 2] = prevEdgeID;
|
||||
OP.NextIB[OP.NextIndexCount + 3] = index;
|
||||
OP.NextIB[OP.NextIndexCount + 4] = nextEdgeID;
|
||||
OP.NextIndexCount += 5;
|
||||
++OP.NextFaceCount;
|
||||
}
|
||||
|
||||
i += count;
|
||||
}
|
||||
|
||||
int vbFaceOffset = OP.NextVertexCount;
|
||||
int ibIndex = 1;
|
||||
face = 0;
|
||||
for (int i = 0; i < IndexCount; ++face)
|
||||
{
|
||||
int count = IndexBuffer[i++];
|
||||
|
||||
vec4 fp;
|
||||
for (int j = 0; j < count; ++j)
|
||||
{
|
||||
fp += VertexBuffer[IndexBuffer[i + j]].Position;
|
||||
OP.NextIB[ibIndex] = vbFaceOffset + face;
|
||||
ibIndex += 5;
|
||||
}
|
||||
OP.NextVB[vbFaceOffset + face].Position = fp / (float)count;
|
||||
++OP.NextVertexCount;
|
||||
i += count;
|
||||
}
|
||||
|
||||
memcpy(VertexBuffer, OP.NextVB, MaxVertexBuffer * sizeof(MeshVertex));
|
||||
memcpy(IndexBuffer, OP.NextIB, MaxIndexBuffer * sizeof(unsigned short));
|
||||
VertexCount = OP.NextVertexCount;
|
||||
IndexCount = OP.NextIndexCount;
|
||||
FaceCount = OP.NextFaceCount;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::CreateCube()
|
||||
{
|
||||
Lock();
|
||||
VertexBuffer[0].Position = vec4(-2, -1, 0, 1);
|
||||
VertexBuffer[1].Position = vec4(-2, 1, 0, 1);
|
||||
VertexBuffer[2].Position = vec4(2, 1, 0, 1);
|
||||
VertexBuffer[3].Position = vec4(2, -1, 0, 1);
|
||||
VertexCount = 4;
|
||||
IndexBuffer[0] = 4;
|
||||
IndexBuffer[1] = 0;
|
||||
IndexBuffer[2] = 1;
|
||||
IndexBuffer[3] = 2;
|
||||
IndexBuffer[4] = 3;
|
||||
IndexCount = 5;
|
||||
FaceCount = 1;
|
||||
Extrude(1.0f);
|
||||
GenerateNormals();
|
||||
Triangulate();
|
||||
Homogenize();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void Mesh::CreateSphere(unsigned int lod)
|
||||
{
|
||||
Lock();
|
||||
VertexBuffer[0].Position = vec4(-1, -1, 0, 1);
|
||||
VertexBuffer[1].Position = vec4(-1, 1, 0, 1);
|
||||
VertexBuffer[2].Position = vec4(1, 1, 0, 1);
|
||||
VertexBuffer[3].Position = vec4(1, -1, 0, 1);
|
||||
VertexCount = 4;
|
||||
IndexBuffer[0] = 4;
|
||||
IndexBuffer[1] = 0;
|
||||
IndexBuffer[2] = 1;
|
||||
IndexBuffer[3] = 2;
|
||||
IndexBuffer[4] = 3;
|
||||
IndexCount = 5;
|
||||
FaceCount = 1;
|
||||
Extrude(1.0f);
|
||||
for (unsigned int i = 0; i < lod; ++i)
|
||||
CatmullClarkSubdivide();
|
||||
GenerateNormals();
|
||||
Triangulate();
|
||||
Homogenize();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Homogenize()
|
||||
{
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
VertexBuffer[i].Position.w = 1;
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Transform(const Matrix& transform)
|
||||
{
|
||||
Lock();
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
VertexBuffer[i].Position = transform * VertexBuffer[i].Position;
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
92
4kgfx/mesh.h
Normal file
92
4kgfx/mesh.h
Normal file
@@ -0,0 +1,92 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
struct MeshVertex
|
||||
{
|
||||
vec4 Position;
|
||||
vec4 Normal;
|
||||
};
|
||||
|
||||
|
||||
struct Instance
|
||||
{
|
||||
Matrix transform;
|
||||
};
|
||||
|
||||
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
Mesh();
|
||||
|
||||
struct VertexInfo
|
||||
{
|
||||
int Pos;
|
||||
int Normal;
|
||||
int UV;
|
||||
|
||||
bool operator < (const VertexInfo& v) const
|
||||
{
|
||||
if (Pos == v.Pos)
|
||||
{
|
||||
if (Normal == v.Normal)
|
||||
{
|
||||
return UV < v.UV;
|
||||
}
|
||||
return Normal < v.Normal;
|
||||
}
|
||||
return Pos < v.Pos;
|
||||
}
|
||||
};
|
||||
|
||||
int VertexCount;
|
||||
int IndexCount;
|
||||
int FaceCount;
|
||||
|
||||
static const int MaxVertexBuffer = 65536;
|
||||
static const int MaxIndexBuffer = 65536 * 9 / 2;
|
||||
|
||||
MeshVertex* VertexBuffer;
|
||||
unsigned short* IndexBuffer;
|
||||
|
||||
struct OpInfo
|
||||
{
|
||||
void Reset();
|
||||
|
||||
MeshVertex NextVB[Mesh::MaxVertexBuffer];
|
||||
unsigned short int NextIB[Mesh::MaxIndexBuffer];
|
||||
int NextVertexCount;
|
||||
int NextIndexCount;
|
||||
int NextFaceCount;
|
||||
|
||||
int EdgeCount;
|
||||
unsigned int EdgeConfiguration[Mesh::MaxIndexBuffer];
|
||||
unsigned char EdgeUsage[Mesh::MaxIndexBuffer];
|
||||
int MakeEdgeID(unsigned short VertexA, unsigned short VertexB);
|
||||
unsigned short int EdgeID[Mesh::MaxIndexBuffer];
|
||||
};
|
||||
|
||||
OpInfo OP;
|
||||
|
||||
unsigned int VertexArrayObject;
|
||||
unsigned int VertexArrayBuffer;
|
||||
unsigned int IndexBufferObject;
|
||||
|
||||
void Render();
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
void Transform(const Matrix& transform);
|
||||
void CreateCube();
|
||||
void CreateSphere(unsigned int lod);
|
||||
|
||||
private:
|
||||
void Homogenize();
|
||||
void GenerateNormals();
|
||||
void NormalizeNormals();
|
||||
void CatmullClarkSubdivide();
|
||||
void StandardSubdivide();
|
||||
void Extrude(float extend);
|
||||
void Bevel(float extend, float minAngle);
|
||||
void Triangulate();
|
||||
};
|
||||
102
4kgfx/ogl3.h
Normal file
102
4kgfx/ogl3.h
Normal file
@@ -0,0 +1,102 @@
|
||||
#pragma once
|
||||
|
||||
#define XRES 1280
|
||||
#define YRES 720
|
||||
|
||||
typedef HGLRC (WINAPI *PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
typedef void (WINAPI *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
|
||||
typedef void (WINAPI *PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam);
|
||||
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
|
||||
#pragma data_seg(".screenSettings")
|
||||
static DEVMODE screenSettings = {{0}, 0, 0, sizeof(DEVMODE), 0, 0x001c0000, {0}, 0, 0, 0, 0, 0, {0}, 0, 32, XRES, YRES, {0}, 0};
|
||||
|
||||
#pragma data_seg(".pfd")
|
||||
static const PIXELFORMATDESCRIPTOR pfd = {0, 1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8};
|
||||
|
||||
#pragma code_seg(".compile")
|
||||
unsigned int __cdecl compileShader(const char* vsh, const char* fsh)
|
||||
{
|
||||
GLuint s,p;
|
||||
p = glCreateProgram();
|
||||
s = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(s, 1, &vsh, NULL);
|
||||
glCompileShader(s);
|
||||
glAttachShader(p, s);
|
||||
s = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(s, 1, &fsh, NULL);
|
||||
glCompileShader(s);
|
||||
glAttachShader(p, s);
|
||||
glLinkProgram(p);
|
||||
glUseProgram(p);
|
||||
return p;
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
void APIENTRY glDebugOutputAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
|
||||
{
|
||||
OutputDebugStringA("[");
|
||||
|
||||
if (severity == GL_DEBUG_SEVERITY_HIGH_AMD)
|
||||
OutputDebugStringA("high");
|
||||
else if (severity == GL_DEBUG_SEVERITY_MEDIUM_AMD)
|
||||
OutputDebugStringA("medium");
|
||||
else if (severity == GL_DEBUG_SEVERITY_LOW_AMD)
|
||||
OutputDebugStringA("low");
|
||||
|
||||
OutputDebugStringA("] ");
|
||||
|
||||
if (category == GL_DEBUG_CATEGORY_API_ERROR_AMD)
|
||||
OutputDebugStringA("api error");
|
||||
else if (category == GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD)
|
||||
OutputDebugStringA("window system");
|
||||
else if (category == GL_DEBUG_CATEGORY_DEPRECATION_AMD)
|
||||
OutputDebugStringA("deprecation");
|
||||
else if (category == GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD)
|
||||
OutputDebugStringA("undefined behavior");
|
||||
else if (category == GL_DEBUG_CATEGORY_PERFORMANCE_AMD)
|
||||
OutputDebugStringA("performance");
|
||||
else if (category == GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD)
|
||||
OutputDebugStringA("shader compiler");
|
||||
else if (category == GL_DEBUG_CATEGORY_APPLICATION_AMD)
|
||||
OutputDebugStringA("application");
|
||||
else if (category == GL_DEBUG_CATEGORY_OTHER_AMD)
|
||||
OutputDebugStringA("other");
|
||||
|
||||
OutputDebugStringA(": ");
|
||||
OutputDebugStringA(message);
|
||||
OutputDebugStringA("\n");
|
||||
|
||||
DebugBreak();
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma data_seg(".attribs")
|
||||
static const int attribs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||
#ifdef _DEBUG
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB | WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
#else
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||
#endif
|
||||
0
|
||||
};
|
||||
128
4kgfx/small.h
Normal file
128
4kgfx/small.h
Normal file
@@ -0,0 +1,128 @@
|
||||
#pragma once
|
||||
|
||||
#pragma code_seg("pi")
|
||||
__forceinline float pi()
|
||||
{
|
||||
__asm fldpi
|
||||
}
|
||||
|
||||
#pragma code_seg("sm0")
|
||||
|
||||
unsigned long ftol(float Value)
|
||||
{
|
||||
unsigned long RetVal;
|
||||
__asm fld Value
|
||||
__asm fistp RetVal
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
#pragma code_seg("sm1")
|
||||
|
||||
float frac(float Value)
|
||||
{
|
||||
return Value - ftol(Value);
|
||||
}
|
||||
|
||||
#pragma code_seg("sm2")
|
||||
|
||||
float abs(float Value)
|
||||
{
|
||||
__asm fld Value
|
||||
__asm fabs
|
||||
}
|
||||
|
||||
#pragma code_seg("sm3")
|
||||
|
||||
float sin(float Value)
|
||||
{
|
||||
__asm fld Value
|
||||
__asm fsin
|
||||
}
|
||||
|
||||
#pragma code_seg("sm4")
|
||||
|
||||
float sign(float Value)
|
||||
{
|
||||
if (Value != 0)
|
||||
return Value / abs(Value);
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
#pragma code_seg("sm5")
|
||||
|
||||
float sqrt(float Value)
|
||||
{
|
||||
__asm fld Value
|
||||
__asm fsqrt
|
||||
}
|
||||
|
||||
#pragma code_seg("sm7")
|
||||
|
||||
void* memcpy(void* Dest, const void* Src, size_t destSize)
|
||||
{
|
||||
__asm mov esi, Src
|
||||
__asm mov edi, Dest
|
||||
__asm mov ecx, destSize
|
||||
__asm rep movsb
|
||||
}
|
||||
|
||||
#pragma code_seg("sm8")
|
||||
|
||||
float fmod(float x, float y)
|
||||
{
|
||||
__asm fld y
|
||||
__asm fld x
|
||||
__asm fprem
|
||||
__asm fxch
|
||||
__asm fstp x
|
||||
}
|
||||
|
||||
#pragma data_seg("smA")
|
||||
|
||||
static unsigned long seed=0x12345678;
|
||||
|
||||
#pragma code_seg("sm9")
|
||||
|
||||
__forceinline void randomize(unsigned long x)
|
||||
{
|
||||
seed = x;
|
||||
}
|
||||
|
||||
#pragma code_seg("smB")
|
||||
|
||||
float rand()
|
||||
{
|
||||
seed = seed * 0x76364873 + 1234567;
|
||||
return (float)(seed & 0x7FFFFFFF) * (const float)(2.0f / (float)0x7FFFFFFF) - 1.0f;
|
||||
}
|
||||
|
||||
#pragma code_seg("smS")
|
||||
|
||||
__forceinline size_t strlen(const char* String)
|
||||
{
|
||||
size_t Length = 0;
|
||||
while (*String++) ++Length;
|
||||
return Length;
|
||||
}
|
||||
|
||||
#pragma code_seg("smP")
|
||||
|
||||
float pow(float x, float y){
|
||||
float r;
|
||||
__asm{
|
||||
fld y
|
||||
fld x
|
||||
fyl2x
|
||||
fld1
|
||||
fld st(1)
|
||||
fprem
|
||||
f2xm1
|
||||
faddp st(1),st
|
||||
fscale
|
||||
fxch st(1)
|
||||
fstp st(0)
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
188
4kgfx/smallwin.h
Normal file
188
4kgfx/smallwin.h
Normal file
@@ -0,0 +1,188 @@
|
||||
#pragma once
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define HANDLE void*
|
||||
#define DECLARE_HANDLE(name) typedef HANDLE name
|
||||
#define WINGDIAPI __declspec(dllimport)
|
||||
#define WINUSERAPI __declspec(dllimport)
|
||||
#define WINBASEAPI __declspec(dllimport)
|
||||
#define WINAPI __stdcall
|
||||
#define NULL 0
|
||||
#define APIENTRY WINAPI
|
||||
|
||||
#define PFD_DOUBLEBUFFER 0x00000001
|
||||
#define PFD_STEREO 0x00000002
|
||||
#define PFD_DRAW_TO_WINDOW 0x00000004
|
||||
#define PFD_DRAW_TO_BITMAP 0x00000008
|
||||
#define PFD_SUPPORT_GDI 0x00000010
|
||||
#define PFD_SUPPORT_OPENGL 0x00000020
|
||||
#define PFD_GENERIC_FORMAT 0x00000040
|
||||
#define PFD_NEED_PALETTE 0x00000080
|
||||
#define PFD_NEED_SYSTEM_PALETTE 0x00000100
|
||||
#define PFD_SWAP_EXCHANGE 0x00000200
|
||||
#define PFD_SWAP_COPY 0x00000400
|
||||
#define PFD_SWAP_LAYER_BUFFERS 0x00000800
|
||||
#define PFD_GENERIC_ACCELERATED 0x00001000
|
||||
#define PFD_SUPPORT_DIRECTDRAW 0x00002000
|
||||
#define PFD_DIRECT3D_ACCELERATED 0x00004000
|
||||
#define PFD_SUPPORT_COMPOSITION 0x00008000
|
||||
#define PFD_TYPE_RGBA 0
|
||||
#define PFD_TYPE_COLORINDEX 1
|
||||
|
||||
#define WS_OVERLAPPED 0x00000000L
|
||||
#define WS_POPUP 0x80000000L
|
||||
#define WS_CHILD 0x40000000L
|
||||
#define WS_MINIMIZE 0x20000000L
|
||||
#define WS_VISIBLE 0x10000000L
|
||||
#define WS_DISABLED 0x08000000L
|
||||
#define WS_CLIPSIBLINGS 0x04000000L
|
||||
#define WS_CLIPCHILDREN 0x02000000L
|
||||
#define WS_MAXIMIZE 0x01000000L
|
||||
#define WS_CAPTION 0x00C00000L
|
||||
#define WS_BORDER 0x00800000L
|
||||
#define WS_DLGFRAME 0x00400000L
|
||||
#define WS_VSCROLL 0x00200000L
|
||||
#define WS_HSCROLL 0x00100000L
|
||||
#define WS_SYSMENU 0x00080000L
|
||||
#define WS_THICKFRAME 0x00040000L
|
||||
#define WS_GROUP 0x00020000L
|
||||
#define WS_TABSTOP 0x00010000L
|
||||
|
||||
#define CDS_UPDATEREGISTRY 0x00000001
|
||||
#define CDS_TEST 0x00000002
|
||||
#define CDS_FULLSCREEN 0x00000004
|
||||
#define CDS_GLOBAL 0x00000008
|
||||
#define CDS_SET_PRIMARY 0x00000010
|
||||
#define CDS_VIDEOPARAMETERS 0x00000020
|
||||
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
|
||||
typedef int (WINAPI *PROC)();
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned char BYTE;
|
||||
typedef char CHAR;
|
||||
typedef unsigned int UINT;
|
||||
typedef long LONG;
|
||||
typedef const char* LPCSTR;
|
||||
typedef void VOID;
|
||||
typedef float FLOAT;
|
||||
typedef __int64 INT64;
|
||||
typedef int INT;
|
||||
typedef int INT32;
|
||||
typedef long BOOL;
|
||||
typedef void *HDC;
|
||||
typedef void *HGLRC;
|
||||
typedef void *HWND;
|
||||
typedef void *HMENU;
|
||||
typedef void *HINSTANCE;
|
||||
typedef void *LPVOID;
|
||||
|
||||
typedef struct tagRECT
|
||||
{
|
||||
LONG left;
|
||||
LONG top;
|
||||
LONG right;
|
||||
LONG bottom;
|
||||
} RECT;
|
||||
|
||||
typedef struct _POINTL
|
||||
{
|
||||
long x;
|
||||
long y;
|
||||
} POINTL, *PPOINTL;
|
||||
|
||||
typedef struct _devicemodeA {
|
||||
BYTE dmDeviceName[32];
|
||||
WORD dmSpecVersion;
|
||||
WORD dmDriverVersion;
|
||||
WORD dmSize;
|
||||
WORD dmDriverExtra;
|
||||
DWORD dmFields;
|
||||
union {
|
||||
struct {
|
||||
short dmOrientation;
|
||||
short dmPaperSize;
|
||||
short dmPaperLength;
|
||||
short dmPaperWidth;
|
||||
short dmScale;
|
||||
short dmCopies;
|
||||
short dmDefaultSource;
|
||||
short dmPrintQuality;
|
||||
} a;
|
||||
struct {
|
||||
POINTL dmPosition;
|
||||
DWORD dmDisplayOrientation;
|
||||
DWORD dmDisplayFixedOutput;
|
||||
} b;
|
||||
} c;
|
||||
short dmColor;
|
||||
short dmDuplex;
|
||||
short dmYResolution;
|
||||
short dmTTOption;
|
||||
short dmCollate;
|
||||
BYTE dmFormName[32];
|
||||
WORD dmLogPixels;
|
||||
DWORD dmBitsPerPel;
|
||||
DWORD dmPelsWidth;
|
||||
DWORD dmPelsHeight;
|
||||
union {
|
||||
DWORD dmDisplayFlags;
|
||||
DWORD dmNup;
|
||||
};
|
||||
DWORD dmDisplayFrequency;
|
||||
} DEVMODE;
|
||||
|
||||
typedef struct tagPIXELFORMATDESCRIPTOR
|
||||
{
|
||||
WORD nSize;
|
||||
WORD nVersion;
|
||||
DWORD dwFlags;
|
||||
BYTE iPixelType;
|
||||
BYTE cColorBits;
|
||||
BYTE cRedBits;
|
||||
BYTE cRedShift;
|
||||
BYTE cGreenBits;
|
||||
BYTE cGreenShift;
|
||||
BYTE cBlueBits;
|
||||
BYTE cBlueShift;
|
||||
BYTE cAlphaBits;
|
||||
BYTE cAlphaShift;
|
||||
BYTE cAccumBits;
|
||||
BYTE cAccumRedBits;
|
||||
BYTE cAccumGreenBits;
|
||||
BYTE cAccumBlueBits;
|
||||
BYTE cAccumAlphaBits;
|
||||
BYTE cDepthBits;
|
||||
BYTE cStencilBits;
|
||||
BYTE cAuxBuffers;
|
||||
BYTE iLayerType;
|
||||
BYTE bReserved;
|
||||
DWORD dwLayerMask;
|
||||
DWORD dwVisibleMask;
|
||||
DWORD dwDamageMask;
|
||||
} PIXELFORMATDESCRIPTOR;
|
||||
|
||||
__declspec(dllimport) int WINAPI wglGetProcAddress(LPCSTR);
|
||||
__declspec(dllimport) HGLRC WINAPI wglCreateContext(HDC);
|
||||
__declspec(dllimport) long WINAPI wglMakeCurrent(HDC, HGLRC);
|
||||
__declspec(dllimport) HDC WINAPI GetDC(HWND hWnd);
|
||||
__declspec(dllimport) HWND WINAPI CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||
__declspec(dllimport) long WINAPI SetPixelFormat(HDC hdc, int format, const PIXELFORMATDESCRIPTOR * ppfd);
|
||||
__declspec(dllimport) int WINAPI ChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
__declspec(dllimport) int WINAPI ShowCursor(long bShow);
|
||||
__declspec(dllimport) long WINAPI SwapBuffers(HDC);
|
||||
__declspec(dllimport) short WINAPI GetAsyncKeyState(int vKey);
|
||||
__declspec(dllimport) __declspec(noreturn) void WINAPI ExitProcess(unsigned int uExitCode);
|
||||
__declspec(dllimport) long WINAPI ChangeDisplaySettingsA(DEVMODE* lpDevMode, DWORD dwFlags);
|
||||
__declspec(dllimport) void WINAPI OutputDebugStringA(LPCSTR lpOutputString);
|
||||
__declspec(dllimport) void WINAPI DebugBreak(VOID);
|
||||
|
||||
}
|
||||
292
4kgfx/src/4k.vcproj
Normal file
292
4kgfx/src/4k.vcproj
Normal file
@@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="4k"
|
||||
ProjectGUID="{478863DD-1156-47FF-8AE2-F7A923BB3998}"
|
||||
RootNamespace="My4k"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Compiling shaders..."
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
Outputs=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
FavorSizeOrSpeed="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="0"
|
||||
SmallerTypeCheck="true"
|
||||
RuntimeLibrary="3"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CallingConvention="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
AssemblyDebug="1"
|
||||
ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
EntryPointSymbol="main"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
StructMemberAlignment="5"
|
||||
BufferSecurityCheck="false"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
RuntimeTypeInfo="false"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
EntryPointSymbol="main"
|
||||
RandomizedBaseAddress="0"
|
||||
DataExecutionPrevention="0"
|
||||
ErrorReporting="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Crinkler|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
StructMemberAlignment="5"
|
||||
BufferSecurityCheck="false"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="0"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/CRINKLER /COMPMODE:SLOW /PROGRESSGUI /REPORT:Report.html /HASHSIZE:200 /ORDERTRIES:2000"
|
||||
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
EntryPointSymbol="main"
|
||||
RandomizedBaseAddress="0"
|
||||
DataExecutionPrevention="0"
|
||||
ErrorReporting="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\4kcpu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\intro.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\objects.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
94
4kgfx/src/4kcpu.cpp
Normal file
94
4kgfx/src/4kcpu.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#define XRES 640
|
||||
#define YRES 480
|
||||
#define MAX_OBJECTS 64
|
||||
#define MEMORY 65536
|
||||
#define BLOCKSIZE 64
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include "intro.h"
|
||||
|
||||
#pragma bss_seg(".zero")
|
||||
static int colorBuffer[XRES * YRES];
|
||||
static __declspec(align(16)) char memoryBuffer[MEMORY];
|
||||
static char* freeMemory;
|
||||
|
||||
#pragma data_seg(".blockindex")
|
||||
static __declspec(align(32)) volatile LONG currentPixel = -1;
|
||||
|
||||
#pragma data_seg(".aspectratio")
|
||||
static const float aspectRatio = 1.33f;
|
||||
|
||||
#ifdef _DEBUG
|
||||
static int gi_MemoryRemaining = MEMORY;
|
||||
#endif
|
||||
|
||||
#pragma data_seg(".bitmapinfo")
|
||||
static BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), XRES, -YRES, 1, 32, BI_RGB, 0, 0, 0, 0, 0}, {0, 0, 0, 0}};
|
||||
|
||||
#pragma data_seg(".devmode")
|
||||
static DEVMODE screenSettings = {{0}, 0, 0, 156, 0, 0x001c0000, {0}, 0, 0, 0, 0, 0, {0}, 0, 32, XRES, YRES, {0}, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
#pragma code_seg(".operator_new")
|
||||
void* __cdecl operator new(unsigned int ai_Size)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (gi_MemoryRemaining - (int)ai_Size < 0)
|
||||
{
|
||||
*((char*)0) = 0; // another way to crash
|
||||
}
|
||||
gi_MemoryRemaining -= ai_Size;
|
||||
#endif
|
||||
|
||||
_asm push freeMemory
|
||||
_asm mov eax, freeMemory
|
||||
_asm add eax, ai_Size
|
||||
_asm mov freeMemory, eax
|
||||
_asm pop eax
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_intro_render")
|
||||
DWORD intro_render(LPVOID av_Param_)
|
||||
{
|
||||
int myPixel;
|
||||
do
|
||||
{
|
||||
myPixel = ::InterlockedIncrement(¤tPixel);
|
||||
|
||||
int x = myPixel % XRES;
|
||||
int y = YRES - myPixel / XRES;
|
||||
vec d = normalize(_vec((2.0f * x / XRES - 1.0f) * aspectRatio, 2.0f * y / YRES - 1.0f, -1.0f));
|
||||
vec o = _vec(0.0f, 0.0f, 5.0f);
|
||||
vec color = intro_render(o, d);
|
||||
|
||||
*(colorBuffer + myPixel) = clamp(color, 0.0f, 1.0f).ToInt32();
|
||||
} while (currentPixel < XRES*YRES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_main")
|
||||
void _cdecl main(void)
|
||||
{
|
||||
//ChangeDisplaySettings(&screenSettings, CDS_FULLSCREEN); ShowCursor(0);
|
||||
HDC hDC=GetDC(CreateWindowEx(0,"static",0,WS_VISIBLE|WS_POPUP|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,0,0,XRES,YRES,0,0,0,0));
|
||||
freeMemory = memoryBuffer;
|
||||
|
||||
intro_init();
|
||||
|
||||
SYSTEM_INFO lr_SysInfo;
|
||||
::GetSystemInfo(&lr_SysInfo);
|
||||
do
|
||||
{
|
||||
::CreateThread(0, 0, intro_render, 0, 0, 0);
|
||||
} while (--lr_SysInfo.dwNumberOfProcessors);
|
||||
do
|
||||
{
|
||||
::StretchDIBits(hDC,0,0,XRES,YRES,0,0,XRES,YRES,colorBuffer,&bmi,DIB_RGB_COLORS,SRCCOPY);
|
||||
} while(!GetAsyncKeyState(VK_ESCAPE));
|
||||
::ExitProcess(0);
|
||||
}
|
||||
// /CRINKLER /COMPMODE:SLOW /PROGRESSGUI /ORDERTRIES:1000 /HASHSIZE:200 /REPORT:Report.html
|
||||
// /CRINKLER /COMPMODE:FAST /PROGRESSGUI /ORDERTRIES:100 /HASHSIZE:200 /REPORT:Report.html
|
||||
96
4kgfx/src/intro.h
Normal file
96
4kgfx/src/intro.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib.h"
|
||||
#include "objects.h"
|
||||
|
||||
|
||||
#pragma bss_seg(".introzero")
|
||||
static r_Object* gr_Objects_[255];
|
||||
static vec vectorZero;
|
||||
|
||||
#pragma data_seg(".introcolors")
|
||||
float colorGray[] = {0.5f, 0.5f, 0.5f, 0.0f};
|
||||
float colorLightBlue[] = {0.4f, 0.5f, 0.8f, 0.0f};
|
||||
float colorLightGray[] = {0.8f, 0.8f, 0.8f, 0.0f};
|
||||
float colorLightRed[] = {0.8f, 0.5f, 0.4f, 0.0f};
|
||||
float colorBrown[] = {0.4f, 0.3f, 0.2f, 0.0f};
|
||||
|
||||
#pragma data_seg(".introvectors")
|
||||
float vectorCylinder[] = {1.0f, 0.0f, 1.0f, 0.0f};
|
||||
float vectorPlane1[] = {0.0f, 1.0f, 0.4f, 0.0f};
|
||||
float vectorPlane2[] = {0.4f, -0.3f, 0.9f, 0.0f};
|
||||
|
||||
#pragma data_seg(".intropositions")
|
||||
float positionCylinder[] = {0.0f, -1.0f, 0.5f, 0.0f};
|
||||
float positionPlane1[] = {0.0f, -3.0f, 0.0f, 0.0f};
|
||||
float positionPlane2[] = {0.0f, 0.0f, -10.0f, 0.0f};
|
||||
|
||||
#pragma data_seg(".introvalues")
|
||||
float sphereRadius = 2.0f;
|
||||
float cylinderRadius = 0.5f;
|
||||
float specularValue = 16.0f;
|
||||
|
||||
#pragma code_seg(".intro_init")
|
||||
__forceinline void intro_init()
|
||||
{
|
||||
gr_Objects_[0] = new r_Sphere(new _vec(vectorZero), sphereRadius, new r_Material(new _vec(colorGray), new _vec(colorLightBlue), new _vec(colorLightGray), specularValue));
|
||||
gr_Objects_[1] = new r_Cylinder(new _vec(normalize(_vec(vectorCylinder))), new _vec(positionCylinder), cylinderRadius, new r_Material(new _vec(colorGray), new _vec(colorLightRed), new _vec(colorLightGray), specularValue));
|
||||
gr_Objects_[2] = new r_Plane(new _vec(normalize(_vec(vectorPlane1))), new _vec(positionPlane1), new r_Material(new _vec(colorGray), new _vec(colorBrown), new _vec(colorGray), specularValue));
|
||||
gr_Objects_[3] = new r_Plane(new _vec(normalize(_vec(vectorPlane2))), new _vec(positionPlane2), new r_Material(new _vec(colorGray), new _vec(colorBrown), new _vec(colorGray), specularValue));
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".get_NearestObject")
|
||||
void get_NearestObject(_vec& p, r_Object** ar_Object__, float* af_Distance)
|
||||
{
|
||||
r_Object** lr_Object__ = gr_Objects_;
|
||||
r_Object* lr_NearestObject_ = NULL;
|
||||
float lf_MinDistance = 1024.0f;
|
||||
|
||||
// Evaluate distance field:
|
||||
while (*lr_Object__)
|
||||
{
|
||||
*af_Distance = (*lr_Object__)->get_Distance(p);
|
||||
if (*af_Distance < lf_MinDistance)
|
||||
{
|
||||
lr_NearestObject_ = *lr_Object__;
|
||||
lf_MinDistance = *af_Distance;
|
||||
}
|
||||
++lr_Object__;
|
||||
}
|
||||
|
||||
*af_Distance = lf_MinDistance;
|
||||
*ar_Object__ = lr_NearestObject_;
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".get_HitObject")
|
||||
void get_HitObject(_vec& ro, _vec& rd, _vec* hitpoint, r_Object** ar_Object__)
|
||||
{
|
||||
float lf_Distance;
|
||||
vec p = ro;
|
||||
int li_Iterations = 1024;
|
||||
// Raymarch:
|
||||
do
|
||||
{
|
||||
get_NearestObject(p, ar_Object__, &lf_Distance);
|
||||
p += rd * lf_Distance;
|
||||
} while (lf_Distance > 0.001f && li_Iterations--);
|
||||
if (lf_Distance > 0.001f)
|
||||
*ar_Object__ = NULL;
|
||||
else
|
||||
*hitpoint = p;
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".intro_render")
|
||||
__forceinline vec intro_render(_vec& ro, _vec& rd)
|
||||
{
|
||||
r_Object* lr_HitObject_ = NULL;
|
||||
vec hitPoint;
|
||||
get_HitObject(ro, rd, &hitPoint, &lr_HitObject_);
|
||||
if (lr_HitObject_ == NULL)
|
||||
return _vec(1,1,1);
|
||||
|
||||
return *lr_HitObject_->mr_Material_->mr_Diffuse_ * dot(-lr_HitObject_->get_Normal(hitPoint), rd);
|
||||
}
|
||||
400
4kgfx/src/lib.h
Normal file
400
4kgfx/src/lib.h
Normal file
@@ -0,0 +1,400 @@
|
||||
#pragma once
|
||||
#include <intrin.h>
|
||||
|
||||
#pragma data_seg(".const_eps")
|
||||
static const float eps = 0.001f;
|
||||
|
||||
#pragma code_seg(".func_pow")
|
||||
float pow(float x, float y)
|
||||
{
|
||||
float r;
|
||||
__asm
|
||||
{
|
||||
fld y
|
||||
fld x
|
||||
fyl2x
|
||||
fld1
|
||||
fld st(1)
|
||||
fprem
|
||||
f2xm1
|
||||
faddp st(1),st
|
||||
fscale
|
||||
fxch st(1)
|
||||
fstp st(0)
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_sqrt")
|
||||
__inline float sqrt(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fsqrt
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_sin")
|
||||
__inline float sin(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fsin
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_cos")
|
||||
__inline float cos(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fcos
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_fabs")
|
||||
__inline float fabs(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fabs
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_smoothstep")
|
||||
float smoothstep(float x, float a, float b)
|
||||
{
|
||||
if (x<a) return 0.0f;
|
||||
if (x>b) return 1.0f;
|
||||
x = (x-a)/(b-a);
|
||||
return x*x*(3.0f-2.0f*x);
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_memcopy")
|
||||
void memcopy(void* av_Dest_, const void* av_Src_, size_t ai_Size)
|
||||
{
|
||||
__asm mov esi, av_Src_
|
||||
__asm mov edi, av_Dest_
|
||||
__asm mov ecx, ai_Size
|
||||
__asm rep movsb
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_pi")
|
||||
float pi()
|
||||
{
|
||||
__asm fldpi
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_exp2")
|
||||
float exp2(float f)
|
||||
{
|
||||
_asm fld dword ptr [f]
|
||||
_asm fld1
|
||||
_asm fld st(1)
|
||||
_asm fprem
|
||||
_asm f2xm1
|
||||
_asm faddp st(1), st
|
||||
_asm fscale
|
||||
_asm fstp st(1)
|
||||
_asm fstp dword ptr [f]
|
||||
return f;
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_floor")
|
||||
int ftol(float x)
|
||||
{
|
||||
x -= 0.5f;
|
||||
int t;
|
||||
_asm fld x
|
||||
_asm fistp t
|
||||
return t;
|
||||
}
|
||||
|
||||
#pragma code_seg(".struct_vec")
|
||||
#define vec __declspec(align(16)) _vec
|
||||
struct vec
|
||||
{
|
||||
union
|
||||
{
|
||||
struct __declspec(align(16))
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
__declspec(align(16)) float m[4];
|
||||
};
|
||||
|
||||
vec():x(0),y(0),z(0),w(0){};
|
||||
vec(const _vec& arg):x(arg.x),y(arg.y),z(arg.z),w(arg.w){};
|
||||
vec(float X, float Y, float Z, float W = 0.0f):x(X),y(Y),z(Z),w(W){};
|
||||
vec(float a):x(a),y(a),z(a),w(0){};
|
||||
vec(const float* arg){memcopy(m, arg, 16);};
|
||||
vec(const __m128& arg){_mm_store_ps(m, arg);};
|
||||
|
||||
int ToInt32() const
|
||||
{
|
||||
return (((ftol(255 * x) << 8) + ftol(255 * y)) << 8) + ftol(255 * z);
|
||||
}
|
||||
|
||||
operator __m128() const
|
||||
{
|
||||
return _mm_load_ps(m);
|
||||
}
|
||||
|
||||
vec operator + (const _vec& arg) const
|
||||
{
|
||||
return _mm_add_ps(_mm_load_ps(m), _mm_load_ps(arg.m));
|
||||
}
|
||||
|
||||
vec operator + (float arg) const
|
||||
{
|
||||
return *this + _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void operator += (const _vec& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_add_ps(*this, arg));
|
||||
}
|
||||
|
||||
void operator += (float arg)
|
||||
{
|
||||
*this += _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec operator - (const _vec& arg) const
|
||||
{
|
||||
return _mm_sub_ps(*this, arg);
|
||||
}
|
||||
|
||||
vec operator - (float arg) const
|
||||
{
|
||||
return *this - _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void operator -= (const _vec& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_sub_ps(*this, arg));
|
||||
}
|
||||
|
||||
void operator -= (float arg)
|
||||
{
|
||||
*this -= _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec operator * (const _vec& arg) const
|
||||
{
|
||||
return _mm_mul_ps(*this, arg);
|
||||
}
|
||||
|
||||
vec operator * (float arg) const
|
||||
{
|
||||
return *this * _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void operator *= (const _vec& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_mul_ps(*this, arg));
|
||||
}
|
||||
|
||||
void operator *= (float arg)
|
||||
{
|
||||
*this *= _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec operator / (float arg) const
|
||||
{
|
||||
return *this * _mm_set_ps1(1.0f / arg);
|
||||
}
|
||||
|
||||
void operator /= (float arg)
|
||||
{
|
||||
*this *= _mm_set_ps1(1.0f / arg);
|
||||
}
|
||||
|
||||
vec operator -() const
|
||||
{
|
||||
return *this * -1.0f;
|
||||
}
|
||||
};
|
||||
|
||||
#pragma code_seg(".align")
|
||||
__inline vec align(_vec& arg)
|
||||
{
|
||||
return arg;
|
||||
};
|
||||
|
||||
|
||||
#pragma code_seg(".struct_material")
|
||||
struct r_Material
|
||||
{
|
||||
r_Material() {};
|
||||
r_Material(_vec* ar_Ambient_, _vec* ar_Diffuse_, _vec* ar_Specular_, float af_Shininess)
|
||||
: mr_Ambient_(ar_Ambient_)
|
||||
, mr_Diffuse_(ar_Diffuse_)
|
||||
, mr_Specular_(ar_Specular_)
|
||||
, mf_Shininess(af_Shininess)
|
||||
{
|
||||
}
|
||||
|
||||
vec* mr_Ambient_;
|
||||
vec* mr_Diffuse_;
|
||||
vec* mr_Specular_;
|
||||
float mf_Shininess;
|
||||
};
|
||||
|
||||
#pragma code_seg(".func_dot")
|
||||
float dot(const _vec& arg1, const _vec& arg2)
|
||||
{
|
||||
__m128 temp = _mm_mul_ps(arg1, arg2);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
return temp.m128_f32[0];
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_length")
|
||||
float length(_vec& arg)
|
||||
{
|
||||
return sqrt(dot(arg, arg));
|
||||
}
|
||||
|
||||
#pragma code_seg(".func_normalize")
|
||||
vec normalize(_vec& arg)
|
||||
{
|
||||
return arg * _mm_rsqrt_ss(_mm_set_ps1(dot(arg,arg))).m128_f32[0];
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_mix")
|
||||
vec mix(_vec& arg1, _vec& arg2, float t)
|
||||
{
|
||||
return arg1 * (1.0f - t) + arg2 * t;
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_clamp1")
|
||||
vec clamp(_vec& arg, float lo, float hi)
|
||||
{
|
||||
return _mm_max_ps(_mm_min_ps(arg, _mm_set_ps1(hi)), _mm_set_ps1(lo));
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_clamp2")
|
||||
float clamp(float arg, float lo, float hi)
|
||||
{
|
||||
return max(min(arg, hi), lo);
|
||||
}
|
||||
|
||||
|
||||
#pragma code_seg(".func_reflect")
|
||||
vec reflect(_vec& arg1, _vec& arg2)
|
||||
{
|
||||
return arg1 - arg2 * 2.0f * dot(arg2, arg1);
|
||||
}
|
||||
|
||||
#pragma data_seg(".struct_mat")
|
||||
#define mat __declspec(align(16)) _mat
|
||||
//struct mat
|
||||
//{
|
||||
// union
|
||||
// {
|
||||
// struct __declspec(align(16))
|
||||
// {
|
||||
// vec r1;
|
||||
// vec r2;
|
||||
// vec r3;
|
||||
// vec r4;
|
||||
// };
|
||||
// __declspec(align(16)) float m[16];
|
||||
// };
|
||||
//
|
||||
// mat():r1(1,0,0,0),r2(0,1,0,0),r3(0,0,1,0),r4(0,0,0,1){};
|
||||
// mat(const _mat& arg):r1(arg.r1),r2(arg.r2),r3(arg.r3),r4(arg.r4){};
|
||||
// mat(const _vec& R1, const _vec& R2, const _vec& R3, const _vec& R4):r1(R1),r2(R2),r3(R3),r4(R4){};
|
||||
//
|
||||
// vec operator * (const _vec& arg) const
|
||||
// {
|
||||
// return _vec(dot(r1, arg), dot(r2, arg), dot(r3, arg), dot(r4, arg));
|
||||
// }
|
||||
//
|
||||
// mat operator * (const _mat& arg) const
|
||||
// {
|
||||
// return _mat(
|
||||
// *this * arg.r1,
|
||||
// *this * arg.r2,
|
||||
// *this * arg.r3,
|
||||
// *this * arg.r4);
|
||||
// }
|
||||
//
|
||||
// void operator *= (const _mat& arg)
|
||||
// {
|
||||
// r1 = *this * arg.r1;
|
||||
// r2 = *this * arg.r2;
|
||||
// r3 = *this * arg.r3;
|
||||
// r4 = *this * arg.r4;
|
||||
// }
|
||||
//
|
||||
// static mat rotateX(float af_Rad)
|
||||
// {
|
||||
// float s = sin(af_Rad);
|
||||
// float c = cos(af_Rad);
|
||||
// return _mat(
|
||||
// _vec(1,0,0,0),
|
||||
// _vec(0,c,-s,0),
|
||||
// _vec(0,s,c,0),
|
||||
// _vec(0,0,0,1));
|
||||
// }
|
||||
//
|
||||
// static mat rotateY(float af_Rad)
|
||||
// {
|
||||
// float s = sin(af_Rad);
|
||||
// float c = cos(af_Rad);
|
||||
// return _mat(
|
||||
// _vec(c,0,s,0),
|
||||
// _vec(0,1,0,0),
|
||||
// _vec(-s,0,c,0),
|
||||
// _vec(0,0,0,1));
|
||||
// }
|
||||
//
|
||||
// static mat rotateZ(float af_Rad)
|
||||
// {
|
||||
// float s = sin(af_Rad);
|
||||
// float c = cos(af_Rad);
|
||||
// return _mat(
|
||||
// _vec(c,-s,0,0),
|
||||
// _vec(s,c,0,0),
|
||||
// _vec(0,0,1,0),
|
||||
// _vec(0,0,0,1));
|
||||
// }
|
||||
//
|
||||
// static mat scale(float s)
|
||||
// {
|
||||
// return _mat(
|
||||
// _vec(s,0,0,0),
|
||||
// _vec(0,s,0,0),
|
||||
// _vec(0,0,s,0),
|
||||
// _vec(0,0,0,1));
|
||||
// }
|
||||
//
|
||||
// mat transpose(const _mat& arg) const
|
||||
// {
|
||||
// return _mat(
|
||||
// _vec(arg.r1.x, arg.r2.x, arg.r3.x, arg.r4.x),
|
||||
// _vec(arg.r1.y, arg.r2.y, arg.r3.y, arg.r4.y),
|
||||
// _vec(arg.r1.z, arg.r2.z, arg.r3.z, arg.r4.z),
|
||||
// _vec(arg.r1.w, arg.r2.w, arg.r3.w, arg.r4.w));
|
||||
// }
|
||||
//};
|
||||
//
|
||||
#pragma data_seg(".seed")
|
||||
static unsigned long seed=0x80808080;
|
||||
|
||||
#pragma code_seg(".randseed")
|
||||
void randseed(unsigned long x)
|
||||
{
|
||||
seed = x;
|
||||
}
|
||||
|
||||
#pragma code_seg(".frand")
|
||||
float frand()
|
||||
{
|
||||
seed=seed*0x76364873+1234567;
|
||||
return (float)(seed&0x7FFFFFFF)*(const float)(2.0f/(float)0x7FFFFFFF)-1.0f;
|
||||
}
|
||||
107
4kgfx/src/objects.h
Normal file
107
4kgfx/src/objects.h
Normal file
@@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#pragma data_seg(".struct_object")
|
||||
struct r_Object
|
||||
{
|
||||
r_Material* mr_Material_;
|
||||
|
||||
r_Object(r_Material* ar_Material_)
|
||||
: mr_Material_(ar_Material_)
|
||||
{
|
||||
}
|
||||
|
||||
virtual float get_Distance(const _vec& ar_Point) = 0;
|
||||
virtual vec get_Normal(const _vec& ar_Point) = 0;
|
||||
virtual vec get_AltNormal(const _vec& ar_Point)
|
||||
{
|
||||
vec e1,e2,e3;
|
||||
e1.x=e2.y=e3.z=eps;
|
||||
|
||||
return normalize(_vec(
|
||||
get_Distance(ar_Point+e1) - get_Distance(ar_Point-e1),
|
||||
get_Distance(ar_Point+e2) - get_Distance(ar_Point-e2),
|
||||
get_Distance(ar_Point+e3) - get_Distance(ar_Point-e3)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#pragma data_seg(".struct_sphere")
|
||||
struct r_Sphere : r_Object
|
||||
{
|
||||
vec* mr_Center_;
|
||||
float mf_Radius;
|
||||
|
||||
r_Sphere(_vec* ar_Center_, float af_Radius, r_Material* ar_Material_)
|
||||
: r_Object(ar_Material_)
|
||||
, mr_Center_(ar_Center_)
|
||||
, mf_Radius(af_Radius)
|
||||
{
|
||||
};
|
||||
|
||||
virtual float get_Distance(const _vec& ar_Point)
|
||||
{
|
||||
return length(*mr_Center_ - ar_Point) - mf_Radius;
|
||||
}
|
||||
|
||||
virtual vec get_Normal(const _vec& ar_Point)
|
||||
{
|
||||
return normalize(ar_Point - *mr_Center_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#pragma data_seg(".struct_plane")
|
||||
struct r_Plane : r_Object
|
||||
{
|
||||
vec* mr_Normal_;
|
||||
vec* mr_Origin_;
|
||||
|
||||
r_Plane(_vec* ar_Normal_, _vec* ar_Origin_, r_Material* ar_Material_)
|
||||
: r_Object(ar_Material_)
|
||||
, mr_Normal_(ar_Normal_)
|
||||
, mr_Origin_(ar_Origin_)
|
||||
{
|
||||
*mr_Normal_ = normalize(*mr_Normal_);
|
||||
};
|
||||
|
||||
virtual float get_Distance(const _vec& ar_Point)
|
||||
{
|
||||
return dot(*mr_Normal_, ar_Point - *mr_Origin_);
|
||||
}
|
||||
|
||||
virtual vec get_Normal(const _vec& ar_Point)
|
||||
{
|
||||
return *mr_Normal_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#pragma data_seg(".struct_cylinder")
|
||||
struct r_Cylinder : r_Object
|
||||
{
|
||||
vec* mr_Direction_;
|
||||
vec* mr_Center_;
|
||||
float mf_Radius;
|
||||
|
||||
r_Cylinder(_vec* ar_Direction_, _vec* ar_Center_, float af_Radius, r_Material* ar_Material_)
|
||||
: r_Object(ar_Material_)
|
||||
, mr_Direction_(ar_Direction_)
|
||||
, mr_Center_(ar_Center_)
|
||||
, mf_Radius(af_Radius)
|
||||
{
|
||||
*ar_Direction_ = normalize(*ar_Direction_);
|
||||
};
|
||||
|
||||
virtual float get_Distance(const _vec& ar_Point)
|
||||
{
|
||||
vec bP = *mr_Center_ + *mr_Direction_ * dot(ar_Point - *mr_Center_, *mr_Direction_);
|
||||
return length(ar_Point - bP) - mf_Radius;
|
||||
}
|
||||
|
||||
virtual vec get_Normal(const _vec& ar_Point)
|
||||
{
|
||||
vec bP = *mr_Center_ + *mr_Direction_ * dot(ar_Point - *mr_Center_, *mr_Direction_);
|
||||
return normalize(ar_Point - bP);
|
||||
}
|
||||
};
|
||||
3
4kgfx/stdafx.cpp
Normal file
3
4kgfx/stdafx.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
unsigned int currentProgramId;
|
||||
10
4kgfx/stdafx.h
Normal file
10
4kgfx/stdafx.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "smallwin.h"
|
||||
#include <GL/gl.h>
|
||||
#include "glext.h"
|
||||
#include "vecmath.h"
|
||||
#include "ogl3.h"
|
||||
#include "mesh.h"
|
||||
|
||||
extern unsigned int currentProgramId;
|
||||
663
4kgfx/vecmath.cpp
Normal file
663
4kgfx/vecmath.cpp
Normal file
@@ -0,0 +1,663 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
float pi()
|
||||
{
|
||||
__asm fldpi
|
||||
}
|
||||
|
||||
void memclear(void* dest, size_t _size)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
xor eax, eax
|
||||
mov edi, dest
|
||||
mov ecx, _size
|
||||
rep stosb
|
||||
}
|
||||
}
|
||||
|
||||
void* memcpy(void* dest, const void* source, size_t _size)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov esi, source
|
||||
mov edi, dest
|
||||
mov ecx, _size
|
||||
rep movsb
|
||||
}
|
||||
}
|
||||
|
||||
size_t strlen(const char* string)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
xor ecx, ecx
|
||||
mov edi, string
|
||||
not ecx
|
||||
xor al, al
|
||||
cld
|
||||
repne scasb
|
||||
not ecx
|
||||
lea eax, [ecx-1]
|
||||
}
|
||||
}
|
||||
|
||||
float pow(float x, float y)
|
||||
{
|
||||
float r;
|
||||
__asm
|
||||
{
|
||||
fld y
|
||||
fld x
|
||||
fyl2x
|
||||
fld1
|
||||
fld st(1)
|
||||
fprem
|
||||
f2xm1
|
||||
faddp st(1),st
|
||||
fscale
|
||||
fxch st(1)
|
||||
fstp st(0)
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
float sqrt(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fsqrt
|
||||
}
|
||||
|
||||
float sin(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fsin
|
||||
}
|
||||
|
||||
float cos(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fcos
|
||||
}
|
||||
|
||||
float fabs(float x)
|
||||
{
|
||||
__asm fld x
|
||||
__asm fabs
|
||||
}
|
||||
|
||||
float tan(float f)
|
||||
{
|
||||
return sin(f) / cos(f);
|
||||
}
|
||||
|
||||
float smoothstep(float x, float a, float b)
|
||||
{
|
||||
if (x<a) return 0.0f;
|
||||
if (x>b) return 1.0f;
|
||||
x = (x-a)/(b-a);
|
||||
return x*x*(3.0f-2.0f*x);
|
||||
}
|
||||
|
||||
float exp2(float f)
|
||||
{
|
||||
_asm fld dword ptr [f]
|
||||
_asm fld1
|
||||
_asm fld st(1)
|
||||
_asm fprem
|
||||
_asm f2xm1
|
||||
_asm faddp st(1), st
|
||||
_asm fscale
|
||||
_asm fstp st(1)
|
||||
_asm fstp dword ptr [f]
|
||||
return f;
|
||||
}
|
||||
|
||||
unsigned long ftol(float x)
|
||||
{
|
||||
int t;
|
||||
_asm fld x
|
||||
_asm fistp t
|
||||
return t;
|
||||
}
|
||||
|
||||
long _ftol2_sse(float x)
|
||||
{
|
||||
*((char*)0) = 0; // If it breaks here, it's because you have a cast to (int) somewhere. Use ftol for float-to-int casts.
|
||||
return ftol(x);
|
||||
}
|
||||
|
||||
float min(float a, float b)
|
||||
{
|
||||
if (a < b) return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
float max(float a, float b)
|
||||
{
|
||||
if (a > b) return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
int _fltused = 1;
|
||||
}
|
||||
|
||||
vec4::vec4():x(0),y(0),z(0),w(0){};
|
||||
vec4::vec4(const vec4& arg):x(arg.x),y(arg.y),z(arg.z),w(arg.w){};
|
||||
vec4::vec4(float X, float Y, float Z, float W):x(X),y(Y),z(Z),w(W){};
|
||||
vec4::vec4(float a):x(a),y(a),z(a),w(0){};
|
||||
vec4::vec4(const float* arg){memcpy(m, arg, 16);};
|
||||
vec4::vec4(const __m128& arg){_mm_store_ps(m, arg);};
|
||||
|
||||
int vec4::ToInt32() const
|
||||
{
|
||||
return (((ftol(255 * x) << 8) + ftol(255 * y)) << 8) + ftol(255 * z);
|
||||
}
|
||||
|
||||
vec4::operator __m128() const
|
||||
{
|
||||
return _mm_load_ps(m);
|
||||
}
|
||||
|
||||
float& vec4::operator[](int i)
|
||||
{
|
||||
return m[i];
|
||||
}
|
||||
|
||||
vec4 vec4::operator + (const vec4& arg) const
|
||||
{
|
||||
return _mm_add_ps(_mm_load_ps(m), _mm_load_ps(arg.m));
|
||||
}
|
||||
|
||||
vec4 vec4::operator + (float arg) const
|
||||
{
|
||||
return *this + _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void vec4::operator += (const vec4& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_add_ps(*this, arg));
|
||||
}
|
||||
|
||||
void vec4::operator += (float arg)
|
||||
{
|
||||
*this += _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator - (const vec4& arg) const
|
||||
{
|
||||
return _mm_sub_ps(*this, arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator - (float arg) const
|
||||
{
|
||||
return *this - _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void vec4::operator -= (const vec4& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_sub_ps(*this, arg));
|
||||
}
|
||||
|
||||
void vec4::operator -= (float arg)
|
||||
{
|
||||
*this -= _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator * (const vec4& arg) const
|
||||
{
|
||||
return _mm_mul_ps(*this, arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator * (float arg) const
|
||||
{
|
||||
return *this * _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
void vec4::operator *= (const vec4& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_mul_ps(*this, arg));
|
||||
}
|
||||
|
||||
void vec4::operator *= (float arg)
|
||||
{
|
||||
*this *= _mm_set_ps1(arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator / (float arg) const
|
||||
{
|
||||
return *this * _mm_set_ps1(1.0f / arg);
|
||||
}
|
||||
|
||||
void vec4::operator /= (float arg)
|
||||
{
|
||||
*this *= _mm_set_ps1(1.0f / arg);
|
||||
}
|
||||
|
||||
vec4 vec4::operator -() const
|
||||
{
|
||||
return *this * -1.0f;
|
||||
}
|
||||
|
||||
__inline vec4 align(vec4& arg)
|
||||
{
|
||||
return arg;
|
||||
};
|
||||
|
||||
float dot(const vec4& arg1, const vec4& arg2)
|
||||
{
|
||||
__m128 temp = _mm_mul_ps(arg1, arg2);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
return temp.m128_f32[0];
|
||||
}
|
||||
|
||||
float length(vec4& arg)
|
||||
{
|
||||
return sqrt(dot(arg, arg));
|
||||
}
|
||||
|
||||
vec4 normalize(vec4 const& arg)
|
||||
{
|
||||
return arg * _mm_rsqrt_ss(_mm_set_ps1(dot(arg,arg))).m128_f32[0];
|
||||
}
|
||||
|
||||
vec4 mix(vec4& arg1, vec4& arg2, float t)
|
||||
{
|
||||
return arg1 * (1.0f - t) + arg2 * t;
|
||||
}
|
||||
|
||||
vec4 clamp(vec4& arg, float lo, float hi)
|
||||
{
|
||||
return _mm_max_ps(_mm_min_ps(arg, _mm_set_ps1(hi)), _mm_set_ps1(lo));
|
||||
}
|
||||
|
||||
float clamp(float arg, float lo, float hi)
|
||||
{
|
||||
return max(min(arg, hi), lo);
|
||||
}
|
||||
|
||||
vec4 reflect(vec4& arg1, vec4& arg2)
|
||||
{
|
||||
return arg1 - arg2 * 2.0f * dot(arg2, arg1);
|
||||
}
|
||||
|
||||
vec4 cross(vec4& va, vec4& vb)
|
||||
{
|
||||
__m128 a = va;
|
||||
__m128 b = vb;
|
||||
__m128 ea = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 eb = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 xa = _mm_mul_ps(ea, eb);
|
||||
a = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
b = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 xb = _mm_mul_ps(a, b);
|
||||
return _mm_sub_ps(xa, xb);
|
||||
}
|
||||
|
||||
Quaternion::Quaternion()
|
||||
: x(0)
|
||||
, y(0)
|
||||
, z(0)
|
||||
, w(1)
|
||||
{
|
||||
};
|
||||
|
||||
Quaternion::Quaternion(const Quaternion& arg)
|
||||
: x(arg.x)
|
||||
, y(arg.y)
|
||||
, z(arg.z)
|
||||
, w(arg.w)
|
||||
{
|
||||
};
|
||||
|
||||
Quaternion::Quaternion(const float* M)
|
||||
{
|
||||
memcpy(m, M, 4 * sizeof(float));
|
||||
};
|
||||
|
||||
Quaternion::operator __m128() const
|
||||
{
|
||||
return _mm_load_ps(m);
|
||||
}
|
||||
|
||||
Quaternion::Quaternion(float X, float Y, float Z, float W, bool ab_Rotation)
|
||||
: x(X)
|
||||
, y(Y)
|
||||
, z(Z)
|
||||
, w(W)
|
||||
{
|
||||
if (ab_Rotation)
|
||||
{
|
||||
W *= pi();
|
||||
W /= 180.0;
|
||||
w = 0.0f;
|
||||
normalize();
|
||||
_mm_store_ps(m, _mm_mul_ps(*this, _mm_set_ps1(sin(W / 2.0f))));
|
||||
w = cos(W / 2.0f);
|
||||
}
|
||||
};
|
||||
|
||||
Quaternion::Quaternion(const __m128& arg)
|
||||
{
|
||||
_mm_store_ps(m, arg);
|
||||
};
|
||||
|
||||
Quaternion::operator float*()
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
Quaternion Quaternion::operator * (const Quaternion& arg) const
|
||||
{
|
||||
return _mm_set_ps(
|
||||
x * -arg.x - y * arg.y - z * arg.z * w * arg.w,
|
||||
x * -arg.y + y * arg.x + z * arg.w - w * arg.z,
|
||||
x * -arg.z - y * arg.w + z * arg.x + w * arg.y,
|
||||
x * -arg.w + y * arg.z - z * arg.y + w * arg.x);
|
||||
}
|
||||
|
||||
Quaternion Quaternion::operator -() const
|
||||
{
|
||||
return _mm_set_ps(-x, -y, -z, -w);
|
||||
}
|
||||
|
||||
void Quaternion::operator *= (const Quaternion& arg)
|
||||
{
|
||||
_mm_store_ps(m, *this * arg);
|
||||
}
|
||||
|
||||
void Quaternion::operator += (const Quaternion& arg)
|
||||
{
|
||||
_mm_store_ps(m, _mm_add_ps(*this, arg));
|
||||
}
|
||||
|
||||
void Quaternion::rotate (const Quaternion& arg)
|
||||
{
|
||||
_mm_store_ps(m, -arg * *this * arg);
|
||||
}
|
||||
|
||||
float Quaternion::lengthSquared() const
|
||||
{
|
||||
__m128 temp = _mm_mul_ps(*this, *this);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
temp = _mm_hadd_ps(temp, temp);
|
||||
return temp.m128_f32[0];
|
||||
}
|
||||
|
||||
float Quaternion::length() const
|
||||
{
|
||||
return sqrt(lengthSquared());
|
||||
}
|
||||
|
||||
void Quaternion::normalize()
|
||||
{
|
||||
_mm_store_ps(m, _mm_mul_ps(*this, _mm_set_ps1(_mm_rsqrt_ss(_mm_set_ps1(lengthSquared())).m128_f32[0])));
|
||||
}
|
||||
|
||||
Matrix::Matrix()
|
||||
: r1(1, 0, 0, 0)
|
||||
, r2(0, 1, 0, 0)
|
||||
, r3(0, 0, 1, 0)
|
||||
, r4(0, 0, 0, 1)
|
||||
{
|
||||
};
|
||||
|
||||
Matrix::Matrix(const Matrix& arg)
|
||||
: r1(arg.r1)
|
||||
, r2(arg.r2)
|
||||
, r3(arg.r3)
|
||||
, r4(arg.r4)
|
||||
{
|
||||
};
|
||||
|
||||
Matrix::Matrix(const vec4& R1, const vec4& R2, const vec4& R3, const vec4& R4)
|
||||
: r1(R1)
|
||||
, r2(R2)
|
||||
, r3(R3)
|
||||
, r4(R4)
|
||||
{
|
||||
};
|
||||
|
||||
Matrix::Matrix(const float* M)
|
||||
: r1(&M[0])
|
||||
, r2(&M[4])
|
||||
, r3(&M[8])
|
||||
, r4(&M[12])
|
||||
{
|
||||
};
|
||||
|
||||
Matrix::Matrix(const Quaternion& aQuaternion)
|
||||
{
|
||||
Quaternion lQuaterion(aQuaternion);
|
||||
float lf_Length2 = lQuaterion.lengthSquared();
|
||||
if (lf_Length2 != 1.0 && lf_Length2 != 0.0)
|
||||
{
|
||||
lQuaterion.normalize();
|
||||
}
|
||||
|
||||
float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2;
|
||||
|
||||
x2 = lQuaterion.m[0] + lQuaterion.m[0];
|
||||
y2 = lQuaterion.m[1] + lQuaterion.m[1];
|
||||
z2 = lQuaterion.m[2] + lQuaterion.m[2];
|
||||
|
||||
xx = lQuaterion.m[0] * x2;
|
||||
xy = lQuaterion.m[0] * y2;
|
||||
xz = lQuaterion.m[0] * z2;
|
||||
|
||||
yy = lQuaterion.m[1] * y2;
|
||||
yz = lQuaterion.m[1] * z2;
|
||||
zz = lQuaterion.m[2] * z2;
|
||||
|
||||
wx = lQuaterion.m[3] * x2;
|
||||
wy = lQuaterion.m[3] * y2;
|
||||
wz = lQuaterion.m[3] * z2;
|
||||
|
||||
r1 = vec4(1.0f - (yy + zz), xy - wz, xz + wy, 0.0f);
|
||||
r2 = vec4(xy + wz, 1.0f - (xx + zz), yz - wx, 0.0f);
|
||||
r3 = vec4(xz - wy, yz + wx, 1.0f - (xx + yy), 0.0f);
|
||||
r4 = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
};
|
||||
|
||||
float& Matrix::operator[](int i)
|
||||
{
|
||||
return m[i];
|
||||
}
|
||||
|
||||
vec4 Matrix::operator * (const vec4& arg) const
|
||||
{
|
||||
return vec4(dot(r1, arg), dot(r2, arg), dot(r3, arg), dot(r4, arg));
|
||||
}
|
||||
|
||||
Matrix Matrix::operator * (const Matrix& arg) const
|
||||
{
|
||||
Matrix temp;
|
||||
for (int i = 0; i < 4; ++i) // zeile
|
||||
{
|
||||
for (int j = 0; j < 4; ++j) // spalte
|
||||
{
|
||||
float value = 0;
|
||||
for (int k = 0; k < 4; ++k)
|
||||
{
|
||||
value += m[i*4+k] * arg.m[k*4+j];
|
||||
}
|
||||
temp.m[i*4+j] = value;
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
void Matrix::operator *= (const Matrix& arg)
|
||||
{
|
||||
Matrix lTemp = *this;
|
||||
r1 = lTemp * arg.r1;
|
||||
r2 = lTemp * arg.r2;
|
||||
r3 = lTemp * arg.r3;
|
||||
r4 = lTemp * arg.r4;
|
||||
}
|
||||
|
||||
Matrix Matrix::rotateX(float af_Rad)
|
||||
{
|
||||
float s = sin(af_Rad);
|
||||
float c = cos(af_Rad);
|
||||
return Matrix(
|
||||
vec4(1,0,0,0),
|
||||
vec4(0,c,-s,0),
|
||||
vec4(0,s,c,0),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
Matrix Matrix::rotateY(float af_Rad)
|
||||
{
|
||||
float s = sin(af_Rad);
|
||||
float c = cos(af_Rad);
|
||||
return Matrix(
|
||||
vec4(c,0,s,0),
|
||||
vec4(0,1,0,0),
|
||||
vec4(-s,0,c,0),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
Matrix Matrix::rotateZ(float af_Rad)
|
||||
{
|
||||
float s = sin(af_Rad);
|
||||
float c = cos(af_Rad);
|
||||
return Matrix(
|
||||
vec4(c,-s,0,0),
|
||||
vec4(s,c,0,0),
|
||||
vec4(0,0,1,0),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
Matrix Matrix::scale(float s)
|
||||
{
|
||||
return Matrix(
|
||||
vec4(s,0,0,0),
|
||||
vec4(0,s,0,0),
|
||||
vec4(0,0,s,0),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
Matrix Matrix::scale(const vec4& s)
|
||||
{
|
||||
return Matrix(
|
||||
vec4(s.x,0,0,0),
|
||||
vec4(0,s.y,0,0),
|
||||
vec4(0,0,s.z,0),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
Matrix Matrix::translate(const vec4& aTranslation)
|
||||
{
|
||||
return Matrix(
|
||||
vec4(1,0,0,aTranslation.x),
|
||||
vec4(0,1,0,aTranslation.y),
|
||||
vec4(0,0,1,aTranslation.z),
|
||||
vec4(0,0,0,1));
|
||||
}
|
||||
|
||||
void Matrix::transpose()
|
||||
{
|
||||
Matrix lTemp(
|
||||
vec4(r1.x, r2.x, r3.x, r4.x),
|
||||
vec4(r1.y, r2.y, r3.y, r4.y),
|
||||
vec4(r1.z, r2.z, r3.z, r4.z),
|
||||
vec4(r1.w, r2.w, r3.w, r4.w));
|
||||
r1 = lTemp.r1;
|
||||
r2 = lTemp.r2;
|
||||
r3 = lTemp.r3;
|
||||
r4 = lTemp.r4;
|
||||
}
|
||||
|
||||
float Matrix::Determinante2x2(float a1, float a2, float b1, float b2)
|
||||
{
|
||||
return a1 * b2 - b1 * a2;
|
||||
}
|
||||
|
||||
float Matrix::Determinante3x3( float a1, float a2, float a3,
|
||||
float b1, float b2, float b3,
|
||||
float c1, float c2, float c3)
|
||||
{
|
||||
return a1 * Determinante2x2( b2, b3, c2, c3 ) - b1 * Determinante2x2( a2, a3, c2, c3 ) + c1 * Determinante2x2( a2, a3, b2, b3 );
|
||||
}
|
||||
|
||||
void Matrix::inverse()
|
||||
{
|
||||
Matrix lResult;
|
||||
lResult.m[0] = Determinante3x3( m[5], m[9], m[13], m[6], m[10], m[14], m[7], m[11], m[15] );
|
||||
lResult.m[4] = -Determinante3x3( m[4], m[8], m[12], m[6], m[10], m[14], m[7], m[11], m[15] );
|
||||
lResult.m[8] = Determinante3x3( m[4], m[8], m[12], m[5], m[9], m[13], m[7], m[11], m[15] );
|
||||
lResult.m[12] = -Determinante3x3( m[4], m[8], m[12], m[5], m[9], m[13], m[6], m[10], m[14] );
|
||||
|
||||
lResult.m[1] = -Determinante3x3( m[1], m[9], m[13], m[2], m[10], m[14], m[3], m[11], m[15] );
|
||||
lResult.m[5] = Determinante3x3( m[0], m[8], m[12], m[2], m[10], m[14], m[3], m[11], m[15] );
|
||||
lResult.m[9] = -Determinante3x3( m[0], m[8], m[12], m[1], m[9], m[13], m[3], m[11], m[15] );
|
||||
lResult.m[13] = Determinante3x3( m[0], m[8], m[12], m[1], m[9], m[13], m[2], m[10], m[14] );
|
||||
|
||||
lResult.m[2] = Determinante3x3( m[1], m[5], m[13], m[2], m[6], m[14], m[3], m[7], m[15] );
|
||||
lResult.m[6] = -Determinante3x3( m[0], m[4], m[12], m[2], m[6], m[14], m[3], m[7], m[15] );
|
||||
lResult.m[10] = Determinante3x3( m[0], m[4], m[12], m[1], m[5], m[13], m[3], m[7], m[15] );
|
||||
lResult.m[14] = -Determinante3x3( m[0], m[4], m[12], m[1], m[5], m[13], m[2], m[6], m[14] );
|
||||
|
||||
lResult.m[3] = -Determinante3x3( m[1], m[5], m[9], m[2], m[6], m[10], m[3], m[7], m[11] );
|
||||
lResult.m[7] = Determinante3x3( m[0], m[4], m[8], m[2], m[6], m[10], m[3], m[7], m[11] );
|
||||
lResult.m[11] = -Determinante3x3( m[0], m[4], m[8], m[1], m[5], m[9], m[3], m[7], m[11] );
|
||||
lResult.m[15] = Determinante3x3( m[0], m[4], m[8], m[1], m[5], m[9], m[2], m[6], m[10] );
|
||||
|
||||
float lf_Det = (m[0] * lResult.m[0]) + (m[1] * lResult.m[4]) + (m[2] * lResult.m[8]) + (m[3] * lResult.m[12]);
|
||||
if (lf_Det == 0.0f)
|
||||
return; // matrix is singular
|
||||
|
||||
lf_Det = 1.0f / lf_Det;
|
||||
|
||||
*this = lResult;
|
||||
|
||||
m[0] *= lf_Det;
|
||||
m[4] *= lf_Det;
|
||||
m[8] *= lf_Det;
|
||||
m[12] *= lf_Det;
|
||||
|
||||
m[1] *= lf_Det;
|
||||
m[5] *= lf_Det;
|
||||
m[9] *= lf_Det;
|
||||
m[13] *= lf_Det;
|
||||
|
||||
m[2] *= lf_Det;
|
||||
m[6] *= lf_Det;
|
||||
m[10] *= lf_Det;
|
||||
m[14] *= lf_Det;
|
||||
|
||||
m[3] *= lf_Det;
|
||||
m[7] *= lf_Det;
|
||||
m[11] *= lf_Det;
|
||||
m[15] *= lf_Det;
|
||||
}
|
||||
|
||||
Matrix Matrix::Perspective(float fov, float aspectRatio, float zNear, float zFar)
|
||||
{
|
||||
float f = 1.0f / tan(fov / 2.0f);
|
||||
float m = zNear - zFar;
|
||||
Matrix M(
|
||||
vec4(f / aspectRatio, 0, 0, 0),
|
||||
vec4(0, f, 0, 0),
|
||||
vec4(0, 0, (zFar + zNear) / m, (2 * zFar * zNear) / m),
|
||||
vec4(0, 0, -1, 0));
|
||||
return M;
|
||||
}
|
||||
|
||||
Matrix Matrix::LookAt(vec4& eye, vec4& center, vec4& up)
|
||||
{
|
||||
vec4 f = normalize(center - eye);
|
||||
vec4 u = normalize(up);
|
||||
vec4 s = cross(f, u);
|
||||
u = cross(s, f);
|
||||
s[3] = u[3] = f[3] = 0;
|
||||
Matrix M(s, u, -f, vec4(0, 0, 0, 1));
|
||||
//M.transpose();
|
||||
M *= Matrix::translate(-eye);
|
||||
return M;
|
||||
}
|
||||
147
4kgfx/vecmath.h
Normal file
147
4kgfx/vecmath.h
Normal file
@@ -0,0 +1,147 @@
|
||||
#pragma once
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
float pi();
|
||||
void* memcpy(void* dest, const void* source, size_t size);
|
||||
void memclear(void* dest, size_t size);
|
||||
size_t strlen(const char* string);
|
||||
|
||||
float pow(float x, float y);
|
||||
float sqrt(float x);
|
||||
float sin(float x);
|
||||
float cos(float x);
|
||||
float fabs(float x);
|
||||
float smoothstep(float x, float a, float b);
|
||||
float exp2(float f);
|
||||
float tan(float f);
|
||||
unsigned long ftol(float x);
|
||||
long _ftol2_sse(float x);
|
||||
float min(float a, float b);
|
||||
float max(float a, float b);
|
||||
}
|
||||
|
||||
struct __declspec(align(16)) vec4
|
||||
{
|
||||
union
|
||||
{
|
||||
struct __declspec(align(16))
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
__declspec(align(16)) float m[4];
|
||||
};
|
||||
|
||||
vec4();
|
||||
vec4(const vec4& arg);
|
||||
vec4(float X, float Y, float Z, float W = 0.0f);
|
||||
vec4(float a);
|
||||
vec4(const float* arg);
|
||||
vec4(const __m128& arg);
|
||||
|
||||
int ToInt32() const;
|
||||
operator __m128() const;
|
||||
float& operator[](int i);
|
||||
vec4 operator + (const vec4& arg) const;
|
||||
vec4 operator + (float arg) const;
|
||||
void operator += (const vec4& arg);
|
||||
void operator += (float arg);
|
||||
vec4 operator - (const vec4& arg) const;
|
||||
vec4 operator - (float arg) const;
|
||||
void operator -= (const vec4& arg);
|
||||
void operator -= (float arg);
|
||||
vec4 operator * (const vec4& arg) const;
|
||||
vec4 operator * (float arg) const;
|
||||
void operator *= (const vec4& arg);
|
||||
void operator *= (float arg);
|
||||
vec4 operator / (float arg) const;
|
||||
void operator /= (float arg);
|
||||
vec4 operator -() const;
|
||||
};
|
||||
|
||||
|
||||
struct __declspec(align(16)) Quaternion
|
||||
{
|
||||
union
|
||||
{
|
||||
struct __declspec(align(16))
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
__declspec(align(16)) float m[4];
|
||||
};
|
||||
|
||||
Quaternion();
|
||||
Quaternion(const Quaternion& arg);
|
||||
Quaternion(const float* M);
|
||||
operator __m128() const;
|
||||
Quaternion(float X, float Y, float Z, float W, bool ab_Rotation = false);
|
||||
Quaternion(const __m128& arg);
|
||||
operator float*();
|
||||
Quaternion operator * (const Quaternion& arg) const;
|
||||
Quaternion operator -() const;
|
||||
void operator *= (const Quaternion& arg);
|
||||
void operator += (const Quaternion& arg);
|
||||
void rotate (const Quaternion& arg);
|
||||
float lengthSquared() const;
|
||||
float length() const;
|
||||
void normalize();
|
||||
};
|
||||
|
||||
|
||||
struct __declspec(align(16)) Matrix
|
||||
{
|
||||
union
|
||||
{
|
||||
struct __declspec(align(16))
|
||||
{
|
||||
vec4 r1;
|
||||
vec4 r2;
|
||||
vec4 r3;
|
||||
vec4 r4;
|
||||
};
|
||||
__declspec(align(16)) float m[16];
|
||||
};
|
||||
|
||||
Matrix();
|
||||
Matrix(const Matrix& arg);
|
||||
Matrix(const vec4& R1, const vec4& R2, const vec4& R3, const vec4& R4);
|
||||
Matrix(const float* M);
|
||||
Matrix(const Quaternion& aQuaternion);
|
||||
float& operator[](int i);
|
||||
vec4 operator * (const vec4& arg) const;
|
||||
Matrix operator * (const Matrix& arg) const;
|
||||
void operator *= (const Matrix& arg);
|
||||
static Matrix rotateX(float af_Rad);
|
||||
static Matrix rotateY(float af_Rad);
|
||||
static Matrix rotateZ(float af_Rad);
|
||||
static Matrix scale(float s);
|
||||
static Matrix scale(const vec4& s);
|
||||
static Matrix translate(const vec4& aTranslation);
|
||||
static Matrix Perspective(float fov, float aspect, float near, float far);
|
||||
static Matrix LookAt(vec4& eye, vec4& center, vec4& up);
|
||||
void transpose();
|
||||
float Determinante2x2(float a1, float a2, float b1, float b2);
|
||||
float Determinante3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3);
|
||||
void inverse();
|
||||
};
|
||||
|
||||
__inline vec4 align(vec4& arg);
|
||||
__inline Quaternion align(Quaternion& arg);
|
||||
__inline Matrix align(Matrix& arg);
|
||||
float dot(const vec4& arg1, const vec4& arg2);
|
||||
float length(vec4& arg);
|
||||
vec4 normalize(vec4 const& arg);
|
||||
vec4 mix(vec4& arg1, vec4& arg2, float t);
|
||||
vec4 clamp(vec4& arg, float lo, float hi);
|
||||
float clamp(float arg, float lo, float hi);
|
||||
vec4 reflect(vec4& arg1, vec4& arg2);
|
||||
vec4 cross(vec4& a, vec4& b);
|
||||
897
4kgfx/wglext.h
Normal file
897
4kgfx/wglext.h
Normal file
@@ -0,0 +1,897 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* wglext.h last updated 2010/08/06 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define WGL_WGLEXT_VERSION 22
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_out
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#endif
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#endif
|
||||
#ifndef WGL_NV_present_video
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#endif
|
||||
#ifndef WGL_NV_video_output
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#endif
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
DECLARE_HANDLE(HPGPUNV);
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
|
||||
typedef struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
} GPU_DEVICE, *PGPU_DEVICE;
|
||||
#endif
|
||||
#ifndef WGL_NV_video_capture
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
extern int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
extern void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#endif
|
||||
|
||||
extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user