port from perforce
This commit is contained in:
70
Blu64k/Blu64k.sln
Normal file
70
Blu64k/Blu64k.sln
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blu64k", "src\Blu64k\Blu64k.vcxproj", "{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BluAuthor", "src\BluAuthor\BluAuthor.vcxproj", "{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BluDX11", "src\BluDX11\BluDX11.vcxproj", "{749ED417-3445-43CE-8B7C-E3B4786A817F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E} = {2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5} = {6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSGCompiler", "src\CSGCompiler\CSGCompiler.vcxproj", "{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSGCompiler.exe", "src\CSGCompiler.exe\CSGCompiler.exe.vcxproj", "{1AAB032F-3899-F48B-3401-17370F49CBE4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E} = {2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Authoring Debug|Win32 = Authoring Debug|Win32
|
||||
Authoring Release|Win32 = Authoring Release|Win32
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Authoring Debug|Win32.ActiveCfg = Authoring Debug|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Authoring Debug|Win32.Build.0 = Authoring Debug|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Authoring Release|Win32.ActiveCfg = Release|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}.Release|Win32.Build.0 = Release|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Authoring Debug|Win32.ActiveCfg = Authoring Debug|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Authoring Debug|Win32.Build.0 = Authoring Debug|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Authoring Release|Win32.ActiveCfg = Authoring Release|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Authoring Release|Win32.Build.0 = Authoring Release|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6B6B5CF7-FCD2-4AE0-8FD3-9262DC5CAAF5}.Release|Win32.Build.0 = Release|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Authoring Debug|Win32.ActiveCfg = Authoring Debug|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Authoring Debug|Win32.Build.0 = Authoring Debug|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Authoring Release|Win32.ActiveCfg = Authoring Release|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Authoring Release|Win32.Build.0 = Authoring Release|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{749ED417-3445-43CE-8B7C-E3B4786A817F}.Release|Win32.Build.0 = Release|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Authoring Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Authoring Debug|Win32.Build.0 = Debug|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Authoring Release|Win32.ActiveCfg = Release|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2FA32593-9C3D-F8F8-D4F2-6D731DCE4C8E}.Release|Win32.Build.0 = Release|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Authoring Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Authoring Debug|Win32.Build.0 = Debug|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Authoring Release|Win32.ActiveCfg = Release|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1AAB032F-3899-F48B-3401-17370F49CBE4}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Blu64k/Blu64k.suo
Normal file
BIN
Blu64k/Blu64k.suo
Normal file
Binary file not shown.
19
Blu64k/UpgradeLog.XML
Normal file
19
Blu64k/UpgradeLog.XML
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
|
||||
<Properties><Property Name="Solution" Value="Blu64k">
|
||||
</Property><Property Name="Solution File" Value="E:\Private\Frank\Code\blu-flame.org\Blu64k\Blu64k.sln">
|
||||
</Property><Property Name="Date" Value="Tuesday, May 31, 2011">
|
||||
</Property><Property Name="Time" Value="22:08">
|
||||
</Property></Properties><Event ErrorLevel="0" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="Converting project file 'E:\Private\Frank\Code\blu-flame.org\Blu64k\src\Blu64k\Blu64k.vcproj'.">
|
||||
</Event><Event ErrorLevel="1" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
|
||||
</Event><Event ErrorLevel="1" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="VCConvertEngine could not convert attribute UseUnicodeResponseFiles = false under Tool VCCLCompilerTool.">
|
||||
</Event><Event ErrorLevel="1" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="VCConvertEngine could not convert attribute UseUnicodeResponseFiles = false under Tool VCLinkerTool.">
|
||||
</Event><Event ErrorLevel="0" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="Done converting to new project file 'E:\Private\Frank\Code\blu-flame.org\Blu64k\src\Blu64k\Blu64k.vcxproj'.">
|
||||
</Event><Event ErrorLevel="3" Project="Blu64k" Source="src\Blu64k\Blu64k.vcproj" Description="Converted">
|
||||
</Event><Event ErrorLevel="0" Project="BluAuthor" Source="src\BluAuthor\BluAuthor.vcproj" Description="Converting project file 'E:\Private\Frank\Code\blu-flame.org\Blu64k\src\BluAuthor\BluAuthor.vcproj'.">
|
||||
</Event><Event ErrorLevel="1" Project="BluAuthor" Source="src\BluAuthor\BluAuthor.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
|
||||
</Event><Event ErrorLevel="1" Project="BluAuthor" Source="src\BluAuthor\BluAuthor.vcproj" Description="VCConvertEngine could not convert attribute UseUnicodeResponseFiles = false under Tool VCCLCompilerTool.">
|
||||
</Event><Event ErrorLevel="0" Project="BluAuthor" Source="src\BluAuthor\BluAuthor.vcproj" Description="Done converting to new project file 'E:\Private\Frank\Code\blu-flame.org\Blu64k\src\BluAuthor\BluAuthor.vcxproj'.">
|
||||
</Event><Event ErrorLevel="3" Project="BluAuthor" Source="src\BluAuthor\BluAuthor.vcproj" Description="Converted">
|
||||
</Event><Event ErrorLevel="0" Project="" Source="Blu64k.sln" Description="Solution converted successfully">
|
||||
</Event><Event ErrorLevel="3" Project="" Source="Blu64k.sln" Description="Converted">
|
||||
</Event></UpgradeLog>
|
||||
BIN
Blu64k/msk/bluflame-2012.it
Normal file
BIN
Blu64k/msk/bluflame-2012.it
Normal file
Binary file not shown.
BIN
Blu64k/msk/e-piano bell.v2p
Normal file
BIN
Blu64k/msk/e-piano bell.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/hard pad.v2p
Normal file
BIN
Blu64k/msk/hard pad.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/pan flute.v2p
Normal file
BIN
Blu64k/msk/pan flute.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/strings.v2p
Normal file
BIN
Blu64k/msk/strings.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/sweep pad.v2p
Normal file
BIN
Blu64k/msk/sweep pad.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/tom.v2p
Normal file
BIN
Blu64k/msk/tom.v2p
Normal file
Binary file not shown.
BIN
Blu64k/msk/warm pad.v2p
Normal file
BIN
Blu64k/msk/warm pad.v2p
Normal file
Binary file not shown.
74
Blu64k/src/Blu64k/Blu64k.cpp
Normal file
74
Blu64k/src/Blu64k/Blu64k.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
// Blu64k.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Scenes/TestScene.h"
|
||||
#include "Scenes/ParticleTestScene.h"
|
||||
#include "Textures/NoiseTexture.h"
|
||||
#include "Window.h"
|
||||
#include "RandomGenerator.h"
|
||||
#ifndef AUTHORING
|
||||
#include "Shaders/shaders.g.h"
|
||||
#endif
|
||||
|
||||
RandomGenerator GlobalRandomGenerator;
|
||||
|
||||
|
||||
extern "C" void WinMainCRTStartup()
|
||||
{
|
||||
GlobalRandomGenerator.setSeed(1337);
|
||||
|
||||
Window window("Evoke 2011 64k intro", 1024, 768, false);
|
||||
window.Initialize();
|
||||
|
||||
NoiseTexture* noiseTexture = new NoiseTexture();
|
||||
|
||||
blu::VectorVariable* camPos = CreateVectorVariable("cameraPosition");
|
||||
OglScene* testScene = new ParticleTestScene(camPos);
|
||||
//OglScene* testScene = new TestScene(*noiseTexture);
|
||||
OglCameraScene* view1 = new OglCameraScene(testScene);
|
||||
OglLayer* outputLayer = new OglLayer();
|
||||
view1->outputLayers[0] = outputLayer;
|
||||
view1->outputLayersCount = 1;
|
||||
|
||||
MSG msg;
|
||||
blu::Player::Init(135, 4, 4);
|
||||
#ifndef AUTHORING
|
||||
blu::Player::Play();
|
||||
#else
|
||||
ShaderMonitor::StartMonitoring();
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
else
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window.get_Active())
|
||||
{
|
||||
blu::Player::Tick();
|
||||
|
||||
view1->cameraPos = camPos->value;
|
||||
view1->cameraCenter = vec4(0, 0, 4, 0.0f);
|
||||
view1->cameraUp = vec4(0, 1, 0, 0.0f);
|
||||
RenderPipeline::Render();
|
||||
window.SwapBuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AUTHORING
|
||||
blu::Player::Exit();
|
||||
#endif
|
||||
|
||||
::ExitProcess(0);
|
||||
}
|
||||
547
Blu64k/src/Blu64k/Blu64k.vcproj
Normal file
547
Blu64k/src/Blu64k/Blu64k.vcproj
Normal file
@@ -0,0 +1,547 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="Blu64k"
|
||||
ProjectGUID="{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}"
|
||||
RootNamespace="Blu64k"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib dsound.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UseUnicodeResponseFiles="false"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="false"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
FloatingPointModel="2"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="0"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
UseUnicodeResponseFiles="false"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib dsound.lib"
|
||||
GenerateManifest="false"
|
||||
EnableUAC="false"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
RandomizedBaseAddress="0"
|
||||
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="Authoring Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="AUTHORING"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib dsound.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Filters\Base.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Blu64k.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Blur.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Combine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\EnvMap\DualParaboloidEnvMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\FullScreenQuad.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\glext.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Glow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GPUParticles\GPUParticles.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mesh\Mesh.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Textures\NoiseTexture.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglArrayBuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglCameraScene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglGraphics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglLayer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglRenderTarget.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglShader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglTexture.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglTransition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Path\Path.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RenderPipeline\RenderPipeline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Simple.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Authoring Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Window.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Filters\Base.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Transitions\Blur.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Shaders\Blur.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Blur.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Combine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Transitions\CornerMelt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Shaders\Diffuse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\EnvMap\DualParaboloidEnvMap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\FullScreenQuad.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\glext.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Glow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GPUParticles\GPUParticles.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\Shaders\Layer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mesh\Mesh.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Textures\NoiseTexture.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglArrayBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglCameraScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglGraphics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglLayer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglRenderTarget.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglShader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglTexture.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\OglTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Shaders\Particle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Scenes\ParticleTestScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Path\Path.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RandomGenerator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RenderPipeline\RenderPipeline.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Filters\Simple.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Shaders\SkyShader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\targetver.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Scenes\TestScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OpenGL\wglext.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Window.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
225
Blu64k/src/Blu64k/Blu64k.vcxproj
Normal file
225
Blu64k/src/Blu64k/Blu64k.vcxproj
Normal file
@@ -0,0 +1,225 @@
|
||||
<?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="Authoring Debug|Win32">
|
||||
<Configuration>Authoring Debug</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>{315EBF28-B2F4-4D02-BA43-2C4F04FBEE31}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Blu64k</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Authoring 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>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|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>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'">$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName)_$(Configuration).pdb</ProgramDataBaseFileName>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;glu32.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<ShowIncludes>true</ShowIncludes>
|
||||
<ExpandAttributedSource>true</ExpandAttributedSource>
|
||||
<AssemblerOutput>All</AssemblerOutput>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName)_$(Configuration).pdb</ProgramDataBaseFileName>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;glu32.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<RandomizedBaseAddress>
|
||||
</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>AUTHORING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName)_$(Configuration).pdb</ProgramDataBaseFileName>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;glu32.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Filters\Base.cpp" />
|
||||
<ClCompile Include="Blu64k.cpp" />
|
||||
<ClCompile Include="Filters\Blur.cpp" />
|
||||
<ClCompile Include="Filters\Combine.cpp" />
|
||||
<ClCompile Include="EnvMap\DualParaboloidEnvMap.cpp" />
|
||||
<ClCompile Include="OpenGL\FullScreenQuad.cpp" />
|
||||
<ClCompile Include="OpenGL\glext.cpp" />
|
||||
<ClCompile Include="Filters\Glow.cpp" />
|
||||
<ClCompile Include="GPUParticles\GPUParticles.cpp" />
|
||||
<ClCompile Include="Mesh\Mesh.cpp" />
|
||||
<ClCompile Include="Textures\NoiseTexture.cpp" />
|
||||
<ClCompile Include="OpenGL\OglArrayBuffer.cpp" />
|
||||
<ClCompile Include="OpenGL\OglCameraScene.cpp" />
|
||||
<ClCompile Include="OpenGL\OglGraphics.cpp" />
|
||||
<ClCompile Include="OpenGL\OglLayer.cpp" />
|
||||
<ClCompile Include="OpenGL\OglRenderTarget.cpp" />
|
||||
<ClCompile Include="OpenGL\OglShader.cpp" />
|
||||
<ClCompile Include="OpenGL\OglTexture.cpp" />
|
||||
<ClCompile Include="OpenGL\OglTransition.cpp" />
|
||||
<ClCompile Include="Path\Path.cpp" />
|
||||
<ClCompile Include="RenderPipeline\RenderPipeline.cpp" />
|
||||
<ClCompile Include="Filters\Simple.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Authoring Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Window.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Filters\Base.h" />
|
||||
<ClInclude Include="Transitions\Blur.h" />
|
||||
<ClInclude Include="Shaders\Blur.h" />
|
||||
<ClInclude Include="Filters\Blur.h" />
|
||||
<ClInclude Include="Filters\Combine.h" />
|
||||
<ClInclude Include="Transitions\CornerMelt.h" />
|
||||
<ClInclude Include="Shaders\Diffuse.h" />
|
||||
<ClInclude Include="EnvMap\DualParaboloidEnvMap.h" />
|
||||
<ClInclude Include="OpenGL\FullScreenQuad.h" />
|
||||
<ClInclude Include="OpenGL\glext.h" />
|
||||
<ClInclude Include="Filters\Glow.h" />
|
||||
<ClInclude Include="GPUParticles\GPUParticles.h" />
|
||||
<ClInclude Include="OpenGL\Shaders\Layer.h" />
|
||||
<ClInclude Include="Mesh\Mesh.h" />
|
||||
<ClInclude Include="Textures\NoiseTexture.h" />
|
||||
<ClInclude Include="OpenGL\OglArrayBuffer.h" />
|
||||
<ClInclude Include="OpenGL\OglCameraScene.h" />
|
||||
<ClInclude Include="OpenGL\OglGraphics.h" />
|
||||
<ClInclude Include="OpenGL\OglLayer.h" />
|
||||
<ClInclude Include="OpenGL\OglRenderTarget.h" />
|
||||
<ClInclude Include="OpenGL\OglScene.h" />
|
||||
<ClInclude Include="OpenGL\OglShader.h" />
|
||||
<ClInclude Include="OpenGL\OglTexture.h" />
|
||||
<ClInclude Include="OpenGL\OglTransition.h" />
|
||||
<ClInclude Include="Shaders\Particle.h" />
|
||||
<ClInclude Include="Scenes\ParticleTestScene.h" />
|
||||
<ClInclude Include="Path\Path.h" />
|
||||
<ClInclude Include="RandomGenerator.h" />
|
||||
<ClInclude Include="RenderPipeline\RenderPipeline.h" />
|
||||
<ClInclude Include="Filters\Simple.h" />
|
||||
<ClInclude Include="Shaders\SkyShader.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="Scenes\TestScene.h" />
|
||||
<ClInclude Include="OpenGL\wglext.h" />
|
||||
<ClInclude Include="Window.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BluAuthor\BluAuthor.vcxproj">
|
||||
<Project>{6b6b5cf7-fcd2-4ae0-8fd3-9262dc5caaf5}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
201
Blu64k/src/Blu64k/Blu64k.vcxproj.filters
Normal file
201
Blu64k/src/Blu64k/Blu64k.vcxproj.filters
Normal file
@@ -0,0 +1,201 @@
|
||||
<?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</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Filters\Base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Blu64k.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Filters\Blur.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Filters\Combine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EnvMap\DualParaboloidEnvMap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\FullScreenQuad.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\glext.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Filters\Glow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GPUParticles\GPUParticles.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mesh\Mesh.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Textures\NoiseTexture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglArrayBuffer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglCameraScene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglGraphics.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglLayer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglRenderTarget.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglShader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglTexture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OpenGL\OglTransition.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Path\Path.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RenderPipeline\RenderPipeline.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Filters\Simple.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Window.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Filters\Base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Transitions\Blur.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Shaders\Blur.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Filters\Blur.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Filters\Combine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Transitions\CornerMelt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Shaders\Diffuse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EnvMap\DualParaboloidEnvMap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\FullScreenQuad.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\glext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Filters\Glow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GPUParticles\GPUParticles.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\Shaders\Layer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mesh\Mesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Textures\NoiseTexture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglArrayBuffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglCameraScene.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglGraphics.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglLayer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglRenderTarget.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglScene.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglShader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglTexture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\OglTransition.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Shaders\Particle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Scenes\ParticleTestScene.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Path\Path.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RandomGenerator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RenderPipeline\RenderPipeline.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Filters\Simple.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Shaders\SkyShader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Scenes\TestScene.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OpenGL\wglext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Window.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Blu64k/src/Blu64k/Blu64k.vcxproj.user
Normal file
6
Blu64k/src/Blu64k/Blu64k.vcxproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
3
Blu64k/src/Blu64k/Blu64k.vcxproj.vs10x
Normal file
3
Blu64k/src/Blu64k/Blu64k.vcxproj.vs10x
Normal file
@@ -0,0 +1,3 @@
|
||||
This file contains Alternate Data Streams, storing configuration information used by CodeSMART 10 and VS10X Extensions.
|
||||
|
||||
PLEASE DO NOT DELETE.
|
||||
62
Blu64k/src/Blu64k/DoF/DepthOfField.cpp
Normal file
62
Blu64k/src/Blu64k/DoF/DepthOfField.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "stdafx.h"
|
||||
#include "DepthOfField.h"
|
||||
#include "DofCombine.h"
|
||||
#include "DofDownscale.h"
|
||||
|
||||
#include "../Filters/Blur.h"
|
||||
|
||||
DepthOfField::DepthOfField()
|
||||
{
|
||||
DoFActive = CreateBoolVariable("DoF.Active");
|
||||
|
||||
FocalPlaneFalloff = CreateFloatVariable("DoF.FocalPlaneFalloff");
|
||||
FocalPlaneDepth = CreateFloatVariable("DoF.FocalPlaneDepth");
|
||||
BlurinessCutoff = CreateFloatVariable("DoF.BlurinessCutoff");
|
||||
|
||||
int width = OglGraphics::Instance()->Width;
|
||||
int height = OglGraphics::Instance()->Height;
|
||||
|
||||
blurFilter = new BlurFilter(BlurFilter::Description(width / 3, height / 3, TextureFormat::RGBAf, 1, 1.0, BlurFilter::Type::Bokeh));
|
||||
doFAddDepthValuesFilter = new DoFDownscaleFilter(SimpleFilter::Description(width, height, TextureFormat::RGBAf));
|
||||
doFDownscaleFilter = new DoFDownscaleFilter(SimpleFilter::Description(width / 3, height / 3, TextureFormat::RGBAf));
|
||||
doFCombineFilter = new DoFCombineFilter(SimpleFilter::Description(width, height, TextureFormat::RGBAf));
|
||||
}
|
||||
|
||||
|
||||
void DepthOfField::Process(OglTexture* sceneTexture, OglTexture* normalDepthTexture)
|
||||
{
|
||||
if (!DoFActive->value)
|
||||
return;
|
||||
|
||||
vec4 dofParams( FocalPlaneFalloff->value,
|
||||
FocalPlaneDepth->value,
|
||||
BlurinessCutoff->value);
|
||||
|
||||
doFDownscaleFilter->DooFParams = dofParams;
|
||||
doFAddDepthValuesFilter->DooFParams = dofParams;
|
||||
|
||||
doFAddDepthValuesFilter->Apply(sceneTexture, normalDepthTexture);
|
||||
doFDownscaleFilter->Apply(sceneTexture, normalDepthTexture);
|
||||
blurFilter->Apply(doFDownscaleFilter->get_Result(), doFAddDepthValuesFilter->get_Result());
|
||||
doFCombineFilter->Apply(doFAddDepthValuesFilter->get_Result(), blurFilter->get_Result());
|
||||
}
|
||||
|
||||
|
||||
void DepthOfField::Display()
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
if (DoFActive->value)
|
||||
FullScreenQuad::Instance()->Display(doFCombineFilter->get_Result());
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DepthOfField::get_ResultTexture() const
|
||||
{
|
||||
return doFCombineFilter->get_Result();
|
||||
}
|
||||
|
||||
|
||||
bool DepthOfField::IsDofAvailable() const
|
||||
{
|
||||
return DoFActive->value;
|
||||
}
|
||||
32
Blu64k/src/Blu64k/DoF/DepthOfField.h
Normal file
32
Blu64k/src/Blu64k/DoF/DepthOfField.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
class OglTexture;
|
||||
class BlurFilter;
|
||||
class DoFCombineFilter;
|
||||
class DoFDownscaleFilter;
|
||||
|
||||
class DepthOfField
|
||||
{
|
||||
public:
|
||||
DepthOfField();
|
||||
void Process(OglTexture* sceneTexture, OglTexture* normalDepthTexture);
|
||||
void Display();
|
||||
|
||||
OglTexture* get_ResultTexture() const;
|
||||
|
||||
bool IsDofAvailable() const;
|
||||
|
||||
public:
|
||||
blu::BoolVariable* DoFActive;
|
||||
|
||||
blu::FloatVariable* FocalPlaneFalloff;
|
||||
blu::FloatVariable* FocalPlaneDepth;
|
||||
blu::FloatVariable* BlurinessCutoff;
|
||||
|
||||
private:
|
||||
|
||||
BlurFilter* blurFilter;
|
||||
DoFCombineFilter* doFCombineFilter;
|
||||
DoFDownscaleFilter* doFDownscaleFilter;
|
||||
DoFDownscaleFilter* doFAddDepthValuesFilter;
|
||||
};
|
||||
23
Blu64k/src/Blu64k/DoF/DoFCombine.cpp
Normal file
23
Blu64k/src/Blu64k/DoF/DoFCombine.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "stdafx.h"
|
||||
#include "DoFCombine.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
DoFCombineFilter::DoFCombineFilter(Description description)
|
||||
: SimpleFilter(description)
|
||||
{
|
||||
SHADER_SOURCE(Shader, "Filters/BaseVS.h", "Filters/DoFCombineFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DoFCombineFilter::Apply(OglTexture* inputTexture, OglTexture* bluredTexture)
|
||||
{
|
||||
OglShader* shader = this->Begin();
|
||||
bluredTexture->Apply(1);
|
||||
shader->SetParam("t1", 1);
|
||||
this->End(inputTexture);
|
||||
bluredTexture->Unapply(1);
|
||||
return this->get_Result();
|
||||
}
|
||||
11
Blu64k/src/Blu64k/DoF/DoFCombine.h
Normal file
11
Blu64k/src/Blu64k/DoF/DoFCombine.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "../Filters/Simple.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class DoFCombineFilter : public SimpleFilter
|
||||
{
|
||||
public:
|
||||
DoFCombineFilter(Description description);
|
||||
OglTexture* Apply(OglTexture* inputTexture, OglTexture* bluredTexture);
|
||||
};
|
||||
24
Blu64k/src/Blu64k/DoF/DoFDownscale.cpp
Normal file
24
Blu64k/src/Blu64k/DoF/DoFDownscale.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "stdafx.h"
|
||||
#include "DoFDownscale.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
DoFDownscaleFilter::DoFDownscaleFilter(Description description)
|
||||
: SimpleFilter(description)
|
||||
{
|
||||
SHADER_SOURCE(Shader, "Filters/BaseVS.h", "Filters/DoFDownscaleFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DoFDownscaleFilter::Apply(OglTexture* inputTexture, OglTexture* normalDepthTexture)
|
||||
{
|
||||
OglShader* shader = this->Begin();
|
||||
shader->SetParam("DooFParams", DooFParams, 3);
|
||||
normalDepthTexture->Apply(1);
|
||||
shader->SetParam("t1", 1);
|
||||
this->End(inputTexture);
|
||||
normalDepthTexture->Unapply(1);
|
||||
return this->get_Result();
|
||||
}
|
||||
14
Blu64k/src/Blu64k/DoF/DofDownscale.h
Normal file
14
Blu64k/src/Blu64k/DoF/DofDownscale.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "../Filters/Simple.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class DoFDownscaleFilter : public SimpleFilter
|
||||
{
|
||||
public:
|
||||
DoFDownscaleFilter(Description description);
|
||||
OglTexture* Apply(OglTexture* inputTexture, OglTexture* normalDepthTexture);
|
||||
|
||||
public:
|
||||
vec4 DooFParams;
|
||||
};
|
||||
52
Blu64k/src/Blu64k/EnvMap/DualParaboloidEnvMap.cpp
Normal file
52
Blu64k/src/Blu64k/EnvMap/DualParaboloidEnvMap.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "stdafx.h"
|
||||
#include "EnvBlur.h"
|
||||
#include "DualParaboloidEnvMap.h"
|
||||
|
||||
|
||||
DualParaboloidEnvMap::DualParaboloidEnvMap(int blurStrength)
|
||||
: envBlurFilter(NULL)
|
||||
{
|
||||
static const int size = 512;
|
||||
frontTexture = new OglTexture(size, size, TextureFormat::RGBAf, TextureWrap::Border);
|
||||
backTexture = new OglTexture(size, size, TextureFormat::RGBAf, TextureWrap::Border);
|
||||
envMapFrontRenderTarget = new OglRenderTarget(size, size);
|
||||
envMapFrontRenderTarget->set_Textures(1, &frontTexture->textureId);
|
||||
envMapBackRenderTarget = new OglRenderTarget(size, size);
|
||||
envMapBackRenderTarget->set_Textures(1, &backTexture->textureId);
|
||||
|
||||
if (blurStrength > 1)
|
||||
envBlurFilter = new EnvBlurFilter(EnvBlurFilter::Description(size/blurStrength, size/blurStrength, TextureFormat::RGBAf, 5));
|
||||
}
|
||||
|
||||
|
||||
void DualParaboloidEnvMap::PrepareRenderFront()
|
||||
{
|
||||
envMapFrontRenderTarget->Bind();
|
||||
}
|
||||
|
||||
|
||||
void DualParaboloidEnvMap::PrepareRenderBack()
|
||||
{
|
||||
envMapFrontRenderTarget->Unbind();
|
||||
envMapBackRenderTarget->Bind();
|
||||
}
|
||||
|
||||
|
||||
void DualParaboloidEnvMap::End()
|
||||
{
|
||||
envMapBackRenderTarget->Unbind();
|
||||
if (envBlurFilter != NULL)
|
||||
envBlurFilter->Apply(frontTexture, backTexture);
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DualParaboloidEnvMap::get_FrontTexture()
|
||||
{
|
||||
return envBlurFilter == NULL ? frontTexture : envBlurFilter->get_Description().TargetTextureA;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DualParaboloidEnvMap::get_BackTexture()
|
||||
{
|
||||
return envBlurFilter == NULL ? backTexture : envBlurFilter->get_Description().TargetTextureB;
|
||||
}
|
||||
26
Blu64k/src/Blu64k/EnvMap/DualParaboloidEnvMap.h
Normal file
26
Blu64k/src/Blu64k/EnvMap/DualParaboloidEnvMap.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class EnvBlurFilter;
|
||||
|
||||
class DualParaboloidEnvMap
|
||||
{
|
||||
public:
|
||||
DualParaboloidEnvMap(int blurStrength = 1);
|
||||
|
||||
void PrepareRenderFront();
|
||||
void PrepareRenderBack();
|
||||
void End();
|
||||
|
||||
OglTexture* get_FrontTexture();
|
||||
OglTexture* get_BackTexture();
|
||||
|
||||
|
||||
private:
|
||||
OglTexture* frontTexture;
|
||||
OglTexture* backTexture;
|
||||
|
||||
OglRenderTarget* envMapFrontRenderTarget;
|
||||
OglRenderTarget* envMapBackRenderTarget;
|
||||
EnvBlurFilter* envBlurFilter;
|
||||
};
|
||||
90
Blu64k/src/Blu64k/EnvMap/EnvBlur.cpp
Normal file
90
Blu64k/src/Blu64k/EnvMap/EnvBlur.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "stdafx.h"
|
||||
#include "EnvBlur.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
EnvBlurFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
unsigned int passes)
|
||||
: TargetTextureA(NULL)
|
||||
, TargetTextureB(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
, Passes(passes)
|
||||
{ }
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EnvBlurFilter::EnvBlurFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTextureA == NULL)
|
||||
this->description.TargetTextureA = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
|
||||
if (this->description.TargetTextureB == NULL)
|
||||
this->description.TargetTextureB = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < 2; ++i)
|
||||
{
|
||||
pingPongA[i] = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
pingPongB[i] = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
}
|
||||
|
||||
SHADER_SOURCE(blurShader, "Filters/BaseVS.h", "Filters/EnvMapBlur.h");
|
||||
}
|
||||
|
||||
|
||||
void EnvBlurFilter::Apply(OglTexture* frontTexture, OglTexture* backTexture)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
float ddxy[2];
|
||||
unsigned int textureIds[2];
|
||||
for (unsigned int i = 0; i < description.Passes; ++i)
|
||||
{
|
||||
textureIds[0] = pingPongA[i % 2]->textureId;
|
||||
textureIds[1] = pingPongB[i % 2]->textureId;
|
||||
renderTarget->set_Textures(2, textureIds);
|
||||
renderTarget->Bind();
|
||||
|
||||
OglTexture* currentTextureA = i == 0 ? frontTexture : pingPongA[(i + 1) % 2];
|
||||
OglTexture* currentTextureB = i == 0 ? backTexture : pingPongB[(i + 1) % 2];
|
||||
|
||||
blurShader->Apply();
|
||||
|
||||
ddxy[0] = 1.0f / currentTextureA->get_Width();
|
||||
ddxy[1] = 1.0f / currentTextureA->get_Height();
|
||||
blurShader->SetParam("ddxy", ddxy, 2);
|
||||
|
||||
currentTextureA->Apply(0);
|
||||
currentTextureB->Apply(1);
|
||||
blurShader->SetParam("inEnvMapFront", 0);
|
||||
blurShader->SetParam("inEnvMapBack", 1);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
currentTextureA->Unapply(0);
|
||||
currentTextureB->Unapply(1);
|
||||
|
||||
blurShader->Unapply();
|
||||
|
||||
renderTarget->Unbind();
|
||||
}
|
||||
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTextureA)->textureId);
|
||||
renderTarget->Bind();
|
||||
FullScreenQuad::Instance()->Display(pingPongA[(description.Passes -1 ) % 2]);
|
||||
renderTarget->Unbind();
|
||||
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTextureB)->textureId);
|
||||
renderTarget->Bind();
|
||||
FullScreenQuad::Instance()->Display(pingPongB[(description.Passes -1 ) % 2]);
|
||||
renderTarget->Unbind();
|
||||
}
|
||||
|
||||
38
Blu64k/src/Blu64k/EnvMap/EnvBlur.h
Normal file
38
Blu64k/src/Blu64k/EnvMap/EnvBlur.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "../Filters/Base.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
|
||||
class EnvBlurFilter
|
||||
: public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
unsigned int passes = 5);
|
||||
|
||||
OglTexture* TargetTextureA;
|
||||
OglTexture* TargetTextureB;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
unsigned int Passes;
|
||||
};
|
||||
|
||||
EnvBlurFilter(Description description);
|
||||
|
||||
void Apply(OglTexture* frontTexture, OglTexture* backTexture);
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
|
||||
OglTexture* pingPongA[2];
|
||||
OglTexture* pingPongB[2];
|
||||
OglShader* blurShader;
|
||||
};
|
||||
10
Blu64k/src/Blu64k/Filters/Base.cpp
Normal file
10
Blu64k/src/Blu64k/Filters/Base.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "Base.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
FilterBase::FilterBase(unsigned int width, unsigned int height)
|
||||
: renderTarget(new OglRenderTarget(width, height))
|
||||
{
|
||||
}
|
||||
12
Blu64k/src/Blu64k/Filters/Base.h
Normal file
12
Blu64k/src/Blu64k/Filters/Base.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
class OglRenderTarget;
|
||||
|
||||
class FilterBase
|
||||
{
|
||||
public:
|
||||
FilterBase(unsigned int width, unsigned int height);
|
||||
|
||||
protected:
|
||||
OglRenderTarget* renderTarget;
|
||||
};
|
||||
120
Blu64k/src/Blu64k/Filters/Blur.cpp
Normal file
120
Blu64k/src/Blu64k/Filters/Blur.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
#include "stdafx.h"
|
||||
#include "Blur.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
BlurFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
unsigned int passes,
|
||||
float strength,
|
||||
Type::Enumeration type)
|
||||
: TargetTexture(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
, Passes(passes)
|
||||
, Strength(strength)
|
||||
, Type(type)
|
||||
{ }
|
||||
|
||||
BlurFilter::Description::Description(OglTexture* targetTexture,
|
||||
unsigned int passes,
|
||||
float strength,
|
||||
Type::Enumeration type)
|
||||
: TargetTexture(targetTexture)
|
||||
, Width(targetTexture->get_Width())
|
||||
, Height(targetTexture->get_Height())
|
||||
, Format(targetTexture->get_Format())
|
||||
, Passes(passes)
|
||||
, Strength(strength)
|
||||
, Type(type)
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
BlurFilter::BlurFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTexture == NULL)
|
||||
this->description.TargetTexture = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
|
||||
for (unsigned int i = 0; i < 2; ++i)
|
||||
pingPong[i] = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
|
||||
switch (description.Type)
|
||||
{
|
||||
case Type::Circle:
|
||||
{
|
||||
SHADER_SOURCE(blurShader, "Filters/BaseVS.h", "Filters/BlurCircleFS.h");
|
||||
}
|
||||
break;
|
||||
case Type::Bokeh:
|
||||
{
|
||||
SHADER_SOURCE(blurShader, "Filters/BaseVS.h", "Filters/BlurBokehFS.h");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
SHADER_SOURCE(blurShader, "Filters/BaseVS.h", "Filters/BlurBoxFS.h");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OglTexture* BlurFilter::Apply(OglTexture* inputTexture, OglTexture* extraDataTexture)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
for (unsigned int i = 0; i < description.Passes; ++i)
|
||||
{
|
||||
renderTarget->set_Textures(1, &pingPong[i % 2]->textureId);
|
||||
renderTarget->Bind();
|
||||
|
||||
OglTexture* currentTexture = i == 0 ? inputTexture : pingPong[(i + 1) % 2];
|
||||
|
||||
blurShader->Apply();
|
||||
blurShader->SetParam("s", description.Strength);
|
||||
|
||||
ddxy[0] = description.Type == Type::Vertical ? 0.0f : (1.0f / currentTexture->get_Width());
|
||||
ddxy[1] = description.Type == Type::Horizontal ? 0.0f : (1.0f / currentTexture->get_Height());
|
||||
blurShader->SetParam("ddxy", ddxy, 2);
|
||||
|
||||
currentTexture->Apply(0);
|
||||
blurShader->SetParam("t0", 0);
|
||||
|
||||
if (extraDataTexture != NULL)
|
||||
{
|
||||
ddxy[0] = 1.0f / extraDataTexture->get_Width();
|
||||
ddxy[1] = 1.0f / extraDataTexture->get_Height();
|
||||
blurShader->SetParam("ddxy2", ddxy, 2);
|
||||
|
||||
extraDataTexture->Apply(1);
|
||||
blurShader->SetParam("t1", 1);
|
||||
}
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
currentTexture->Unapply(0);
|
||||
if (extraDataTexture != NULL)
|
||||
extraDataTexture->Unapply(1);
|
||||
|
||||
blurShader->Unapply();
|
||||
|
||||
renderTarget->Unbind();
|
||||
}
|
||||
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTexture)->textureId);
|
||||
renderTarget->Bind();
|
||||
FullScreenQuad::Instance()->Display(pingPong[(description.Passes -1 ) % 2]);
|
||||
renderTarget->Unbind();
|
||||
|
||||
return description.TargetTexture;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* BlurFilter::get_Result()
|
||||
{
|
||||
return description.TargetTexture;
|
||||
}
|
||||
59
Blu64k/src/Blu64k/Filters/Blur.h
Normal file
59
Blu64k/src/Blu64k/Filters/Blur.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
#include "Base.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
|
||||
class BlurFilter
|
||||
: public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Type
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Box,
|
||||
Horizontal,
|
||||
Vertical,
|
||||
Circle,
|
||||
Bokeh
|
||||
};
|
||||
};
|
||||
|
||||
struct Description
|
||||
{
|
||||
Description(OglTexture* targetTexture,
|
||||
unsigned int passes = 5,
|
||||
float strength = 2.0f,
|
||||
Type::Enumeration type = Type::Box);
|
||||
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
unsigned int passes = 5,
|
||||
float strength = 2.0f,
|
||||
Type::Enumeration type = Type::Box);
|
||||
|
||||
OglTexture* TargetTexture;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
unsigned int Passes;
|
||||
float Strength;
|
||||
Type::Enumeration Type;
|
||||
};
|
||||
|
||||
BlurFilter(Description description);
|
||||
|
||||
OglTexture* Apply(OglTexture* inputTexture, OglTexture* extraDataTexture = NULL);
|
||||
OglTexture* get_Result();
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
|
||||
OglTexture* pingPong[2];
|
||||
OglShader* blurShader;
|
||||
float ddxy[2];
|
||||
};
|
||||
81
Blu64k/src/Blu64k/Filters/Combine.cpp
Normal file
81
Blu64k/src/Blu64k/Filters/Combine.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
#include "stdafx.h"
|
||||
#include "Combine.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CombineFilter::Description::Description(OglTexture* targetTexture, Type::Enumeration type)
|
||||
: TargetTexture(targetTexture)
|
||||
, Width(targetTexture->get_Width())
|
||||
, Height(targetTexture->get_Height())
|
||||
, Format(targetTexture->get_Format())
|
||||
, Type(type)
|
||||
{ }
|
||||
|
||||
CombineFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
Type::Enumeration type)
|
||||
: TargetTexture(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
, Type(type)
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CombineFilter::CombineFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTexture == NULL && description.Width != 0)
|
||||
this->description.TargetTexture = new OglTexture(description.Width, description.Height, description.Format);
|
||||
|
||||
if (this->description.Type == Description::Type::Additive)
|
||||
{
|
||||
SHADER_SOURCE(combineShader, "Filters/BaseVS.h", "Filters/CombineFS.h");
|
||||
}
|
||||
else
|
||||
{
|
||||
SHADER_SOURCE(combineShader, "Filters/BaseVS.h", "Filters/CombineMaxFS.h");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OglTexture* CombineFilter::Apply(OglTexture* textureA, OglTexture* textureB)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
if (description.TargetTexture != NULL)
|
||||
{
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTexture)->textureId);
|
||||
renderTarget->Bind();
|
||||
}
|
||||
|
||||
combineShader->Apply();
|
||||
|
||||
textureA->Apply(0);
|
||||
textureB->Apply(1);
|
||||
combineShader->SetParam("t0", 0);
|
||||
combineShader->SetParam("t1", 1);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
textureA->Unapply(0);
|
||||
textureB->Unapply(1);
|
||||
combineShader->Unapply();
|
||||
|
||||
if (description.TargetTexture != NULL)
|
||||
renderTarget->Unbind();
|
||||
|
||||
return description.TargetTexture;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* CombineFilter::get_Result()
|
||||
{
|
||||
return description.TargetTexture;
|
||||
}
|
||||
45
Blu64k/src/Blu64k/Filters/Combine.h
Normal file
45
Blu64k/src/Blu64k/Filters/Combine.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "Base.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class CombineFilter
|
||||
: public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
struct Type
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Additive,
|
||||
Maximum
|
||||
};
|
||||
};
|
||||
|
||||
Description(OglTexture* targetTexture, Type::Enumeration type = Type::Additive);
|
||||
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
Type::Enumeration type = Type::Additive);
|
||||
|
||||
OglTexture* TargetTexture;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
Type::Enumeration Type;
|
||||
};
|
||||
|
||||
CombineFilter(Description description);
|
||||
|
||||
OglTexture* Apply(OglTexture* textureA, OglTexture* textureB);
|
||||
OglTexture* get_Result();
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
OglShader* combineShader;
|
||||
};
|
||||
99
Blu64k/src/Blu64k/Filters/Downscale.cpp
Normal file
99
Blu64k/src/Blu64k/Filters/Downscale.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
#include "stdafx.h"
|
||||
#include "Downscale.h"
|
||||
#include "Blur.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
DownscaleFilter::Description::Description(unsigned int startWidth,
|
||||
unsigned int startHeight,
|
||||
unsigned int endWidth,
|
||||
unsigned int endHeight,
|
||||
TextureFormat::Enumeration format,
|
||||
Type::Enumeration type)
|
||||
: StartWidth(startWidth)
|
||||
, StartHeight(startHeight)
|
||||
, EndWidth(endWidth)
|
||||
, EndHeight(endHeight)
|
||||
, Format(format)
|
||||
, Type(type)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
DownscaleFilter::DownscaleFilter(Description description)
|
||||
: description(description)
|
||||
{
|
||||
unsigned int w = description.StartWidth;
|
||||
unsigned int h = description.StartHeight;
|
||||
|
||||
this->TextureCount = 0;
|
||||
this->Textures = new OglTexture*[100];
|
||||
this->RenderTargets = new OglRenderTarget*[100];
|
||||
while (w > description.EndWidth || h > description.EndHeight)
|
||||
{
|
||||
w = w / 2;
|
||||
if (w < description.EndWidth)
|
||||
w = description.EndWidth;
|
||||
|
||||
h = h / 2;
|
||||
if (h < description.EndHeight)
|
||||
h = description.EndHeight;
|
||||
|
||||
this->Textures[this->TextureCount] = new OglTexture(w, h, description.Format, TextureWrap::Edge);
|
||||
|
||||
this->RenderTargets[this->TextureCount] = new OglRenderTarget(w, h);
|
||||
this->TextureCount++;
|
||||
}
|
||||
|
||||
if (this->description.Type == Description::Type::Blur)
|
||||
{
|
||||
SHADER_SOURCE(shader, "Filters/BaseVS.h", "Filters/BlurBoxFS.h");
|
||||
}
|
||||
else
|
||||
{
|
||||
SHADER_SOURCE(shader, "Filters/BaseVS.h", "Filters/CalcLuminanceFS.h");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DownscaleFilter::Apply(OglTexture* inputTexture)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
for (unsigned int i = 0; i < TextureCount; ++i)
|
||||
{
|
||||
RenderTargets[i]->set_Textures(1, &Textures[i]->textureId);
|
||||
RenderTargets[i]->Bind();
|
||||
|
||||
OglTexture* currentTexture = i == 0 ? inputTexture : Textures[i - 1];
|
||||
|
||||
ddxy[0] = 1.0f / currentTexture->get_Width();
|
||||
ddxy[1] = 1.0f / currentTexture->get_Height();
|
||||
|
||||
shader->Apply();
|
||||
shader->SetParam("ddxy", ddxy, 2);
|
||||
shader->SetParam("s", 2.0f);
|
||||
|
||||
currentTexture->Apply(0);
|
||||
shader->SetParam("t0", 0);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
currentTexture->Unapply(0);
|
||||
shader->Unapply();
|
||||
|
||||
RenderTargets[i]->Unbind();
|
||||
}
|
||||
|
||||
return Textures[TextureCount - 1];
|
||||
}
|
||||
|
||||
|
||||
OglTexture* DownscaleFilter::get_Result()
|
||||
{
|
||||
return Textures[TextureCount - 1];
|
||||
}
|
||||
49
Blu64k/src/Blu64k/Filters/Downscale.h
Normal file
49
Blu64k/src/Blu64k/Filters/Downscale.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class DownscaleFilter
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
struct Type
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Blur,
|
||||
CalcLuminance
|
||||
};
|
||||
};
|
||||
|
||||
Description(unsigned int startWidth,
|
||||
unsigned int startHeight,
|
||||
unsigned int endWidth,
|
||||
unsigned int endHeight,
|
||||
TextureFormat::Enumeration format,
|
||||
Type::Enumeration type = Type::Blur);
|
||||
|
||||
unsigned int StartWidth;
|
||||
unsigned int StartHeight;
|
||||
unsigned int EndWidth;
|
||||
unsigned int EndHeight;
|
||||
TextureFormat::Enumeration Format;
|
||||
Type::Enumeration Type;
|
||||
};
|
||||
|
||||
DownscaleFilter(Description description);
|
||||
|
||||
OglTexture* Apply(OglTexture* inputTexture);
|
||||
OglTexture* get_Result();
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
OglShader* shader;
|
||||
|
||||
OglRenderTarget** RenderTargets;
|
||||
OglTexture** Textures;
|
||||
unsigned int TextureCount;
|
||||
float ddxy[2];
|
||||
};
|
||||
80
Blu64k/src/Blu64k/Filters/Glow.cpp
Normal file
80
Blu64k/src/Blu64k/Filters/Glow.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
#include "stdafx.h"
|
||||
#include "Glow.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
GlowFilter::Description::Description(OglTexture* targetTexture,
|
||||
float contrast,
|
||||
float brightness,
|
||||
float bias)
|
||||
: TargetTexture(targetTexture)
|
||||
, Width(targetTexture->get_Width())
|
||||
, Height(targetTexture->get_Height())
|
||||
, Format(targetTexture->get_Format())
|
||||
, Contrast(contrast)
|
||||
, Brightness(brightness)
|
||||
, Bias(bias)
|
||||
{ }
|
||||
|
||||
GlowFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
float contrast,
|
||||
float brightness,
|
||||
float bias)
|
||||
: TargetTexture(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
, Contrast(contrast)
|
||||
, Brightness(brightness)
|
||||
, Bias(bias)
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
GlowFilter::GlowFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTexture == NULL)
|
||||
this->description.TargetTexture = new OglTexture(description.Width, description.Height, description.Format);
|
||||
|
||||
SHADER_SOURCE(glowShader, "Filters/BaseVS.h", "Filters/GlowLdrFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* GlowFilter::Apply(OglTexture* inputTexture)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTexture)->textureId);
|
||||
renderTarget->Bind();
|
||||
|
||||
glowShader->Apply();
|
||||
glowShader->SetParam("bias", description.Bias);
|
||||
glowShader->SetParam("brightness", description.Brightness);
|
||||
glowShader->SetParam("contrast", description.Contrast);
|
||||
|
||||
inputTexture->Apply(0);
|
||||
glowShader->SetParam("t0", 0);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
inputTexture->Unapply(0);
|
||||
glowShader->Unapply();
|
||||
|
||||
renderTarget->Unbind();
|
||||
|
||||
return description.TargetTexture;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* GlowFilter::get_Result()
|
||||
{
|
||||
return description.TargetTexture;
|
||||
}
|
||||
43
Blu64k/src/Blu64k/Filters/Glow.h
Normal file
43
Blu64k/src/Blu64k/Filters/Glow.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "Simple.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class GlowFilter : public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
Description(OglTexture* targetTexture,
|
||||
float contrast = 1.0,
|
||||
float brightness = 1.0f,
|
||||
float bias = 1.0f);
|
||||
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format,
|
||||
float contrast = 1.0,
|
||||
float brightness = 1.0f,
|
||||
float bias = 1.0f);
|
||||
|
||||
OglTexture* TargetTexture;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
float Contrast;
|
||||
float Brightness;
|
||||
float Bias;
|
||||
};
|
||||
|
||||
GlowFilter(Description description);
|
||||
|
||||
OglTexture* Apply(OglTexture* inputTexture);
|
||||
|
||||
OglTexture* get_Result();
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
OglShader* glowShader;
|
||||
};
|
||||
21
Blu64k/src/Blu64k/Filters/Luminance.cpp
Normal file
21
Blu64k/src/Blu64k/Filters/Luminance.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "stdafx.h"
|
||||
#include "Luminance.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
LuminanceFilter::LuminanceFilter(Description description)
|
||||
: SimpleFilter(description)
|
||||
{
|
||||
SHADER_SOURCE(Shader, "Filters/BaseVS.h", "Filters/LuminanceFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* LuminanceFilter::Apply(OglTexture* inputTexture)
|
||||
{
|
||||
OglShader* shader = this->Begin();
|
||||
return this->End(inputTexture);
|
||||
}
|
||||
11
Blu64k/src/Blu64k/Filters/Luminance.h
Normal file
11
Blu64k/src/Blu64k/Filters/Luminance.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Simple.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class LuminanceFilter : public SimpleFilter
|
||||
{
|
||||
public:
|
||||
LuminanceFilter(Description description);
|
||||
OglTexture* Apply(OglTexture* inputTexture);
|
||||
};
|
||||
76
Blu64k/src/Blu64k/Filters/Simple.cpp
Normal file
76
Blu64k/src/Blu64k/Filters/Simple.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "stdafx.h"
|
||||
#include "Simple.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SimpleFilter::Description::Description(OglTexture* targetTexture)
|
||||
: TargetTexture(targetTexture)
|
||||
, Width(targetTexture->get_Width())
|
||||
, Height(targetTexture->get_Height())
|
||||
, Format(targetTexture->get_Format())
|
||||
{ }
|
||||
|
||||
SimpleFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format)
|
||||
: TargetTexture(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SimpleFilter::SimpleFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTexture == NULL)
|
||||
this->description.TargetTexture = new OglTexture(description.Width, description.Height, description.Format, TextureWrap::Edge);
|
||||
}
|
||||
|
||||
|
||||
OglShader* SimpleFilter::Begin()
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTexture)->textureId);
|
||||
renderTarget->Bind();
|
||||
|
||||
Shader->Apply();
|
||||
|
||||
return Shader;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* SimpleFilter::End(OglTexture* inputTexture)
|
||||
{
|
||||
inputTexture->Apply(0);
|
||||
Shader->SetParam("t0", 0);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
inputTexture->Unapply(0);
|
||||
Shader->Unapply();
|
||||
|
||||
renderTarget->Unbind();
|
||||
|
||||
return description.TargetTexture;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* SimpleFilter::Apply(OglTexture* inputTexture)
|
||||
{
|
||||
Begin();
|
||||
return End(inputTexture);
|
||||
}
|
||||
|
||||
|
||||
OglTexture* SimpleFilter::get_Result()
|
||||
{
|
||||
return description.TargetTexture;
|
||||
}
|
||||
36
Blu64k/src/Blu64k/Filters/Simple.h
Normal file
36
Blu64k/src/Blu64k/Filters/Simple.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include "Base.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class SimpleFilter : public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
Description(OglTexture* targetTexture);
|
||||
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format);
|
||||
|
||||
OglTexture* TargetTexture;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
};
|
||||
|
||||
SimpleFilter(Description description);
|
||||
|
||||
OglShader* Begin();
|
||||
OglTexture* End(OglTexture* inputTexture);
|
||||
OglTexture* Apply(OglTexture* inputTexture);
|
||||
|
||||
OglTexture* get_Result();
|
||||
OglShader* Shader;
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
};
|
||||
199
Blu64k/src/Blu64k/GPUParticles/GPUParticles.cpp
Normal file
199
Blu64k/src/Blu64k/GPUParticles/GPUParticles.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <OpenGL/OglShader.h>
|
||||
#include "GPUParticles.h"
|
||||
|
||||
|
||||
#define BUFFER_OFFSET(i) ((char*)NULL + (i))
|
||||
|
||||
|
||||
GPUParticles::GPUParticles(unsigned int maxParticles,
|
||||
unsigned int maxParticleSpawnedPerSecond,
|
||||
GPUParticles::ParticleAttributeInfo& particleAttributeInfo,
|
||||
unsigned int maxWrittenParticlesPerParticleUpdate)
|
||||
: maxParticles(maxParticles)
|
||||
, maxParticleSpawnedPerSecond(maxParticleSpawnedPerSecond)
|
||||
, particleAttributeInfo(particleAttributeInfo)
|
||||
, frame(0)
|
||||
, sortTBO(0)
|
||||
, sortShader(NULL)
|
||||
, currentSortPass(0)
|
||||
, currentSortStage(0)
|
||||
{
|
||||
|
||||
OglGeometryShaderData* geometryShaderData = new OglGeometryShaderData(maxWrittenParticlesPerParticleUpdate,
|
||||
GL_POINTS,
|
||||
GL_POINTS,
|
||||
particleAttributeInfo.AttributeCount,
|
||||
particleAttributeInfo.AttributeNames);
|
||||
|
||||
SHADER_SOURCE_GS(updateShader, "Particle/UpdateParticleVS.h", NULL, "Particle/UpdateParticleGS.h", geometryShaderData);
|
||||
|
||||
OglGeometryShaderData* sortShaderData = new OglGeometryShaderData(
|
||||
1,
|
||||
GL_POINTS,
|
||||
GL_POINTS,
|
||||
particleAttributeInfo.AttributeCount,
|
||||
particleAttributeInfo.AttributeNames);
|
||||
|
||||
SHADER_SOURCE_GS(sortShader, "Particle/SortParticleVS.h", NULL, "Particle/SortParticleGS.h", sortShaderData);
|
||||
|
||||
glGenTextures(1, &sortTBO);
|
||||
|
||||
glGenVertexArrays(1, &emitVAO);
|
||||
glGenBuffers(1, &particleEmitBuffer);
|
||||
glBindVertexArray(emitVAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, particleEmitBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, maxParticleSpawnedPerSecond * particleAttributeInfo.ParticleSize, 0, GL_DYNAMIC_DRAW);
|
||||
SetAttributes();
|
||||
glBindVertexArray(0);
|
||||
|
||||
glGenQueries(1, &queryHandle);
|
||||
|
||||
glGenVertexArrays(2, updateVAO);
|
||||
glGenBuffers(2, particleBuffer);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
glBindVertexArray(updateVAO[i]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, particleBuffer[i]);
|
||||
glBufferData(GL_ARRAY_BUFFER, maxParticles * particleAttributeInfo.ParticleSize, 0, GL_DYNAMIC_DRAW);
|
||||
SetAttributes();
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GPUParticles::ParticleUpdateData GPUParticles::BeginUpdate(float inDeltaTime)
|
||||
{
|
||||
deltaTime = inDeltaTime;
|
||||
frame++;
|
||||
ParticleUpdateData emitData;
|
||||
emitData.UpdateShader = updateShader;
|
||||
emitData.EmitData = 0;
|
||||
emitData.EmitCount = ftol(deltaTime * maxParticleSpawnedPerSecond);
|
||||
if (emitData.EmitCount > maxParticleSpawnedPerSecond)
|
||||
emitData.EmitCount = maxParticleSpawnedPerSecond;
|
||||
|
||||
particleToEmitCount = emitData.EmitCount;
|
||||
if (emitData.EmitCount > 0)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, particleEmitBuffer);
|
||||
emitData.EmitData = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
return emitData;
|
||||
}
|
||||
|
||||
|
||||
void GPUParticles::EndUpdate()
|
||||
{
|
||||
if (particleToEmitCount + currentParticleCount == 0)
|
||||
return;
|
||||
|
||||
updateShader->Apply();
|
||||
|
||||
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particleBuffer[frame % 2]);
|
||||
|
||||
glEnable(GL_RASTERIZER_DISCARD);
|
||||
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queryHandle);
|
||||
glBeginTransformFeedback(GL_POINTS);
|
||||
|
||||
if (particleToEmitCount > 0)
|
||||
{
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
||||
updateShader->SetParam("deltaTime", 0.0f);
|
||||
glBindVertexArray(emitVAO);
|
||||
glDrawArrays(GL_POINTS, 0, particleToEmitCount);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
if (currentParticleCount > 0)
|
||||
{
|
||||
updateShader->SetParam("deltaTime", deltaTime);
|
||||
glBindVertexArray(updateVAO[(frame + 1) % 2]);
|
||||
glDrawArrays(GL_POINTS, 0, currentParticleCount);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
glEndTransformFeedback();
|
||||
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
glGetQueryObjectuiv(queryHandle, GL_QUERY_RESULT, ¤tParticleCount);
|
||||
glDisable(GL_RASTERIZER_DISCARD);
|
||||
updateShader->Unapply();
|
||||
}
|
||||
|
||||
|
||||
unsigned int GPUParticles::BeginRender()
|
||||
{
|
||||
if (currentParticleCount == 0)
|
||||
return 0;
|
||||
|
||||
glBindVertexArray(updateVAO[frame % 2]);
|
||||
|
||||
return currentParticleCount;
|
||||
}
|
||||
|
||||
|
||||
void GPUParticles::EndRender()
|
||||
{
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
|
||||
void GPUParticles::Sort(vec4& eye, unsigned int sortCount)
|
||||
{
|
||||
if (sortShader == NULL || currentParticleCount == 0)
|
||||
return;
|
||||
|
||||
sortShader->Apply();
|
||||
glEnable(GL_RASTERIZER_DISCARD);
|
||||
|
||||
sortShader->SetParam("eye", eye.m, 3);
|
||||
sortShader->SetParam("particleCount", ftol(currentParticleCount));
|
||||
sortShader->SetParam("particleElementCount", ftol(particleAttributeInfo.AttributeCount));
|
||||
|
||||
for (unsigned int i = 0; i < sortCount; ++i)
|
||||
{
|
||||
frame++;
|
||||
glBindTexture(GL_TEXTURE_BUFFER, sortTBO);
|
||||
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, particleBuffer[(frame + 1) % 2]);
|
||||
|
||||
sortShader->SetParam("pass", ftol(blu::exp2((float)currentSortPass)));
|
||||
sortShader->SetParam("stage", ftol(blu::exp2((float)currentSortStage)));
|
||||
|
||||
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particleBuffer[frame % 2]);
|
||||
|
||||
glBeginTransformFeedback(GL_POINTS);
|
||||
|
||||
glBindVertexArray(updateVAO[(frame + 1) % 2]);
|
||||
glDrawArrays(GL_POINTS, 0, currentParticleCount);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glEndTransformFeedback();
|
||||
|
||||
if (--currentSortPass < 0)
|
||||
{
|
||||
if (++currentSortStage >= 21)
|
||||
currentSortStage = 0;
|
||||
|
||||
currentSortPass = currentSortStage;
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_RASTERIZER_DISCARD);
|
||||
sortShader->Unapply();
|
||||
}
|
||||
|
||||
|
||||
void GPUParticles::SetAttributes()
|
||||
{
|
||||
unsigned int currentOffset = 0;
|
||||
for (unsigned int i = 0; i < particleAttributeInfo.AttributeCount; ++i)
|
||||
{
|
||||
glEnableVertexAttribArray(i);
|
||||
glVertexAttribPointer((GLuint)i, particleAttributeInfo.AttributeSizes[i], GL_FLOAT, false, particleAttributeInfo.ParticleSize, BUFFER_OFFSET(currentOffset));
|
||||
currentOffset += sizeof(float) * particleAttributeInfo.AttributeSizes[i];
|
||||
}
|
||||
}
|
||||
76
Blu64k/src/Blu64k/GPUParticles/GPUParticles.h
Normal file
76
Blu64k/src/Blu64k/GPUParticles/GPUParticles.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class OglShader;
|
||||
class GPUParticles
|
||||
{
|
||||
public:
|
||||
struct ParticleAttributeInfo
|
||||
{
|
||||
ParticleAttributeInfo(const char** attributeNames, const unsigned int* attributeSizes, unsigned int attributeCount)
|
||||
: AttributeNames(attributeNames)
|
||||
, AttributeSizes(attributeSizes)
|
||||
, AttributeCount(attributeCount)
|
||||
{
|
||||
ParticleSize = 0;
|
||||
for (unsigned int i = 0; i < AttributeCount; ++i)
|
||||
{
|
||||
ParticleSize += AttributeSizes[i] * sizeof(float);
|
||||
}
|
||||
}
|
||||
|
||||
const char** AttributeNames;
|
||||
const unsigned int* AttributeSizes;
|
||||
unsigned int AttributeCount;
|
||||
unsigned int ParticleSize;
|
||||
};
|
||||
|
||||
struct ParticleUpdateData
|
||||
{
|
||||
unsigned int EmitCount;
|
||||
void* EmitData;
|
||||
OglShader* UpdateShader;
|
||||
};
|
||||
|
||||
public:
|
||||
GPUParticles(unsigned int maxParticles,
|
||||
unsigned int maxParticleSpawnedPerSecond,
|
||||
ParticleAttributeInfo& particleAttributeInfo,
|
||||
unsigned int maxWrittenParticlesPerParticleUpdate = 1);
|
||||
|
||||
ParticleUpdateData BeginUpdate(float deltaTime);
|
||||
void EndUpdate();
|
||||
|
||||
unsigned int BeginRender();
|
||||
void EndRender();
|
||||
|
||||
void Sort(vec4& eye, unsigned int sortCount);
|
||||
|
||||
private:
|
||||
void SetAttributes();
|
||||
private:
|
||||
const unsigned int maxParticles;
|
||||
const unsigned int maxParticleSpawnedPerSecond;
|
||||
ParticleAttributeInfo particleAttributeInfo;
|
||||
|
||||
unsigned int currentParticleCount;
|
||||
|
||||
GLuint queryHandle;
|
||||
|
||||
unsigned int particleBuffer[2];
|
||||
unsigned int particleEmitBuffer;
|
||||
|
||||
OglShader* updateShader;
|
||||
OglShader* sortShader;
|
||||
|
||||
unsigned int updateVAO[2];
|
||||
unsigned int emitVAO;
|
||||
unsigned int sortTBO;
|
||||
|
||||
int currentSortPass;
|
||||
int currentSortStage;
|
||||
int frame;
|
||||
|
||||
unsigned int particleToEmitCount;
|
||||
float deltaTime;
|
||||
};
|
||||
30
Blu64k/src/Blu64k/HDR/Brightpass.cpp
Normal file
30
Blu64k/src/Blu64k/HDR/Brightpass.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "stdafx.h"
|
||||
#include "Brightpass.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
BrightpassFilter::BrightpassFilter(Description description, float threshold)
|
||||
: SimpleFilter(description)
|
||||
, Threshold(threshold)
|
||||
, Exposure(1.0f)
|
||||
{
|
||||
SHADER_SOURCE(Shader, "Filters/BaseVS.h", "Filters/BrightpassFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* BrightpassFilter::Apply(OglTexture* inputTexture, OglTexture* luminanceTexture)
|
||||
{
|
||||
OglShader* shader = this->Begin();
|
||||
shader->SetParam("threshold", Threshold);
|
||||
shader->SetParam("whiteCutOff", WhiteCutOff);
|
||||
shader->SetParam("exposure", Exposure);
|
||||
luminanceTexture->Apply(1);
|
||||
shader->SetParam("t1", 1);
|
||||
this->End(inputTexture);
|
||||
luminanceTexture->Unapply(1);
|
||||
return this->get_Result();
|
||||
}
|
||||
16
Blu64k/src/Blu64k/HDR/Brightpass.h
Normal file
16
Blu64k/src/Blu64k/HDR/Brightpass.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "../Filters/Simple.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class BrightpassFilter : public SimpleFilter
|
||||
{
|
||||
public:
|
||||
BrightpassFilter(Description description, float threshold);
|
||||
OglTexture* Apply(OglTexture* inputTexture, OglTexture* luminanceTexture);
|
||||
|
||||
public:
|
||||
float Threshold;
|
||||
float Exposure;
|
||||
float WhiteCutOff;
|
||||
};
|
||||
109
Blu64k/src/Blu64k/HDR/HdrCombine.cpp
Normal file
109
Blu64k/src/Blu64k/HDR/HdrCombine.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include "stdafx.h"
|
||||
#include "HdrCombine.h"
|
||||
#include <OpenGL/OglRenderTarget.h>
|
||||
#include <OpenGL/OglTexture.h>
|
||||
#include <OpenGL/FullScreenQuad.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HdrCombineFilter::Description::Description(OglTexture* targetTexture)
|
||||
: TargetTexture(targetTexture)
|
||||
, Width(targetTexture->get_Width())
|
||||
, Height(targetTexture->get_Height())
|
||||
, Format(targetTexture->get_Format())
|
||||
, Exposure(0.5f)
|
||||
, WhiteCutOff(1.0f)
|
||||
, LensFlareStrength(1.0f)
|
||||
, AnamorphicLensFlareStrength(1.0f)
|
||||
, GlowStrength(1.0f)
|
||||
, StreakStrength(1.0f)
|
||||
{ }
|
||||
|
||||
HdrCombineFilter::Description::Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format)
|
||||
: TargetTexture(NULL)
|
||||
, Width(width)
|
||||
, Height(height)
|
||||
, Format(format)
|
||||
, Exposure(0.5f)
|
||||
, WhiteCutOff(1.0f)
|
||||
, LensFlareStrength(1.0f)
|
||||
, AnamorphicLensFlareStrength(1.0f)
|
||||
, GlowStrength(1.0f)
|
||||
, StreakStrength(1.0f)
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HdrCombineFilter::HdrCombineFilter(Description description)
|
||||
: FilterBase(description.Width, description.Height)
|
||||
, description(description)
|
||||
{
|
||||
if (this->description.TargetTexture == NULL && description.Width != 0)
|
||||
this->description.TargetTexture = new OglTexture(description.Width, description.Height, description.Format);
|
||||
|
||||
SHADER_SOURCE(combineShader, "Filters/BaseVS.h", "Filters/HdrCombineFS.h");
|
||||
}
|
||||
|
||||
|
||||
OglTexture* HdrCombineFilter::Apply(
|
||||
OglTexture* baseTexture,
|
||||
OglTexture* glowTexture,
|
||||
OglTexture* streakTextureA,
|
||||
OglTexture* streakTextureB,
|
||||
OglTexture* anamorphicGlareTexture,
|
||||
OglTexture* luminanceTexture)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
if (description.TargetTexture != NULL)
|
||||
{
|
||||
renderTarget->set_Textures(1, &((OglTexture*)description.TargetTexture)->textureId);
|
||||
renderTarget->Bind();
|
||||
}
|
||||
|
||||
combineShader->Apply();
|
||||
|
||||
baseTexture->Apply(0);
|
||||
glowTexture->Apply(1);
|
||||
streakTextureA->Apply(2);
|
||||
streakTextureB->Apply(3);
|
||||
anamorphicGlareTexture->Apply(4);
|
||||
luminanceTexture->Apply(5);
|
||||
combineShader->SetParam("baseT", 0);
|
||||
combineShader->SetParam("glowT", 1);
|
||||
combineShader->SetParam("streakAT", 2);
|
||||
combineShader->SetParam("streakBT", 3);
|
||||
combineShader->SetParam("anaT", 4);
|
||||
combineShader->SetParam("lumT", 5);
|
||||
|
||||
combineShader->SetParam("whiteCutOff", description.WhiteCutOff);
|
||||
combineShader->SetParam("exposure", description.Exposure);
|
||||
combineShader->SetParam("lensS", description.LensFlareStrength);
|
||||
combineShader->SetParam("anaS", description.AnamorphicLensFlareStrength);
|
||||
combineShader->SetParam("glowS", description.GlowStrength);
|
||||
combineShader->SetParam("streakS", description.StreakStrength);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
baseTexture->Unapply(0);
|
||||
glowTexture->Unapply(1);
|
||||
streakTextureA->Unapply(2);
|
||||
streakTextureA->Unapply(3);
|
||||
anamorphicGlareTexture->Unapply(4);
|
||||
luminanceTexture->Unapply(5);
|
||||
|
||||
combineShader->Unapply();
|
||||
|
||||
if (description.TargetTexture != NULL)
|
||||
renderTarget->Unbind();
|
||||
|
||||
return description.TargetTexture;
|
||||
}
|
||||
|
||||
|
||||
OglTexture* HdrCombineFilter::get_Result()
|
||||
{
|
||||
return description.TargetTexture;
|
||||
}
|
||||
46
Blu64k/src/Blu64k/HDR/HdrCombine.h
Normal file
46
Blu64k/src/Blu64k/HDR/HdrCombine.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include "../Filters/Base.h"
|
||||
|
||||
class OglTexture;
|
||||
|
||||
class HdrCombineFilter
|
||||
: public FilterBase
|
||||
{
|
||||
public:
|
||||
struct Description
|
||||
{
|
||||
Description(OglTexture* targetTexture);
|
||||
|
||||
Description(unsigned int width,
|
||||
unsigned int height,
|
||||
TextureFormat::Enumeration format);
|
||||
|
||||
OglTexture* TargetTexture;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
TextureFormat::Enumeration Format;
|
||||
float Exposure;
|
||||
float WhiteCutOff;
|
||||
float LensFlareStrength;
|
||||
float AnamorphicLensFlareStrength;
|
||||
float GlowStrength;
|
||||
float StreakStrength;
|
||||
};
|
||||
|
||||
HdrCombineFilter(Description description);
|
||||
|
||||
OglTexture* Apply(
|
||||
OglTexture* baseTexture,
|
||||
OglTexture* glowTexture,
|
||||
OglTexture* streakTextureA,
|
||||
OglTexture* streakTextureB,
|
||||
OglTexture* anamorphicGlareTexture,
|
||||
OglTexture* luminanceTexture);
|
||||
OglTexture* get_Result();
|
||||
|
||||
Description& get_Description() { return description; }
|
||||
|
||||
private:
|
||||
Description description;
|
||||
OglShader* combineShader;
|
||||
};
|
||||
82
Blu64k/src/Blu64k/HDR/HighDynamicRange.cpp
Normal file
82
Blu64k/src/Blu64k/HDR/HighDynamicRange.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "stdafx.h"
|
||||
#include "HighDynamicRange.h"
|
||||
#include "../Filters/Blur.h"
|
||||
#include "../Filters/Combine.h"
|
||||
#include "../Filters/Downscale.h"
|
||||
#include "../Filters/Luminance.h"
|
||||
#include "Brightpass.h"
|
||||
#include "HdrCombine.h"
|
||||
|
||||
|
||||
HighDynamicRange::HighDynamicRange()
|
||||
{
|
||||
int width = OglGraphics::Instance()->Width;
|
||||
int height = OglGraphics::Instance()->Height;
|
||||
|
||||
brightpassFilter = new BrightpassFilter(SimpleFilter::Description(width / 4, height / 4, TextureFormat::RGBAf), 0.5f);
|
||||
blurFilter = new BlurFilter(BlurFilter::Description(width / 4, height / 4, TextureFormat::RGBAf, 10, 4.0f, BlurFilter::Type::Circle));
|
||||
horizontalStreakBlurFilter = new BlurFilter(BlurFilter::Description(width / 8, height / 4, TextureFormat::RGBAf, 10, 2.0f, BlurFilter::Type::Horizontal));
|
||||
verticalStreakBlurFilter = new BlurFilter(BlurFilter::Description(width / 4, height / 8, TextureFormat::RGBAf, 10, 2.0f, BlurFilter::Type::Vertical));
|
||||
downscaleAnamorphFilter = new DownscaleFilter(DownscaleFilter::Description(width, height, 2, height, TextureFormat::RGBAf, DownscaleFilter::Description::Type::Blur));
|
||||
luminanceFilter = new LuminanceFilter(SimpleFilter::Description(width, height, TextureFormat::RGBAf));
|
||||
downscaleFilter = new DownscaleFilter(DownscaleFilter::Description(width, height, 1, 1, TextureFormat::RGBAf, DownscaleFilter::Description::Type::CalcLuminance));
|
||||
hdrCombineFilter = new HdrCombineFilter(HdrCombineFilter::Description(width, height, TextureFormat::RGBA));
|
||||
|
||||
HDRActive = CreateBoolVariable("Hdr.Active");
|
||||
Exposure = CreateFloatVariable("Hdr.Exposure");
|
||||
WhiteCutOff = CreateFloatVariable("Hdr.WhiteCutOff");
|
||||
Threshold = CreateFloatVariable("Hdr.BrightpassThreshold");
|
||||
GlowStrength = CreateFloatVariable("Hdr.GlowStrength");
|
||||
StreakStrength = CreateFloatVariable("Hdr.StreakStrength");
|
||||
AnamorphicStrength = CreateFloatVariable("Hdr.AnamorphicLensFlareStrength");
|
||||
LensStrength = CreateFloatVariable("Hdr.LensFlareStrength");
|
||||
}
|
||||
|
||||
|
||||
void HighDynamicRange::Process(OglTexture* hdrSceneTexture)
|
||||
{
|
||||
if (!HDRActive->value)
|
||||
return;
|
||||
|
||||
brightpassFilter->Threshold = Threshold->value;
|
||||
brightpassFilter->Exposure = Exposure->value;
|
||||
brightpassFilter->WhiteCutOff = WhiteCutOff->value;
|
||||
hdrCombineFilter->get_Description().WhiteCutOff = WhiteCutOff->value;
|
||||
hdrCombineFilter->get_Description().Exposure = Exposure->value;
|
||||
hdrCombineFilter->get_Description().GlowStrength = GlowStrength->value;
|
||||
hdrCombineFilter->get_Description().LensFlareStrength = LensStrength->value;
|
||||
hdrCombineFilter->get_Description().StreakStrength = StreakStrength->value;
|
||||
hdrCombineFilter->get_Description().AnamorphicLensFlareStrength = AnamorphicStrength->value;
|
||||
|
||||
// Luminance
|
||||
luminanceFilter->Apply(hdrSceneTexture);
|
||||
downscaleFilter->Apply(luminanceFilter->get_Result());
|
||||
|
||||
// Brightpass
|
||||
brightpassFilter->Apply(hdrSceneTexture, luminanceFilter->get_Result());
|
||||
|
||||
// Anamorphic
|
||||
downscaleAnamorphFilter->Apply(brightpassFilter->get_Result());
|
||||
|
||||
// Glow
|
||||
blurFilter->Apply(brightpassFilter->get_Result());
|
||||
|
||||
// Streak
|
||||
horizontalStreakBlurFilter->Apply(brightpassFilter->get_Result());
|
||||
verticalStreakBlurFilter->Apply(brightpassFilter->get_Result());
|
||||
|
||||
hdrCombineFilter->Apply(hdrSceneTexture, blurFilter->get_Result(), horizontalStreakBlurFilter->get_Result(), verticalStreakBlurFilter->get_Result(), downscaleAnamorphFilter->get_Result(), downscaleFilter->get_Result());
|
||||
}
|
||||
|
||||
|
||||
void HighDynamicRange::Display()
|
||||
{
|
||||
if (HDRActive->value)
|
||||
FullScreenQuad::Instance()->Display(hdrCombineFilter->get_Result());
|
||||
}
|
||||
|
||||
|
||||
bool HighDynamicRange::IsHdrAvailable() const
|
||||
{
|
||||
return HDRActive->value;
|
||||
}
|
||||
40
Blu64k/src/Blu64k/HDR/HighDynamicRange.h
Normal file
40
Blu64k/src/Blu64k/HDR/HighDynamicRange.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
class OglRenderTarget;
|
||||
class OglTexture;
|
||||
class BlurFilter;
|
||||
class HdrCombineFilter;
|
||||
class BrightpassFilter;
|
||||
class DownscaleFilter;
|
||||
class LuminanceFilter;
|
||||
|
||||
class HighDynamicRange
|
||||
{
|
||||
public:
|
||||
HighDynamicRange();
|
||||
void Process(OglTexture* hdrSceneTexture);
|
||||
void Display();
|
||||
|
||||
bool IsHdrAvailable() const;
|
||||
|
||||
public:
|
||||
blu::BoolVariable* HDRActive;
|
||||
|
||||
blu::FloatVariable* WhiteCutOff;
|
||||
blu::FloatVariable* Exposure;
|
||||
blu::FloatVariable* Threshold;
|
||||
blu::FloatVariable* GlowStrength;
|
||||
blu::FloatVariable* StreakStrength;
|
||||
blu::FloatVariable* AnamorphicStrength;
|
||||
blu::FloatVariable* LensStrength;
|
||||
|
||||
private:
|
||||
BlurFilter* blurFilter;
|
||||
BlurFilter* horizontalStreakBlurFilter;
|
||||
BlurFilter* verticalStreakBlurFilter;
|
||||
HdrCombineFilter* hdrCombineFilter;
|
||||
BrightpassFilter* brightpassFilter;
|
||||
DownscaleFilter* downscaleFilter;
|
||||
DownscaleFilter* downscaleAnamorphFilter;
|
||||
LuminanceFilter* luminanceFilter;
|
||||
};
|
||||
573
Blu64k/src/Blu64k/Mesh/Mesh.cpp
Normal file
573
Blu64k/src/Blu64k/Mesh/Mesh.cpp
Normal file
@@ -0,0 +1,573 @@
|
||||
#include "stdafx.h"
|
||||
#include "Mesh.h"
|
||||
#include <RandomGenerator.h>
|
||||
#include <OpenGL/OglShader.h>
|
||||
|
||||
|
||||
Mesh::Mesh()
|
||||
: IndexCount(0)
|
||||
, VertexCount(0)
|
||||
{
|
||||
glGenVertexArrays(1, &VertexArrayObject);
|
||||
glBindVertexArray(VertexArrayObject);
|
||||
|
||||
VertexArrayBuffer = new OglArrayBuffer(MaxVertexBuffer * sizeof(MeshVertex));
|
||||
|
||||
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(unsigned int instances, OglArrayBuffer* instanceArrayBuffer)
|
||||
{
|
||||
glBindVertexArray(VertexArrayObject);
|
||||
|
||||
unsigned int positionId = OglShader::GetCurrentAttribLocation("inPosition");
|
||||
unsigned int normalId = OglShader::GetCurrentAttribLocation("inNormal");
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexBufferObject);
|
||||
VertexArrayBuffer->Bind();
|
||||
if (positionId+1 != 0)
|
||||
{
|
||||
glEnableVertexAttribArray(positionId);
|
||||
glVertexAttribPointer(positionId, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), (const GLvoid*)0);
|
||||
}
|
||||
if (normalId+1 != 0)
|
||||
{
|
||||
glEnableVertexAttribArray(normalId);
|
||||
glVertexAttribPointer(normalId, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), (const GLvoid*)16);
|
||||
}
|
||||
|
||||
if (instances)
|
||||
{
|
||||
unsigned int instanceId = OglShader::GetCurrentAttribLocation("inInstance");
|
||||
instanceArrayBuffer->Bind();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
glEnableVertexAttribArray(instanceId + i);
|
||||
glVertexAttribDivisor(instanceId + i, 1);
|
||||
glVertexAttribPointer(instanceId + i, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 16, (void*)(sizeof(float) * i * 4));
|
||||
}
|
||||
glDrawElementsInstanced(GL_TRIANGLES, IndexCount, GL_UNSIGNED_SHORT, 0, instances);
|
||||
}
|
||||
else
|
||||
glDrawElements(GL_TRIANGLES, IndexCount, GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Lock()
|
||||
{
|
||||
//glBindVertexArray(VertexArrayObject);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexBufferObject);
|
||||
IndexBuffer = (unsigned short*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_WRITE);
|
||||
VertexBuffer = (MeshVertex*)VertexArrayBuffer->Lock();
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Unlock()
|
||||
{
|
||||
VertexArrayBuffer->Unlock();
|
||||
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;
|
||||
}
|
||||
|
||||
blu::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);
|
||||
}
|
||||
|
||||
blu::memcpy(VertexBuffer, OP.NextVB, MaxVertexBuffer * sizeof(MeshVertex));
|
||||
blu::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()
|
||||
{
|
||||
blu::memset(NextVB, 0, sizeof (NextVB));
|
||||
blu::memset(NextIB, 0, sizeof (NextIB));
|
||||
blu::memset(EdgeConfiguration, 0, sizeof (EdgeConfiguration));
|
||||
blu::memset(EdgeUsage, 0, sizeof (EdgeUsage));
|
||||
blu::memset(EdgeID, 0, 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::Perturb(float extend)
|
||||
{
|
||||
for (int i = 0; i < VertexCount; ++i)
|
||||
{
|
||||
float rand = GlobalRandomGenerator.genFloat();
|
||||
VertexBuffer[i].Position -= VertexBuffer[i].Normal * extend * rand;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mesh::StandardSubdivide()
|
||||
{
|
||||
OP.Reset();
|
||||
blu::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;
|
||||
}
|
||||
|
||||
blu::memcpy(VertexBuffer, OP.NextVB, MaxVertexBuffer * sizeof(MeshVertex));
|
||||
blu::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);
|
||||
StandardSubdivide();
|
||||
StandardSubdivide();
|
||||
GenerateNormals();
|
||||
NormalizeNormals();
|
||||
Perturb(0.5f);
|
||||
CatmullClarkSubdivide();
|
||||
GenerateNormals();
|
||||
NormalizeNormals();
|
||||
Perturb(0.1f);
|
||||
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;
|
||||
OutputDebugString("");
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void Mesh::Ribbon(Path& path, const vec4& upVector, float maxT, float stepSize)
|
||||
{
|
||||
Lock();
|
||||
|
||||
float currentT = 0;
|
||||
vec4 previousUp = upVector;
|
||||
IndexBuffer[0] = 4;
|
||||
IndexBuffer[1] = 0;
|
||||
IndexBuffer[2] = 1;
|
||||
IndexBuffer[3] = 2;
|
||||
IndexBuffer[4] = 3;
|
||||
IndexCount = 5;
|
||||
FaceCount = 1;
|
||||
VertexCount = 0;
|
||||
while (currentT <= maxT)
|
||||
{
|
||||
vec4 pos = path.CalcPositionForTime(currentT);
|
||||
vec4 dir = normalize(path.CalcPositionForTime(currentT + stepSize) - pos);
|
||||
vec4 right = normalize(cross(dir, previousUp));
|
||||
vec4 up = normalize(cross(right, dir));
|
||||
|
||||
VertexBuffer[VertexCount + 0].Position = pos+( up+right)*pos.w;
|
||||
VertexBuffer[VertexCount + 1].Position = pos+(-up+right)*pos.w;
|
||||
VertexBuffer[VertexCount + 2].Position = pos+(-up-right)*pos.w;
|
||||
VertexBuffer[VertexCount + 3].Position = pos+( up-right)*pos.w;
|
||||
IndexBuffer[IndexCount + 0] = 4;
|
||||
IndexBuffer[IndexCount + 1] = VertexCount + 4;
|
||||
IndexBuffer[IndexCount + 2] = VertexCount + 0;
|
||||
IndexBuffer[IndexCount + 3] = VertexCount + 1;
|
||||
IndexBuffer[IndexCount + 4] = VertexCount + 5;
|
||||
IndexCount += 5;
|
||||
IndexBuffer[IndexCount + 0] = 4;
|
||||
IndexBuffer[IndexCount + 1] = VertexCount + 5;
|
||||
IndexBuffer[IndexCount + 2] = VertexCount + 1;
|
||||
IndexBuffer[IndexCount + 3] = VertexCount + 2;
|
||||
IndexBuffer[IndexCount + 4] = VertexCount + 6;
|
||||
IndexCount += 5;
|
||||
IndexBuffer[IndexCount + 0] = 4;
|
||||
IndexBuffer[IndexCount + 1] = VertexCount + 6;
|
||||
IndexBuffer[IndexCount + 2] = VertexCount + 2;
|
||||
IndexBuffer[IndexCount + 3] = VertexCount + 3;
|
||||
IndexBuffer[IndexCount + 4] = VertexCount + 7;
|
||||
IndexCount += 5;
|
||||
IndexBuffer[IndexCount + 0] = 4;
|
||||
IndexBuffer[IndexCount + 1] = VertexCount + 7;
|
||||
IndexBuffer[IndexCount + 2] = VertexCount + 3;
|
||||
IndexBuffer[IndexCount + 3] = VertexCount + 0;
|
||||
IndexBuffer[IndexCount + 4] = VertexCount + 4;
|
||||
IndexCount += 5;
|
||||
VertexCount += 4;
|
||||
FaceCount += 4;
|
||||
|
||||
previousUp = up;
|
||||
currentT += stepSize;
|
||||
}
|
||||
IndexBuffer[IndexCount + 0] = 4;
|
||||
IndexBuffer[IndexCount + 1] = VertexCount-4 + 0;
|
||||
IndexBuffer[IndexCount + 2] = VertexCount-4 + 1;
|
||||
IndexBuffer[IndexCount + 3] = VertexCount-4 + 2;
|
||||
IndexBuffer[IndexCount + 4] = VertexCount-4 + 3;
|
||||
IndexCount += 5;
|
||||
FaceCount += 1;
|
||||
|
||||
CatmullClarkSubdivide();
|
||||
GenerateNormals();
|
||||
Triangulate();
|
||||
Homogenize();
|
||||
Unlock();
|
||||
}
|
||||
96
Blu64k/src/Blu64k/Mesh/Mesh.h
Normal file
96
Blu64k/src/Blu64k/Mesh/Mesh.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#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 MaxInstanceBuffer = 65536;
|
||||
static const int MaxIndexBuffer = 65536 * 9 / 2;
|
||||
|
||||
MeshVertex* VertexBuffer;
|
||||
Matrix* InstanceBuffer;
|
||||
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;
|
||||
OglArrayBuffer* VertexArrayBuffer;
|
||||
unsigned int IndexBufferObject;
|
||||
|
||||
void Render(unsigned int instances = 0, OglArrayBuffer* InstanceArrayBuffer = 0);
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
void Transform(const Matrix& transform);
|
||||
void CreateCube();
|
||||
void CreateSphere(unsigned int lod);
|
||||
void Ribbon(Path& path, const vec4& upVector, float maxT, float stepSize);
|
||||
|
||||
private:
|
||||
void Homogenize();
|
||||
void GenerateNormals();
|
||||
void NormalizeNormals();
|
||||
void CatmullClarkSubdivide();
|
||||
void StandardSubdivide();
|
||||
void Extrude(float extend);
|
||||
void Bevel(float extend, float minAngle);
|
||||
void Triangulate();
|
||||
void Perturb(float extend);
|
||||
};
|
||||
62
Blu64k/src/Blu64k/OpenGL/FullScreenQuad.cpp
Normal file
62
Blu64k/src/Blu64k/OpenGL/FullScreenQuad.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "stdafx.h"
|
||||
#include "FullScreenQuad.h"
|
||||
|
||||
|
||||
FullScreenQuad::FullScreenQuad()
|
||||
{
|
||||
SHADER_SOURCE(displayShader, "Filters/BaseVS.h", "Pixel/ShowColorFS.h");
|
||||
|
||||
float* vertices = new float[8];
|
||||
|
||||
vertices[0] = -1; vertices[1] = 1;
|
||||
vertices[2] = -1; vertices[3] = -1;
|
||||
vertices[4] = 1; vertices[5] = 1;
|
||||
vertices[6] = 1; vertices[7] = -1;
|
||||
|
||||
glGenVertexArrays(1, &vertexArrayObject);
|
||||
glBindVertexArray(vertexArrayObject);
|
||||
|
||||
glGenBuffers(1, &vertexBufferObject);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), vertices, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer((GLuint)0, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
|
||||
FullScreenQuad* FullScreenQuad::instance = NULL;
|
||||
FullScreenQuad* FullScreenQuad::Instance()
|
||||
{
|
||||
if (instance == NULL)
|
||||
instance = new FullScreenQuad();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
void FullScreenQuad::Render()
|
||||
{
|
||||
glBindVertexArray(vertexArrayObject);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void FullScreenQuad::Display(OglTexture* tex, OglShader* shader)
|
||||
{
|
||||
if (shader == NULL)
|
||||
shader = displayShader;
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
shader->Apply();
|
||||
tex->Apply(0);
|
||||
shader->SetParam("t0", 0);
|
||||
FullScreenQuad::Instance()->Render();
|
||||
shader->Unapply();
|
||||
tex->Unapply(0);
|
||||
}
|
||||
|
||||
20
Blu64k/src/Blu64k/OpenGL/FullScreenQuad.h
Normal file
20
Blu64k/src/Blu64k/OpenGL/FullScreenQuad.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
class OglTexture;
|
||||
class OglShader;
|
||||
class FullScreenQuad
|
||||
{
|
||||
public:
|
||||
FullScreenQuad();
|
||||
|
||||
static FullScreenQuad* Instance();
|
||||
void Render();
|
||||
void Display(OglTexture* tex, OglShader* shader = NULL);
|
||||
|
||||
private:
|
||||
static FullScreenQuad* instance;
|
||||
|
||||
GLuint vertexArrayObject;
|
||||
GLuint vertexBufferObject;
|
||||
OglShader* displayShader;
|
||||
};
|
||||
29
Blu64k/src/Blu64k/OpenGL/OglArrayBuffer.cpp
Normal file
29
Blu64k/src/Blu64k/OpenGL/OglArrayBuffer.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglArrayBuffer.h"
|
||||
|
||||
|
||||
OglArrayBuffer::OglArrayBuffer(size_t size, bool dynamic)
|
||||
{
|
||||
glGenBuffers(1, &Handle);
|
||||
Bind();
|
||||
glBufferData(GL_ARRAY_BUFFER, size, NULL, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
|
||||
void* OglArrayBuffer::Lock()
|
||||
{
|
||||
Bind();
|
||||
return glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
|
||||
}
|
||||
|
||||
|
||||
void OglArrayBuffer::Unlock()
|
||||
{
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
|
||||
void OglArrayBuffer::Bind()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, Handle);
|
||||
}
|
||||
13
Blu64k/src/Blu64k/OpenGL/OglArrayBuffer.h
Normal file
13
Blu64k/src/Blu64k/OpenGL/OglArrayBuffer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class OglArrayBuffer
|
||||
{
|
||||
public:
|
||||
OglArrayBuffer(size_t size, bool dynamic = 0);
|
||||
void Bind();
|
||||
void* Lock();
|
||||
void Unlock();
|
||||
unsigned int Handle;
|
||||
};
|
||||
|
||||
53
Blu64k/src/Blu64k/OpenGL/OglCameraScene.cpp
Normal file
53
Blu64k/src/Blu64k/OpenGL/OglCameraScene.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglCameraScene.h"
|
||||
#include "OglLayer.h"
|
||||
#include "OglTexture.h"
|
||||
|
||||
|
||||
OglRenderTarget* OglCameraScene::renderTarget = 0;
|
||||
OglCameraScene* OglCameraScene::currentRenderingInstance = 0;
|
||||
|
||||
|
||||
OglCameraScene::OglCameraScene(OglScene* scene)
|
||||
: scene(scene)
|
||||
, cameraFov(blu::pi()/3)
|
||||
, cameraNear(0.1f)
|
||||
, cameraFar(1000.0f)
|
||||
, cameraPos()
|
||||
, cameraCenter()
|
||||
, cameraUp()
|
||||
{
|
||||
if (renderTarget == NULL)
|
||||
renderTarget = new OglRenderTarget(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height);
|
||||
|
||||
RenderPipeline::CameraScenes[RenderPipeline::CameraSceneCount++] = this;
|
||||
}
|
||||
|
||||
|
||||
void OglCameraScene::Render()
|
||||
{
|
||||
currentRenderingInstance = this;
|
||||
bool render = false;
|
||||
unsigned int textures[16];
|
||||
for (int i = 0; i < this->outputLayersCount; ++i)
|
||||
{
|
||||
textures[i] = ((OglTexture*)((OglLayer*)outputLayers[i])->texture)->textureId;
|
||||
if (outputLayers[i]->alpha > 0)
|
||||
{
|
||||
render = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!render)
|
||||
return;
|
||||
|
||||
renderTarget->set_Textures(outputLayersCount, textures);
|
||||
renderTarget->Bind();
|
||||
|
||||
perspectiveMatrix = Matrix::Perspective(cameraFov, OglGraphics::Instance()->AspectRatio, cameraNear, cameraFar);
|
||||
viewMatrix = Matrix::LookAt(cameraPos, cameraCenter, cameraUp);
|
||||
|
||||
scene->Render();
|
||||
renderTarget->Unbind();
|
||||
currentRenderingInstance = 0;
|
||||
}
|
||||
30
Blu64k/src/Blu64k/OpenGL/OglCameraScene.h
Normal file
30
Blu64k/src/Blu64k/OpenGL/OglCameraScene.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
class OglRenderTarget;
|
||||
class OglLayer;
|
||||
class OglScene;
|
||||
|
||||
|
||||
class __declspec(align(16)) OglCameraScene
|
||||
{
|
||||
public:
|
||||
static OglCameraScene* currentRenderingInstance;
|
||||
vec4 cameraPos;
|
||||
vec4 cameraCenter;
|
||||
vec4 cameraUp;
|
||||
OglLayer* outputLayers[16];
|
||||
int outputLayersCount;
|
||||
float cameraFov;
|
||||
float cameraNear;
|
||||
float cameraFar;
|
||||
Matrix perspectiveMatrix;
|
||||
Matrix viewMatrix;
|
||||
OglScene* scene;
|
||||
|
||||
OglCameraScene(OglScene* scene);
|
||||
|
||||
virtual void Render();
|
||||
|
||||
private:
|
||||
static OglRenderTarget* renderTarget;
|
||||
};
|
||||
27
Blu64k/src/Blu64k/OpenGL/OglGraphics.cpp
Normal file
27
Blu64k/src/Blu64k/OpenGL/OglGraphics.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglGraphics.h"
|
||||
|
||||
|
||||
OglGraphics::OglGraphics()
|
||||
: AspectRatio(16.0f / 9.0f)
|
||||
, Width(1280)
|
||||
, Height(720)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
OglGraphics* OglGraphics::instance = NULL;
|
||||
OglGraphics* OglGraphics::Instance()
|
||||
{
|
||||
if (instance == NULL)
|
||||
{
|
||||
instance = new OglGraphics();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
void OglGraphics::Clear()
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
17
Blu64k/src/Blu64k/OpenGL/OglGraphics.h
Normal file
17
Blu64k/src/Blu64k/OpenGL/OglGraphics.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class OglGraphics
|
||||
{
|
||||
private:
|
||||
static OglGraphics* instance;
|
||||
|
||||
public:
|
||||
OglGraphics();
|
||||
static OglGraphics* Instance();
|
||||
float AspectRatio;
|
||||
int Width;
|
||||
int Height;
|
||||
|
||||
virtual void Clear();
|
||||
};
|
||||
35
Blu64k/src/Blu64k/OpenGL/OglLayer.cpp
Normal file
35
Blu64k/src/Blu64k/OpenGL/OglLayer.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglLayer.h"
|
||||
#include "FullScreenQuad.h"
|
||||
|
||||
|
||||
OglShader* OglLayer::LayerShader = NULL;
|
||||
|
||||
|
||||
OglLayer::OglLayer()
|
||||
: alpha(1.0f)
|
||||
, texture(0)
|
||||
{
|
||||
texture = new OglTexture(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height, TextureFormat::RGBA);
|
||||
|
||||
if (LayerShader == NULL)
|
||||
SHADER_SOURCE(LayerShader, "Vertex/layer.h", "Pixel/layer.h");
|
||||
|
||||
RenderPipeline::Layers[RenderPipeline::LayerCount++] = this;
|
||||
}
|
||||
|
||||
|
||||
void OglLayer::Render()
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
texture->Apply(0);
|
||||
LayerShader->SetParam("a", alpha);
|
||||
LayerShader->SetParam("t", 0);
|
||||
|
||||
FullScreenQuad::Instance()->Render();
|
||||
|
||||
texture->Unapply(0);
|
||||
}
|
||||
|
||||
18
Blu64k/src/Blu64k/OpenGL/OglLayer.h
Normal file
18
Blu64k/src/Blu64k/OpenGL/OglLayer.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
class OglTexture;
|
||||
class OglShader;
|
||||
|
||||
|
||||
class OglLayer
|
||||
{
|
||||
public:
|
||||
OglLayer();
|
||||
OglTexture* texture;
|
||||
float alpha;
|
||||
static OglShader* LayerShader;
|
||||
|
||||
virtual void Render();
|
||||
|
||||
private:
|
||||
};
|
||||
103
Blu64k/src/Blu64k/OpenGL/OglRenderTarget.cpp
Normal file
103
Blu64k/src/Blu64k/OpenGL/OglRenderTarget.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglRenderTarget.h"
|
||||
|
||||
|
||||
OglRenderTarget* OglRenderTarget::stack[16];
|
||||
unsigned int OglRenderTarget::stackCount = 0;
|
||||
|
||||
|
||||
OglRenderTarget::OglRenderTarget(unsigned int width, unsigned int height)
|
||||
: width(width)
|
||||
, height(height)
|
||||
, frameBufferId(0)
|
||||
, depthBufferId(0)
|
||||
{
|
||||
glGenFramebuffersEXT(1, &frameBufferId);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId);
|
||||
glGenRenderbuffersEXT(1, &depthBufferId);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBufferId);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);//OglGraphics::Width, OglGraphics::Height);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBufferId);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
|
||||
|
||||
void OglRenderTarget::BindInternal()
|
||||
{
|
||||
static GLenum buffers[16];
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId);
|
||||
for (unsigned int i = 0; i < textureCount; ++i)
|
||||
{
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, textures[i], 0);
|
||||
buffers[i] = GL_COLOR_ATTACHMENT0_EXT + i;
|
||||
}
|
||||
glDrawBuffers(textureCount, buffers);
|
||||
glViewportEx(0, 0, width, height);
|
||||
|
||||
#ifdef _DEBUG
|
||||
GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
switch(error)
|
||||
{
|
||||
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||
OutputDebugString("Incomplete attachment");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||
OutputDebugString("Missing attachment");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||
OutputDebugString("Incomplete dimensions");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
||||
OutputDebugString("Incomplete formats");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||
OutputDebugString("Incomplete draw buffer");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||
OutputDebugString("Incomplete read buffer");
|
||||
DebugBreak();
|
||||
break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||
OutputDebugString("Framebufferobjects unsupported");
|
||||
DebugBreak();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void OglRenderTarget::Bind()
|
||||
{
|
||||
BindInternal();
|
||||
stack[++stackCount] = this;
|
||||
}
|
||||
|
||||
|
||||
void OglRenderTarget::Unbind()
|
||||
{
|
||||
--stackCount;
|
||||
if (stackCount == 0)
|
||||
{
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glViewportEx(0, 0, OglGraphics::Instance()->Width, OglGraphics::Instance()->Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
stack[stackCount]->BindInternal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OglRenderTarget::set_Textures(unsigned int num, unsigned int* textures)
|
||||
{
|
||||
textureCount = num;
|
||||
for (unsigned int i = 0; i < textureCount; ++i)
|
||||
this->textures[i] = textures[i];
|
||||
}
|
||||
27
Blu64k/src/Blu64k/OpenGL/OglRenderTarget.h
Normal file
27
Blu64k/src/Blu64k/OpenGL/OglRenderTarget.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class OglRenderTarget
|
||||
{
|
||||
public:
|
||||
OglRenderTarget(unsigned int width, unsigned int height);
|
||||
|
||||
void Bind();
|
||||
static void Unbind();
|
||||
|
||||
unsigned int get_Width() const { return width; }
|
||||
unsigned int get_Height() const { return height; }
|
||||
void set_Textures(unsigned int num, unsigned int* textures);
|
||||
|
||||
private:
|
||||
void BindInternal();
|
||||
static OglRenderTarget* stack[16];
|
||||
static unsigned int stackCount;
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int frameBufferId;
|
||||
unsigned int depthBufferId;
|
||||
unsigned int textures[16];
|
||||
unsigned int textureCount;
|
||||
};
|
||||
8
Blu64k/src/Blu64k/OpenGL/OglScene.h
Normal file
8
Blu64k/src/Blu64k/OpenGL/OglScene.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class OglScene
|
||||
{
|
||||
public:
|
||||
virtual void Render() = 0;
|
||||
};
|
||||
268
Blu64k/src/Blu64k/OpenGL/OglShader.cpp
Normal file
268
Blu64k/src/Blu64k/OpenGL/OglShader.cpp
Normal file
@@ -0,0 +1,268 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglShader.h"
|
||||
|
||||
|
||||
OglShader* shaders[128];
|
||||
int g_ShaderCount = 0;
|
||||
unsigned int OglShader::currentProgramId;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define CHECK_DEBUG_OUTPUT(shader) \
|
||||
{\
|
||||
GLint success = 0;\
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\
|
||||
if (!success)\
|
||||
{\
|
||||
GLchar infoLog[16384];\
|
||||
glGetShaderInfoLog(shader, 16384, NULL, infoLog);\
|
||||
OutputDebugString(infoLog);\
|
||||
}\
|
||||
}
|
||||
#else
|
||||
#define CHECK_DEBUG_OUTPUT(shader)
|
||||
#endif
|
||||
|
||||
//DebugBreak();\
|
||||
|
||||
|
||||
#ifdef AUTHORING
|
||||
char ShaderMonitor::VSFiles[256][4096];
|
||||
char ShaderMonitor::FSFiles[256][4096];
|
||||
char ShaderMonitor::GSFiles[256][4096];
|
||||
OglShader* ShaderMonitor::Shaders[256];
|
||||
char ShaderMonitor::VSFileToShaderMap[256];
|
||||
char ShaderMonitor::FSFileToShaderMap[256];
|
||||
char ShaderMonitor::GSFileToShaderMap[256];
|
||||
int ShaderMonitor::VSFileCount;
|
||||
int ShaderMonitor::FSFileCount;
|
||||
int ShaderMonitor::GSFileCount;
|
||||
int ShaderMonitor::ShaderCount;
|
||||
ShaderLoadMap g_Shaders[512];
|
||||
|
||||
DWORD WINAPI monitorThread(void* param)
|
||||
{
|
||||
char* buffer = new char[16 * 1024 * 1024];
|
||||
|
||||
char path[4096];
|
||||
::GetModuleFileName(NULL, path, 4096);
|
||||
char* ptr = path;
|
||||
while (*ptr++ != 0) ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
blu::memcpy(++ptr, "\\src\\Blu64k\\Shaders\\", 21); ptr += 20;
|
||||
|
||||
HANDLE dirHandle = CreateFile(path, FILE_LIST_DIRECTORY, 7, 0, 3, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||
do
|
||||
{
|
||||
DWORD bytesReturned = 0;
|
||||
ReadDirectoryChangesW(dirHandle, buffer, 16 * 1024 * 1024, TRUE, FILE_NOTIFY_CHANGE_LAST_WRITE, &bytesReturned, 0, 0);
|
||||
::Sleep(100);
|
||||
char* ptr = buffer;
|
||||
DWORD NextEntryOffset;
|
||||
DWORD Action;
|
||||
DWORD FileNameLength;
|
||||
WCHAR* FileName;
|
||||
char fileName[4096];
|
||||
char tempFileName[4096];
|
||||
size_t fileNameSize = 0;
|
||||
do
|
||||
{
|
||||
DWORD* dptr = (DWORD*)ptr;
|
||||
NextEntryOffset = dptr[0];
|
||||
Action = dptr[1];
|
||||
FileNameLength = dptr[2];
|
||||
FileName = (WCHAR*)&dptr[3];
|
||||
blu::memcpy(fileName, path, strlen(path) + 1);
|
||||
wcstombs_s(&fileNameSize, tempFileName, FileName, 4096);
|
||||
blu::memcpy(fileName + strlen(path), tempFileName, strlen(tempFileName) + 1);
|
||||
ptr += NextEntryOffset;
|
||||
|
||||
bool shaderBitmap[256];
|
||||
blu::memset(shaderBitmap, 0, 256);
|
||||
|
||||
// Iterate to all file maps and fish out all OglShader*s that need recompiling
|
||||
for (int i = 0; i < ShaderMonitor::VSFileCount; ++i)
|
||||
if (strcmp(fileName, ShaderMonitor::VSFiles[i]) == 0)
|
||||
shaderBitmap[ShaderMonitor::VSFileToShaderMap[i]] = true;
|
||||
for (int i = 0; i < ShaderMonitor::FSFileCount; ++i)
|
||||
if (strcmp(fileName, ShaderMonitor::FSFiles[i]) == 0)
|
||||
shaderBitmap[ShaderMonitor::FSFileToShaderMap[i]] = true;
|
||||
for (int i = 0; i < ShaderMonitor::GSFileCount; ++i)
|
||||
if (strcmp(fileName, ShaderMonitor::GSFiles[i]) == 0)
|
||||
shaderBitmap[ShaderMonitor::GSFileToShaderMap[i]] = true;
|
||||
for (int i = 0; i < 256; ++i)
|
||||
if (shaderBitmap[i])
|
||||
{
|
||||
static char* vsSource, *fsSource, *gsSource;
|
||||
vsSource = ShaderMonitor::TextFileRead(ShaderMonitor::VSFiles[g_Shaders[i].vsId]);
|
||||
fsSource = ShaderMonitor::TextFileRead(ShaderMonitor::FSFiles[g_Shaders[i].fsId]);
|
||||
gsSource = g_Shaders[i].gsId != -1 ? ShaderMonitor::TextFileRead(ShaderMonitor::GSFiles[g_Shaders[i].gsId]) : 0;
|
||||
ShaderMonitor::Shaders[i]->Load(vsSource, fsSource, gsSource, true);
|
||||
}
|
||||
|
||||
} while (NextEntryOffset != 0);
|
||||
} while (true);
|
||||
}
|
||||
|
||||
#else
|
||||
int currentShader;
|
||||
#endif
|
||||
|
||||
OglShader::OglShader(char* vertexShader, char* pixelShader, char* geometryShader, OglGeometryShaderData* gsd)
|
||||
{
|
||||
this->geometryShaderData = gsd;
|
||||
Load(vertexShader, pixelShader, geometryShader);
|
||||
}
|
||||
|
||||
|
||||
void OglShader::Load(char* vertexShader, char* pixelShader, char* geometryShader, bool copy)
|
||||
{
|
||||
if (copy)
|
||||
{
|
||||
vsSource = new char[blu::strlen(vertexShader)];
|
||||
blu::memcpy(vsSource, vertexShader, blu::strlen(vertexShader));
|
||||
fsSource = new char[blu::strlen(pixelShader)];
|
||||
blu::memcpy(fsSource, pixelShader, blu::strlen(pixelShader));
|
||||
if (geometryShader)
|
||||
{
|
||||
gsSource = new char[blu::strlen(geometryShader)];
|
||||
blu::memcpy(gsSource, geometryShader, blu::strlen(geometryShader));
|
||||
}
|
||||
else
|
||||
{
|
||||
gsSource = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vsSource = vertexShader;
|
||||
fsSource = pixelShader;
|
||||
gsSource = geometryShader;
|
||||
}
|
||||
reload = true;
|
||||
}
|
||||
|
||||
|
||||
void OglShader::Reload()
|
||||
{
|
||||
programId = glCreateProgram();
|
||||
|
||||
// VertexShader
|
||||
if (vsSource != 0)
|
||||
{
|
||||
unsigned int vertexShaderHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||
int vertexShaderLength = blu::strlen(vsSource);
|
||||
glShaderSource(vertexShaderHandle, 1, (const GLchar**)&vsSource, &vertexShaderLength);
|
||||
glCompileShader(vertexShaderHandle);
|
||||
CHECK_DEBUG_OUTPUT(vertexShaderHandle);
|
||||
glAttachShader(programId, vertexShaderHandle);
|
||||
}
|
||||
|
||||
|
||||
// PixelShader
|
||||
if (fsSource != 0)
|
||||
{
|
||||
unsigned int pixelShaderHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
int pixelShaderLength = blu::strlen(fsSource);
|
||||
glShaderSource(pixelShaderHandle, 1, (const GLchar**)&fsSource, &pixelShaderLength);
|
||||
glCompileShader(pixelShaderHandle);
|
||||
CHECK_DEBUG_OUTPUT(pixelShaderHandle);
|
||||
glAttachShader(programId, pixelShaderHandle);
|
||||
}
|
||||
|
||||
// GeometryShader
|
||||
if (geometryShaderData != NULL)
|
||||
{
|
||||
OglGeometryShaderData* geoShaderData = (OglGeometryShaderData*)geometryShaderData;
|
||||
unsigned int geometryShaderHandle = glCreateShader(GL_GEOMETRY_SHADER_EXT);
|
||||
int geometryShaderLength = blu::strlen(gsSource);
|
||||
glShaderSource(geometryShaderHandle, 1, (const GLchar**)&gsSource, &geometryShaderLength);
|
||||
glCompileShader(geometryShaderHandle);
|
||||
CHECK_DEBUG_OUTPUT(geometryShaderHandle);
|
||||
glAttachShader(programId, geometryShaderHandle);
|
||||
|
||||
glProgramParameteriEXT(programId, GL_GEOMETRY_VERTICES_OUT_EXT, geoShaderData->VerticesOutCount);
|
||||
glProgramParameteriEXT(programId, GL_GEOMETRY_INPUT_TYPE_EXT, geoShaderData->InputType);
|
||||
glProgramParameteriEXT(programId, GL_GEOMETRY_OUTPUT_TYPE_EXT, geoShaderData->OutputType);
|
||||
|
||||
if (geoShaderData->TransformFeedBackVaryingCount > 0)
|
||||
{
|
||||
glTransformFeedbackVaryings(programId, geoShaderData->TransformFeedBackVaryingCount, geoShaderData->TransformFeedBackVaryings, GL_INTERLEAVED_ATTRIBS);
|
||||
}
|
||||
}
|
||||
|
||||
glLinkProgram(programId);
|
||||
reload = false;
|
||||
}
|
||||
|
||||
|
||||
void OglShader::Unapply()
|
||||
{
|
||||
glUseProgram(0);
|
||||
currentProgramId = 0;
|
||||
}
|
||||
|
||||
|
||||
void OglShader::Apply()
|
||||
{
|
||||
if (reload)
|
||||
Reload();
|
||||
|
||||
glUseProgram(programId);
|
||||
currentProgramId = programId;
|
||||
}
|
||||
|
||||
|
||||
int OglShader::get_UniformHandle(LPCSTR param)
|
||||
{
|
||||
return glGetUniformLocation(programId, param);
|
||||
}
|
||||
|
||||
|
||||
void OglShader::SetParam(const char* param, int value)
|
||||
{
|
||||
int location = get_UniformHandle(param);
|
||||
glUniform1i(location, value);
|
||||
}
|
||||
|
||||
|
||||
void OglShader::SetParam(const char* param, float value)
|
||||
{
|
||||
int location = get_UniformHandle(param);
|
||||
glUniform1f(location, value);
|
||||
}
|
||||
|
||||
|
||||
void OglShader::SetParam(const char* param, const float* value, int count)
|
||||
{
|
||||
int location = get_UniformHandle(param);
|
||||
if (location >= 0)
|
||||
switch (count)
|
||||
{
|
||||
case 1: glUniform1fv(location, 1, value); break;
|
||||
case 2: glUniform2fv(location, 1, value); break;
|
||||
case 3: glUniform3fv(location, 1, value); break;
|
||||
case 4: glUniform4fv(location, 1, value); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OglShader::SetParam(const char* param, const Matrix& value)
|
||||
{
|
||||
int location = get_UniformHandle(param);
|
||||
if (location >= 0)
|
||||
glUniformMatrix4fv(location, 1, true, value.m);
|
||||
}
|
||||
|
||||
|
||||
void OglShader::SetParam(const char* param, const vec4& value, int dimension)
|
||||
{
|
||||
this->SetParam(param, (float*)value.m, dimension);
|
||||
}
|
||||
|
||||
|
||||
unsigned int OglShader::GetCurrentAttribLocation(const char* param)
|
||||
{
|
||||
return glGetAttribLocation(currentProgramId, param);
|
||||
}
|
||||
328
Blu64k/src/Blu64k/OpenGL/OglShader.h
Normal file
328
Blu64k/src/Blu64k/OpenGL/OglShader.h
Normal file
@@ -0,0 +1,328 @@
|
||||
#pragma once
|
||||
//#define CRUNCH
|
||||
|
||||
struct OglGeometryShaderData
|
||||
{
|
||||
OglGeometryShaderData(
|
||||
unsigned int verticesOutCount = 1,
|
||||
int inputType = GL_POINTS,
|
||||
int outputType = GL_POINTS,
|
||||
unsigned int transformFeedBackVaryingCount = 0,
|
||||
const char** transformFeedBackVaryings = 0)
|
||||
: VerticesOutCount(verticesOutCount)
|
||||
, InputType(inputType)
|
||||
, OutputType(outputType)
|
||||
, TransformFeedBackVaryingCount(transformFeedBackVaryingCount)
|
||||
, TransformFeedBackVaryings(transformFeedBackVaryings)
|
||||
{
|
||||
|
||||
}
|
||||
unsigned int VerticesOutCount;
|
||||
int InputType;
|
||||
int OutputType;
|
||||
|
||||
const char** TransformFeedBackVaryings;
|
||||
unsigned int TransformFeedBackVaryingCount;
|
||||
};
|
||||
|
||||
class OglShader
|
||||
{
|
||||
public:
|
||||
OglShader(char* vertexShader, char* pixelShader, char* geometryShader = 0, OglGeometryShaderData* geometryShaderData = 0);
|
||||
|
||||
virtual void Load(char* vertexShader, char* pixelShader, char* geometryShader = 0, bool copy = false);
|
||||
|
||||
virtual void Unapply();
|
||||
virtual void Apply();
|
||||
virtual void SetParam(const char* param, int value);
|
||||
virtual void SetParam(const char* param, float value);
|
||||
virtual void SetParam(const char* param, const float* value, int count);
|
||||
virtual void SetParam(const char* param, const Matrix& value);
|
||||
virtual void SetParam(const char* param, const vec4& value, int dimension = 4);
|
||||
static unsigned int GetCurrentAttribLocation(const char* param);
|
||||
|
||||
unsigned int programId;
|
||||
static unsigned int currentProgramId;
|
||||
|
||||
private:
|
||||
void Reload();
|
||||
bool reload;
|
||||
char* vsSource;
|
||||
char* fsSource;
|
||||
char* gsSource;
|
||||
OglGeometryShaderData* geometryShaderData;
|
||||
int get_UniformHandle(LPCSTR param);
|
||||
};
|
||||
|
||||
|
||||
struct ShaderLoadMap
|
||||
{
|
||||
char vsId;
|
||||
char fsId;
|
||||
char gsId;
|
||||
};
|
||||
|
||||
|
||||
extern ShaderLoadMap g_Shaders[];
|
||||
|
||||
|
||||
#ifdef AUTHORING
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
extern DWORD WINAPI monitorThread(void* param);
|
||||
|
||||
class ShaderMonitor
|
||||
{
|
||||
public:
|
||||
static char VSFiles[256][4096];
|
||||
static char FSFiles[256][4096];
|
||||
static char GSFiles[256][4096];
|
||||
static OglShader* Shaders[256];
|
||||
static char VSFileToShaderMap[256];
|
||||
static char FSFileToShaderMap[256];
|
||||
static char GSFileToShaderMap[256];
|
||||
static int VSFileCount;
|
||||
static int FSFileCount;
|
||||
static int GSFileCount;
|
||||
static int ShaderCount;
|
||||
|
||||
// TODO: cache all shader sources, make a mapping from filename to source
|
||||
static char* TextFileRead(const char* fileName)
|
||||
{
|
||||
if (!fileName)
|
||||
return 0;
|
||||
|
||||
FILE* file;
|
||||
char* content = NULL;
|
||||
size_t count = 0;
|
||||
|
||||
fopen_s(&file, fileName, "rt");
|
||||
if (file == NULL)
|
||||
{
|
||||
DebugBreak(); // "Error: Can't open file!";
|
||||
}
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
count = ftell(file);
|
||||
rewind(file);
|
||||
|
||||
content = new char[count + 1];
|
||||
count = fread_s(content, count + 1, sizeof(char), count, file);
|
||||
content[count] = 0;
|
||||
|
||||
fclose(file);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
static int FindVSID(char* path)
|
||||
{
|
||||
for (int i = 0; i < VSFileCount; ++i)
|
||||
if (strcmp(VSFiles[i], path) == 0)
|
||||
return i;
|
||||
|
||||
return VSFileCount++;
|
||||
}
|
||||
|
||||
static int FindFSID(char* path)
|
||||
{
|
||||
for (int i = 0; i < FSFileCount; ++i)
|
||||
if (strcmp(FSFiles[i], path) == 0)
|
||||
return i;
|
||||
|
||||
return FSFileCount++;
|
||||
}
|
||||
|
||||
static int FindGSID(char* path)
|
||||
{
|
||||
for (int i = 0; i < GSFileCount; ++i)
|
||||
if (strcmp(GSFiles[i], path) == 0)
|
||||
return i;
|
||||
|
||||
return GSFileCount++;
|
||||
}
|
||||
|
||||
static OglShader* Add(char* vert, char* frag, char* geo, OglGeometryShaderData* geoData)
|
||||
{
|
||||
OutputDebugString("Adding shader: ");
|
||||
OutputDebugString(vert);
|
||||
OutputDebugString(", ");
|
||||
OutputDebugString(frag);
|
||||
OutputDebugString(", ");
|
||||
OutputDebugString(geo);
|
||||
OutputDebugString("...\n");
|
||||
|
||||
static char path[4096];
|
||||
::GetModuleFileName(NULL, path, 4096);
|
||||
char* ptr = path;
|
||||
while (*ptr++ != 0) ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
blu::memcpy(++ptr, "\\src\\Blu64k\\Shaders\\", 21); ptr += 20;
|
||||
|
||||
int shaderId = ShaderCount++;
|
||||
static char* vsSource, *fsSource, *gsSource;
|
||||
|
||||
blu::memcpy(ptr, vert, strlen(vert) + 1);
|
||||
for (int i = 0; i < 4096; ++i) if (path[i] == '/') path[i] = '\\';
|
||||
vsSource = TextFileRead(path);
|
||||
int vertId = FindVSID(path);
|
||||
VSFileToShaderMap[vertId] = shaderId;
|
||||
blu::memcpy(VSFiles[vertId], path, 4096);
|
||||
|
||||
int fragId = -1;
|
||||
if (frag != 0)
|
||||
{
|
||||
blu::memcpy(ptr, frag, strlen(frag) + 1);
|
||||
for (int i = 0; i < 4096; ++i) if (path[i] == '/') path[i] = '\\';
|
||||
fsSource = TextFileRead(path);
|
||||
fragId = FindFSID(path);
|
||||
FSFileToShaderMap[fragId] = shaderId;
|
||||
blu::memcpy(FSFiles[fragId], path, 4096);
|
||||
}
|
||||
else
|
||||
fsSource = NULL;
|
||||
|
||||
int geoId = -1;
|
||||
if (geo != 0)
|
||||
{
|
||||
blu::memcpy(ptr, geo, strlen(geo) + 1);
|
||||
for (int i = 0; i < 4096; ++i) if (path[i] == '/') path[i] = '\\';
|
||||
gsSource = TextFileRead(path);
|
||||
geoId = FindGSID(path);
|
||||
GSFileToShaderMap[geoId] = shaderId;
|
||||
blu::memcpy(GSFiles[geoId], path, 4096);
|
||||
}
|
||||
else
|
||||
gsSource = NULL;
|
||||
|
||||
OglShader* shader = new OglShader(vsSource, fsSource, gsSource, geoData);
|
||||
Shaders[shaderId] = shader;
|
||||
|
||||
g_Shaders[shaderId].fsId = fragId;
|
||||
g_Shaders[shaderId].vsId = vertId;
|
||||
g_Shaders[shaderId].gsId = geoId;
|
||||
return shader;
|
||||
}
|
||||
|
||||
static char* Crunch(char* fileName)
|
||||
{
|
||||
char* read, *ptr;
|
||||
char result[16384];
|
||||
#ifdef CRUNCH
|
||||
char tempFilePath[4096], path[4096];
|
||||
GetTempPath(4096, path);
|
||||
GetTempFileName(path, "blu", 0, tempFilePath);
|
||||
GetModuleFileName(NULL, path, 4096);
|
||||
ptr = path;
|
||||
while (*ptr++ != 0) ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
blu::memcpy(++ptr, "\\src\\Blu64k\\glsl_minifier.exe --shader-only --preserve-externals -o ", 68); ptr += 68;
|
||||
blu::memcpy(ptr, tempFilePath, strlen(tempFilePath)); ptr += strlen(tempFilePath);
|
||||
blu::memcpy(ptr, " ", 1); ++ptr;
|
||||
blu::memcpy(ptr, fileName, strlen(fileName) + 1);
|
||||
static STARTUPINFO sj;
|
||||
static PROCESS_INFORMATION pj;
|
||||
if (CreateProcessA(0, path, 0, 0, FALSE, DETACHED_PROCESS | CREATE_NO_WINDOW, 0, 0, &sj, &pj))
|
||||
{
|
||||
WaitForSingleObject(pj.hProcess, INFINITE);
|
||||
read = TextFileRead(tempFilePath);
|
||||
DeleteFileA(tempFilePath);
|
||||
}
|
||||
#else
|
||||
read = TextFileRead(fileName);
|
||||
#endif
|
||||
ptr = result;
|
||||
read = strtok(read, "\n\r");
|
||||
while (read != NULL)
|
||||
{
|
||||
blu::memcpy(ptr, read, strlen(read)); ptr += strlen(read);
|
||||
blu::memcpy(ptr, "\\n", 2); ptr += 2;
|
||||
read = strtok(NULL, "\n\r");
|
||||
}
|
||||
ptr -= 2;
|
||||
*ptr = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
static void StartMonitoring()
|
||||
{
|
||||
char path[4096];
|
||||
::GetModuleFileName(NULL, path, 4096);
|
||||
char* ptr = path;
|
||||
while (*ptr++ != 0) ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
while (*ptr-- != '\\') ;
|
||||
blu::memcpy(++ptr, "\\src\\Blu64k\\Shaders\\", 21); ptr += 20;
|
||||
blu::memcpy(ptr, "shaders.g.h", 13);
|
||||
|
||||
std::ofstream myfile(path);
|
||||
if (myfile.is_open())
|
||||
{
|
||||
myfile << "#pragma once\n\nchar* g_VShaders[] = {\n";
|
||||
if (VSFileCount == 0) myfile << "\t" << (int)0 << "\n"; else
|
||||
for (int i = 0; i < VSFileCount; ++i)
|
||||
{
|
||||
char* shaderCode = Crunch(VSFiles[i]);
|
||||
myfile << "\t\"";
|
||||
myfile << shaderCode;
|
||||
myfile << "\",\n";
|
||||
}
|
||||
myfile << "};\n\nchar* g_FShaders[] = {\n";
|
||||
if (FSFileCount == 0) myfile << "\t" << (int)0 << "\n"; else
|
||||
for (int i = 0; i < FSFileCount; ++i)
|
||||
{
|
||||
char* shaderCode = Crunch(FSFiles[i]);
|
||||
myfile << "\t\"";
|
||||
myfile << shaderCode;
|
||||
myfile << "\",\n";
|
||||
}
|
||||
myfile << "};\n\nchar* g_GShaders[] = {\n";
|
||||
if (GSFileCount == 0) myfile << "\t" << (int)0 << "\n"; else
|
||||
for (int i = 0; i < GSFileCount; ++i)
|
||||
{
|
||||
char* shaderCode = Crunch(GSFiles[i]);
|
||||
myfile << "\t\"";
|
||||
myfile << shaderCode;
|
||||
myfile << "\",\n";
|
||||
}
|
||||
myfile << "};\n\nShaderLoadMap g_Shaders[] = {\n";
|
||||
for (int i = 0; i < ShaderCount; ++i)
|
||||
{
|
||||
myfile << "\t{";
|
||||
myfile << (int)g_Shaders[i].vsId;
|
||||
myfile << ", ";
|
||||
myfile << (int)g_Shaders[i].fsId;
|
||||
myfile << ", ";
|
||||
myfile << (int)g_Shaders[i].gsId;
|
||||
myfile << "},\n";
|
||||
}
|
||||
myfile << "};\n";
|
||||
myfile.close();
|
||||
}
|
||||
|
||||
::CreateThread(0, 0, monitorThread, 0, 0, 0);
|
||||
// TODO: make a thread about it!
|
||||
}
|
||||
};
|
||||
#else
|
||||
|
||||
extern char* g_VShaders[];
|
||||
extern char* g_FShaders[];
|
||||
extern char* g_GShaders[];
|
||||
extern int currentShader;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef AUTHORING
|
||||
#define SHADER_SOURCE(name, vert, frag) name = ShaderMonitor::Add(vert, frag, 0, 0)
|
||||
#define SHADER_SOURCE_GS(name, vert, frag, geo, geoData) name = ShaderMonitor::Add(vert, frag, geo, geoData)
|
||||
#else
|
||||
#define SHADER_SOURCE(name, vert, frag) name = new OglShader(g_VShaders[g_Shaders[currentShader].vsId], g_FShaders[g_Shaders[currentShader].fsId]); ++currentShader
|
||||
#define SHADER_SOURCE_GS(name, vert, frag, geo, geoData) name = new OglShader(g_VShaders[g_Shaders[currentShader].vsId], NULL, g_GShaders[g_Shaders[currentShader].gsId], geoData); ++currentShader
|
||||
#endif
|
||||
117
Blu64k/src/Blu64k/OpenGL/OglTexture.cpp
Normal file
117
Blu64k/src/Blu64k/OpenGL/OglTexture.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglTexture.h"
|
||||
#include "OglRenderTarget.h"
|
||||
#include "FullScreenQuad.h"
|
||||
|
||||
|
||||
OglTexture::OglTexture(unsigned int width, unsigned int height, TextureFormat::Enumeration format, TextureWrap::Enumeration wrap, void* data)
|
||||
: width(width)
|
||||
, height(height)
|
||||
, format(format)
|
||||
, renderTarget(NULL)
|
||||
{
|
||||
glGenTextures(1, &textureId);
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
|
||||
GLenum internalFormat = 1;
|
||||
GLenum pixelFormat = 1;
|
||||
GLenum type = 1;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case TextureFormat::RGB:
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
pixelFormat = GL_RGB;
|
||||
internalFormat = GL_RGB;
|
||||
break;
|
||||
case TextureFormat::RGBf:
|
||||
type = GL_FLOAT;
|
||||
pixelFormat = GL_RGB;
|
||||
internalFormat = GL_RGB16F;
|
||||
break;
|
||||
case TextureFormat::RGBA:
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
pixelFormat = GL_RGBA;
|
||||
internalFormat = GL_RGBA;
|
||||
break;
|
||||
case TextureFormat::RGBAf:
|
||||
type = GL_FLOAT;
|
||||
pixelFormat = GL_RGBA;
|
||||
internalFormat = GL_RGBA16F;
|
||||
break;
|
||||
case TextureFormat::Depth:
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
pixelFormat = GL_DEPTH_COMPONENT;
|
||||
internalFormat = GL_DEPTH_COMPONENT;
|
||||
break;
|
||||
case TextureFormat::Depthf:
|
||||
type = GL_FLOAT;
|
||||
pixelFormat = GL_DEPTH_COMPONENT;
|
||||
internalFormat = GL_DEPTH_COMPONENT32;
|
||||
break;
|
||||
}
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, pixelFormat, type, data);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (GLint)wrap);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (GLint)wrap);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
|
||||
void OglTexture::Unapply(int textureUnit)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + textureUnit);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
|
||||
void OglTexture::Apply(int textureUnit)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + textureUnit);
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
}
|
||||
|
||||
|
||||
unsigned int OglTexture::get_Width()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
unsigned int OglTexture::get_Height()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
TextureFormat::Enumeration OglTexture::get_Format() const
|
||||
{
|
||||
return format;
|
||||
}
|
||||
|
||||
|
||||
void OglTexture::FillWithShader(OglShader* shader)
|
||||
{
|
||||
if (renderTarget == NULL)
|
||||
{
|
||||
renderTarget = new OglRenderTarget(width, height);
|
||||
}
|
||||
|
||||
renderTarget->set_Textures(1, &textureId);
|
||||
renderTarget->Bind();
|
||||
{
|
||||
float texSize[4] =
|
||||
{
|
||||
(float)width,
|
||||
(float)height,
|
||||
1.0f / width,
|
||||
1.0f / height
|
||||
};
|
||||
|
||||
shader->Apply();
|
||||
shader->SetParam("texSize", texSize, 4);
|
||||
FullScreenQuad::Instance()->Render();
|
||||
shader->Unapply();
|
||||
}
|
||||
renderTarget->Unbind();
|
||||
}
|
||||
57
Blu64k/src/Blu64k/OpenGL/OglTexture.h
Normal file
57
Blu64k/src/Blu64k/OpenGL/OglTexture.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
class OglRenderTarget;
|
||||
class OglShader;
|
||||
|
||||
|
||||
struct TextureFormat
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
RGB,
|
||||
RGBA,
|
||||
RGBf,
|
||||
RGBAf,
|
||||
Depth,
|
||||
Depthf
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct TextureWrap
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Border = GL_CLAMP_TO_BORDER,
|
||||
Edge = GL_CLAMP_TO_EDGE,
|
||||
Repeat = GL_REPEAT,
|
||||
Mirror = GL_MIRRORED_REPEAT
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
class OglTexture
|
||||
{
|
||||
public:
|
||||
OglTexture(unsigned int width, unsigned int height, TextureFormat::Enumeration format, TextureWrap::Enumeration wrap = TextureWrap::Repeat, void* data = 0);
|
||||
|
||||
virtual void Unapply(int textureUnit);
|
||||
virtual void Apply(int textureUnit);
|
||||
|
||||
virtual unsigned int get_Width();
|
||||
virtual unsigned int get_Height();
|
||||
virtual TextureFormat::Enumeration get_Format() const;
|
||||
|
||||
virtual void FillWithShader(OglShader* shader);
|
||||
|
||||
unsigned int textureId;
|
||||
|
||||
private:
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
TextureFormat::Enumeration format;
|
||||
|
||||
OglRenderTarget* renderTarget;
|
||||
};
|
||||
66
Blu64k/src/Blu64k/OpenGL/OglTransition.cpp
Normal file
66
Blu64k/src/Blu64k/OpenGL/OglTransition.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "stdafx.h"
|
||||
#include "OglTransition.h"
|
||||
#include "OglLayer.h"
|
||||
#include "OglTexture.h"
|
||||
#include "FullScreenQuad.h"
|
||||
|
||||
|
||||
OglRenderTarget* OglTransition::renderTarget = NULL;
|
||||
|
||||
|
||||
OglTransition::OglTransition()
|
||||
: shader(NULL)
|
||||
, outputLayer(NULL)
|
||||
, inputLayersCount(0)
|
||||
, balance(0)
|
||||
{
|
||||
if (renderTarget == NULL)
|
||||
renderTarget = new OglRenderTarget(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height);
|
||||
|
||||
RenderPipeline::Transitions[RenderPipeline::TransitionCount++] = this;
|
||||
}
|
||||
|
||||
|
||||
void OglTransition::BeforeRender()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void OglTransition::AfterRender()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void OglTransition::Render()
|
||||
{
|
||||
if (outputLayer == NULL)
|
||||
return;
|
||||
|
||||
unsigned int texture = ((OglTexture*)((OglLayer*)outputLayer)->texture)->textureId;
|
||||
renderTarget->set_Textures(1, &texture);
|
||||
renderTarget->Bind();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
shader->Apply();
|
||||
|
||||
for (int i = 0; i < inputLayersCount; ++i)
|
||||
{
|
||||
((OglLayer*)inputLayers[i])->texture->Apply(i);
|
||||
char paramName[] = "t0";
|
||||
paramName[1] += i;
|
||||
shader->SetParam(paramName, i);
|
||||
}
|
||||
shader->SetParam("t", balance);
|
||||
|
||||
this->BeforeRender();
|
||||
FullScreenQuad::Instance()->Render();
|
||||
this->AfterRender();
|
||||
|
||||
for (int i = 0; i < inputLayersCount; ++i)
|
||||
{
|
||||
((OglLayer*)inputLayers[i])->texture->Unapply(i);
|
||||
}
|
||||
shader->Unapply();
|
||||
renderTarget->Unbind();
|
||||
}
|
||||
24
Blu64k/src/Blu64k/OpenGL/OglTransition.h
Normal file
24
Blu64k/src/Blu64k/OpenGL/OglTransition.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "OglRenderTarget.h"
|
||||
|
||||
|
||||
class OglTransition
|
||||
{
|
||||
public:
|
||||
OglTransition();
|
||||
float balance;
|
||||
OglLayer* outputLayer;
|
||||
int inputLayersCount;
|
||||
OglLayer* inputLayers[16];
|
||||
OglShader* shader;
|
||||
|
||||
virtual void Render();
|
||||
|
||||
protected:
|
||||
virtual void BeforeRender();
|
||||
virtual void AfterRender();
|
||||
|
||||
private:
|
||||
static OglRenderTarget* renderTarget;
|
||||
};
|
||||
16
Blu64k/src/Blu64k/OpenGL/Shaders/Layer.h
Normal file
16
Blu64k/src/Blu64k/OpenGL/Shaders/Layer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
static const char layerVertexShader[] = "\
|
||||
#version 130\n\
|
||||
in vec4 v; out vec4 vo; void main()\
|
||||
{\
|
||||
vo=v;\
|
||||
gl_Position=v;\
|
||||
}";
|
||||
|
||||
static const char layerPixelShader[] = "\
|
||||
#version 130\n\
|
||||
in vec4 vo;uniform float a;out vec4 c;uniform sampler2D t;void main()\
|
||||
{\
|
||||
c=texture(t,vo.xy*.5+.5)*vec4(1,1,1,a);\
|
||||
}";
|
||||
156
Blu64k/src/Blu64k/OpenGL/glext.cpp
Normal file
156
Blu64k/src/Blu64k/OpenGL/glext.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
|
||||
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
|
||||
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
|
||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
|
||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
|
||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||
PFNGLDRAWBUFFERSPROC glDrawBuffers;
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
PFNGLUNIFORM1IPROC glUniform1i;
|
||||
PFNGLUNIFORM1FPROC glUniform1f;
|
||||
PFNGLUNIFORM1FVPROC glUniform1fv;
|
||||
PFNGLUNIFORM2FVPROC glUniform2fv;
|
||||
PFNGLUNIFORM3FVPROC glUniform3fv;
|
||||
PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLGENQUERIESARBPROC glGenQueries;
|
||||
PFNGLBEGINQUERYARBPROC glBeginQuery;
|
||||
PFNGLENDQUERYARBPROC glEndQuery;
|
||||
PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuiv;
|
||||
PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
|
||||
PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
|
||||
PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
|
||||
PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT;
|
||||
PFNGLTEXBUFFERPROC glTexBuffer;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
|
||||
PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv;
|
||||
PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv;
|
||||
PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
|
||||
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
PFNGLBINDFRAGDATALOCATIONPROC glBindFragDataLocation;
|
||||
PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
||||
PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv;
|
||||
PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
PFNGLDEBUGMESSAGECALLBACKAMDPROC glDebugMessageCallbackAMD;
|
||||
PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements;
|
||||
PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
|
||||
PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
||||
PFNGLTEXIMAGE3DPROC glTexImage3D;
|
||||
PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s;
|
||||
PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
|
||||
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
|
||||
void InitializeGL()
|
||||
{
|
||||
glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) wglGetProcAddress("glGenFramebuffersEXT");
|
||||
glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) wglGetProcAddress("glBindFramebufferEXT");
|
||||
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) wglGetProcAddress("glGenRenderbuffersEXT");
|
||||
glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) wglGetProcAddress("glBindRenderbufferEXT");
|
||||
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) wglGetProcAddress("glRenderbufferStorageEXT");
|
||||
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) wglGetProcAddress("glFramebufferRenderbufferEXT");
|
||||
glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) wglGetProcAddress("glFramebufferTexture2DEXT");
|
||||
glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) wglGetProcAddress("glCheckFramebufferStatusEXT");
|
||||
glDrawBuffers = (PFNGLDRAWBUFFERSPROC) wglGetProcAddress("glDrawBuffers");
|
||||
glCreateProgram = (PFNGLCREATEPROGRAMPROC) wglGetProcAddress("glCreateProgram");
|
||||
glCreateShader = (PFNGLCREATESHADERPROC) wglGetProcAddress("glCreateShader");
|
||||
glShaderSource = (PFNGLSHADERSOURCEPROC) wglGetProcAddress("glShaderSource");
|
||||
glCompileShader = (PFNGLCOMPILESHADERPROC) wglGetProcAddress("glCompileShader");
|
||||
glAttachShader = (PFNGLATTACHSHADERPROC) wglGetProcAddress("glAttachShader");
|
||||
glLinkProgram = (PFNGLLINKPROGRAMPROC) wglGetProcAddress("glLinkProgram");
|
||||
glUseProgram = (PFNGLUSEPROGRAMPROC) wglGetProcAddress("glUseProgram");
|
||||
glUniform1i = (PFNGLUNIFORM1IPROC) wglGetProcAddress("glUniform1i");
|
||||
glUniform1f = (PFNGLUNIFORM1FPROC) wglGetProcAddress("glUniform1f");
|
||||
glUniform1fv = (PFNGLUNIFORM1FVPROC) wglGetProcAddress("glUniform1fv");
|
||||
glUniform2fv = (PFNGLUNIFORM2FVPROC) wglGetProcAddress("glUniform2fv");
|
||||
glUniform3fv = (PFNGLUNIFORM3FVPROC) wglGetProcAddress("glUniform3fv");
|
||||
glUniform4fv = (PFNGLUNIFORM4FVPROC) wglGetProcAddress("glUniform4fv");
|
||||
glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) wglGetProcAddress("glGetUniformLocation");
|
||||
glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");
|
||||
glGenBuffers = (PFNGLGENBUFFERSPROC) wglGetProcAddress("glGenBuffers");
|
||||
glBindBuffer = (PFNGLBINDBUFFERPROC) wglGetProcAddress("glBindBuffer");
|
||||
glBufferData = (PFNGLBUFFERDATAPROC) wglGetProcAddress("glBufferData");
|
||||
glGenQueries = (PFNGLGENQUERIESARBPROC) wglGetProcAddress("glGenQueries");
|
||||
glBeginQuery = (PFNGLBEGINQUERYARBPROC) wglGetProcAddress("glBeginQuery");
|
||||
glEndQuery = (PFNGLENDQUERYARBPROC) wglGetProcAddress("glEndQuery");
|
||||
glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVARBPROC) wglGetProcAddress("glGetQueryObjectuiv");
|
||||
glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) wglGetProcAddress("glBindBufferBase");
|
||||
glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) wglGetProcAddress("glTransformFeedbackVaryings");
|
||||
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) wglGetProcAddress("glBeginTransformFeedback");
|
||||
glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) wglGetProcAddress("glEndTransformFeedback");
|
||||
glMapBuffer = (PFNGLMAPBUFFERPROC) wglGetProcAddress("glMapBuffer");
|
||||
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) wglGetProcAddress("glUnmapBuffer");
|
||||
glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC) wglGetProcAddress("glProgramParameteriEXT");
|
||||
glTexBuffer = (PFNGLTEXBUFFERPROC) wglGetProcAddress("glTexBuffer");
|
||||
glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) wglGetProcAddress("glDisableVertexAttribArray");
|
||||
glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) wglGetProcAddress("glGetAttribLocation");
|
||||
glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) wglGetProcAddress("glEnableVertexAttribArray");
|
||||
glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) wglGetProcAddress("glVertexAttribPointer");
|
||||
glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) wglGetProcAddress("glUniformMatrix1fv");
|
||||
glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) wglGetProcAddress("glUniformMatrix3fv");
|
||||
glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) wglGetProcAddress("glUniformMatrix4fv");
|
||||
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) wglGetProcAddress("glGenVertexArrays");
|
||||
glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) wglGetProcAddress("glBindVertexArray");
|
||||
glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC) wglGetProcAddress("glBindFragDataLocation");
|
||||
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) wglGetProcAddress("glDrawRangeElements");
|
||||
glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) wglGetProcAddress("glGetBufferPointerv");
|
||||
glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC) wglGetProcAddress("glMultiDrawElements");
|
||||
glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) wglGetProcAddress("glDrawElementsInstanced");
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) wglGetProcAddress("glVertexAttribDivisor");
|
||||
glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
|
||||
glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC) wglGetProcAddress("glVertexAttrib1s");
|
||||
glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) wglGetProcAddress("glBlendEquationSeparate");
|
||||
glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) wglGetProcAddress("glBlendFuncSeparate");
|
||||
|
||||
#ifdef _DEBUG
|
||||
glGetProgramiv = (PFNGLGETPROGRAMIVPROC) wglGetProcAddress("glGetProgramiv");
|
||||
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) wglGetProcAddress("glGetProgramInfoLog");
|
||||
glGetShaderiv = (PFNGLGETSHADERIVPROC) wglGetProcAddress("glGetShaderiv");
|
||||
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) wglGetProcAddress("glGetShaderInfoLog");
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) wglGetProcAddress("glDebugMessageCallbackARB");
|
||||
glDebugMessageCallbackAMD = (PFNGLDEBUGMESSAGECALLBACKAMDPROC) wglGetProcAddress("glDebugMessageCallbackAMD");
|
||||
#endif
|
||||
}
|
||||
|
||||
int currentViewportX = 0;
|
||||
int currentViewportY = 0;
|
||||
int currentViewportH = 0;
|
||||
int currentViewportW = 0;
|
||||
|
||||
void glViewportEx(int x, int y, int w, int h)
|
||||
{
|
||||
if (x == currentViewportX && y == currentViewportY && w == currentViewportW && h == currentViewportH)
|
||||
return;
|
||||
|
||||
currentViewportX = x;
|
||||
currentViewportY = y;
|
||||
currentViewportH = h;
|
||||
currentViewportW = w;
|
||||
glViewport(x, y, w, h);
|
||||
}
|
||||
|
||||
11099
Blu64k/src/Blu64k/OpenGL/glext.h
Normal file
11099
Blu64k/src/Blu64k/OpenGL/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
902
Blu64k/src/Blu64k/OpenGL/wglext.h
Normal file
902
Blu64k/src/Blu64k/OpenGL/wglext.h
Normal file
@@ -0,0 +1,902 @@
|
||||
#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 */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#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
|
||||
BIN
Blu64k/src/Blu64k/Path/Path.cpp
Normal file
BIN
Blu64k/src/Blu64k/Path/Path.cpp
Normal file
Binary file not shown.
45
Blu64k/src/Blu64k/Path/Path.h
Normal file
45
Blu64k/src/Blu64k/Path/Path.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
class PathSegment
|
||||
{
|
||||
public:
|
||||
PathSegment();
|
||||
|
||||
vec4 Position;
|
||||
float Duration;
|
||||
};
|
||||
|
||||
class Path
|
||||
{
|
||||
public:
|
||||
Path(PathSegment* pathSegments, unsigned int pathSegmentCount, const char* amplitudeName, bool loop);
|
||||
|
||||
vec4 CalcPositionForTime(float time, int seed = 0) const;
|
||||
|
||||
private:
|
||||
vec4 Randomize(const vec4& pos, int seed, int index) const;
|
||||
|
||||
float Hermite00(float t) const;
|
||||
float Hermite10(float t) const;
|
||||
float Hermite01(float t) const;
|
||||
float Hermite11(float t) const;
|
||||
|
||||
vec4 GetCatmullRomTangent(int index, int seed) const;
|
||||
|
||||
int GetPathSegmentIndexByTime(float time) const;
|
||||
PathSegment& GetPathSegmentByIndex(int index) const;
|
||||
vec4 GetPathSegmentPositionByIndex(int index, int seed) const;
|
||||
float GetTimeByIndex(int index) const;
|
||||
|
||||
float NormalizeTime(float time) const;
|
||||
int NormalizeIndex(int index) const;
|
||||
|
||||
private:
|
||||
PathSegment* pathSegments;
|
||||
unsigned int pathSegmentCount;
|
||||
float maxDuration;
|
||||
bool loop;
|
||||
|
||||
public:
|
||||
blu::VectorVariable* AmplitudeVariable;
|
||||
};
|
||||
114
Blu64k/src/Blu64k/RandomGenerator.h
Normal file
114
Blu64k/src/Blu64k/RandomGenerator.h
Normal file
@@ -0,0 +1,114 @@
|
||||
#pragma once
|
||||
|
||||
struct RandomGenerator
|
||||
{
|
||||
float getRand()
|
||||
{
|
||||
return 2.0f * ( genFloat() - 0.5f );
|
||||
}
|
||||
|
||||
float getRand( float a, float b )
|
||||
{
|
||||
return genFloat( a, b );
|
||||
}
|
||||
|
||||
int getRandInt( int a, int b )
|
||||
{
|
||||
return genInteger( a, b );
|
||||
}
|
||||
|
||||
enum RandConstants
|
||||
{
|
||||
KK = 17,
|
||||
JJ = 10,
|
||||
R1 = 13,
|
||||
R2 = 9
|
||||
};
|
||||
|
||||
int g_iP1;
|
||||
int g_iP2;
|
||||
|
||||
unsigned g_u32Buffer[ KK ];
|
||||
|
||||
float genFloat()
|
||||
{
|
||||
unsigned int u32Tmp;
|
||||
// nächste Zahl
|
||||
u32Tmp= _lrotl( g_u32Buffer[ g_iP2 ], R1 ) +
|
||||
_lrotl( g_u32Buffer[ g_iP1 ], R2 );
|
||||
g_u32Buffer[ g_iP1 ]= u32Tmp;
|
||||
|
||||
// Listen rotieren
|
||||
g_iP1--;
|
||||
if ( g_iP1 < 0 )
|
||||
{
|
||||
g_iP1 = KK - 1;
|
||||
}
|
||||
|
||||
g_iP2--;
|
||||
if ( g_iP2 < 0 )
|
||||
{
|
||||
g_iP2 = KK - 1;
|
||||
}
|
||||
|
||||
// conversion to float:
|
||||
union
|
||||
{
|
||||
double f;
|
||||
unsigned long i[2];
|
||||
} convert;
|
||||
|
||||
convert.i[0] = u32Tmp << 20;
|
||||
convert.i[1] = ( u32Tmp >> 12 ) | 0x3FF00000;
|
||||
return (float)( convert.f - 1.0f );
|
||||
|
||||
}
|
||||
|
||||
unsigned int getLastTempValue()
|
||||
{
|
||||
return g_u32Buffer[ g_iP1 ];
|
||||
}
|
||||
|
||||
void setSeed( unsigned int Seed )
|
||||
{
|
||||
int i;
|
||||
|
||||
// Buffer füllen
|
||||
for( i= 0; i < KK; i++ )
|
||||
{
|
||||
Seed= Seed * 2891336453 + 1;
|
||||
g_u32Buffer[ i ] = Seed;
|
||||
}
|
||||
|
||||
// Pointer initialisieren
|
||||
g_iP1= 0;
|
||||
g_iP2= JJ;
|
||||
|
||||
// Anfang der Folge wegwerfen
|
||||
for( i= 0; i < 9; i++ )
|
||||
{
|
||||
genFloat();
|
||||
}
|
||||
}
|
||||
|
||||
int genInteger( int iMin, int iMax )
|
||||
{
|
||||
float fInterval = (float)( iMax - iMin ) + 0.96875f;
|
||||
float fRet= fInterval * genFloat();
|
||||
fRet+= (float)iMin;
|
||||
int iRet= (int)( fRet - 0.484375f );
|
||||
//int iRet= (int)( fRet );
|
||||
//assert( iRet >= iMin );
|
||||
//assert( iRet <= iMax );
|
||||
return iRet;
|
||||
}
|
||||
|
||||
float genFloat( float fMin, float fMax )
|
||||
{
|
||||
float fInterval = (float)( fMax - fMin );
|
||||
|
||||
return fMin + fInterval * genFloat();
|
||||
}
|
||||
};
|
||||
|
||||
extern RandomGenerator GlobalRandomGenerator;
|
||||
103
Blu64k/src/Blu64k/RaytracedSphere/Glass.h
Normal file
103
Blu64k/src/Blu64k/RaytracedSphere/Glass.h
Normal file
@@ -0,0 +1,103 @@
|
||||
// VertexShader
|
||||
static const char sphereRtVS[] = "#version 130\n" MAKE_STRING(
|
||||
|
||||
uniform mat4 viewMatrix;
|
||||
uniform mat4 projViewMatrixInverse;
|
||||
uniform vec4 position;
|
||||
uniform float radius;
|
||||
|
||||
in vec4 inVertex;
|
||||
|
||||
out vec3 vsVecPos;
|
||||
out vec3 vsEyePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = inVertex;
|
||||
vec4 pos = projViewMatrixInverse * vec4(inVertex.xy, 0, 1);
|
||||
vsVecPos = pos.xyz;
|
||||
vec4 eye = projViewMatrixInverse * vec4(0, 0, -1, 1);
|
||||
vsEyePos = eye.xyz;
|
||||
}
|
||||
);
|
||||
|
||||
// PixelShader
|
||||
static const char sphereRtPS[] = "#version 130\n" MAKE_STRING(
|
||||
uniform mat4 viewMatrix;
|
||||
uniform sampler2D envMapFront;
|
||||
uniform sampler2D envMapBack;
|
||||
uniform vec4 position;
|
||||
uniform float radius;
|
||||
uniform float fresnelScale;
|
||||
uniform float fresnelBias;
|
||||
uniform float fresnelPower;
|
||||
|
||||
in vec3 vsVecPos;
|
||||
in vec3 vsEyePos;
|
||||
|
||||
out vec4 color;
|
||||
out vec4 normaldepth;
|
||||
|
||||
vec3 envColor(vec3 R)
|
||||
{
|
||||
vec2 front;
|
||||
front.x = R.x / (R.z + 1);
|
||||
front.y = R.y / (R.z + 1);
|
||||
front.x = -.5f * front.x + .5f;
|
||||
front.y = .5f * front.y + .5f;
|
||||
|
||||
vec2 back;
|
||||
back.x = R.x / (1 - R.z);
|
||||
back.y = R.y / (1 - R.z);
|
||||
back.x = -.5f * back.x + .5f;
|
||||
back.y = .5f * back.y + .5f;
|
||||
|
||||
vec4 cFront = texture(envMapFront, back);
|
||||
vec4 cBack = texture(envMapBack, front);
|
||||
return max(cFront, cBack).rgb;
|
||||
}
|
||||
|
||||
// Realtime Rendering, page 586
|
||||
bool raySphereIntersect(in vec3 o, in vec3 d, in vec3 c, in float r, out float t, out vec3 p)
|
||||
{
|
||||
vec3 l = c - o;
|
||||
float s = dot(l, d);
|
||||
float l2 = dot(l, l);
|
||||
float r2 = r * r;
|
||||
float s2 = s * s;
|
||||
if (s < 0 && l2 > r2)
|
||||
return false;
|
||||
|
||||
float m2 = l2 - s2;
|
||||
if (m2 > r2)
|
||||
return false;
|
||||
|
||||
float q = sqrt(r2 - m2);
|
||||
if (l2 > r2)
|
||||
t = s - q;
|
||||
else
|
||||
t = s + q;
|
||||
|
||||
p = o + t * d;
|
||||
return true;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 o = vsEyePos; //set ray origin
|
||||
vec3 d = normalize(vsVecPos - o); //set ray direction
|
||||
vec3 c = position.xyz; //sphere center
|
||||
float r = radius; // sphere radius
|
||||
float t; // ray length
|
||||
vec3 p; // ray hit position
|
||||
|
||||
color = vec4(0);
|
||||
if (!raySphereIntersect(o, d, c, r, t, p))
|
||||
discard;
|
||||
|
||||
vec3 normal = normalize(p - c);
|
||||
vec3 refl = reflect(d, normal);
|
||||
vec3 refr = refract(d, normal, 0.8);
|
||||
float fresnel = fresnelBias + fresnelScale * pow(1 + dot(d, normal), fresnelPower);
|
||||
color = normaldepth = vec4(mix(envColor(refr), envColor(refl), fresnel), 1);
|
||||
});
|
||||
54
Blu64k/src/Blu64k/RaytracedSphere/RTSphere.cpp
Normal file
54
Blu64k/src/Blu64k/RaytracedSphere/RTSphere.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "StdAfx.h"
|
||||
#include "RTSphere.h"
|
||||
#include "../EnvMap/DualParaboloidEnvMap.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
RTSphere::RTSphere(DualParaboloidEnvMap* envMap)
|
||||
: Radius(CreateFloatVariable("GlassSphere.radius"))
|
||||
, Position(CreateVectorVariable("GlassSphere.position"))
|
||||
, FresnelScale(CreateFloatVariable("GlassSphere.Fresnel.scale"))
|
||||
, FresnelBias(CreateFloatVariable("GlassSphere.Fresnel.bias"))
|
||||
, FresnelPower(CreateFloatVariable("GlassSphere.Fresnel.power"))
|
||||
, envMap(envMap)
|
||||
{
|
||||
SHADER_SOURCE(shader, "Vertex/sphere.h", "Pixel/sphere.h");
|
||||
}
|
||||
|
||||
|
||||
RTSphere::~RTSphere()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RTSphere::Render(const Matrix& projViewMatrix)
|
||||
{
|
||||
Matrix projViewMatrixInverse = projViewMatrix;
|
||||
projViewMatrixInverse.inverse();
|
||||
|
||||
shader->Apply();
|
||||
shader->SetParam("position", Position->value);
|
||||
shader->SetParam("radius", Radius->value);
|
||||
shader->SetParam("fresnelScale", FresnelScale->value);
|
||||
shader->SetParam("fresnelBias", FresnelBias->value);
|
||||
shader->SetParam("fresnelPower", FresnelPower->value);
|
||||
shader->SetParam("projViewMatrix", projViewMatrix);
|
||||
shader->SetParam("projViewMatrixInverse", projViewMatrixInverse);
|
||||
shader->SetParam("ddxy", vec4(1.0f / OglGraphics::Instance()->Width, 1.0f / OglGraphics::Instance()->Height, 0, 0));
|
||||
|
||||
envMap->get_FrontTexture()->Apply(0);
|
||||
envMap->get_BackTexture()->Apply(1);
|
||||
shader->SetParam("envMapFront", 0);
|
||||
shader->SetParam("envMapBack", 1);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
|
||||
FullScreenQuad::Instance()->Render();
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
envMap->get_FrontTexture()->Unapply(0);
|
||||
envMap->get_BackTexture()->Unapply(1);
|
||||
|
||||
shader->Unapply();
|
||||
}
|
||||
34
Blu64k/src/Blu64k/RaytracedSphere/RTSphere.h
Normal file
34
Blu64k/src/Blu64k/RaytracedSphere/RTSphere.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class DualParaboloidEnvMap;
|
||||
|
||||
class RTSphere
|
||||
{
|
||||
struct SphereData
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float Z;
|
||||
float Radius;
|
||||
};
|
||||
|
||||
public:
|
||||
RTSphere(DualParaboloidEnvMap* envMap);
|
||||
~RTSphere();
|
||||
|
||||
void Render(const Matrix& projViewMatrix);
|
||||
|
||||
blu::FloatVariable* Radius;
|
||||
blu::FloatVariable* FresnelScale;
|
||||
blu::FloatVariable* FresnelBias;
|
||||
blu::FloatVariable* FresnelPower;
|
||||
blu::VectorVariable* Position;
|
||||
private:
|
||||
|
||||
DualParaboloidEnvMap* envMap;
|
||||
OglShader* shader;
|
||||
unsigned int VAO;
|
||||
unsigned int VB;
|
||||
};
|
||||
|
||||
47
Blu64k/src/Blu64k/RenderPipeline/RenderPipeline.cpp
Normal file
47
Blu64k/src/Blu64k/RenderPipeline/RenderPipeline.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "stdafx.h"
|
||||
#include "RenderPipeline.h"
|
||||
|
||||
OglCameraScene* RenderPipeline::CameraScenes[512];
|
||||
unsigned int RenderPipeline::CameraSceneCount;
|
||||
OglLayer* RenderPipeline::Layers[512];
|
||||
unsigned int RenderPipeline::LayerCount;
|
||||
OglTransition* RenderPipeline::Transitions[512];
|
||||
unsigned int RenderPipeline::TransitionCount;
|
||||
|
||||
|
||||
void RenderPipeline::Render()
|
||||
{
|
||||
for (unsigned int i = 0; i < CameraSceneCount; ++i)
|
||||
{
|
||||
CameraScenes[i]->Render();
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < TransitionCount; ++i)
|
||||
{
|
||||
Transitions[i]->Render();
|
||||
}
|
||||
|
||||
OglGraphics::Instance()->Clear();
|
||||
|
||||
OglLayer::LayerShader->Apply();
|
||||
for (unsigned int l = 0; l < LayerCount; ++l)
|
||||
{
|
||||
bool used = false;
|
||||
for (unsigned int t = 0; t < TransitionCount; ++t)
|
||||
{
|
||||
for (int i = 0; i < Transitions[t]->inputLayersCount; ++i)
|
||||
{
|
||||
if (Transitions[t]->inputLayers[i] == Layers[l])
|
||||
{
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (used)
|
||||
break;
|
||||
}
|
||||
if (!used)
|
||||
Layers[l]->Render();
|
||||
}
|
||||
OglLayer::LayerShader->Unapply();
|
||||
}
|
||||
15
Blu64k/src/Blu64k/RenderPipeline/RenderPipeline.h
Normal file
15
Blu64k/src/Blu64k/RenderPipeline/RenderPipeline.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class RenderPipeline
|
||||
{
|
||||
public:
|
||||
static void Render();
|
||||
|
||||
static OglCameraScene* CameraScenes[512];
|
||||
static unsigned int CameraSceneCount;
|
||||
static OglLayer* Layers[512];
|
||||
static unsigned int LayerCount;
|
||||
static OglTransition* Transitions[512];
|
||||
static unsigned int TransitionCount;
|
||||
};
|
||||
69
Blu64k/src/Blu64k/SceneResult/SceneResult.cpp
Normal file
69
Blu64k/src/Blu64k/SceneResult/SceneResult.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "StdAfx.h"
|
||||
#include "SceneResult.h"
|
||||
#include "../Filters/Base.h"
|
||||
|
||||
|
||||
SceneResult::SceneResult()
|
||||
: currentMode(SceneMode::None)
|
||||
{
|
||||
renderTarget = new OglRenderTarget(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height);
|
||||
diffuseTexture = new OglTexture(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height, TextureFormat::RGBAf);
|
||||
normalDepthTexture = new OglTexture(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height, TextureFormat::RGBAf);
|
||||
|
||||
renderTargetTextures[0] = diffuseTexture->textureId;
|
||||
renderTargetTextures[1] = normalDepthTexture->textureId;
|
||||
|
||||
showNormalsOnly = CreateBoolVariable("Scene.ShowNormalsOnly");
|
||||
showDepthOnly = CreateBoolVariable("Scene.ShowDepthOnly");
|
||||
|
||||
SHADER_SOURCE(showNormalsShader, "Filters/BaseVS.h", "Pixel/ShowNormalsFS.h");
|
||||
SHADER_SOURCE(showDepthShader, "Filters/BaseVS.h", "Pixel/ShowDepthFS.h");
|
||||
SHADER_SOURCE(showColorsShader, "Filters/BaseVS.h", "Pixel/ShowColorFS.h");
|
||||
}
|
||||
|
||||
void SceneResult::Begin(SceneMode::Enumeration mode)
|
||||
{
|
||||
currentMode = mode;
|
||||
|
||||
if (mode == SceneMode::DiffuseNormalAndDepth)
|
||||
renderTarget->set_Textures(2, renderTargetTextures);
|
||||
|
||||
if (mode != SceneMode::None)
|
||||
renderTarget->Bind();
|
||||
}
|
||||
|
||||
|
||||
void SceneResult::End()
|
||||
{
|
||||
renderTarget->Unbind();
|
||||
|
||||
if (currentMode == SceneMode::DiffuseNormalAndDepth)
|
||||
{
|
||||
dof.Process(diffuseTexture, normalDepthTexture);
|
||||
hdr.Process(dof.IsDofAvailable() ? dof.get_ResultTexture() : diffuseTexture);
|
||||
}
|
||||
|
||||
currentMode = SceneMode::None;
|
||||
}
|
||||
|
||||
|
||||
void SceneResult::Display()
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
if (showNormalsOnly->value)
|
||||
FullScreenQuad::Instance()->Display(normalDepthTexture, showNormalsShader);
|
||||
else if (showDepthOnly->value)
|
||||
FullScreenQuad::Instance()->Display(normalDepthTexture, showDepthShader);
|
||||
else if (hdr.IsHdrAvailable())
|
||||
hdr.Display();
|
||||
else if (dof.IsDofAvailable())
|
||||
dof.Display();
|
||||
else
|
||||
FullScreenQuad::Instance()->Display(diffuseTexture, showColorsShader);
|
||||
}
|
||||
|
||||
|
||||
SceneMode::Enumeration SceneResult::get_CurrentMode() const
|
||||
{
|
||||
return currentMode;
|
||||
}
|
||||
41
Blu64k/src/Blu64k/SceneResult/SceneResult.h
Normal file
41
Blu64k/src/Blu64k/SceneResult/SceneResult.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "../HDR/HighDynamicRange.h"
|
||||
#include "../DoF/DepthOfField.h"
|
||||
|
||||
struct SceneMode
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
None,
|
||||
DiffuseNormalAndDepth
|
||||
};
|
||||
};
|
||||
class SceneResult
|
||||
{
|
||||
public:
|
||||
SceneResult();
|
||||
|
||||
void Begin(SceneMode::Enumeration mode);
|
||||
void End();
|
||||
void Display();
|
||||
|
||||
SceneMode::Enumeration get_CurrentMode() const;
|
||||
private:
|
||||
OglTexture* diffuseTexture;
|
||||
OglTexture* normalDepthTexture;
|
||||
|
||||
OglShader* showNormalsShader;
|
||||
OglShader* showColorsShader;
|
||||
OglShader* showDepthShader;
|
||||
blu::BoolVariable* showNormalsOnly;
|
||||
blu::BoolVariable* showDepthOnly;
|
||||
|
||||
HighDynamicRange hdr;
|
||||
DepthOfField dof;
|
||||
OglRenderTarget* renderTarget;
|
||||
SceneMode::Enumeration currentMode;
|
||||
|
||||
unsigned int renderTargetTextures[2];
|
||||
};
|
||||
|
||||
177
Blu64k/src/Blu64k/Scenes/ParticleTestScene.h
Normal file
177
Blu64k/src/Blu64k/Scenes/ParticleTestScene.h
Normal file
@@ -0,0 +1,177 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GPUParticles/GPUParticles.h"
|
||||
#include "../RandomGenerator.h"
|
||||
#include "../Filters/Blur.h"
|
||||
#include "../Filters/Glow.h"
|
||||
#include "../Filters/Combine.h"
|
||||
#include "../Path/Path.h"
|
||||
|
||||
|
||||
class ParticleTestScene
|
||||
: public OglScene
|
||||
{
|
||||
struct ParticleData
|
||||
{
|
||||
float Position[3];
|
||||
float Size;
|
||||
float Velocity[3];
|
||||
float Lifetime;
|
||||
};
|
||||
|
||||
public:
|
||||
ParticleTestScene(blu::VectorVariable* camPos)
|
||||
{
|
||||
this->camPos = camPos;
|
||||
random.setSeed(0);
|
||||
SHADER_SOURCE(renderParticlesShader, "Particle/RenderParticleVS.h", "Particle/RenderParticleFS.h");
|
||||
|
||||
static const char *attributeNames[] = { "gl_Position", "outVelocity" };
|
||||
static const unsigned int attributeSizes[] = { 4, 4 };
|
||||
GPUParticles::ParticleAttributeInfo particleAttributeInfo(attributeNames, attributeSizes, 2);
|
||||
particles = new GPUParticles(1000 * 1000,
|
||||
10000,
|
||||
particleAttributeInfo,
|
||||
1);
|
||||
|
||||
blurFilter = new BlurFilter(BlurFilter::Description(512, 512, TextureFormat::RGBA, 10, 2.0f, BlurFilter::Type::Circle));
|
||||
glowFilter = new GlowFilter(GlowFilter::Description(512, 512, TextureFormat::RGBA, 2.0f, 100.0f, 0.0f));
|
||||
combineFilter = new CombineFilter(CombineFilter::Description(512, 512, TextureFormat::RGBA));
|
||||
|
||||
diffuseTexture = new OglTexture(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height, TextureFormat::RGBA);
|
||||
renderTarget = new OglRenderTarget(OglGraphics::Instance()->Width, OglGraphics::Instance()->Height);
|
||||
|
||||
blurStrength = CreateFloatVariable("particleBlurStrength");
|
||||
particleContrast = CreateFloatVariable("particleContrast");
|
||||
particleBrightness = CreateFloatVariable("particleBrightness");
|
||||
particleBias = CreateFloatVariable("particleBias");
|
||||
|
||||
const int cnt = 10;
|
||||
PathSegment* pathSegments = new PathSegment[cnt];
|
||||
float myPi = blu::pi() / cnt;
|
||||
for (int i = 0; i < cnt; ++i)
|
||||
{
|
||||
pathSegments[i].Duration = 1.0f;
|
||||
pathSegments[i].Position.x = 20*blu::cos(2 * myPi * i);
|
||||
pathSegments[i].Position.y = 20*blu::sin(2 * myPi * i);
|
||||
pathSegments[i].Position.z = 0;
|
||||
}
|
||||
path = new Path(pathSegments, cnt, "particlePathAmplitude", true);
|
||||
}
|
||||
|
||||
virtual void Render()
|
||||
{
|
||||
this->projMatrix = OglCameraScene::currentRenderingInstance->perspectiveMatrix;
|
||||
this->viewMatrix = OglCameraScene::currentRenderingInstance->viewMatrix;// * Matrix::rotateY(blu::Player::Time);
|
||||
this->projViewMatrix = this->projMatrix * this->viewMatrix;
|
||||
|
||||
float deltaTime = blu::Player::Time - lastFrameTime;
|
||||
|
||||
Update(deltaTime);
|
||||
particles->Sort(camPos->value, 21);
|
||||
|
||||
RenderParticles(camPos->value);
|
||||
|
||||
blurFilter->get_Description().Strength = blurStrength->value;
|
||||
glowFilter->get_Description().Bias = particleBias->value;
|
||||
glowFilter->get_Description().Contrast = particleContrast->value;
|
||||
glowFilter->get_Description().Brightness = particleBrightness->value;
|
||||
|
||||
blurFilter->Apply(diffuseTexture);
|
||||
OglTexture* blurFilterResult = blurFilter->get_Result();
|
||||
glowFilter->Apply(blurFilterResult);
|
||||
OglTexture* glowFilterResult = glowFilter->get_Result();
|
||||
|
||||
combineFilter->Apply(glowFilterResult, diffuseTexture);
|
||||
FullScreenQuad::Instance()->Display(combineFilter->get_Result());
|
||||
|
||||
lastFrameTime = blu::Player::Time;
|
||||
}
|
||||
|
||||
void RenderParticles(const vec4& eye)
|
||||
{
|
||||
unsigned int particleCount = particles->BeginRender();
|
||||
if (particleCount == 0)
|
||||
return;
|
||||
renderParticlesShader->Apply();
|
||||
float viewportHeight = (float)OglGraphics::Instance()->Height;
|
||||
renderParticlesShader->SetParam("eye", eye.m, 3);
|
||||
renderParticlesShader->SetParam("viewportHeight", viewportHeight);
|
||||
renderParticlesShader->SetParam("projViewMatrix", projViewMatrix);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
renderTarget->set_Textures(1, &diffuseTexture->textureId);
|
||||
renderTarget->Bind();
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, particleCount);
|
||||
|
||||
renderTarget->Unbind();
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
renderParticlesShader->Unapply();
|
||||
particles->EndRender();
|
||||
}
|
||||
|
||||
void Update(float deltaTime)
|
||||
{
|
||||
path->AmplitudeVariable->value = vec4(5.0f, 5.0f, 0.0f, 0.1f);
|
||||
|
||||
GPUParticles::ParticleUpdateData particleUpdateData = particles->BeginUpdate(deltaTime);
|
||||
if (particleUpdateData.EmitCount > 0)
|
||||
{
|
||||
ParticleData* particleData = (ParticleData*)particleUpdateData.EmitData;
|
||||
for (unsigned int i = 0; i < particleUpdateData.EmitCount; ++i, ++particleData)
|
||||
{
|
||||
vec4 pos = path->CalcPositionForTime(lastFrameTime, i % 10);
|
||||
particleData->Position[0] = pos.x;
|
||||
particleData->Position[1] = pos.y;
|
||||
particleData->Position[2] = pos.z;
|
||||
|
||||
particleData->Size = 0.02f;
|
||||
|
||||
vec4 dir(random.genFloat(-1.0f, 1.0f), random.genFloat(-1.0f, 1.0f), random.genFloat(-1.0f, 1.0f));
|
||||
dir = normalize(dir);
|
||||
float v = 2;
|
||||
particleData->Velocity[0] = dir.x * v;
|
||||
particleData->Velocity[1] = dir.y * v;
|
||||
particleData->Velocity[2] = dir.z * v;
|
||||
|
||||
particleData->Lifetime = 10.0f;
|
||||
}
|
||||
}
|
||||
particles->EndUpdate();
|
||||
}
|
||||
|
||||
private:
|
||||
OglRenderTarget* renderTarget;
|
||||
OglTexture* diffuseTexture;
|
||||
|
||||
blu::VectorVariable* camPos;
|
||||
GPUParticles* particles;
|
||||
OglShader* renderParticlesShader;
|
||||
float lastFrameTime;
|
||||
BlurFilter* blurFilter;
|
||||
GlowFilter* glowFilter;
|
||||
CombineFilter* combineFilter;
|
||||
|
||||
RandomGenerator random;
|
||||
|
||||
Matrix viewMatrix;
|
||||
Matrix projMatrix;
|
||||
Matrix projViewMatrix;
|
||||
|
||||
blu::FloatVariable* blurStrength;
|
||||
blu::FloatVariable* particleContrast;
|
||||
blu::FloatVariable* particleBrightness;
|
||||
blu::FloatVariable* particleBias;
|
||||
|
||||
Path* path;
|
||||
};
|
||||
144
Blu64k/src/Blu64k/Scenes/TestScene.h
Normal file
144
Blu64k/src/Blu64k/Scenes/TestScene.h
Normal file
@@ -0,0 +1,144 @@
|
||||
#pragma once
|
||||
|
||||
#include <Mesh/Mesh.h>
|
||||
#include <Textures/NoiseTexture.h>
|
||||
#include <EnvMap/DualParaboloidEnvMap.h>
|
||||
#include <SceneResult/SceneResult.h>
|
||||
#include <RaytracedSphere/RTSphere.h>
|
||||
#include <Vegetation/plant.h>
|
||||
|
||||
extern const char instancedVS[];
|
||||
extern const char envmapInstancedVS[];
|
||||
extern const char standardVS[];
|
||||
extern const char envmapVS[];
|
||||
extern const char diffusePS[];
|
||||
extern const char normalDepthPS[];
|
||||
extern const char skyPS[];
|
||||
|
||||
|
||||
class TestScene
|
||||
: public OglScene
|
||||
{
|
||||
public:
|
||||
TestScene(NoiseTexture& noiseTexture)
|
||||
: noiseTexture(noiseTexture)
|
||||
{
|
||||
color = CreateVectorVariable("stoneColor");
|
||||
cube.CreateCube();
|
||||
sky.CreateSphere(5);
|
||||
sky.Transform(Matrix::scale(500));
|
||||
|
||||
SHADER_SOURCE(diffuseShader, "Vertex/instanced.h", "Pixel/diffuse.h");
|
||||
SHADER_SOURCE(diffuseEnvShader, "Vertex/envmapInstanced.h", "Pixel/diffuse.h");
|
||||
SHADER_SOURCE(skyShader, "Vertex/standard.h", "Pixel/sky.h");
|
||||
SHADER_SOURCE(skyEnvShader, "Vertex/envmap.h", "Pixel/sky.h");
|
||||
|
||||
instanceBuffer = new OglArrayBuffer(20 * sizeof(Matrix), true);
|
||||
envMap = new DualParaboloidEnvMap(4);
|
||||
plant = new Plant(envMap, noiseTexture);
|
||||
glassSphere = new RTSphere(envMap);
|
||||
glassSphere->Radius->value = 0.5f;
|
||||
}
|
||||
|
||||
virtual void Render()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
this->projMatrix = OglCameraScene::currentRenderingInstance->perspectiveMatrix;
|
||||
this->viewMatrix = OglCameraScene::currentRenderingInstance->viewMatrix;
|
||||
this->projViewMatrix = this->projMatrix * this->viewMatrix;
|
||||
|
||||
envViewMatrix = Matrix::LookAt(vec4(0,0,0), vec4(0,0,1), vec4(0,1,0));
|
||||
|
||||
Instance* instances = (Instance*)instanceBuffer->Lock();
|
||||
Matrix rotMat = Matrix::rotateY(blu::Player::Time);
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
Matrix translate = Matrix::translate(vec4(2.0f, 0, -i * 5.0f));
|
||||
instances[i].transform = translate;//rotMat * translate;
|
||||
instances[i].transform.transpose();
|
||||
}
|
||||
instanceBuffer->Unlock();
|
||||
|
||||
envMap->PrepareRenderFront();
|
||||
RenderInternal(skyEnvShader, diffuseEnvShader, 1.0f);
|
||||
envMap->PrepareRenderBack();
|
||||
RenderInternal(skyEnvShader, diffuseEnvShader, -1.0f);
|
||||
envMap->End();
|
||||
|
||||
sceneResult.Begin(SceneMode::DiffuseNormalAndDepth);
|
||||
RenderInternal(skyShader, diffuseShader, 0.0f);
|
||||
sceneResult.End();
|
||||
|
||||
sceneResult.Display();
|
||||
}
|
||||
|
||||
void setShaderParams(OglShader* shader, float envMapped)
|
||||
{
|
||||
shader->Apply();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_3D, noiseTexture.textureId);
|
||||
shader->SetParam("projViewMatrix", projViewMatrix);
|
||||
shader->SetParam("viewMatrix", viewMatrix);
|
||||
shader->SetParam("envMatrix", envViewMatrix);
|
||||
shader->SetParam("noiseTexture", 0);
|
||||
shader->SetParam("time", blu::Player::Time);
|
||||
shader->SetParam("nearPlane", 0.1f);
|
||||
shader->SetParam("farPlane", 1000.0f);
|
||||
shader->SetParam("direction", envMapped);
|
||||
shader->SetParam("camPos", OglCameraScene::currentRenderingInstance->cameraPos);
|
||||
if (envMapped == 0.0f)
|
||||
{
|
||||
envMap->get_FrontTexture()->Apply(0);
|
||||
envMap->get_BackTexture()->Apply(1);
|
||||
shader->SetParam("envMapFront", 0);
|
||||
shader->SetParam("envMapBack", 1);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderInternal(OglShader* skyShader, OglShader* diffuseShader, float envMapped)
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// Render everything that goes into the env map
|
||||
glDisable(GL_BLEND);
|
||||
setShaderParams(skyShader, envMapped);
|
||||
sky.Render();
|
||||
|
||||
// Render the reflective surface
|
||||
if (envMapped == 0)
|
||||
{
|
||||
//plant->Render();
|
||||
glassSphere->Render(projViewMatrix);
|
||||
|
||||
/*setShaderParams(diffuseShader, envMapped);
|
||||
diffuseShader->SetParam("stoneColor", color->value);
|
||||
cube.Render(20, instanceBuffer);*/
|
||||
//cube.Render();
|
||||
}
|
||||
}
|
||||
|
||||
blu::VectorVariable* color;
|
||||
|
||||
private:
|
||||
DualParaboloidEnvMap* envMap;
|
||||
OglArrayBuffer* instanceBuffer;
|
||||
Mesh cube;
|
||||
Mesh sky;
|
||||
OglShader* diffuseShader;
|
||||
OglShader* diffuseEnvShader;
|
||||
OglShader* skyShader;
|
||||
OglShader* skyEnvShader;
|
||||
NoiseTexture& noiseTexture;
|
||||
Matrix viewMatrix;
|
||||
Matrix projMatrix;
|
||||
Matrix projViewMatrix;
|
||||
Matrix envViewMatrix;
|
||||
RTSphere* glassSphere;
|
||||
Plant* plant;
|
||||
|
||||
OglRenderTarget* renderTarget;
|
||||
|
||||
SceneResult sceneResult;
|
||||
};
|
||||
8
Blu64k/src/Blu64k/Shaders/Filters/BaseVS.h
Normal file
8
Blu64k/src/Blu64k/Shaders/Filters/BaseVS.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 130
|
||||
in vec4 position;
|
||||
out vec4 v;
|
||||
void main()
|
||||
{
|
||||
v=position;
|
||||
gl_Position=v;
|
||||
}
|
||||
29
Blu64k/src/Blu64k/Shaders/Filters/BlurBokehFS.h
Normal file
29
Blu64k/src/Blu64k/Shaders/Filters/BlurBokehFS.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
uniform vec2 ddxy;
|
||||
uniform float s;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tex = v.xy*.5+.5;
|
||||
|
||||
vec2 vDelta = ddxy;
|
||||
vec4 fGuide = texture2D(t1, tex);
|
||||
|
||||
float fWeight = 0.0;
|
||||
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
float angle = 3.14 / 6 * i;
|
||||
vec2 to = tex + vDelta * 1 * vec2( cos(angle), sin(angle) );
|
||||
vec4 fSample = texture2D(t0, to);
|
||||
float fSampleWeight = 1.f - clamp(4.0 * (fGuide.w - fSample.w), 0.0, 1.0);
|
||||
color += fSample * fSampleWeight;
|
||||
fWeight += fSampleWeight;
|
||||
}
|
||||
|
||||
color = mix(fGuide, color / fWeight, clamp(fWeight, 0.0, 1.0));
|
||||
}
|
||||
17
Blu64k/src/Blu64k/Shaders/Filters/BlurBoxFS.h
Normal file
17
Blu64k/src/Blu64k/Shaders/Filters/BlurBoxFS.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform vec2 ddxy;
|
||||
uniform float s;
|
||||
vec4 blur(sampler2D x,vec2 c)
|
||||
{
|
||||
vec2 o = ddxy * s;
|
||||
return (texture2D(x,c)*4+texture2D(x,c+vec2(0,o.y))*2+texture2D(x,c+vec2(o.x,0))*2+texture2D(x,c-vec2(0,o.y))*2+texture2D(x,c-vec2(o.x,0))*2
|
||||
+texture2D(x,c+vec2(0,2*o.y))+texture2D(x,c+vec2(2*o.x,0))+texture2D(x,c-vec2(0,2*o.y))+texture2D(x,c-vec2(2*o.x,0))
|
||||
+texture2D(x,c+vec2(o.x,o.y))+texture2D(x,c+vec2(o.x,-o.y))+texture2D(x,c+vec2(-o.x,o.y))+texture2D(x,c-vec2(o.x,o.y)))/20;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
color = blur(t0,v.xy*.5+.5);
|
||||
}
|
||||
17
Blu64k/src/Blu64k/Shaders/Filters/BlurCircleFS.h
Normal file
17
Blu64k/src/Blu64k/Shaders/Filters/BlurCircleFS.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform vec2 ddxy;
|
||||
uniform float s;
|
||||
void main()
|
||||
{
|
||||
vec2 tex = v.xy*.5+.5;
|
||||
float pi4 = 3.141 * 2.0 / 8;
|
||||
color = vec4(0.0);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
color += texture2D(t0, tex + vec2(sin(pi4 * i), cos(pi4 * i)) * ddxy * s);
|
||||
}
|
||||
color /= 8;
|
||||
}
|
||||
20
Blu64k/src/Blu64k/Shaders/Filters/BrightpassFS.h
Normal file
20
Blu64k/src/Blu64k/Shaders/Filters/BrightpassFS.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
uniform float threshold;
|
||||
uniform float exposure;
|
||||
uniform float whiteCutOff;
|
||||
void main()
|
||||
{
|
||||
color = texture2D(t0,v.xy*.5+.5);
|
||||
|
||||
float luminance = exp(texture2D(t1,v.xy*.5+.5).z);
|
||||
float l = dot(color.xyz, vec3(0.299, 0.587, 0.184));
|
||||
luminance = (exposure / luminance) * l;
|
||||
luminance = (luminance * (1 + luminance / (whiteCutOff*whiteCutOff))) / (1 + luminance);
|
||||
color *= luminance;
|
||||
color = max(color - threshold, 0.0);
|
||||
color /= threshold + color;
|
||||
}
|
||||
20
Blu64k/src/Blu64k/Shaders/Filters/CalcLuminanceFS.h
Normal file
20
Blu64k/src/Blu64k/Shaders/Filters/CalcLuminanceFS.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform vec2 ddxy;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 minmaxav = texture2D(t0, v.xy*.5+.5).xyz;
|
||||
|
||||
vec2 SamplePos;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SamplePos = (v.xy*.5+.5) + ddxy * 2.0 * vec2(sin((3.141 / 4.0) * i), cos((3.141 / 4.0) * i));
|
||||
vec3 lum = texture2D(t0, SamplePos).xyz;
|
||||
minmaxav = vec3(min(minmaxav.x, lum.x), max(minmaxav.y, lum.y), (minmaxav.z + lum.z) * 0.5);
|
||||
}
|
||||
|
||||
color = vec4(minmaxav, 1);
|
||||
}
|
||||
9
Blu64k/src/Blu64k/Shaders/Filters/CombineFS.h
Normal file
9
Blu64k/src/Blu64k/Shaders/Filters/CombineFS.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
void main()
|
||||
{
|
||||
color = texture2D(t0,v.xy*.5+.5) + texture2D(t1,v.xy*.5+.5);
|
||||
}
|
||||
9
Blu64k/src/Blu64k/Shaders/Filters/CombineMaxPS.h
Normal file
9
Blu64k/src/Blu64k/Shaders/Filters/CombineMaxPS.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
void main()
|
||||
{
|
||||
color = max(texture2D(t0,v.xy*.5+.5), texture2D(t1,v.xy*.5+.5));
|
||||
}
|
||||
61
Blu64k/src/Blu64k/Shaders/Filters/DoFCombineFS.h
Normal file
61
Blu64k/src/Blu64k/Shaders/Filters/DoFCombineFS.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
|
||||
const float gfRadius = 0.005;
|
||||
const float gfLowRadiusScaling = 0.5;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tex = v.xy*.5+.5;
|
||||
vec2 poissonKernel[12];
|
||||
poissonKernel[0] = vec2(-0.3262122, -0.40587);
|
||||
poissonKernel[1] = vec2(-0.840144, -0.07358);
|
||||
poissonKernel[2] = vec2(-0.695914, 0.457137);
|
||||
poissonKernel[3] = vec2(-0.203345, 0.620716);
|
||||
poissonKernel[4] = vec2(0.96234, -0.194983);
|
||||
poissonKernel[5] = vec2(0.473434, -0.480026);
|
||||
poissonKernel[6] = vec2(0.519456, 0.767022);
|
||||
poissonKernel[7] = vec2(0.185461, -0.893124);
|
||||
poissonKernel[8] = vec2(0.507431, 0.064425);
|
||||
poissonKernel[9] = vec2(0.89642, 0.412458);
|
||||
poissonKernel[10] = vec2(-0.32197, -0.932615);
|
||||
poissonKernel[11] = vec2(-0.791559, -0.89771);
|
||||
|
||||
// Center pixel depth
|
||||
float fDepth = texture2D(t0,tex).a;
|
||||
|
||||
// Scale sampling radius
|
||||
float fRadius = abs(2.0 * gfRadius * fDepth - gfRadius);
|
||||
float fLowRadius = fRadius * gfLowRadiusScaling;
|
||||
|
||||
float fAmount = 0.0f;
|
||||
|
||||
// Loop over samples
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
// Sample on poisson disc
|
||||
vec2 fHighSampleTexCoord = tex + fRadius * poissonKernel[i];
|
||||
vec2 fLowSampleTexCoord = tex + fLowRadius * poissonKernel[i];
|
||||
|
||||
// Sample blurred and unblurred texture
|
||||
vec4 fHighSample = texture2D(t0, fHighSampleTexCoord);
|
||||
vec4 fLowSample = texture2D(t1, fLowSampleTexCoord);
|
||||
|
||||
// Blend between blurred and unblurred texture
|
||||
float fSampleBlurIntensity = abs(2.0 * fHighSample.w - 1.0);
|
||||
vec4 fSample = mix(fHighSample, fLowSample, fSampleBlurIntensity);
|
||||
|
||||
// Compute smart weight to avoid cross-edge leaking
|
||||
float fWeight = fSample.w < fDepth ? abs(2.0 * fSample.w - 1.0) : 1.0;
|
||||
|
||||
// Sum up
|
||||
color += fSample * fWeight;
|
||||
fAmount += fWeight;
|
||||
}
|
||||
|
||||
color /= fAmount;
|
||||
color.a = 1.0;
|
||||
}
|
||||
28
Blu64k/src/Blu64k/Shaders/Filters/DoFDownscaleFS.h
Normal file
28
Blu64k/src/Blu64k/Shaders/Filters/DoFDownscaleFS.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform sampler2D t1;
|
||||
uniform vec3 DooFParams;
|
||||
|
||||
float ComputeDepthBlur(float depth)
|
||||
{
|
||||
float f;
|
||||
if (depth < 0)
|
||||
f = 1.0;
|
||||
else
|
||||
if (depth < DooFParams.y)
|
||||
f = (depth - DooFParams.y)/(DooFParams.y - (DooFParams.y - DooFParams.x));
|
||||
else
|
||||
{
|
||||
f = (depth - DooFParams.y)/((DooFParams.y + DooFParams.x) - DooFParams.y);
|
||||
f = clamp(f, 0.0, DooFParams.z);
|
||||
}
|
||||
return clamp(f * 0.5 + 0.5, 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
color = texture2D(t0,v.xy*.5+.5);
|
||||
color.a = ComputeDepthBlur(texture2D(t1,v.xy*.5+.5).a);
|
||||
}
|
||||
62
Blu64k/src/Blu64k/Shaders/Filters/EnvMapBlur.h
Normal file
62
Blu64k/src/Blu64k/Shaders/Filters/EnvMapBlur.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#version 130
|
||||
|
||||
in vec4 v;
|
||||
|
||||
uniform sampler2D inEnvMapFront;
|
||||
uniform sampler2D inEnvMapBack;
|
||||
uniform vec2 ddxy;
|
||||
|
||||
out vec4 outEnvMapFront;
|
||||
out vec4 outEnvMapBack;
|
||||
|
||||
vec4 envColor(vec3 R)
|
||||
{
|
||||
vec2 front;
|
||||
front.x = R.x / (R.z + 1);
|
||||
front.y = R.y / (R.z + 1);
|
||||
front.x = .5 * front.x + .5;
|
||||
front.y = .5 * front.y + .5;
|
||||
|
||||
vec2 back;
|
||||
back.x = R.x / (1 - R.z);
|
||||
back.y = R.y / (1 - R.z);
|
||||
back.x = .5 * back.x + .5;
|
||||
back.y = .5 * back.y + .5;
|
||||
|
||||
vec4 cFront = texture(inEnvMapFront, back);
|
||||
vec4 cBack = texture(inEnvMapBack, front);
|
||||
return max(cFront, cBack);
|
||||
}
|
||||
|
||||
vec3 calcDir(vec2 tex)
|
||||
{
|
||||
tex = tex * 2.0 - 1;
|
||||
return normalize(vec3(tex.x, tex.y, 0.5 - 0.5*(tex.x*tex.x+tex.y*tex.y)));
|
||||
}
|
||||
|
||||
vec4 sampleEnvMap(vec2 tex, int side)
|
||||
{
|
||||
vec3 dir = calcDir(tex);
|
||||
dir.z *= side;
|
||||
if (tex.x > 1.0 || tex.x < 0.0 || tex.y > 1.0 || tex.y < 0.0)
|
||||
dir.z *= -1;
|
||||
|
||||
return envColor(dir);
|
||||
}
|
||||
|
||||
|
||||
vec4 blur(vec2 c, int side)
|
||||
{
|
||||
vec2 o = ddxy;
|
||||
return sampleEnvMap(c, side);
|
||||
return (sampleEnvMap(c, side)*4+sampleEnvMap(c+vec2(0,o.y), side)*2+sampleEnvMap(c+vec2(o.x,0), side)*2+sampleEnvMap(c-vec2(0,o.y), side)*2+sampleEnvMap(c-vec2(o.x,0), side)*2
|
||||
+sampleEnvMap(c+vec2(0,2*o.y), side)+sampleEnvMap(c+vec2(2*o.x,0), side)+sampleEnvMap(c-vec2(0,2*o.y), side)+sampleEnvMap(c-vec2(2*o.x,0), side)
|
||||
+sampleEnvMap(c+vec2(o.x,o.y), side)+sampleEnvMap(c+vec2(o.x,-o.y), side)+sampleEnvMap(c+vec2(-o.x,o.y), side)+sampleEnvMap(c-vec2(o.x,o.y), side))/20;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tex = v.xy * 0.5 + 0.5;
|
||||
outEnvMapFront = blur(tex, 1);
|
||||
outEnvMapBack = blur(tex, -1);
|
||||
}
|
||||
11
Blu64k/src/Blu64k/Shaders/Filters/GlowLdrFS.h
Normal file
11
Blu64k/src/Blu64k/Shaders/Filters/GlowLdrFS.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
uniform float bias;
|
||||
uniform float brightness;
|
||||
uniform float contrast;
|
||||
void main()
|
||||
{
|
||||
color = max(vec4(0.0), pow(max(vec4(0.0), texture2D(t0,v.xy*.5+.5) + vec4(bias)), vec4(contrast)) * brightness);
|
||||
}
|
||||
42
Blu64k/src/Blu64k/Shaders/Filters/HdrCombineFS.h
Normal file
42
Blu64k/src/Blu64k/Shaders/Filters/HdrCombineFS.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D baseT;
|
||||
uniform sampler2D glowT;
|
||||
uniform sampler2D streakAT;
|
||||
uniform sampler2D streakBT;
|
||||
uniform sampler2D anaT;
|
||||
uniform sampler2D lumT;
|
||||
|
||||
uniform float exposure;
|
||||
uniform float whiteCutOff;
|
||||
uniform float lensS;
|
||||
uniform float anaS;
|
||||
uniform float glowS;
|
||||
uniform float streakS;
|
||||
|
||||
vec4 getLens(float scale)
|
||||
{
|
||||
vec2 tex = min(vec2(1.0), max(vec2(0.0), v.xy * scale * .5+.5));
|
||||
return texture2D(glowT,tex) * (1.0 - min(0.0, length(tex*2.0-1.0)));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 base = texture2D(baseT,v.xy*.5+.5);
|
||||
vec4 glow = glowS * texture2D(glowT,v.xy*.5+.5);
|
||||
vec4 streak = streakS * max(texture2D(streakAT,v.xy*.5+.5), texture2D(streakBT,v.xy*.5+.5));
|
||||
vec4 anamorph = anaS * pow(texture2D(anaT,v.xy*.5+.5) * vec4(0.0,0.0,1.0,1.0) * 5.0, vec4(2.0));
|
||||
vec4 lens = lensS * (getLens(0.1) + getLens(0.25) + getLens(0.5) + getLens(0.75) + getLens(1.5) + getLens(2.0) +
|
||||
getLens(-0.1) + getLens(-0.25) + getLens(-0.5) + getLens(-0.75) + getLens(-1.5) + getLens(-2.0));
|
||||
|
||||
color = base + lens;
|
||||
|
||||
float luminance = exp(texture2D(lumT,v.xy*.5+.5).z);
|
||||
float l = length(color.xyz);//dot(color.xyz, vec3(0.299, 0.587, 0.184));
|
||||
luminance = (exposure / luminance) * l;
|
||||
luminance = (luminance * (1 + luminance / (whiteCutOff*whiteCutOff))) / (1 + luminance);
|
||||
color *= luminance;
|
||||
|
||||
color += glow + streak + anamorph;
|
||||
}
|
||||
10
Blu64k/src/Blu64k/Shaders/Filters/LuminanceFS.h
Normal file
10
Blu64k/src/Blu64k/Shaders/Filters/LuminanceFS.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 130
|
||||
in vec4 v;
|
||||
out vec4 color;
|
||||
uniform sampler2D t0;
|
||||
void main()
|
||||
{
|
||||
color = texture2D(t0,v.xy*.5+.5);
|
||||
float l = length(color.xyz);//dot(color.xyz, vec3(0.299, 0.587, 0.184));
|
||||
color = vec4(l, l, log(0.01 + l), 1.0);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user