From pre-0.0.3 source code
This commit is contained in:
parent
57c6329c62
commit
931be8cf09
20
.gitignore
vendored
20
.gitignore
vendored
@ -11,3 +11,23 @@
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
|
||||
# autotools
|
||||
Makefile
|
||||
Makefile.in
|
||||
configure
|
||||
|
||||
# Xcode Generated Files
|
||||
DerivedData
|
||||
xcuserdata
|
||||
*~.nib
|
||||
*.pbxuser
|
||||
*.perspective
|
||||
*.perspectivev2
|
||||
#!xcuserdata/
|
||||
#*.xcuserstate
|
||||
UserInterfaceState.xcuserstate
|
||||
|
||||
# Windows related
|
||||
Thumbs.db
|
||||
|
||||
|
13
ChangeLog
Normal file
13
ChangeLog
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
2013-08-12 yvt <i@yvt.jp>
|
||||
|
||||
* Software Rendered Reflective Shadow Map
|
||||
|
||||
2013-08-17 yvt <i@yvt.jp>
|
||||
|
||||
* Do some works in vertex shader rather than frag. shader
|
||||
* Made chunkPosition uniform
|
||||
* Corrected killer for fall death
|
||||
* Modified reload volume
|
||||
* fogColor in GLShadowShader is now linearized
|
||||
|
321
Makefile.am
Normal file
321
Makefile.am
Normal file
@ -0,0 +1,321 @@
|
||||
bin_PROGRAMS = openspades
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/Sources/ENet/include
|
||||
|
||||
AM_CPPFLAGS += $(GL_CFLAGS)
|
||||
AM_CPPFLAGS += $(GLEW_CFLAGS)
|
||||
AM_CPPFLAGS += $(SDL_CFLAGS)
|
||||
AM_CPPFLAGS += $(FLTK_CFLAGS)
|
||||
AM_CPPFLAGS += $(ZLIB_CFLAGS)
|
||||
# AM_CPPFLAGS += $(PNG_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += -DNDEBUG=1
|
||||
|
||||
openspades_LDADD = $(GL_LIBS)
|
||||
openspades_LDADD += $(GLEW_LIBS)
|
||||
openspades_LDADD += $(SDL_LIBS)
|
||||
openspades_LDADD += $(FLTK_LIBS)
|
||||
openspades_LDADD += $(ZLIB_LIBS)
|
||||
# openspades_LDADD += $(PNG_LIBS)
|
||||
openspades_LDADD += $(WIN32_LIBS)
|
||||
|
||||
# pkg-config doesn't seem to work...
|
||||
# openspades_LDADD += -ljpeg
|
||||
|
||||
openspades_SOURCES = \
|
||||
Sources/Audio/ALDevice.cpp \
|
||||
Sources/Audio/ALDevice.h \
|
||||
Sources/Audio/ALFuncs.cpp \
|
||||
Sources/Audio/ALFuncs.h \
|
||||
Sources/Audio/AL/al.h \
|
||||
Sources/Audio/AL/alc.h \
|
||||
Sources/Audio/AL/alctypes.h \
|
||||
Sources/Audio/AL/altypes.h \
|
||||
Sources/Audio/AL/alut.h \
|
||||
Sources/Audio/AL/efx-creative.h \
|
||||
Sources/Audio/AL/efx-presets.h \
|
||||
Sources/Audio/AL/efx.h \
|
||||
Sources/Audio/AL/MacOSX_OALExtensions.h \
|
||||
Sources/Client/AsyncRenderer.cpp \
|
||||
Sources/Client/AsyncRenderer.h \
|
||||
Sources/Client/CenterMessageView.cpp \
|
||||
Sources/Client/CenterMessageView.h \
|
||||
Sources/Client/ChatWindow.cpp \
|
||||
Sources/Client/ChatWindow.h \
|
||||
Sources/Client/Client.cpp \
|
||||
Sources/Client/Client.h \
|
||||
Sources/Client/Corpse.cpp \
|
||||
Sources/Client/Corpse.h \
|
||||
Sources/Client/CTFGameMode.cpp \
|
||||
Sources/Client/CTFGameMode.h \
|
||||
Sources/Client/FallingBlock.cpp \
|
||||
Sources/Client/FallingBlock.h \
|
||||
Sources/Client/FontData.h \
|
||||
Sources/Client/GameMap.cpp \
|
||||
Sources/Client/GameMap.h \
|
||||
Sources/Client/GameMapWrapper.cpp \
|
||||
Sources/Client/GameMapWrapper.h \
|
||||
Sources/Client/Grenade.cpp \
|
||||
Sources/Client/Grenade.h \
|
||||
Sources/Client/GunCasing.cpp \
|
||||
Sources/Client/GunCasing.h \
|
||||
Sources/Client/HurtRingView.cpp \
|
||||
Sources/Client/HurtRingView.h \
|
||||
Sources/Client/IAudioChunk.cpp \
|
||||
Sources/Client/IAudioChunk.h \
|
||||
Sources/Client/IAudioDevice.cpp \
|
||||
Sources/Client/IAudioDevice.h \
|
||||
Sources/Client/IFont.cpp \
|
||||
Sources/Client/IFont.h \
|
||||
Sources/Client/IGameMapListener.cpp \
|
||||
Sources/Client/IGameMapListener.h \
|
||||
Sources/Client/IGameMode.cpp \
|
||||
Sources/Client/IGameMode.h \
|
||||
Sources/Client/IImage.cpp \
|
||||
Sources/Client/IImage.h \
|
||||
Sources/Client/IInputInterface.cpp \
|
||||
Sources/Client/IInputInterface.h \
|
||||
Sources/Client/ILocalEntity.cpp \
|
||||
Sources/Client/ILocalEntity.h \
|
||||
Sources/Client/IModel.cpp \
|
||||
Sources/Client/IModel.h \
|
||||
Sources/Client/IRenderer.cpp \
|
||||
Sources/Client/IRenderer.h \
|
||||
Sources/Client/IWorldListener.cpp \
|
||||
Sources/Client/IWorldListener.h \
|
||||
Sources/Client/LimboView.cpp \
|
||||
Sources/Client/LimboView.h \
|
||||
Sources/Client/MapView.cpp \
|
||||
Sources/Client/MapView.h \
|
||||
Sources/Client/NetClient.cpp \
|
||||
Sources/Client/NetClient.h \
|
||||
Sources/Client/PaletteView.cpp \
|
||||
Sources/Client/PaletteView.h \
|
||||
Sources/Client/ParticleSpriteEntity.cpp \
|
||||
Sources/Client/ParticleSpriteEntity.h \
|
||||
Sources/Client/Player.cpp \
|
||||
Sources/Client/Player.h \
|
||||
Sources/Client/PhysicsConstants.h \
|
||||
Sources/Client/Quake3Font.cpp \
|
||||
Sources/Client/Quake3Font.h \
|
||||
Sources/Client/SceneDefinition.cpp \
|
||||
Sources/Client/SceneDefinition.h \
|
||||
Sources/Client/ScoreboardView.cpp \
|
||||
Sources/Client/ScoreboardView.h \
|
||||
Sources/Client/SmokeSpriteEntity.cpp \
|
||||
Sources/Client/SmokeSpriteEntity.h \
|
||||
Sources/Client/TCGameMode.cpp \
|
||||
Sources/Client/TCGameMode.h \
|
||||
Sources/Client/TCProgressView.cpp \
|
||||
Sources/Client/TCProgressView.h \
|
||||
Sources/Client/Weapon.cpp \
|
||||
Sources/Client/Weapon.h \
|
||||
Sources/Client/World.cpp \
|
||||
Sources/Client/World.h \
|
||||
Sources/Core/AutoLocker.cpp \
|
||||
Sources/Core/AutoLocker.h \
|
||||
Sources/Core/Bitmap.cpp \
|
||||
Sources/Core/Bitmap.h \
|
||||
Sources/Core/BitmapAtlasGenerator.cpp \
|
||||
Sources/Core/BitmapAtlasGenerator.h \
|
||||
Sources/Core/ConcurrentDispatch.cpp \
|
||||
Sources/Core/ConcurrentDispatch.h \
|
||||
Sources/Core/DynamicMemoryStream.cpp \
|
||||
Sources/Core/DynamicMemoryStream.h \
|
||||
Sources/Core/Debug.cpp \
|
||||
Sources/Core/Debug.h \
|
||||
Sources/Core/DeflateStream.cpp \
|
||||
Sources/Core/DeflateStream.h \
|
||||
Sources/Core/Deque.cpp \
|
||||
Sources/Core/Deque.h \
|
||||
Sources/Core/DirectoryFileSystem.cpp \
|
||||
Sources/Core/DirectoryFileSystem.h \
|
||||
Sources/Core/DynamicLibrary.cpp \
|
||||
Sources/Core/DynamicLibrary.h \
|
||||
Sources/Core/Exception.cpp \
|
||||
Sources/Core/Exception.h \
|
||||
Sources/Core/FileManager.cpp \
|
||||
Sources/Core/FileManager.h \
|
||||
Sources/Core/FltkImageReader.cpp \
|
||||
Sources/Core/IAudioStream.cpp \
|
||||
Sources/Core/IAudioStream.h \
|
||||
Sources/Core/IBitmapCodec.cpp \
|
||||
Sources/Core/IBitmapCodec.h \
|
||||
Sources/Core/IFileSystem.cpp \
|
||||
Sources/Core/IFileSystem.h \
|
||||
Sources/Core/ILockable.cpp \
|
||||
Sources/Core/ILockable.h \
|
||||
Sources/Core/IRunnable.cpp \
|
||||
Sources/Core/IRunnable.h \
|
||||
Sources/Core/IStream.cpp \
|
||||
Sources/Core/IStream.h \
|
||||
Sources/Core/Math.cpp \
|
||||
Sources/Core/Math.h \
|
||||
Sources/Core/MemoryStream.cpp \
|
||||
Sources/Core/MemoryStream.h \
|
||||
Sources/Core/Mutex.cpp \
|
||||
Sources/Core/Mutex.h \
|
||||
Sources/Core/Semaphore.cpp \
|
||||
Sources/Core/Semaphore.h \
|
||||
Sources/Core/Settings.cpp \
|
||||
Sources/Core/Settings.h \
|
||||
Sources/Core/StdStream.cpp \
|
||||
Sources/Core/StdStream.h \
|
||||
Sources/Core/Stopwatch.cpp \
|
||||
Sources/Core/Stopwatch.h \
|
||||
Sources/Core/TargaReader.cpp \
|
||||
Sources/Core/TargaWriter.cpp \
|
||||
Sources/Core/Thread.cpp \
|
||||
Sources/Core/Thread.h \
|
||||
Sources/Core/ThreadLocalStorage.cpp \
|
||||
Sources/Core/ThreadLocalStorage.h \
|
||||
Sources/Core/VoxelModel.cpp \
|
||||
Sources/Core/VoxelModel.h \
|
||||
Sources/Core/WavAudioStream.cpp \
|
||||
Sources/Core/WavAudioStream.h \
|
||||
Sources/Core/ZipFileSystem.cpp \
|
||||
Sources/Core/ZipFileSystem.h \
|
||||
Sources/Draw/GLAmbientShadowRenderer.cpp \
|
||||
Sources/Draw/GLAmbientShadowRenderer.h \
|
||||
Sources/Draw/GLBasicShadowMapRenderer.cpp \
|
||||
Sources/Draw/GLBasicShadowMapRenderer.h \
|
||||
Sources/Draw/GLBloomFilter.cpp \
|
||||
Sources/Draw/GLBloomFilter.h \
|
||||
Sources/Draw/GLCameraBlurFilter.cpp \
|
||||
Sources/Draw/GLCameraBlurFilter.h \
|
||||
Sources/Draw/GLDynamicLight.cpp \
|
||||
Sources/Draw/GLDynamicLight.h \
|
||||
Sources/Draw/GLDynamicLightShader.cpp \
|
||||
Sources/Draw/GLDynamicLightShader.h \
|
||||
Sources/Draw/GLFlatMapRenderer.cpp \
|
||||
Sources/Draw/GLFlatMapRenderer.h \
|
||||
Sources/Draw/GLFramebufferManager.cpp \
|
||||
Sources/Draw/GLFramebufferManager.h \
|
||||
Sources/Draw/GLImage.cpp \
|
||||
Sources/Draw/GLImage.h \
|
||||
Sources/Draw/GLImageManager.cpp \
|
||||
Sources/Draw/GLImageManager.h \
|
||||
Sources/Draw/GLImageRenderer.cpp \
|
||||
Sources/Draw/GLImageRenderer.h \
|
||||
Sources/Draw/GLLensFilter.cpp \
|
||||
Sources/Draw/GLLensFilter.h \
|
||||
Sources/Draw/GLMapChunk.cpp \
|
||||
Sources/Draw/GLMapChunk.h \
|
||||
Sources/Draw/GLMapRenderer.cpp \
|
||||
Sources/Draw/GLMapRenderer.h \
|
||||
Sources/Draw/GLMapShadowRenderer.cpp \
|
||||
Sources/Draw/GLMapShadowRenderer.h \
|
||||
Sources/Draw/GLModel.cpp \
|
||||
Sources/Draw/GLModel.h \
|
||||
Sources/Draw/GLModelManager.cpp \
|
||||
Sources/Draw/GLModelManager.h \
|
||||
Sources/Draw/GLModelRenderer.cpp \
|
||||
Sources/Draw/GLModelRenderer.h \
|
||||
Sources/Draw/GLOptimizedVoxelModel.cpp \
|
||||
Sources/Draw/GLOptimizedVoxelModel.h \
|
||||
Sources/Draw/GLProgram.cpp \
|
||||
Sources/Draw/GLProgram.h \
|
||||
Sources/Draw/GLProgramAttribute.cpp \
|
||||
Sources/Draw/GLProgramAttribute.h \
|
||||
Sources/Draw/GLProgramManager.cpp \
|
||||
Sources/Draw/GLProgramManager.h \
|
||||
Sources/Draw/GLProgramUniform.cpp \
|
||||
Sources/Draw/GLProgramUniform.h \
|
||||
Sources/Draw/GLQuadRenderer.cpp \
|
||||
Sources/Draw/GLQuadRenderer.h \
|
||||
Sources/Draw/GLRadiosityRenderer.cpp \
|
||||
Sources/Draw/GLRadiosityRenderer.h \
|
||||
Sources/Draw/GLRenderer.cpp \
|
||||
Sources/Draw/GLRenderer.h \
|
||||
Sources/Draw/GLShader.cpp \
|
||||
Sources/Draw/GLShader.h \
|
||||
Sources/Draw/GLShadowMapShader.cpp \
|
||||
Sources/Draw/GLShadowMapShader.h \
|
||||
Sources/Draw/GLShadowShader.cpp \
|
||||
Sources/Draw/GLShadowShader.h \
|
||||
Sources/Draw/GLSoftSpriteRenderer.cpp \
|
||||
Sources/Draw/GLSoftSpriteRenderer.h \
|
||||
Sources/Draw/GLSpriteRenderer.cpp \
|
||||
Sources/Draw/GLSpriteRenderer.h \
|
||||
Sources/Draw/GLVoxelModel.cpp \
|
||||
Sources/Draw/GLVoxelModel.h \
|
||||
Sources/Draw/GLWaterRenderer.cpp \
|
||||
Sources/Draw/GLWaterRenderer.h \
|
||||
Sources/Draw/IGLDevice.cpp \
|
||||
Sources/Draw/IGLDevice.h \
|
||||
Sources/Draw/IGLSpriteRenderer.cpp \
|
||||
Sources/Draw/IGLSpriteRenderer.h \
|
||||
Sources/Draw/IGLShadowMapRenderer.cpp \
|
||||
Sources/Draw/IGLShadowMapRenderer.h \
|
||||
Sources/Gui/Main.cpp \
|
||||
Sources/Gui/DetailConfigWindow.cpp \
|
||||
Sources/Gui/DetailConfigWindowHandler.cpp \
|
||||
Sources/Gui/DetailConfigWindow.h \
|
||||
Sources/Gui/DetailConfigWindow.fl \
|
||||
Sources/Gui/DetailConfigTable.cpp \
|
||||
Sources/Gui/DetailConfigTable.h \
|
||||
Sources/Gui/MainWindow.cpp \
|
||||
Sources/Gui/MainWindowHandler.cpp \
|
||||
Sources/Gui/MainWindow.h \
|
||||
Sources/Gui/MainWindow.fl \
|
||||
Sources/Gui/SDLGLDevice.cpp \
|
||||
Sources/Gui/SDLGLDevice.h \
|
||||
Sources/Gui/SDLAsyncRunner.cpp \
|
||||
Sources/Gui/SDLAsyncRunner.h \
|
||||
Sources/Gui/SDLRunner.cpp \
|
||||
Sources/Gui/SDLRunner.h \
|
||||
Sources/ENet/callbacks.c \
|
||||
Sources/ENet/compress.c \
|
||||
Sources/ENet/host.c \
|
||||
Sources/ENet/list.c \
|
||||
Sources/ENet/packet.c \
|
||||
Sources/ENet/peer.c \
|
||||
Sources/ENet/protocol.c \
|
||||
Sources/ENet/unix.c \
|
||||
Sources/ENet/win32.c \
|
||||
Sources/ENet/include/enet/callbacks.h \
|
||||
Sources/ENet/include/enet/enet.h \
|
||||
Sources/ENet/include/enet/list.h \
|
||||
Sources/ENet/include/enet/protocol.h \
|
||||
Sources/ENet/include/enet/time.h \
|
||||
Sources/ENet/include/enet/types.h \
|
||||
Sources/ENet/include/enet/unix.h \
|
||||
Sources/ENet/include/enet/utility.h \
|
||||
Sources/ENet/include/enet/win32.h \
|
||||
Sources/poly2tri/common/shapes.cc \
|
||||
Sources/poly2tri/common/shapes.h \
|
||||
Sources/poly2tri/common/utils.h \
|
||||
Sources/poly2tri/poly2tri.h \
|
||||
Sources/poly2tri/sweep/advancing_front.cc \
|
||||
Sources/poly2tri/sweep/advancing_front.h \
|
||||
Sources/poly2tri/sweep/cdt.cc \
|
||||
Sources/poly2tri/sweep/cdt.h \
|
||||
Sources/poly2tri/sweep/sweep_context.cc \
|
||||
Sources/poly2tri/sweep/sweep_context.h \
|
||||
Sources/poly2tri/sweep/sweep.cc \
|
||||
Sources/poly2tri/sweep/sweep.h \
|
||||
Sources/kiss_fft130/kiss_fft.c \
|
||||
Sources/kiss_fft130/kiss_fft.h \
|
||||
Sources/kiss_fft130/_kiss_fft_guts.h \
|
||||
Sources/binpack2d/binpack2d.hpp \
|
||||
Sources/unzip/unzip.c \
|
||||
Sources/unzip/unzip.h \
|
||||
Sources/unzip/ioapi.c \
|
||||
Sources/unzip/ioapi.h \
|
||||
Sources/Imports/SDL.h \
|
||||
Sources/Imports/OpenGL.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
Sources/ENet/LICENSE \
|
||||
Sources/ENet/README \
|
||||
Sources/kiss_fft130/CHANGELOG \
|
||||
Sources/kiss_fft130/COPYING \
|
||||
Sources/kiss_fft130/README \
|
||||
Sources/kiss_fft130/README.simd \
|
||||
Sources/Gui/AboutText.html
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1400
OpenSpades.xcodeproj/project.pbxproj
Normal file
1400
OpenSpades.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
7
OpenSpades.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
OpenSpades.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:OpenSpades.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
BIN
Resources/.DS_Store
vendored
Normal file
BIN
Resources/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Resources/Shaders/.DS_Store
vendored
Normal file
BIN
Resources/Shaders/.DS_Store
vendored
Normal file
Binary file not shown.
7
Resources/Shaders/Basic.fs
Normal file
7
Resources/Shaders/Basic.fs
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
2
Resources/Shaders/Basic.program
Normal file
2
Resources/Shaders/Basic.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/Basic.fs
|
||||
Shaders/Basic.vs
|
16
Resources/Shaders/Basic.vs
Normal file
16
Resources/Shaders/Basic.vs
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
|
||||
attribute vec4 positionAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position = projectionViewMatrix * positionAttribute;
|
||||
|
||||
color = colorAttribute;
|
||||
|
||||
}
|
||||
|
36
Resources/Shaders/BasicBlock.fs
Normal file
36
Resources/Shaders/BasicBlock.fs
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 ambientOcclusionCoord;
|
||||
varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
|
||||
uniform sampler2D ambientOcclusionTexture;
|
||||
uniform sampler2D detailTexture;
|
||||
uniform vec3 fogColor;
|
||||
|
||||
vec3 EvaluateSunLight();
|
||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion);
|
||||
//void VisibilityOfSunLight_Model_Debug();
|
||||
|
||||
void main() {
|
||||
// color is linear
|
||||
gl_FragColor = vec4(color.xyz, 1.);
|
||||
|
||||
vec3 shading = vec3(color.w);
|
||||
shading *= EvaluateSunLight();
|
||||
|
||||
float ao = texture2D(ambientOcclusionTexture, ambientOcclusionCoord).x;
|
||||
|
||||
shading += EvaluateAmbientLight(ao);
|
||||
|
||||
// apply diffuse shading
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
// apply fog
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, fogColor, fogDensity);
|
||||
|
||||
// gamma correct
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
}
|
||||
|
3
Resources/Shaders/BasicBlock.program
Normal file
3
Resources/Shaders/BasicBlock.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/BasicBlock.fs
|
||||
Shaders/BasicBlock.vs
|
||||
*shadow*
|
59
Resources/Shaders/BasicBlock.vs
Normal file
59
Resources/Shaders/BasicBlock.vs
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform vec3 chunkPosition;
|
||||
uniform float fogDistance;
|
||||
|
||||
// --- Vertex attribute ---
|
||||
// [x, y, z]
|
||||
attribute vec3 positionAttribute;
|
||||
|
||||
// [ax, ay]
|
||||
attribute vec2 ambientOcclusionCoordAttribute;
|
||||
|
||||
// [R, G, B, diffuse]
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
// [nx, ny, nz]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec2 ambientOcclusionCoord;
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadow(vec3 worldOrigin, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(chunkPosition, 1.);
|
||||
|
||||
vertexPos.xyz += positionAttribute.xyz;
|
||||
|
||||
gl_Position = projectionViewMatrix * vertexPos;
|
||||
|
||||
color = colorAttribute;
|
||||
color.xyz *= color.xyz; // linearize
|
||||
|
||||
// ambient occlusion
|
||||
ambientOcclusionCoord = (ambientOcclusionCoordAttribute + .5) / 256.;
|
||||
|
||||
vec4 viewPos = viewMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
/*
|
||||
detailCoord = (vec2(dot(tan1, vertexPos.xyz), dot(tan2, vertexPos.xyz))) / 2.;
|
||||
*/
|
||||
|
||||
vec3 normal = normalAttribute; //cross(tan2, tan1);
|
||||
vec3 shadowVertexPos = vertexPos.xyz;
|
||||
if(abs(normal.x) > .1) // avoid self shadowing
|
||||
shadowVertexPos += normal * 0.01;
|
||||
PrepareForShadow(shadowVertexPos, normal);
|
||||
}
|
||||
|
25
Resources/Shaders/BasicBlockDynamicLit.fs
Normal file
25
Resources/Shaders/BasicBlockDynamicLit.fs
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
|
||||
uniform sampler2D detailTexture;
|
||||
uniform vec3 fogColor;
|
||||
|
||||
vec3 EvaluateDynamicLightNoBump();
|
||||
|
||||
void main() {
|
||||
// color is linearized
|
||||
gl_FragColor = vec4(color.xyz, 1.);
|
||||
|
||||
vec3 shading = EvaluateDynamicLightNoBump();
|
||||
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
// fog fade
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, vec3(0.), fogDensity);
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
}
|
||||
|
3
Resources/Shaders/BasicBlockDynamicLit.program
Normal file
3
Resources/Shaders/BasicBlockDynamicLit.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/BasicBlockDynamicLit.fs
|
||||
Shaders/BasicBlockDynamicLit.vs
|
||||
*dlight*
|
51
Resources/Shaders/BasicBlockDynamicLit.vs
Normal file
51
Resources/Shaders/BasicBlockDynamicLit.vs
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform vec3 chunkPosition;
|
||||
uniform float fogDistance;
|
||||
|
||||
// --- Vertex attribute ---
|
||||
// [x, y, z]
|
||||
attribute vec3 positionAttribute;
|
||||
|
||||
// [R, G, B, diffuse]
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
// [nx, ny, nz]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
varying vec2 detailCoord;
|
||||
|
||||
void PrepareForDynamicLightNoBump(vec3 vertexCoord, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(chunkPosition, 1.);
|
||||
|
||||
vertexPos.xyz += positionAttribute.xyz;
|
||||
|
||||
gl_Position = projectionViewMatrix * vertexPos;
|
||||
|
||||
color = colorAttribute;
|
||||
color.xyz *= color.xyz; // linearize
|
||||
|
||||
vec4 viewPos = viewMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
/*
|
||||
detailCoord = (vec2(dot(tan1, vertexPos.xyz), dot(tan2, vertexPos.xyz))) / 2.;
|
||||
*/
|
||||
|
||||
vec3 normal = normalAttribute; //cross(tan2, tan1);
|
||||
vec3 shadowVertexPos = vertexPos.xyz;
|
||||
|
||||
PrepareForDynamicLightNoBump(shadowVertexPos, normal);
|
||||
}
|
||||
|
11
Resources/Shaders/BasicImage.fs
Normal file
11
Resources/Shaders/BasicImage.fs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(texture, texCoord);
|
||||
gl_FragColor *= color;
|
||||
}
|
||||
|
2
Resources/Shaders/BasicImage.program
Normal file
2
Resources/Shaders/BasicImage.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/BasicImage.fs
|
||||
Shaders/BasicImage.vs
|
26
Resources/Shaders/BasicImage.vs
Normal file
26
Resources/Shaders/BasicImage.vs
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
attribute vec2 textureCoordAttribute;
|
||||
|
||||
uniform vec2 screenSize;
|
||||
uniform vec2 textureSize;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
pos /= screenSize;
|
||||
pos = pos * 2. - 1.;
|
||||
pos.y = -pos.y;
|
||||
|
||||
gl_Position = vec4(pos, 0.5, 1.);
|
||||
|
||||
color = colorAttribute;
|
||||
texCoord = textureCoordAttribute / textureSize;
|
||||
}
|
||||
|
BIN
Resources/Shaders/DynamicLight/.DS_Store
vendored
Normal file
BIN
Resources/Shaders/DynamicLight/.DS_Store
vendored
Normal file
Binary file not shown.
53
Resources/Shaders/DynamicLight/Common.fs
Normal file
53
Resources/Shaders/DynamicLight/Common.fs
Normal file
@ -0,0 +1,53 @@
|
||||
// Common code for dynamic light rendering
|
||||
|
||||
|
||||
// -- shadowing
|
||||
|
||||
float VisibilityOfLight_Map();
|
||||
|
||||
float VisibilityOfLight() {
|
||||
return VisibilityOfLight_Map();
|
||||
}
|
||||
|
||||
float EvaluateDynamicLightShadow(){
|
||||
return VisibilityOfLight();
|
||||
}
|
||||
|
||||
// -- lighting (without bumpmapping)
|
||||
|
||||
uniform vec3 dynamicLightColor;
|
||||
uniform float dynamicLightRadius;
|
||||
uniform float dynamicLightRadiusInversed;
|
||||
uniform sampler2D dynamicLightProjectionTexture;
|
||||
|
||||
varying vec3 lightPos;
|
||||
varying vec3 lightNormal;
|
||||
varying vec3 lightTexCoord;
|
||||
|
||||
vec3 EvaluateDynamicLightNoBump() {
|
||||
if(lightTexCoord.z < 0.) discard;
|
||||
|
||||
// diffuse lighting
|
||||
float intensity = dot(normalize(lightPos), normalize(lightNormal));
|
||||
if(intensity < 0.) discard;
|
||||
|
||||
// attenuation
|
||||
float distance = length(lightPos);
|
||||
if(distance >= dynamicLightRadius) discard;
|
||||
distance *= dynamicLightRadiusInversed;
|
||||
distance = max(1. - distance, 0.);
|
||||
float att = distance * distance;
|
||||
|
||||
// apply attenuation
|
||||
intensity *= att;
|
||||
|
||||
// projection
|
||||
// if(lightTexCoord.w < 0.) discard; -- done earlier
|
||||
vec3 texValue = texture2DProj(dynamicLightProjectionTexture, lightTexCoord).xyz;
|
||||
|
||||
// TODO: specular lighting?
|
||||
return dynamicLightColor * intensity * EvaluateDynamicLightShadow() * texValue;
|
||||
}
|
||||
|
||||
// TODO: bumpmapping variant (requires tangent vector)
|
||||
|
23
Resources/Shaders/DynamicLight/Common.vs
Normal file
23
Resources/Shaders/DynamicLight/Common.vs
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
uniform vec3 dynamicLightOrigin;
|
||||
uniform mat4 dynamicLightSpotMatrix;
|
||||
|
||||
void PrepareForShadow_Map(vec3 vertexCoord) ;
|
||||
|
||||
|
||||
varying vec3 lightPos;
|
||||
varying vec3 lightNormal;
|
||||
varying vec3 lightTexCoord;
|
||||
|
||||
void PrepareForDynamicLightNoBump(vec3 vertexCoord, vec3 normal) {
|
||||
PrepareForShadow_Map(vertexCoord);
|
||||
|
||||
lightPos = dynamicLightOrigin - vertexCoord;
|
||||
lightNormal = normal;
|
||||
|
||||
// projection
|
||||
lightTexCoord = (dynamicLightSpotMatrix * vec4(vertexCoord,1.)).xyw;
|
||||
|
||||
}
|
||||
|
||||
// TODO: bumpmapping variant (requires tangent vector)
|
5
Resources/Shaders/DynamicLight/MapNull.fs
Normal file
5
Resources/Shaders/DynamicLight/MapNull.fs
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
float VisibilityOfLight_Map() {
|
||||
return 1.;
|
||||
}
|
4
Resources/Shaders/DynamicLight/MapNull.vs
Normal file
4
Resources/Shaders/DynamicLight/MapNull.vs
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
void PrepareForShadow_Map(vec3 vertexCoord) {
|
||||
|
||||
}
|
54
Resources/Shaders/OptimizedVoxelModel.fs
Normal file
54
Resources/Shaders/OptimizedVoxelModel.fs
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
|
||||
varying vec4 textureCoord;
|
||||
//varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
varying float flatShading;
|
||||
|
||||
uniform sampler2D ambientOcclusionTexture;
|
||||
uniform sampler2D modelTexture;
|
||||
uniform vec3 fogColor;
|
||||
uniform vec3 customColor;
|
||||
|
||||
vec3 EvaluateSunLight();
|
||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion);
|
||||
|
||||
void main() {
|
||||
vec4 texData = texture2D(modelTexture, textureCoord.xy);
|
||||
|
||||
// model color
|
||||
gl_FragColor = vec4(texData.xyz, 1.);
|
||||
if(dot(gl_FragColor.xyz, vec3(1.)) < 0.0001){
|
||||
gl_FragColor.xyz = customColor;
|
||||
}
|
||||
|
||||
// ambient occlusion
|
||||
float aoID = texData.w * (255. / 256.);
|
||||
|
||||
float aoY = aoID * 16.;
|
||||
float aoX = fract(aoY);
|
||||
aoY = floor(aoY) / 16.;
|
||||
|
||||
vec2 ambientOcclusionCoord = vec2(aoX, aoY);
|
||||
ambientOcclusionCoord += fract(textureCoord.zw) *
|
||||
(15. / 256.);
|
||||
ambientOcclusionCoord += .5 / 256.;
|
||||
|
||||
// linearize
|
||||
gl_FragColor.xyz *= gl_FragColor.xyz;
|
||||
|
||||
// shading
|
||||
vec3 shading = vec3(flatShading);
|
||||
|
||||
shading *= EvaluateSunLight();
|
||||
|
||||
vec3 ao = texture2D(ambientOcclusionTexture, ambientOcclusionCoord).xyz;
|
||||
shading += EvaluateAmbientLight(ao.x);
|
||||
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, fogColor, fogDensity);
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
}
|
||||
|
3
Resources/Shaders/OptimizedVoxelModel.program
Normal file
3
Resources/Shaders/OptimizedVoxelModel.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/OptimizedVoxelModel.fs
|
||||
Shaders/OptimizedVoxelModel.vs
|
||||
*shadow*
|
57
Resources/Shaders/OptimizedVoxelModel.vs
Normal file
57
Resources/Shaders/OptimizedVoxelModel.vs
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform mat4 viewModelMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
uniform float fogDistance;
|
||||
uniform vec3 sunLightDirection;
|
||||
uniform vec2 texScale;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 positionAttribute;
|
||||
|
||||
// [u, v]
|
||||
attribute vec2 textureCoordAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec4 textureCoord;
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
varying float flatShading;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadow(vec3 worldOrigin, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
|
||||
textureCoord = textureCoordAttribute.xyxy * vec4(texScale.xy, vec2(1.));
|
||||
|
||||
// direct sunlight
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
float sunlight = dot(normal, sunLightDirection);
|
||||
sunlight = max(sunlight, 0.);
|
||||
flatShading = sunlight;
|
||||
|
||||
|
||||
vec4 viewPos = viewModelMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
PrepareForShadow((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
34
Resources/Shaders/OptimizedVoxelModelDynamicLit.fs
Normal file
34
Resources/Shaders/OptimizedVoxelModelDynamicLit.fs
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
varying vec2 textureCoord;
|
||||
//varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
|
||||
uniform sampler2D modelTexture;
|
||||
uniform vec3 customColor;
|
||||
//uniform sampler2D detailTexture;
|
||||
|
||||
vec3 EvaluateDynamicLightNoBump();
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 texData = texture2D(modelTexture, textureCoord.xy);
|
||||
|
||||
// model color
|
||||
gl_FragColor = vec4(texData.xyz, 1.);
|
||||
if(dot(gl_FragColor.xyz, vec3(1.)) < 0.0001){
|
||||
gl_FragColor.xyz = customColor;
|
||||
}
|
||||
|
||||
// linearize
|
||||
gl_FragColor.xyz *= gl_FragColor.xyz;
|
||||
|
||||
// lighting
|
||||
vec3 shading = EvaluateDynamicLightNoBump();
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, vec3(0.), fogDensity);
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
}
|
||||
|
3
Resources/Shaders/OptimizedVoxelModelDynamicLit.program
Normal file
3
Resources/Shaders/OptimizedVoxelModelDynamicLit.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/OptimizedVoxelModelDynamicLit.fs
|
||||
Shaders/OptimizedVoxelModelDynamicLit.vs
|
||||
*dlight*
|
50
Resources/Shaders/OptimizedVoxelModelDynamicLit.vs
Normal file
50
Resources/Shaders/OptimizedVoxelModelDynamicLit.vs
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform mat4 viewModelMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
uniform float fogDistance;
|
||||
uniform vec2 texScale;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 positionAttribute;
|
||||
|
||||
// [u, v]
|
||||
attribute vec2 textureCoordAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec2 textureCoord;
|
||||
varying vec3 fogDensity;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForDynamicLightNoBump(vec3 vertexCoord, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
|
||||
textureCoord = textureCoordAttribute.xy * texScale.xy;
|
||||
|
||||
vec4 viewPos = viewModelMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
// compute normal
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
|
||||
PrepareForDynamicLightNoBump((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
9
Resources/Shaders/OptimizedVoxelModelShadowMap.fs
Normal file
9
Resources/Shaders/OptimizedVoxelModelShadowMap.fs
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
void DoShadowMapRender();
|
||||
|
||||
void main() {
|
||||
DoShadowMapRender();
|
||||
}
|
||||
|
3
Resources/Shaders/OptimizedVoxelModelShadowMap.program
Normal file
3
Resources/Shaders/OptimizedVoxelModelShadowMap.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/OptimizedVoxelModelShadowMap.fs
|
||||
Shaders/OptimizedVoxelModelShadowMap.vs
|
||||
*shadowmap*
|
31
Resources/Shaders/OptimizedVoxelModelShadowMap.vs
Normal file
31
Resources/Shaders/OptimizedVoxelModelShadowMap.vs
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
|
||||
// [x, y, z, AO ID]
|
||||
attribute vec4 positionAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadowMapRender(vec3 position, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
|
||||
PrepareForShadowMapRender((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
61
Resources/Shaders/PostFilters/CameraBlur.fs
Normal file
61
Resources/Shaders/PostFilters/CameraBlur.fs
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D depthTexture;
|
||||
uniform float shutterTimeScale;
|
||||
|
||||
varying vec2 newCoord;
|
||||
varying vec3 oldCoord;
|
||||
|
||||
// linearize gamma
|
||||
vec3 filter(vec3 col){
|
||||
return col * col;
|
||||
}
|
||||
|
||||
vec4 getSample(vec2 coord){
|
||||
vec3 color = texture2D(texture, coord).xyz;
|
||||
color *= color; // linearize
|
||||
|
||||
float depth = texture2D(depthTexture, coord).x;
|
||||
float weight = depth*depth; // [0,0.1] is for view weapon
|
||||
weight = min(weight, 1.) + 0.0001;
|
||||
|
||||
return vec4(color * weight, weight);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 nextCoord = newCoord;
|
||||
vec2 prevCoord = oldCoord.xy / oldCoord.z;
|
||||
vec2 coord;
|
||||
|
||||
vec4 sum;
|
||||
|
||||
coord = mix(nextCoord, prevCoord, 0.);
|
||||
sum = getSample(coord);
|
||||
|
||||
// use latest sample's weight for camera blur strength
|
||||
float allWeight = sum.w;
|
||||
vec4 sum2;
|
||||
|
||||
sum /= sum.w;
|
||||
|
||||
coord = mix(nextCoord, prevCoord, shutterTimeScale * 0.2);
|
||||
sum2 = getSample(coord);
|
||||
|
||||
coord = mix(nextCoord, prevCoord, shutterTimeScale * 0.4);
|
||||
sum2 += getSample(coord);
|
||||
|
||||
coord = mix(nextCoord, prevCoord, shutterTimeScale * 0.6);
|
||||
sum2 += getSample(coord);
|
||||
|
||||
coord = mix(nextCoord, prevCoord, shutterTimeScale * 0.8);
|
||||
sum2 += getSample(coord);
|
||||
|
||||
sum += sum2 * allWeight;
|
||||
|
||||
gl_FragColor.xyz = sum.xyz / sum.w;
|
||||
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
gl_FragColor.w = 1.;
|
||||
}
|
||||
|
2
Resources/Shaders/PostFilters/CameraBlur.program
Normal file
2
Resources/Shaders/PostFilters/CameraBlur.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/PostFilters/CameraBlur.fs
|
||||
Shaders/PostFilters/CameraBlur.vs
|
25
Resources/Shaders/PostFilters/CameraBlur.vs
Normal file
25
Resources/Shaders/PostFilters/CameraBlur.vs
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
|
||||
uniform mat4 reverseMatrix;
|
||||
|
||||
varying vec2 newCoord;
|
||||
varying vec3 oldCoord;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
vec2 scrPos = pos * 2. - 1.;
|
||||
|
||||
gl_Position = vec4(scrPos, 0.5, 1.);
|
||||
|
||||
newCoord = pos;
|
||||
|
||||
vec2 cvtCoord = pos - .5;
|
||||
oldCoord = (reverseMatrix * vec4(cvtCoord, 0., 1.)).xyz;
|
||||
oldCoord.xy += vec2(oldCoord.z) * .5;
|
||||
}
|
||||
|
22
Resources/Shaders/PostFilters/GammaMix.fs
Normal file
22
Resources/Shaders/PostFilters/GammaMix.fs
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
uniform sampler2D texture1;
|
||||
uniform sampler2D texture2;
|
||||
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform vec3 mix1;
|
||||
uniform vec3 mix2;
|
||||
|
||||
void main() {
|
||||
vec3 color1, color2;
|
||||
color1 = texture2D(texture1, texCoord).xyz;
|
||||
color2 = texture2D(texture2, texCoord).xyz;
|
||||
|
||||
vec3 color = color1 * color1 * mix1;
|
||||
color += color2 * color2 * mix2;
|
||||
|
||||
color = sqrt(color);
|
||||
|
||||
gl_FragColor = vec4(color, 1.);
|
||||
}
|
||||
|
2
Resources/Shaders/PostFilters/GammaMix.program
Normal file
2
Resources/Shaders/PostFilters/GammaMix.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/PostFilters/GammaMix.fs
|
||||
Shaders/PostFilters/GammaMix.vs
|
17
Resources/Shaders/PostFilters/GammaMix.vs
Normal file
17
Resources/Shaders/PostFilters/GammaMix.vs
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
vec2 scrPos = pos * 2. - 1.;
|
||||
|
||||
gl_Position = vec4(scrPos, 0.5, 1.);
|
||||
|
||||
texCoord = pos;
|
||||
}
|
||||
|
25
Resources/Shaders/PostFilters/Gauss1D.fs
Normal file
25
Resources/Shaders/PostFilters/Gauss1D.fs
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec4 texCoord1;
|
||||
varying vec4 texCoord2;
|
||||
|
||||
void main() {
|
||||
// generated by ./1dgaussGen.rb
|
||||
// pixelShift is texture coord shift / texture pixel
|
||||
const float pixelShift = 1.;
|
||||
const float shift1 = pixelShift * -2.30654399138844;
|
||||
const float scale1 = 0.178704407070903;
|
||||
const float shift2 = pixelShift * -0.629455560633963;
|
||||
const float scale2 = 0.321295592929097;
|
||||
const float shift3 = pixelShift * 0.629455560633963;
|
||||
const float scale3 = 0.321295592929097;
|
||||
const float shift4 = pixelShift * 2.30654399138844;
|
||||
const float scale4 = 0.178704407070903;
|
||||
|
||||
gl_FragColor = texture2D(texture, texCoord1.xy) * scale1;
|
||||
gl_FragColor += texture2D(texture, texCoord1.zw) * scale2;
|
||||
gl_FragColor += texture2D(texture, texCoord2.xy) * scale3;
|
||||
gl_FragColor += texture2D(texture, texCoord2.zw) * scale4;
|
||||
}
|
||||
|
2
Resources/Shaders/PostFilters/Gauss1D.program
Normal file
2
Resources/Shaders/PostFilters/Gauss1D.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/PostFilters/Gauss1D.fs
|
||||
Shaders/PostFilters/Gauss1D.vs
|
35
Resources/Shaders/PostFilters/Gauss1D.vs
Normal file
35
Resources/Shaders/PostFilters/Gauss1D.vs
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
uniform vec2 unitShift;
|
||||
|
||||
varying vec4 texCoord1;
|
||||
varying vec4 texCoord2;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
vec2 scrPos = pos * 2. - 1.;
|
||||
|
||||
gl_Position = vec4(scrPos, 0.5, 1.);
|
||||
|
||||
// generated by ./1dgaussGen.rb
|
||||
// pixelShift is texture coord shift / texture pixel
|
||||
const float pixelShift = 1.;
|
||||
const float shift1 = pixelShift * -2.30654399138844;
|
||||
const float scale1 = 0.178704407070903;
|
||||
const float shift2 = pixelShift * -0.629455560633963;
|
||||
const float scale2 = 0.321295592929097;
|
||||
const float shift3 = pixelShift * 0.629455560633963;
|
||||
const float scale3 = 0.321295592929097;
|
||||
const float shift4 = pixelShift * 2.30654399138844;
|
||||
const float scale4 = 0.178704407070903;
|
||||
|
||||
texCoord1 = pos.xyxy + unitShift.xyxy * vec4(vec2(shift1), vec2(shift2));
|
||||
texCoord2 = pos.xyxy + unitShift.xyxy * vec4(vec2(shift3), vec2(shift4));
|
||||
|
||||
}
|
||||
|
67
Resources/Shaders/PostFilters/Lens.fs
Normal file
67
Resources/Shaders/PostFilters/Lens.fs
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec3 angleTan;
|
||||
varying vec4 texCoord1;
|
||||
varying vec4 texCoord2;
|
||||
varying vec4 texCoord3;
|
||||
varying vec2 texCoord4;
|
||||
|
||||
// linearize gamma
|
||||
vec3 filter(vec3 col){
|
||||
return col * col;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 sum = vec3(0.), val;
|
||||
|
||||
#if 0
|
||||
val = vec3(0.0, 0.2, 1.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord1.xy).xyz);
|
||||
gl_FragColor.xyz = val;
|
||||
|
||||
val = vec3(0.0, 0.5, 1.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord1.zw).xyz);
|
||||
gl_FragColor.xyz += val;
|
||||
|
||||
val = vec3(0.0, 1.0, 0.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord2.xy).xyz);
|
||||
gl_FragColor.xyz += val;
|
||||
|
||||
val = vec3(1.0, 0.5, 0.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord2.zw).xyz);
|
||||
gl_FragColor.xyz += val;
|
||||
|
||||
val = vec3(1.0, 0.4, 0.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord3.xy).xyz);
|
||||
gl_FragColor.xyz += val;
|
||||
|
||||
val = vec3(1.0, 0.3, 1.0);
|
||||
sum += val;
|
||||
val *= filter(texture2D(texture, texCoord3.zw).xyz);
|
||||
gl_FragColor.xyz += val;
|
||||
|
||||
gl_FragColor.xyz *= 1. / sum;
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
#else
|
||||
gl_FragColor = texture2D(texture, texCoord4);
|
||||
gl_FragColor.w = 1.;
|
||||
#endif
|
||||
|
||||
// calc brightness (cos^4)
|
||||
// note that this is gamma corrected
|
||||
float tanValue = length(angleTan.xy);
|
||||
float brightness = 1. / (1. + tanValue * tanValue);
|
||||
brightness *= angleTan.z;
|
||||
brightness = mix(brightness, 1., 0.4); // weaken
|
||||
|
||||
gl_FragColor.xyz *= brightness;
|
||||
|
||||
gl_FragColor.w = 1.;
|
||||
}
|
||||
|
2
Resources/Shaders/PostFilters/Lens.program
Normal file
2
Resources/Shaders/PostFilters/Lens.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/PostFilters/Lens.fs
|
||||
Shaders/PostFilters/Lens.vs
|
43
Resources/Shaders/PostFilters/Lens.vs
Normal file
43
Resources/Shaders/PostFilters/Lens.vs
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
uniform vec2 fov;
|
||||
|
||||
varying vec3 angleTan;
|
||||
varying vec4 texCoord1;
|
||||
varying vec4 texCoord2;
|
||||
varying vec4 texCoord3;
|
||||
varying vec2 texCoord4;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
vec2 scrPos = pos * 2. - 1.;
|
||||
|
||||
gl_Position = vec4(scrPos, 0.5, 1.);
|
||||
|
||||
// texture coords
|
||||
vec2 startCoord = pos;
|
||||
vec2 diff = vec2(.5) - startCoord;
|
||||
diff *= 0.008;
|
||||
|
||||
startCoord += diff * .7;
|
||||
diff = -diff;
|
||||
|
||||
texCoord1 = startCoord.xyxy + diff.xyxy * vec4(vec2(0.), vec2(.1));
|
||||
texCoord2 = startCoord.xyxy + diff.xyxy * vec4(vec2(0.2), vec2(.3));
|
||||
texCoord3 = startCoord.xyxy + diff.xyxy * vec4(vec2(0.4), vec2(.5));
|
||||
texCoord4 = pos.xy;
|
||||
|
||||
// view angle
|
||||
angleTan.xy = scrPos * fov;
|
||||
|
||||
// angleTan.z = brightness scale
|
||||
// = 1 / cos(fovDiag)
|
||||
angleTan.z = length(fov) * length(fov) + 1.;
|
||||
angleTan.z = mix(angleTan.z, 1., 1.); // weaken the brightness adjust
|
||||
}
|
||||
|
11
Resources/Shaders/PostFilters/PassThrough.fs
Normal file
11
Resources/Shaders/PostFilters/PassThrough.fs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(texture, texCoord);
|
||||
gl_FragColor *= color;
|
||||
}
|
||||
|
2
Resources/Shaders/PostFilters/PassThrough.program
Normal file
2
Resources/Shaders/PostFilters/PassThrough.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/PostFilters/PassThrough.fs
|
||||
Shaders/PostFilters/PassThrough.vs
|
22
Resources/Shaders/PostFilters/PassThrough.vs
Normal file
22
Resources/Shaders/PostFilters/PassThrough.vs
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
attribute vec2 positionAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
uniform vec4 texCoordRange;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 pos = positionAttribute;
|
||||
|
||||
vec2 scrPos = pos * 2. - 1.;
|
||||
|
||||
gl_Position = vec4(scrPos, 0.5, 1.);
|
||||
|
||||
color = colorAttribute;
|
||||
texCoord = pos * texCoordRange.zw + texCoordRange.xy;
|
||||
}
|
||||
|
18
Resources/Shaders/Shadow/Common.fs
Normal file
18
Resources/Shaders/Shadow/Common.fs
Normal file
@ -0,0 +1,18 @@
|
||||
// Common code for sunlight shadow rendering
|
||||
|
||||
float VisibilityOfSunLight_Map();
|
||||
float VisibilityOfSunLight_Model();
|
||||
vec3 Radiosity_Map(float detailAmbientOcclusion);
|
||||
|
||||
float VisibilityOfSunLight() {
|
||||
return VisibilityOfSunLight_Map() *
|
||||
VisibilityOfSunLight_Model();
|
||||
}
|
||||
|
||||
vec3 EvaluateSunLight(){
|
||||
return vec3(.6) * VisibilityOfSunLight();
|
||||
}
|
||||
|
||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion) {
|
||||
return Radiosity_Map(detailAmbientOcclusion);
|
||||
}
|
11
Resources/Shaders/Shadow/Common.vs
Normal file
11
Resources/Shaders/Shadow/Common.vs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
void PrepareForShadow_Map(vec3 vertexCoord, vec3 normal) ;
|
||||
void PrepareForShadow_Model(vec3 vertexCoord, vec3 normal);
|
||||
void PrepareForRadiosity_Map(vec3 vertexCoord, vec3 normal);
|
||||
|
||||
void PrepareForShadow(vec3 vertexCoord, vec3 normal) {
|
||||
PrepareForShadow_Map(vertexCoord, normal);
|
||||
PrepareForShadow_Model(vertexCoord, normal);
|
||||
PrepareForRadiosity_Map(vertexCoord, normal);
|
||||
}
|
12
Resources/Shaders/Shadow/Map.fs
Normal file
12
Resources/Shaders/Shadow/Map.fs
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
uniform sampler2D mapShadowTexture;
|
||||
|
||||
varying vec3 mapShadowCoord;
|
||||
|
||||
float VisibilityOfSunLight_Map() {
|
||||
float val = texture2D(mapShadowTexture, mapShadowCoord.xy).w;
|
||||
if(val < mapShadowCoord.z - 0.0001)
|
||||
return 0.;
|
||||
else
|
||||
return 1.;
|
||||
}
|
16
Resources/Shaders/Shadow/Map.vs
Normal file
16
Resources/Shaders/Shadow/Map.vs
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
|
||||
varying vec3 mapShadowCoord;
|
||||
|
||||
void PrepareForShadow_Map(vec3 vertexCoord, vec3 normal) {
|
||||
mapShadowCoord = vertexCoord;
|
||||
mapShadowCoord.y -= mapShadowCoord.z;
|
||||
|
||||
// texture value is normalized unsigned integer
|
||||
mapShadowCoord.z /= 255.;
|
||||
|
||||
// texture coord is normalized
|
||||
// FIXME: variable texture size
|
||||
mapShadowCoord.xy /= 512.;
|
||||
}
|
83
Resources/Shaders/Shadow/MapRadiosity.fs
Normal file
83
Resources/Shaders/Shadow/MapRadiosity.fs
Normal file
@ -0,0 +1,83 @@
|
||||
#if 0
|
||||
|
||||
uniform sampler3D ambientShadowTexture;
|
||||
varying vec3 radiosity;
|
||||
varying vec3 ambientShadowTextureCoord;
|
||||
varying vec3 ambientColor;
|
||||
|
||||
vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
||||
vec3 col = radiosity;
|
||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||
|
||||
// method1:
|
||||
amb = sqrt(amb * detailAmbientOcclusion);
|
||||
|
||||
// method2:
|
||||
//amb = mix(amb, detailAmbientOcclusion, 0.5);
|
||||
|
||||
// method3:
|
||||
//amb = min(amb, detailAmbientOcclusion);
|
||||
|
||||
col *= detailAmbientOcclusion;
|
||||
col += amb * ambientColor;
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/**** CPU RADIOSITY (FASTER?) *****/
|
||||
|
||||
uniform sampler3D ambientShadowTexture;
|
||||
uniform sampler3D radiosityTextureFlat;
|
||||
uniform sampler3D radiosityTextureX;
|
||||
uniform sampler3D radiosityTextureY;
|
||||
uniform sampler3D radiosityTextureZ;
|
||||
varying vec3 radiosityTextureCoord;
|
||||
varying vec3 ambientShadowTextureCoord;
|
||||
varying vec3 normalVarying;
|
||||
uniform vec3 ambientColor;
|
||||
|
||||
vec3 DecodeRadiosityValue(vec3 val){
|
||||
// reverse bias
|
||||
val *= 31. / 30.;
|
||||
val = (val * 2.) - 1.;
|
||||
val *= val * sign(val);
|
||||
return val;
|
||||
}
|
||||
|
||||
vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
||||
vec3 col = DecodeRadiosityValue
|
||||
(texture3D(radiosityTextureFlat,
|
||||
radiosityTextureCoord).xyz);
|
||||
vec3 normal = normalize(normalVarying);
|
||||
col += normal.x * DecodeRadiosityValue
|
||||
(texture3D(radiosityTextureX,
|
||||
radiosityTextureCoord).xyz);
|
||||
col += normal.y * DecodeRadiosityValue
|
||||
(texture3D(radiosityTextureY,
|
||||
radiosityTextureCoord).xyz);
|
||||
col += normal.z * DecodeRadiosityValue
|
||||
(texture3D(radiosityTextureZ,
|
||||
radiosityTextureCoord).xyz);
|
||||
col = max(col, 0.);
|
||||
|
||||
// ambient occlusion
|
||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||
amb = max(amb, 0.); // by some reason, texture value becomes negative
|
||||
|
||||
// method1:
|
||||
amb = sqrt(amb * detailAmbientOcclusion);
|
||||
// method2:
|
||||
//amb = mix(amb, detailAmbientOcclusion, 0.5);
|
||||
|
||||
// method3:
|
||||
//amb = min(amb, detailAmbientOcclusion);
|
||||
|
||||
col *= detailAmbientOcclusion;
|
||||
col += amb * ambientColor;
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
#endif
|
161
Resources/Shaders/Shadow/MapRadiosity.vs
Normal file
161
Resources/Shaders/Shadow/MapRadiosity.vs
Normal file
@ -0,0 +1,161 @@
|
||||
#if 0
|
||||
|
||||
/**** REAL-TIME RADIOSITY (SLOW) *****/
|
||||
|
||||
uniform sampler2D mapShadowTexture;
|
||||
uniform vec3 eyeOrigin;
|
||||
uniform vec3 eyeFront;
|
||||
uniform vec3 fogColor;
|
||||
|
||||
varying vec3 radiosity;
|
||||
varying vec3 ambientShadowTextureCoord;
|
||||
varying vec3 ambientColor;
|
||||
|
||||
vec3 MapRadiosity_Sample(vec2 mapShadowCoord,
|
||||
vec3 vertexCoord, vec3 normal) {
|
||||
vec4 val = texture2D(mapShadowTexture, mapShadowCoord.xy);
|
||||
|
||||
// extract value
|
||||
vec3 color = val.xyz * 2.;
|
||||
vec3 bits = floor(color); // highest bit
|
||||
color = fract(color); // RGB7, actually [0,254/255]
|
||||
|
||||
// to linear
|
||||
color *= 2.;
|
||||
color *= color;
|
||||
|
||||
float depth = val.w * 255.;
|
||||
|
||||
// compute world position
|
||||
vec3 wp = mapShadowCoord.xyy * vec3(512., 512., 0.);
|
||||
vec3 wn;
|
||||
//wp.xy = floor(wp.xy) + .5;
|
||||
if(bits.x < .5) {
|
||||
// z-plane
|
||||
wp.yz += depth;
|
||||
wn = vec3(0., 0., -1.);
|
||||
}else {
|
||||
// negative y-plane
|
||||
wp.yz += depth - fract(wp.y); // FIXME: maybe wrong (not checked)
|
||||
wn = vec3(0., -1., 0.);
|
||||
}
|
||||
|
||||
float distance2 = dot(vertexCoord - wp, vertexCoord - wp);
|
||||
vec3 ret = color;
|
||||
|
||||
if(dot(normal, wn) > .99){
|
||||
// same plane
|
||||
return vec3(0.);
|
||||
}
|
||||
|
||||
if(distance2 > .0001) {
|
||||
ret *= max(dot(wp - vertexCoord, normal) + .3, 0.);
|
||||
ret *= max(dot(vertexCoord - wp, wn) + .3, 0.);
|
||||
ret /= distance2 + 0.1;
|
||||
ret /= distance2 + 1.;
|
||||
}else{
|
||||
// same position (corner?)
|
||||
ret *= 0.8;
|
||||
return vec3(0.);
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void PrepareForRadiosity_Map(vec3 vertexCoord, vec3 normal) {
|
||||
// copied from Map.fs
|
||||
|
||||
vec3 mapShadowCoord = vertexCoord;
|
||||
mapShadowCoord.y -= mapShadowCoord.z;
|
||||
|
||||
// texture value is normalized unsigned integer
|
||||
mapShadowCoord.z /= 255.;
|
||||
|
||||
// texture coord is normalized
|
||||
// FIXME: variable texture size
|
||||
mapShadowCoord.xy /= 512.;
|
||||
|
||||
vec3 samp = vec3(0.);//MapRadiosity_Sample(mapShadowCoord.xy,
|
||||
//vertexCoord, normal);
|
||||
|
||||
#define SAMPLE(x, y) \
|
||||
samp += MapRadiosity_Sample(mapShadowCoord.xy + vec2(x,y) / 512. * 0.9, \
|
||||
vertexCoord, normal)
|
||||
|
||||
float detail = 2. - length(vertexCoord - eyeOrigin) * .2;
|
||||
detail = clamp(detail, 0., 1.);
|
||||
|
||||
if(dot(vertexCoord - eyeOrigin, eyeFront) < -2.){
|
||||
detail = 0.;
|
||||
}
|
||||
|
||||
if(detail > 0.){
|
||||
SAMPLE(-4., -4.);
|
||||
SAMPLE(-1., -2.);
|
||||
SAMPLE(0., -2.);
|
||||
SAMPLE(1., -2.);
|
||||
SAMPLE(4., -4.);
|
||||
|
||||
SAMPLE(-2., -1.);
|
||||
SAMPLE(2., -1.);
|
||||
SAMPLE(-2., 0.);
|
||||
SAMPLE(2., 0.);
|
||||
SAMPLE(-2., 1.);
|
||||
SAMPLE(2., 1.);
|
||||
|
||||
SAMPLE(-4., 4.);
|
||||
SAMPLE(-1., 2.);
|
||||
SAMPLE(0., 2.);
|
||||
SAMPLE(1., 2.);
|
||||
SAMPLE(4., 4.);
|
||||
|
||||
samp = mix(vec3(0.15), samp * 2., detail);
|
||||
}else{
|
||||
samp = vec3(0.15);
|
||||
}
|
||||
|
||||
detail = 5. - length(vertexCoord - eyeOrigin) * .2;
|
||||
detail = clamp(detail, 0., 1.);
|
||||
|
||||
if(detail > 0.){
|
||||
SAMPLE(-1., -1.);
|
||||
SAMPLE(1., -1.);
|
||||
SAMPLE(-1., 1.);
|
||||
SAMPLE(1., 1.);
|
||||
|
||||
samp = mix(vec3(0.4), samp, detail);
|
||||
}else{
|
||||
samp = vec3(0.4);
|
||||
}
|
||||
|
||||
SAMPLE(0., -1.);
|
||||
SAMPLE(-1., 0.);
|
||||
SAMPLE(0., 0.);
|
||||
SAMPLE(1., 0.);
|
||||
SAMPLE(0., 1.);
|
||||
|
||||
// TODO: variable map size?
|
||||
ambientShadowTextureCoord = (vertexCoord + vec3(0.5, 0.5, 1.5)) / vec3(512., 512., 65.);
|
||||
ambientColor = mix(fogColor, vec3(1.), 0.2) * 0.5;
|
||||
|
||||
radiosity = samp * 0.28 + 0.13 * ambientColor;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/**** CPU RADIOSITY (FASTER?) *****/
|
||||
|
||||
varying vec3 radiosityTextureCoord;
|
||||
varying vec3 ambientShadowTextureCoord;
|
||||
varying vec3 normalVarying;
|
||||
|
||||
void PrepareForRadiosity_Map(vec3 vertexCoord, vec3 normal) {
|
||||
|
||||
radiosityTextureCoord = (vertexCoord + vec3(0., 0., 0.)) / vec3(512., 512., 64.);
|
||||
ambientShadowTextureCoord = (vertexCoord + vec3(0.5, 0.5, 1.5)) / vec3(512., 512., 65.);
|
||||
|
||||
normalVarying = normal;
|
||||
}
|
||||
|
||||
#endif
|
7
Resources/Shaders/Shadow/MapRadiosityNull.fs
Normal file
7
Resources/Shaders/Shadow/MapRadiosityNull.fs
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
uniform vec3 fogColor;
|
||||
|
||||
vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
||||
return mix(fogColor, vec3(1.), 0.5) * 0.5 * detailAmbientOcclusion;
|
||||
}
|
4
Resources/Shaders/Shadow/MapRadiosityNull.vs
Normal file
4
Resources/Shaders/Shadow/MapRadiosityNull.vs
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
void PrepareForRadiosity_Map(vec3 vertexCoord, vec3 normal) {
|
||||
|
||||
}
|
68
Resources/Shaders/Shadow/MapSoft.fs
Normal file
68
Resources/Shaders/Shadow/MapSoft.fs
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
/*
|
||||
* Percentage-Closer Soft Shadow Based
|
||||
* Soft Shadowed Map Shadow Generator
|
||||
*/
|
||||
|
||||
uniform sampler2D mapShadowTexture;
|
||||
|
||||
varying vec3 mapShadowCoord;
|
||||
|
||||
vec2 MapSoft_BlockSample(vec2 sample, float depth) {
|
||||
const float factor = 1. / 512.;
|
||||
float val = texture2D(mapShadowTexture, sample.xy * factor).w;
|
||||
float distance = depth - val;
|
||||
float weight = step(0., distance);
|
||||
weight = clamp(distance*100000., 0., 1.);
|
||||
return vec2(distance, 1.) * weight;
|
||||
}
|
||||
|
||||
float VisibilityOfSunLight_Map() {
|
||||
float depth = mapShadowCoord.z;
|
||||
vec2 iPos = (floor(mapShadowCoord.xy));
|
||||
vec2 fracPos = mapShadowCoord.xy - iPos.xy; // [0, 1]
|
||||
vec2 fracPosHS = fracPos - .5; // [-0.5, 0.5]
|
||||
vec2 fracPosHSAbs = abs(fracPosHS);
|
||||
|
||||
// samples from iPos + sampShift.xy * vec2({0|1},{0|1})
|
||||
vec2 sampShift = sign(fracPos - vec2(0.5));
|
||||
|
||||
// avoid precision error
|
||||
vec2 iPosShifted = iPos + vec2(0.1);
|
||||
|
||||
// blocker distance estimation
|
||||
vec4 distSampPos = vec4(iPosShifted, iPosShifted + sampShift);
|
||||
vec2 samp1 = MapSoft_BlockSample(distSampPos.xy, depth);
|
||||
vec2 samp2 = MapSoft_BlockSample(distSampPos.zy, depth);
|
||||
vec2 samp3 = MapSoft_BlockSample(distSampPos.xw, depth);
|
||||
vec2 samp4 = MapSoft_BlockSample(distSampPos.zw, depth);
|
||||
vec2 distWeighted1 = samp1;
|
||||
distWeighted1 = mix(distWeighted1,
|
||||
samp2,
|
||||
fracPosHSAbs.x);
|
||||
|
||||
vec2 distWeighted2 = samp3;
|
||||
distWeighted2 = mix(distWeighted2,
|
||||
samp4,
|
||||
fracPosHSAbs.x);
|
||||
|
||||
vec2 distWeighted3 = mix(distWeighted1, distWeighted2,
|
||||
fracPosHSAbs.y);
|
||||
|
||||
distWeighted3.x /= distWeighted3.y + 1.e-10;
|
||||
|
||||
float distance = distWeighted3.x;
|
||||
|
||||
// blurred shadow sampling
|
||||
float blur = distance * 4.;
|
||||
blur = max(blur, 1.e-10); // avoid zero division
|
||||
|
||||
vec2 blurWeight = 0.5 - (0.5 - fracPosHSAbs) / blur;
|
||||
blurWeight = max(blurWeight, 0.);
|
||||
|
||||
float val1 = mix(samp1.y, samp2.y, blurWeight.x);
|
||||
float val2 = mix(samp3.y, samp4.y, blurWeight.x);
|
||||
float val = 1. - mix(val1, val2, blurWeight.y);
|
||||
|
||||
return val;
|
||||
}
|
14
Resources/Shaders/Shadow/MapSoft.vs
Normal file
14
Resources/Shaders/Shadow/MapSoft.vs
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
|
||||
varying vec3 mapShadowCoord;
|
||||
|
||||
void PrepareForShadow_Map(vec3 vertexCoord, vec3 normal) {
|
||||
mapShadowCoord = vertexCoord;
|
||||
mapShadowCoord.y -= mapShadowCoord.z;
|
||||
|
||||
// texture value is normalized unsigned integer
|
||||
mapShadowCoord.z /= 255.;
|
||||
|
||||
// don't normalize texture coord here
|
||||
}
|
49
Resources/Shaders/Shadow/Model.fs
Normal file
49
Resources/Shaders/Shadow/Model.fs
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
uniform sampler2DShadow shadowMapTexture1;
|
||||
uniform sampler2DShadow shadowMapTexture2;
|
||||
uniform sampler2DShadow shadowMapTexture3;
|
||||
|
||||
varying vec4 shadowMapCoord1;
|
||||
varying vec4 shadowMapCoord2;
|
||||
varying vec4 shadowMapCoord3;
|
||||
|
||||
varying vec4 shadowMapViewPos;
|
||||
|
||||
bool DepthValidateRange(vec4 coord){
|
||||
return all(lessThanEqual(abs(coord.xy-vec2(0.5)), vec2(0.5)));
|
||||
}
|
||||
|
||||
float VisibilityOfSunLight_Model() {
|
||||
|
||||
if(/*DepthValidateRange(shadowMapCoord1)*/ shadowMapViewPos.z > -12.){
|
||||
vec4 scoord = shadowMapCoord1.xyzw;
|
||||
float v = shadow2D(shadowMapTexture1, scoord.xyz).x;
|
||||
return v;
|
||||
}else if(/*DepthValidateRange(shadowMapCoord2)*/ shadowMapViewPos.z > -40.){
|
||||
vec4 scoord = shadowMapCoord2.xyzw;
|
||||
float v = shadow2D(shadowMapTexture2, scoord.xyz).x;
|
||||
return v;
|
||||
}else {
|
||||
vec4 scoord = shadowMapCoord3.xyzw;
|
||||
float v = shadow2D(shadowMapTexture3, scoord.xyz).x;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void VisibilityOfSunLight_Model_Debug() {
|
||||
|
||||
if(DepthValidateRange(shadowMapCoord1)){
|
||||
vec4 scoord = shadowMapCoord1.xyzw;
|
||||
float v = shadow2D(shadowMapTexture1, scoord.xyz).x;
|
||||
gl_FragColor = vec4(v, 0., 0., 1.);
|
||||
}else if(DepthValidateRange(shadowMapCoord2)){
|
||||
vec4 scoord = shadowMapCoord2.xyzw;
|
||||
float v = shadow2D(shadowMapTexture2, scoord.xyz).x;
|
||||
gl_FragColor = vec4(0., v, 0., 1.);
|
||||
}else {
|
||||
vec4 scoord = shadowMapCoord3.xyzw;
|
||||
float v = shadow2D(shadowMapTexture3, scoord.xyz).x;
|
||||
gl_FragColor = vec4(0., 0., v, 1.);
|
||||
}
|
||||
}
|
35
Resources/Shaders/Shadow/Model.vs
Normal file
35
Resources/Shaders/Shadow/Model.vs
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
uniform mat4 shadowMapMatrix1;
|
||||
uniform mat4 shadowMapMatrix2;
|
||||
uniform mat4 shadowMapMatrix3;
|
||||
uniform mat4 shadowMapViewMatrix;
|
||||
|
||||
varying vec4 shadowMapCoord1;
|
||||
varying vec4 shadowMapCoord2;
|
||||
varying vec4 shadowMapCoord3;
|
||||
varying vec4 shadowMapViewPos;
|
||||
|
||||
void TransformShadowMatrix(out vec4 shadowMapCoord,
|
||||
in vec3 vertexCoord,
|
||||
in mat4 matrix) {
|
||||
vec4 c;
|
||||
c = matrix * vec4(vertexCoord, 1.);
|
||||
c.xyz = (c.xyz * 0.5) + c.w * 0.5;
|
||||
// bias
|
||||
c.z -= c.w * 0.0003;
|
||||
shadowMapCoord = c;
|
||||
}
|
||||
|
||||
void PrepareForShadow_Model(vec3 vertexCoord, vec3 normal) {
|
||||
shadowMapViewPos = shadowMapViewMatrix * vec4(vertexCoord, 1.);
|
||||
TransformShadowMatrix(shadowMapCoord1,
|
||||
vertexCoord,
|
||||
shadowMapMatrix1);
|
||||
TransformShadowMatrix(shadowMapCoord2,
|
||||
vertexCoord,
|
||||
shadowMapMatrix2);
|
||||
TransformShadowMatrix(shadowMapCoord3,
|
||||
vertexCoord,
|
||||
shadowMapMatrix3);
|
||||
|
||||
}
|
4
Resources/Shaders/Shadow/ModelNull.fs
Normal file
4
Resources/Shaders/Shadow/ModelNull.fs
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
float VisibilityOfSunLight_Model() {
|
||||
return 1.;
|
||||
}
|
5
Resources/Shaders/Shadow/ModelNull.vs
Normal file
5
Resources/Shaders/Shadow/ModelNull.vs
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
void PrepareForShadow_Model(vec3 vertexCoord, vec3 normal) {
|
||||
|
||||
}
|
BIN
Resources/Shaders/ShadowMap/.DS_Store
vendored
Normal file
BIN
Resources/Shaders/ShadowMap/.DS_Store
vendored
Normal file
Binary file not shown.
5
Resources/Shaders/ShadowMap/Basic.fs
Normal file
5
Resources/Shaders/ShadowMap/Basic.fs
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
void DoShadowMapRender() {
|
||||
// depth is all we nneed
|
||||
gl_FragColor = vec4(1.);
|
||||
}
|
7
Resources/Shaders/ShadowMap/Basic.vs
Normal file
7
Resources/Shaders/ShadowMap/Basic.vs
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
|
||||
void PrepareForShadowMapRender(vec3 position, vec3 normal) {
|
||||
gl_Position = projectionViewMatrix * vec4(position, 1.);
|
||||
}
|
||||
|
5
Resources/Shaders/ShadowMap/Common.fs
Normal file
5
Resources/Shaders/ShadowMap/Common.fs
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
// empty!
|
||||
void DummyCommonFS(){
|
||||
|
||||
}
|
5
Resources/Shaders/ShadowMap/Common.vs
Normal file
5
Resources/Shaders/ShadowMap/Common.vs
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
//empty!
|
||||
void DummyCommonVS(){
|
||||
|
||||
}
|
47
Resources/Shaders/SoftSprite.fs
Normal file
47
Resources/Shaders/SoftSprite.fs
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
uniform sampler2D depthTexture;
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform vec3 fogColor;
|
||||
uniform vec2 zNearFar;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texCoord;
|
||||
varying vec4 fogDensity;
|
||||
varying vec4 depthRange;
|
||||
|
||||
float decodeDepth(float w, float near, float far){
|
||||
return far * near / mix(far, near, w);
|
||||
}
|
||||
|
||||
float depthAt(vec2 pt){
|
||||
float w = texture2D(depthTexture, pt).x;
|
||||
return decodeDepth(w, zNearFar.x, zNearFar.y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
// get depth
|
||||
float depth = depthAt(texCoord.zw);
|
||||
|
||||
if(depth < depthRange.x){
|
||||
discard;
|
||||
}
|
||||
|
||||
gl_FragColor = texture2D(texture, texCoord.xy);
|
||||
gl_FragColor.xyz *= gl_FragColor.w; // premultiplied alpha
|
||||
gl_FragColor *= color;
|
||||
|
||||
vec4 fogColorPremuld = vec4(fogColor, 1.);
|
||||
fogColorPremuld *= gl_FragColor.w;
|
||||
gl_FragColor = mix(gl_FragColor, fogColorPremuld, fogDensity);
|
||||
|
||||
|
||||
float soft = (depth - depthRange.x) / (depthRange.y - depthRange.w);
|
||||
soft = clamp(soft, 0., 1.);
|
||||
gl_FragColor *= soft;
|
||||
|
||||
if(dot(gl_FragColor, vec4(1.)) < .002)
|
||||
discard;
|
||||
}
|
||||
|
2
Resources/Shaders/SoftSprite.program
Normal file
2
Resources/Shaders/SoftSprite.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/SoftSprite.fs
|
||||
Shaders/SoftSprite.vs
|
74
Resources/Shaders/SoftSprite.vs
Normal file
74
Resources/Shaders/SoftSprite.vs
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform vec3 rightVector;
|
||||
uniform vec3 upVector;
|
||||
uniform vec3 frontVector;
|
||||
uniform vec3 viewOriginVector;
|
||||
|
||||
uniform float fogDistance;
|
||||
|
||||
attribute vec4 positionAttribute;
|
||||
attribute vec3 spritePosAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec4 texCoord;
|
||||
varying vec4 fogDensity;
|
||||
varying vec4 depthRange;
|
||||
|
||||
void main() {
|
||||
vec3 center = positionAttribute.xyz;
|
||||
|
||||
vec3 pos = center;
|
||||
float radius = positionAttribute.w;
|
||||
|
||||
vec3 right = rightVector * radius;
|
||||
vec3 up = upVector * radius;
|
||||
|
||||
float angle = spritePosAttribute.z;
|
||||
float c = cos(angle), s = sin(angle);
|
||||
vec2 sprP;
|
||||
sprP.x = dot(spritePosAttribute.xy, vec2(c, -s));
|
||||
sprP.y = dot(spritePosAttribute.xy, vec2(s, c));
|
||||
sprP *= radius;
|
||||
pos += right * sprP.x;
|
||||
pos += up * sprP.y;
|
||||
|
||||
// move sprite to the front of the volume
|
||||
float centerDepth = dot(center - viewOriginVector, frontVector);
|
||||
depthRange.xy = vec2(centerDepth) + vec2(-1., 1.) * radius;
|
||||
depthRange.z = radius * 2.;
|
||||
|
||||
// clip the volume by the near clip plane
|
||||
float frontDepth = depthRange.x;
|
||||
frontDepth = max(frontDepth, .3);
|
||||
/*if(frontDepth > depthRange.y) // go beyond near clip plane
|
||||
discard;*/ // cannot discard in vertex shader...
|
||||
frontDepth = min(frontDepth, depthRange.y);
|
||||
depthRange.w = frontDepth;
|
||||
|
||||
pos += frontVector * (frontDepth - centerDepth);
|
||||
|
||||
gl_Position = projectionViewMatrix * vec4(pos, 1.);
|
||||
|
||||
|
||||
color = colorAttribute;
|
||||
|
||||
// sprite texture coord
|
||||
texCoord.xy = spritePosAttribute.xy * .5 + .5;
|
||||
|
||||
// depth texture coord
|
||||
texCoord.zw = vec2(.5) + (gl_Position.xy / gl_Position.w) * .5;
|
||||
|
||||
// fog.
|
||||
// cannot gamma correct because sprite may be
|
||||
// alpha-blended.
|
||||
vec4 viewPos = viewMatrix * vec4(pos,1.);
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec4(distance);
|
||||
fogDensity = pow(fogDensity, vec4(1., .9, .7, 1.));
|
||||
fogDensity *= fogDensity; // FIXME
|
||||
}
|
||||
|
22
Resources/Shaders/Sprite.fs
Normal file
22
Resources/Shaders/Sprite.fs
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform vec3 fogColor;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
varying vec4 fogDensity;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(texture, texCoord);
|
||||
gl_FragColor.xyz *= gl_FragColor.w; // premultiplied alpha
|
||||
gl_FragColor *= color;
|
||||
|
||||
vec4 fogColorPremuld = vec4(fogColor, 1.);
|
||||
fogColorPremuld *= gl_FragColor.w;
|
||||
gl_FragColor = mix(gl_FragColor, fogColorPremuld, fogDensity);
|
||||
|
||||
if(dot(gl_FragColor, vec4(1.)) < .002)
|
||||
discard;
|
||||
}
|
||||
|
2
Resources/Shaders/Sprite.program
Normal file
2
Resources/Shaders/Sprite.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/Sprite.fs
|
||||
Shaders/Sprite.vs
|
49
Resources/Shaders/Sprite.vs
Normal file
49
Resources/Shaders/Sprite.vs
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
uniform mat4 projectionViewMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform vec3 rightVector;
|
||||
uniform vec3 upVector;
|
||||
|
||||
uniform float fogDistance;
|
||||
|
||||
attribute vec4 positionAttribute;
|
||||
attribute vec3 spritePosAttribute;
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
varying vec4 fogDensity;
|
||||
|
||||
void main() {
|
||||
vec3 pos = positionAttribute.xyz;
|
||||
float radius = positionAttribute.w;
|
||||
|
||||
vec3 right = rightVector * radius;
|
||||
vec3 up = upVector * radius;
|
||||
|
||||
float angle = spritePosAttribute.z;
|
||||
float c = cos(angle), s = sin(angle);
|
||||
vec2 sprP;
|
||||
sprP.x = dot(spritePosAttribute.xy, vec2(c, -s));
|
||||
sprP.y = dot(spritePosAttribute.xy, vec2(s, c));
|
||||
sprP *= radius;
|
||||
pos += right * sprP.x;
|
||||
pos += up * sprP.y;
|
||||
|
||||
gl_Position = projectionViewMatrix * vec4(pos,1.);
|
||||
|
||||
color = colorAttribute;
|
||||
|
||||
texCoord = spritePosAttribute.xy * .5 + .5;
|
||||
|
||||
// fog.
|
||||
// cannot gamma correct because sprite may be
|
||||
// alpha-blended.
|
||||
vec4 viewPos = viewMatrix * vec4(pos,1.);
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec4(distance);
|
||||
fogDensity = pow(fogDensity, vec4(1., .9, .7, 1.));
|
||||
fogDensity *= fogDensity; // FIXME
|
||||
}
|
||||
|
36
Resources/Shaders/VoxelModel.fs
Normal file
36
Resources/Shaders/VoxelModel.fs
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 ambientOcclusionCoord;
|
||||
//varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
|
||||
uniform sampler2D ambientOcclusionTexture;
|
||||
uniform sampler2D detailTexture;
|
||||
uniform vec3 fogColor;
|
||||
|
||||
vec3 EvaluateSunLight();
|
||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion);
|
||||
|
||||
void main() {
|
||||
// color is linearized
|
||||
gl_FragColor = color;
|
||||
gl_FragColor.w = 1.;
|
||||
|
||||
vec3 shading = vec3(color.w);
|
||||
|
||||
// FIXME: prepare for shadow?
|
||||
shading *= EvaluateSunLight();
|
||||
|
||||
vec3 ao = texture2D(ambientOcclusionTexture, ambientOcclusionCoord).xyz;
|
||||
shading += EvaluateAmbientLight(ao.x);
|
||||
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
//gl_FragColor.xyz *= texture2D(detailTexture, detailCoord).xyz * 2.;
|
||||
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, fogColor, fogDensity);
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
}
|
||||
|
3
Resources/Shaders/VoxelModel.program
Normal file
3
Resources/Shaders/VoxelModel.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/VoxelModel.fs
|
||||
Shaders/VoxelModel.vs
|
||||
*shadow*
|
76
Resources/Shaders/VoxelModel.vs
Normal file
76
Resources/Shaders/VoxelModel.vs
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform mat4 viewModelMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
uniform float fogDistance;
|
||||
uniform vec3 sunLightDirection;
|
||||
uniform vec3 customColor;
|
||||
|
||||
// [x, y, z, AO ID]
|
||||
attribute vec4 positionAttribute;
|
||||
|
||||
// [u, v]
|
||||
attribute vec2 textureCoordAttribute;
|
||||
|
||||
// [R, G, B, diffuse]
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec2 ambientOcclusionCoord;
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadow(vec3 worldOrigin, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
|
||||
color = colorAttribute;
|
||||
|
||||
if(dot(color.xyz, vec3(1.)) < 0.0001){
|
||||
color.xyz = customColor;
|
||||
}
|
||||
|
||||
// linearize
|
||||
color.xyz *= color.xyz;
|
||||
|
||||
// direct sunlight
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
float sunlight = dot(normal, sunLightDirection);
|
||||
sunlight = max(sunlight, 0.);
|
||||
color.w *= sunlight;
|
||||
|
||||
// ambient occlusion
|
||||
float aoID = positionAttribute.w / 256.;
|
||||
|
||||
float aoY = aoID * 16.;
|
||||
float aoX = fract(aoY);
|
||||
aoY = floor(aoY) / 16.;
|
||||
|
||||
ambientOcclusionCoord = vec2(aoX, aoY);
|
||||
ambientOcclusionCoord += textureCoordAttribute.xy * (15. / 256.);
|
||||
ambientOcclusionCoord += .5 / 256.;
|
||||
|
||||
vec4 viewPos = viewModelMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
PrepareForShadow((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
26
Resources/Shaders/VoxelModelDynamicLit.fs
Normal file
26
Resources/Shaders/VoxelModelDynamicLit.fs
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
varying vec4 color;
|
||||
//varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
|
||||
//uniform sampler2D detailTexture;
|
||||
|
||||
vec3 EvaluateDynamicLightNoBump();
|
||||
|
||||
void main() {
|
||||
// color is normalized
|
||||
gl_FragColor = color;
|
||||
gl_FragColor.w = 1.;
|
||||
|
||||
vec3 shading = EvaluateDynamicLightNoBump();
|
||||
|
||||
gl_FragColor.xyz *= shading;
|
||||
|
||||
//gl_FragColor.xyz *= texture2D(detailTexture, detailCoord).xyz * 2.;
|
||||
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, vec3(0.), fogDensity);
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
}
|
||||
|
3
Resources/Shaders/VoxelModelDynamicLit.program
Normal file
3
Resources/Shaders/VoxelModelDynamicLit.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/VoxelModelDynamicLit.fs
|
||||
Shaders/VoxelModelDynamicLit.vs
|
||||
*dlight*
|
58
Resources/Shaders/VoxelModelDynamicLit.vs
Normal file
58
Resources/Shaders/VoxelModelDynamicLit.vs
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform mat4 viewModelMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
uniform float fogDistance;
|
||||
uniform vec3 sunLightDirection;
|
||||
uniform vec3 customColor;
|
||||
|
||||
// [x, y, z, AO ID]
|
||||
attribute vec4 positionAttribute;
|
||||
|
||||
// [R, G, B, diffuse]
|
||||
attribute vec4 colorAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForDynamicLightNoBump(vec3 vertexCoord, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
|
||||
color = colorAttribute;
|
||||
|
||||
if(dot(color.xyz, vec3(1.)) < 0.0001){
|
||||
color.xyz = customColor;
|
||||
}
|
||||
|
||||
// linearize
|
||||
color.xyz *= color.xyz;
|
||||
|
||||
// calculate normal
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
|
||||
vec4 viewPos = viewModelMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
PrepareForDynamicLightNoBump((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
9
Resources/Shaders/VoxelModelShadowMap.fs
Normal file
9
Resources/Shaders/VoxelModelShadowMap.fs
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
void DoShadowMapRender();
|
||||
|
||||
void main() {
|
||||
DoShadowMapRender();
|
||||
}
|
||||
|
3
Resources/Shaders/VoxelModelShadowMap.program
Normal file
3
Resources/Shaders/VoxelModelShadowMap.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/VoxelModelShadowMap.fs
|
||||
Shaders/VoxelModelShadowMap.vs
|
||||
*shadowmap*
|
32
Resources/Shaders/VoxelModelShadowMap.vs
Normal file
32
Resources/Shaders/VoxelModelShadowMap.vs
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 modelNormalMatrix;
|
||||
uniform vec3 modelOrigin;
|
||||
|
||||
// [x, y, z, AO ID]
|
||||
attribute vec4 positionAttribute;
|
||||
|
||||
// [x, y, z]
|
||||
attribute vec3 normalAttribute;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec3 fogDensity;
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadowMapRender(vec3 position, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xyz, 1.);
|
||||
|
||||
vertexPos.xyz += modelOrigin;
|
||||
|
||||
// direct sunlight
|
||||
vec3 normal = normalAttribute;
|
||||
normal = (modelNormalMatrix * vec4(normal, 1.)).xyz;
|
||||
normal = normalize(normal);
|
||||
|
||||
PrepareForShadowMapRender((modelMatrix * vertexPos).xyz, normal);
|
||||
}
|
||||
|
171
Resources/Shaders/Water.fs
Normal file
171
Resources/Shaders/Water.fs
Normal file
@ -0,0 +1,171 @@
|
||||
|
||||
|
||||
//varying vec2 detailCoord;
|
||||
varying vec3 fogDensity;
|
||||
varying vec3 screenPosition;
|
||||
varying vec3 viewPosition;
|
||||
varying vec2 worldPosition;
|
||||
varying vec3 worldPositionFromOrigin;
|
||||
|
||||
varying vec4 waveCoord;
|
||||
varying vec2 waveCoord2;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform sampler2D depthTexture;
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D waveTexture;
|
||||
uniform vec3 fogColor;
|
||||
uniform vec2 zNearFar;
|
||||
uniform vec4 fovTan;
|
||||
uniform vec4 waterPlane;
|
||||
|
||||
uniform vec2 displaceScale;
|
||||
|
||||
vec3 EvaluateSunLight();
|
||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion);
|
||||
|
||||
float decodeDepth(float w, float near, float far){
|
||||
return far * near / mix(far, near, w);
|
||||
}
|
||||
|
||||
float depthAt(vec2 pt){
|
||||
float w = texture2D(depthTexture, pt).x;
|
||||
return decodeDepth(w, zNearFar.x, zNearFar.y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
// evaluate waveform
|
||||
vec4 wave = texture2D(waveTexture, waveCoord.xy).xyzw;
|
||||
wave = mix(vec4(-1.), vec4(1.), wave);
|
||||
wave.z = sqrt(1. - dot(wave.xy, wave.xy));
|
||||
|
||||
// detail (Far Cry seems to use this technique)
|
||||
vec4 wave2 = texture2D(waveTexture, waveCoord.zw).xyzw;
|
||||
wave2 = mix(vec4(-1.), vec4(1.), wave2);
|
||||
wave2.z = sqrt(1. - dot(wave2.xy, wave2.xy));
|
||||
wave += wave2;
|
||||
|
||||
// rough
|
||||
wave2 = texture2D(waveTexture, waveCoord2.xy).xyzw;
|
||||
wave2 = mix(vec4(-1.), vec4(1.), wave2);
|
||||
wave2.z = sqrt(1. - dot(wave2.xy, wave2.xy));
|
||||
wave += wave2;
|
||||
|
||||
wave.xyz = normalize(wave.xyz);
|
||||
|
||||
vec2 origScrPos = screenPosition.xy / screenPosition.z;
|
||||
vec2 scrPos = origScrPos;
|
||||
|
||||
// TODO: do displacement
|
||||
vec2 xToUV = dFdx(worldPosition);
|
||||
vec2 yToUV = dFdy(worldPosition);
|
||||
float scale = 1. / dot(xToUV.xy, yToUV.yx * vec2(1., -1.));
|
||||
vec2 disp = vec2(dot(xToUV, wave.xy * vec2(1., -1.)),
|
||||
dot(yToUV, wave.xy * vec2(-1., 1.)));
|
||||
scrPos += disp * scale * displaceScale ;
|
||||
|
||||
// check envelope length.
|
||||
// if the displaced location points the out of the water,
|
||||
// reset to the original pos.
|
||||
float depth = depthAt(scrPos);
|
||||
|
||||
// convert to view coord
|
||||
vec3 sampledViewCoord = vec3(mix(fovTan.zw, fovTan.xy, scrPos), 1.) * -depth;
|
||||
float planeDistance = dot(vec4(sampledViewCoord, 1.), waterPlane);
|
||||
if(planeDistance < 0.){
|
||||
// reset!
|
||||
// original pos must be in the water.
|
||||
scrPos = origScrPos;
|
||||
depth = depthAt(scrPos);
|
||||
if(depth + viewPosition.z < 0.){
|
||||
// if the pixel is obscured by a object,
|
||||
// this fragment of water is not visible
|
||||
//discard; done by early-Z test
|
||||
}
|
||||
}else{
|
||||
depth = planeDistance / dot(waterPlane, vec4(0.,0.,1.,0.));
|
||||
depth = abs(depth);
|
||||
depth -= viewPosition.z;
|
||||
}
|
||||
|
||||
float envelope = min((depth + viewPosition.z), 1.);
|
||||
envelope = 1. - (1. - envelope) * (1. - envelope);
|
||||
|
||||
// water color
|
||||
// TODO: correct integral
|
||||
vec2 waterCoord = worldPosition;
|
||||
vec2 integralCoord = floor(waterCoord) + .5;
|
||||
vec2 blurDir = (worldPositionFromOrigin.xy);
|
||||
blurDir /= max(length(blurDir), 1.);
|
||||
vec2 blurDirSign = mix(vec2(-1.), vec2(1.), step(0., blurDir));
|
||||
vec2 startPos = (waterCoord - integralCoord) * blurDirSign;
|
||||
vec2 diffPos = blurDir * envelope * blurDirSign * .5 /*limit blur*/;
|
||||
vec2 subCoord = 1. - clamp((vec2(0.5) - startPos) / diffPos,
|
||||
0., 1.);
|
||||
vec2 sampCoord = integralCoord + subCoord * blurDirSign;
|
||||
vec3 waterColor = texture2D(texture, sampCoord / 512.).xyz;
|
||||
|
||||
// underwater object color
|
||||
gl_FragColor = texture2D(screenTexture, scrPos);
|
||||
gl_FragColor.xyz *= gl_FragColor.xyz; // screen color to linear
|
||||
|
||||
// apply fog color to water color now.
|
||||
// note that fog is already applied to underwater object.
|
||||
waterColor = mix(waterColor, fogColor, fogDensity);
|
||||
|
||||
// blend water color with the underwater object's color.
|
||||
gl_FragColor.xyz = mix(gl_FragColor.xyz, waterColor, envelope);
|
||||
|
||||
// attenuation factor for addition blendings below
|
||||
vec3 att = 1. - fogDensity;
|
||||
|
||||
// specular reflection
|
||||
vec3 sunlight = EvaluateSunLight();
|
||||
vec3 ongoing = normalize(worldPositionFromOrigin);
|
||||
if(dot(sunlight, vec3(1.)) > 0.0001){
|
||||
vec3 refl = reflect(ongoing,
|
||||
wave.xyz);
|
||||
float spec = dot(refl, normalize(vec3(0., -1., -1.)));
|
||||
spec = max(spec, 0.);
|
||||
|
||||
/*
|
||||
float sunVisRadius = cos(3.141592654 / 180. / 60. * 32.);
|
||||
|
||||
spec = (spec - (1. - (1. - sunVisRadius) * 2.)) / ((1. - sunVisRadius) * 2.);
|
||||
float fw = fwidth(spec);
|
||||
spec = clamp(.5 + (spec - .5) / fw, 0., 1.);
|
||||
*/
|
||||
spec *= spec; // ^2
|
||||
spec *= spec; // ^4
|
||||
spec *= spec; // ^16
|
||||
spec *= spec; // ^32
|
||||
spec *= spec; // ^64
|
||||
spec *= spec; // ^128
|
||||
spec *= spec; // ^256
|
||||
spec *= spec; // ^512
|
||||
spec *= spec; // ^1024
|
||||
spec *= 1.;
|
||||
gl_FragColor.xyz += sunlight * spec * 10. * att;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// fresnel refrection to sky
|
||||
float fres = dot(ongoing, wave.xyz);
|
||||
fres = clamp(1. - fres, 0., 1.);
|
||||
fres *= fres;
|
||||
fres *= fres;
|
||||
fres *= fres;
|
||||
fres *= fres;
|
||||
fres += .03;
|
||||
gl_FragColor.xyz += fogColor * fres * .6 * att;
|
||||
|
||||
|
||||
|
||||
|
||||
gl_FragColor.xyz = sqrt(gl_FragColor.xyz);
|
||||
|
||||
|
||||
gl_FragColor.w = 1.;
|
||||
}
|
||||
|
3
Resources/Shaders/Water.program
Normal file
3
Resources/Shaders/Water.program
Normal file
@ -0,0 +1,3 @@
|
||||
Shaders/Water.fs
|
||||
Shaders/Water.vs
|
||||
*shadow*
|
52
Resources/Shaders/Water.vs
Normal file
52
Resources/Shaders/Water.vs
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 viewModelMatrix;
|
||||
uniform vec3 viewOrigin;
|
||||
uniform float fogDistance;
|
||||
|
||||
// [x, y]
|
||||
attribute vec2 positionAttribute;
|
||||
|
||||
varying vec3 fogDensity;
|
||||
varying vec3 screenPosition;
|
||||
varying vec3 viewPosition;
|
||||
varying vec2 worldPosition;
|
||||
varying vec3 worldPositionFromOrigin;
|
||||
|
||||
varying vec4 waveCoord;
|
||||
varying vec2 waveCoord2;
|
||||
|
||||
//varying vec2 detailCoord;
|
||||
|
||||
void PrepareForShadow(vec3 worldOrigin, vec3 normal);
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xy, 0., 1.);
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
screenPosition = gl_Position.xyw;
|
||||
screenPosition.xy = (screenPosition.xy + screenPosition.z) * .5;
|
||||
|
||||
vec4 viewPos = viewModelMatrix * vertexPos;
|
||||
float distance = length(viewPos.xyz) / fogDistance;
|
||||
distance = clamp(distance, 0., 1.);
|
||||
fogDensity = vec3(distance);
|
||||
fogDensity = pow(fogDensity, vec3(1., .9, .7));
|
||||
fogDensity *= fogDensity;
|
||||
|
||||
viewPosition = viewPos.xyz;
|
||||
|
||||
worldPosition = (modelMatrix * vertexPos).xy;
|
||||
|
||||
worldPositionFromOrigin = vec3(worldPosition, 63.) - viewOrigin;
|
||||
|
||||
waveCoord.xy = worldPosition * .08;
|
||||
waveCoord.zw = waveCoord.xy * 1.963 + vec2(.754, .1315);
|
||||
waveCoord2.xy = waveCoord.xy * 0.263 + vec2(.154, .7315);
|
||||
|
||||
PrepareForShadow((modelMatrix * vertexPos).xyz, vec3(0., 0., -1.));
|
||||
}
|
||||
|
4
Resources/Shaders/WaterDepth.fs
Normal file
4
Resources/Shaders/WaterDepth.fs
Normal file
@ -0,0 +1,4 @@
|
||||
void main() {
|
||||
gl_FragColor = vec4(1.);
|
||||
}
|
||||
|
2
Resources/Shaders/WaterDepth.program
Normal file
2
Resources/Shaders/WaterDepth.program
Normal file
@ -0,0 +1,2 @@
|
||||
Shaders/WaterDepth.fs
|
||||
Shaders/WaterDepth.vs
|
15
Resources/Shaders/WaterDepth.vs
Normal file
15
Resources/Shaders/WaterDepth.vs
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
uniform mat4 projectionViewModelMatrix;
|
||||
// [x, y]
|
||||
attribute vec2 positionAttribute;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 vertexPos = vec4(positionAttribute.xy, 0., 1.);
|
||||
|
||||
gl_Position = projectionViewModelMatrix * vertexPos;
|
||||
|
||||
}
|
||||
|
BIN
Sources/.DS_Store
vendored
Normal file
BIN
Sources/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Sources/Audio/.DS_Store
vendored
Normal file
BIN
Sources/Audio/.DS_Store
vendored
Normal file
Binary file not shown.
246
Sources/Audio/AL/MacOSX_OALExtensions.h
Normal file
246
Sources/Audio/AL/MacOSX_OALExtensions.h
Normal file
@ -0,0 +1,246 @@
|
||||
/**********************************************************************************************************************************
|
||||
*
|
||||
* OpenAL cross platform audio library
|
||||
* Copyright (c) 2006, Apple Computer, Inc., Copyright (c) 2012, Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Apple Inc. ("Apple") nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
**********************************************************************************************************************************/
|
||||
|
||||
#ifndef __MAC_OSX_OAL_EXTENSIONS_H__
|
||||
#define __MAC_OSX_OAL_EXTENSIONS_H__
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
/*
|
||||
Convert Data When Loading.
|
||||
Default false, currently applies only to monophonic sounds. Use with alEnable()/alDisable()
|
||||
*/
|
||||
#define ALC_MAC_OSX_CONVERT_DATA_UPON_LOADING 0xF001
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ALC_EXT_MAC_OSX
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
typedef ALvoid (*alcMacOSXRenderingQualityProcPtr) (ALint value);
|
||||
typedef ALvoid (*alMacOSXRenderChannelCountProcPtr) (ALint value);
|
||||
typedef ALvoid (*alcMacOSXMixerMaxiumumBussesProcPtr) (ALint value);
|
||||
typedef ALvoid (*alcMacOSXMixerOutputRateProcPtr) (ALdouble value);
|
||||
|
||||
typedef ALint (*alcMacOSXGetRenderingQualityProcPtr) ();
|
||||
typedef ALint (*alMacOSXGetRenderChannelCountProcPtr) ();
|
||||
typedef ALint (*alcMacOSXGetMixerMaxiumumBussesProcPtr) ();
|
||||
typedef ALdouble (*alcMacOSXGetMixerOutputRateProcPtr) ();
|
||||
|
||||
/* Render Quality. Used with alcMacOSXRenderingQuality() */
|
||||
|
||||
#define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH 'rqhi'
|
||||
#define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW 'rdlo'
|
||||
|
||||
/*
|
||||
Render Channels. Used with alMacOSXRenderChannelCount()
|
||||
Allows a user to force OpenAL to render to stereo, regardless of the audio hardware being used
|
||||
*/
|
||||
#define ALC_MAC_OSX_RENDER_CHANNEL_COUNT_STEREO 'rcst'
|
||||
#define ALC_MAC_OSX_RENDER_CHANNEL_COUNT_MULTICHANNEL 'rcmc'
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
AL_EXT_STATIC_BUFFER
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
typedef ALvoid (*alBufferDataStaticProcPtr) (ALint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq);
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
AL_EXT_SOURCE_NOTIFICATIONS
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
/*
|
||||
Source Notifications
|
||||
|
||||
Eliminates the need for continuous polling for source state by providing a
|
||||
mechanism for the application to receive source state change notifications.
|
||||
Upon receiving a notification, the application can retrieve the actual state
|
||||
corresponding to the notification ID for which the notification was sent.
|
||||
*/
|
||||
|
||||
#define AL_QUEUE_HAS_LOOPED 0x9000
|
||||
|
||||
/*
|
||||
Notification Proc: ALSourceNotificationProc
|
||||
|
||||
sid - source id
|
||||
notificationID - id of state that has changed
|
||||
userData - user data provided to alSourceAddNotification()
|
||||
*/
|
||||
|
||||
typedef ALvoid (*alSourceNotificationProc)(ALuint sid, ALuint notificationID, ALvoid* userData);
|
||||
|
||||
/*
|
||||
API: alSourceAddNotification
|
||||
|
||||
sid - source id
|
||||
notificationID - id of state for which caller wants to be notified of a change
|
||||
notifyProc - notification proc
|
||||
userData - ptr to applications user data, will be returned in the notification proc
|
||||
|
||||
Returns AL_NO_ERROR if request is successful.
|
||||
|
||||
Valid IDs:
|
||||
AL_SOURCE_STATE
|
||||
AL_BUFFERS_PROCESSED
|
||||
AL_QUEUE_HAS_LOOPED - notification sent when a looping source has looped to it's start point
|
||||
*/
|
||||
typedef ALenum (*alSourceAddNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
|
||||
|
||||
/*
|
||||
API: alSourceRemoveStateNotification
|
||||
|
||||
sid - source id
|
||||
notificationID - id of state for which caller wants to remove an existing notification
|
||||
notifyProc - notification proc
|
||||
userData - ptr to applications user data, will be returned in the notification proc
|
||||
*/
|
||||
typedef ALvoid (*alSourceRemoveNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ALC_EXT_ASA : Apple Spatial Audio Extension
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
/*
|
||||
Used with the ASA API calls: alcASAGetSource(), alcASASetSource(), alcASAGetListener(), alcASASetListener()
|
||||
*/
|
||||
|
||||
typedef ALenum (*alcASAGetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint* dataSize);
|
||||
typedef ALenum (*alcASASetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint dataSize);
|
||||
typedef ALenum (*alcASAGetListenerProcPtr) (ALuint property, ALvoid *data, ALuint* dataSize);
|
||||
typedef ALenum (*alcASASetListenerProcPtr) (ALuint property, ALvoid *data, ALuint dataSize);
|
||||
|
||||
/* listener properties */
|
||||
#define ALC_ASA_REVERB_ON 'rvon' // type ALuint
|
||||
#define ALC_ASA_REVERB_GLOBAL_LEVEL 'rvgl' // type ALfloat -40.0 db - 40.0 db
|
||||
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE 'rvrt' // type ALint
|
||||
|
||||
/* reverb room type presets for the ALC_ASA_REVERB_ROOM_TYPE property */
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_SmallRoom 0
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_MediumRoom 1
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom 2
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_MediumHall 3
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_LargeHall 4
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_Plate 5
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_MediumChamber 6
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_LargeChamber 7
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_Cathedral 8
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom2 9
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_MediumHall2 10
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_MediumHall3 11
|
||||
#define ALC_ASA_REVERB_ROOM_TYPE_LargeHall2 12
|
||||
|
||||
#define ALC_ASA_REVERB_PRESET 'rvps' // type ALchar* - (set only) path to an au preset file
|
||||
|
||||
#define ALC_ASA_REVERB_EQ_GAIN 'rveg' // type ALfloat
|
||||
#define ALC_ASA_REVERB_EQ_BANDWITH 'rveb' // type ALfloat
|
||||
#define ALC_ASA_REVERB_EQ_FREQ 'rvef' // type ALfloat
|
||||
|
||||
#define ALC_ASA_REVERB_QUALITY 'rvqt' // type ALint
|
||||
|
||||
/* reverb quality settings for the ALC_ASA_REVERB_QUALITY property */
|
||||
#define ALC_ASA_REVERB_QUALITY_Max 0x7F
|
||||
#define ALC_ASA_REVERB_QUALITY_High 0x60
|
||||
#define ALC_ASA_REVERB_QUALITY_Medium 0x40
|
||||
#define ALC_ASA_REVERB_QUALITY_Low 0x20
|
||||
#define ALC_ASA_REVERB_QUALITY_Min 0
|
||||
|
||||
/* source properties */
|
||||
#define ALC_ASA_REVERB_SEND_LEVEL 'rvsl' // type ALfloat 0.0 (dry) - 1.0 (wet) (0-100% dry/wet mix, 0.0 default)
|
||||
#define ALC_ASA_OCCLUSION 'occl' // type ALfloat -100.0 db (most occlusion) - 0.0 db (no occlusion, 0.0 default)
|
||||
#define ALC_ASA_OBSTRUCTION 'obst' // type ALfloat -100.0 db (most obstruction) - 0.0 db (no obstruction, 0.0 default)
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ALC_EXT_ASA_ROGER_BEEP : Apple Spatial Audio Extension for Roger Beep Effect
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
/*
|
||||
Roger Beep : an effect to simulate effects such as Walkie Talkie noise. It is designed to replace the
|
||||
source audio data with a specific 'tone' when falling below a specified db threshold for a specified time.
|
||||
This Extension will be present when the Roger Beep Audio Unit is present on the system (10.5 or greater)
|
||||
Use the alcASAGetSource() and alcASASetSource() APIs in the ALC_EXT_ASA extension.
|
||||
*/
|
||||
|
||||
/* source properties */
|
||||
#define ALC_ASA_ROGER_BEEP_ENABLE 'rben' // type ALboolean - initializes Roger Beep for use - returns error if source is not in a Stopped or Initial state
|
||||
#define ALC_ASA_ROGER_BEEP_ON 'rbon' // type ALboolean - set effect on/off (bypass) - default setting is true (on)
|
||||
#define ALC_ASA_ROGER_BEEP_GAIN 'rbgn' // type ALfloat - 20.0 (db) apply maximum effect : -80.0(db) apply minimum effect amount
|
||||
#define ALC_ASA_ROGER_BEEP_SENSITIVITY 'rbsn' // type ALint - specifiy a predefined sensitivity setting
|
||||
#define ALC_ASA_ROGER_BEEP_TYPE 'rbtp' // type ALint - choose predefined specific Roger Beep tone
|
||||
#define ALC_ASA_ROGER_BEEP_PRESET 'rbps' // type ALchar* - path to an au preset file (set only)
|
||||
|
||||
/* settings for the ALC_ASA_ROGER_BEEP_TYPE property */
|
||||
#define ALC_ASA_ROGER_BEEP_TYPE_quindartone 0
|
||||
#define ALC_ASA_ROGER_BEEP_TYPE_whitenoise 1
|
||||
#define ALC_ASA_ROGER_BEEP_TYPE_walkietalkie 2
|
||||
|
||||
/* settings for the ALC_ASA_ROGER_BEEP_SENSITIVITY property */
|
||||
|
||||
#define ALC_ASA_ROGER_BEEP_SENSITIVITY_Light 0
|
||||
#define ALC_ASA_ROGER_BEEP_SENSITIVITY_Medium 1
|
||||
#define ALC_ASA_ROGER_BEEP_SENSITIVITY_Heavy 2
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ALC_EXT_ASA_DISTORTION : Apple Spatial Audio Extension for Distortion Effect
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
/*
|
||||
Distortion Effect
|
||||
This Extension will be present when the Distortion Audio Unit is present on the system (10.5 or greater)
|
||||
Use the alcASAGetSource() and alcASASetSource() APIs in the ALC_EXT_ASA extension.
|
||||
*/
|
||||
|
||||
/* source properties */
|
||||
#define ALC_ASA_DISTORTION_ENABLE 'dsen' // type ALboolean - initializes Distortion for use - returns error if source is not in a Stopped or Initial state
|
||||
#define ALC_ASA_DISTORTION_ON 'dson' // type ALboolean - set effect on/off (bypass) - default setting is true (on)
|
||||
#define ALC_ASA_DISTORTION_MIX 'dsmx' // type ALfloat - mix balance between dry signal and distortion effect - 0.0 (no effect) - 100.0 (all effect)
|
||||
#define ALC_ASA_DISTORTION_TYPE 'dstp' // type ALint - choose predefined distortion settings
|
||||
#define ALC_ASA_DISTORTION_PRESET 'dsps' // type ALchar* - path to an au preset file (set only)
|
||||
|
||||
/* settings for the ALC_ASA_DISTORTION_TYPE property */
|
||||
#define ALC_ASA_DISTORTION_TYPE_BitBrush 0
|
||||
#define ALC_ASA_DISTORTION_TYPE_BufferBeats 1
|
||||
#define ALC_ASA_DISTORTION_TYPE_LoFi 2
|
||||
#define ALC_ASA_DISTORTION_TYPE_BrokenSpeaker 3
|
||||
#define ALC_ASA_DISTORTION_TYPE_Cellphone 4
|
||||
#define ALC_ASA_DISTORTION_TYPE_Decimated1 5
|
||||
#define ALC_ASA_DISTORTION_TYPE_Decimated2 6
|
||||
#define ALC_ASA_DISTORTION_TYPE_Decimated3 7
|
||||
#define ALC_ASA_DISTORTION_TYPE_Decimated4 8
|
||||
#define ALC_ASA_DISTORTION_TYPE_DistortedFunk 9
|
||||
#define ALC_ASA_DISTORTION_TYPE_DistortionCubed 10
|
||||
#define ALC_ASA_DISTORTION_TYPE_DistortionSquared 11
|
||||
#define ALC_ASA_DISTORTION_TYPE_Echo1 12
|
||||
#define ALC_ASA_DISTORTION_TYPE_Echo2 13
|
||||
#define ALC_ASA_DISTORTION_TYPE_EchoTight1 14
|
||||
#define ALC_ASA_DISTORTION_TYPE_EchoTight2 15
|
||||
#define ALC_ASA_DISTORTION_TYPE_EverythingBroken 16
|
||||
#define ALC_ASA_DISTORTION_TYPE_AlienChatter 17
|
||||
#define ALC_ASA_DISTORTION_TYPE_CosmicInteference 18
|
||||
#define ALC_ASA_DISTORTION_TYPE_GoldenPi 19
|
||||
#define ALC_ASA_DISTORTION_TYPE_RadioTower 20
|
||||
#define ALC_ASA_DISTORTION_TYPE_Waves 21
|
||||
|
||||
|
||||
|
||||
#endif // __MAC_OSX_OAL_EXTENSIONS_H__
|
16
Sources/Audio/AL/VERSION
Normal file
16
Sources/Audio/AL/VERSION
Normal file
@ -0,0 +1,16 @@
|
||||
This file identifies the version of the AL headers in this directory. If you
|
||||
change or update the AL headers in any way, please make sure you also update
|
||||
this file.
|
||||
|
||||
SVN revision >= 402
|
||||
-------------------
|
||||
Headers are from OpenAL CVS 6th August 2005:
|
||||
$ cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository
|
||||
login
|
||||
(use password "guest")
|
||||
$ cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository
|
||||
co -D "6 Aug 2005" openal
|
||||
|
||||
SVN revision >= 374
|
||||
-------------------
|
||||
Standard OpenAL 1.0 headers
|
509
Sources/Audio/AL/al.h
Normal file
509
Sources/Audio/AL/al.h
Normal file
@ -0,0 +1,509 @@
|
||||
#ifndef __al_h_
|
||||
#define __al_h_
|
||||
|
||||
/**
|
||||
* OpenAL cross platform audio library
|
||||
* Copyright (C) 1999-2000 by authors.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* Or go to http://www.gnu.org/copyleft/lgpl.html
|
||||
*/
|
||||
#include "altypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#else
|
||||
#endif
|
||||
|
||||
/* WIN32, not Xbox */
|
||||
#ifdef _WIN32
|
||||
#ifndef _XBOX
|
||||
#ifdef _OPENAL32LIB
|
||||
#define ALAPI __declspec(dllexport)
|
||||
#else
|
||||
#define ALAPI __declspec(dllimport)
|
||||
#endif
|
||||
#define ALAPIENTRY __cdecl
|
||||
#define AL_CALLBACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_OS_MAC
|
||||
#if TARGET_OS_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALAPI
|
||||
#define ALAPI
|
||||
#endif
|
||||
|
||||
#ifndef ALAPIENTRY
|
||||
#define ALAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define AL_CALLBACK
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define OPENAL
|
||||
|
||||
#ifndef AL_NO_PROTOTYPES
|
||||
|
||||
/*
|
||||
* Renderer State management
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alEnable( ALenum capability );
|
||||
|
||||
ALAPI void ALAPIENTRY alDisable( ALenum capability );
|
||||
|
||||
ALAPI ALboolean ALAPIENTRY alIsEnabled( ALenum capability );
|
||||
|
||||
|
||||
/*
|
||||
* State retrieval
|
||||
*/
|
||||
ALAPI const ALchar* ALAPIENTRY alGetString( ALenum param );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBooleanv( ALenum param, ALboolean* data );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetIntegerv( ALenum param, ALint* data );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetFloatv( ALenum param, ALfloat* data );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetDoublev( ALenum param, ALdouble* data );
|
||||
|
||||
ALAPI ALboolean ALAPIENTRY alGetBoolean( ALenum param );
|
||||
|
||||
ALAPI ALint ALAPIENTRY alGetInteger( ALenum param );
|
||||
|
||||
ALAPI ALfloat ALAPIENTRY alGetFloat( ALenum param );
|
||||
|
||||
ALAPI ALdouble ALAPIENTRY alGetDouble( ALenum param );
|
||||
|
||||
|
||||
/*
|
||||
* Error support.
|
||||
* Obtain the most recent error generated in the AL state machine.
|
||||
*/
|
||||
ALAPI ALenum ALAPIENTRY alGetError( );
|
||||
|
||||
|
||||
/*
|
||||
* Extension support.
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( const ALchar* extname );
|
||||
|
||||
ALAPI void* ALAPIENTRY alGetProcAddress( const ALchar* fname );
|
||||
|
||||
ALAPI ALenum ALAPIENTRY alGetEnumValue( const ALchar* ename );
|
||||
|
||||
|
||||
/*
|
||||
* LISTENER
|
||||
* Listener represents the location and orientation of the
|
||||
* 'user' in 3D-space.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Gain AL_GAIN ALfloat
|
||||
* Position AL_POSITION ALfloat[3]
|
||||
* Velocity AL_VELOCITY ALfloat[3]
|
||||
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set Listener parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alListenerf( ALenum param, ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alListenerfv( ALenum param, const ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alListeneri( ALenum param, ALint value );
|
||||
|
||||
ALAPI void ALAPIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alListeneriv( ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Listener parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alGetListenerf( ALenum param, ALfloat* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetListenerfv( ALenum param, ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetListeneri( ALenum param, ALint* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetListeneriv( ALenum param, ALint* values );
|
||||
|
||||
|
||||
/**
|
||||
* SOURCE
|
||||
* Sources represent individual sound objects in 3D-space.
|
||||
* Sources take the PCM data provided in the specified Buffer,
|
||||
* apply Source-specific modifications, and then
|
||||
* submit them to be mixed according to spatial arrangement etc.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Gain AL_GAIN ALfloat
|
||||
* Min Gain AL_MIN_GAIN ALfloat
|
||||
* Max Gain AL_MAX_GAIN ALfloat
|
||||
* Position AL_POSITION ALfloat[3]
|
||||
* Velocity AL_VELOCITY ALfloat[3]
|
||||
* Direction AL_DIRECTION ALfloat[3]
|
||||
* Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
|
||||
* Reference Distance AL_REFERENCE_DISTANCE ALfloat
|
||||
* Max Distance AL_MAX_DISTANCE ALfloat
|
||||
* RollOff Factor AL_ROLLOFF_FACTOR ALfloat
|
||||
* Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
|
||||
* Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
|
||||
* Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
|
||||
* Pitch AL_PITCH ALfloat
|
||||
* Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
|
||||
* MS Offset AL_MSEC_OFFSET ALint or ALfloat
|
||||
* Byte Offset AL_BYTE_OFFSET ALint or ALfloat
|
||||
* Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
|
||||
* Attached Buffer AL_BUFFER ALint
|
||||
* State (Query only) AL_SOURCE_STATE ALint
|
||||
* Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
|
||||
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
|
||||
*/
|
||||
|
||||
/* Create Source objects */
|
||||
ALAPI void ALAPIENTRY alGenSources( ALsizei n, ALuint* sources );
|
||||
|
||||
/* Delete Source objects */
|
||||
ALAPI void ALAPIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
|
||||
|
||||
/* Verify a handle is a valid Source */
|
||||
ALAPI ALboolean ALAPIENTRY alIsSource( ALuint sid );
|
||||
|
||||
/*
|
||||
* Set Source parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
|
||||
|
||||
ALAPI void ALAPIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Source parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
|
||||
ALAPI void ALAPIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
|
||||
ALAPI void ALAPIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
|
||||
|
||||
|
||||
/*
|
||||
* Source vector based playback calls
|
||||
*/
|
||||
|
||||
/* Play, replay, or resume (if paused) a list of Sources */
|
||||
ALAPI void ALAPIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Stop a list of Sources */
|
||||
ALAPI void ALAPIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Rewind a list of Sources */
|
||||
ALAPI void ALAPIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Pause a list of Sources */
|
||||
ALAPI void ALAPIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/*
|
||||
* Source based playback calls
|
||||
*/
|
||||
|
||||
/* Play, replay, or resume a Source */
|
||||
ALAPI void ALAPIENTRY alSourcePlay( ALuint sid );
|
||||
|
||||
/* Stop a Source */
|
||||
ALAPI void ALAPIENTRY alSourceStop( ALuint sid );
|
||||
|
||||
/* Rewind a Source (set playback postiton to beginning) */
|
||||
ALAPI void ALAPIENTRY alSourceRewind( ALuint sid );
|
||||
|
||||
/* Pause a Source */
|
||||
ALAPI void ALAPIENTRY alSourcePause( ALuint sid );
|
||||
|
||||
/*
|
||||
* Source Queuing
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||
|
||||
ALAPI void ALAPIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
|
||||
|
||||
/**
|
||||
* BUFFER
|
||||
* Buffer objects are storage space for sample data.
|
||||
* Buffers are referred to by Sources. One Buffer can be used
|
||||
* by multiple Sources.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Frequency (Query only) AL_FREQUENCY ALint
|
||||
* Size (Query only) AL_SIZE ALint
|
||||
* Bits (Query only) AL_BITS ALint
|
||||
* Channels (Query only) AL_CHANNELS ALint
|
||||
*/
|
||||
|
||||
/* Create Buffer objects */
|
||||
ALAPI void ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
|
||||
|
||||
/* Delete Buffer objects */
|
||||
ALAPI void ALAPIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
|
||||
|
||||
/* Verify a handle is a valid Buffer */
|
||||
ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint bid );
|
||||
|
||||
/* Specify the data to be copied into a buffer */
|
||||
ALAPI void ALAPIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
|
||||
/*
|
||||
* Set Buffer parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
|
||||
|
||||
ALAPI void ALAPIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
ALAPI void ALAPIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Buffer parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
|
||||
ALAPI void ALAPIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
|
||||
|
||||
|
||||
/*
|
||||
* Global Parameters
|
||||
*/
|
||||
ALAPI void ALAPIENTRY alDopplerFactor( ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alDopplerVelocity( ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alSpeedOfSound( ALfloat value );
|
||||
|
||||
ALAPI void ALAPIENTRY alDistanceModel( ALenum distanceModel );
|
||||
|
||||
#else /* AL_NO_PROTOTYPES */
|
||||
|
||||
/*
|
||||
void (ALAPIENTRY *alEnable)( ALenum capability );
|
||||
void (ALAPIENTRY *alDisable)( ALenum capability );
|
||||
ALboolean (ALAPIENTRY *alIsEnabled)( ALenum capability );
|
||||
const ALchar* (ALAPIENTRY *alGetString)( ALenum param );
|
||||
void (ALAPIENTRY *alGetBooleanv)( ALenum param, ALboolean* data );
|
||||
void (ALAPIENTRY *alGetIntegerv)( ALenum param, ALint* data );
|
||||
void (ALAPIENTRY *alGetFloatv)( ALenum param, ALfloat* data );
|
||||
void (ALAPIENTRY *alGetDoublev)( ALenum param, ALdouble* data );
|
||||
ALboolean (ALAPIENTRY *alGetBoolean)( ALenum param );
|
||||
ALint (ALAPIENTRY *alGetInteger)( ALenum param );
|
||||
ALfloat (ALAPIENTRY *alGetFloat)( ALenum param );
|
||||
ALdouble (ALAPIENTRY *alGetDouble)( ALenum param );
|
||||
ALenum (ALAPIENTRY *alGetError)( ALvoid );
|
||||
ALboolean (ALAPIENTRY *alIsExtensionPresent)(const ALchar* extname );
|
||||
void* (ALAPIENTRY *alGetProcAddress)( const ALchar* fname );
|
||||
ALenum (ALAPIENTRY *alGetEnumValue)( const ALchar* ename );
|
||||
void (ALAPIENTRY *alListenerf)( ALenum param, ALfloat value );
|
||||
void (ALAPIENTRY *alListener3f)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
void (ALAPIENTRY *alListenerfv)( ALenum param, const ALfloat* values );
|
||||
void (ALAPIENTRY *alListeneri)( ALenum param, ALint value );
|
||||
void (ALAPIENTRY *alListener3i)( ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
void (ALAPIENTRY *alListeneriv)( ALenum param, const ALint* values );
|
||||
void (ALAPIENTRY *alGetListenerf)( ALenum param, ALfloat* value );
|
||||
void (ALAPIENTRY *alGetListener3f)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
void (ALAPIENTRY *alGetListenerfv)( ALenum param, ALfloat* values );
|
||||
void (ALAPIENTRY *alGetListeneri)( ALenum param, ALint* value );
|
||||
void (ALAPIENTRY *alGetListener3i)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
|
||||
void (ALAPIENTRY *alGetListeneriv)( ALenum param, ALint* values );
|
||||
void (ALAPIENTRY *alGenSources)( ALsizei n, ALuint* sources );
|
||||
void (ALAPIENTRY *alDeleteSources)( ALsizei n, const ALuint* sources );
|
||||
ALboolean (ALAPIENTRY *alIsSource)( ALuint sid );
|
||||
void (ALAPIENTRY *alSourcef)( ALuint sid, ALenum param, ALfloat value);
|
||||
void (ALAPIENTRY *alSource3f)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
void (ALAPIENTRY *alSourcefv)( ALuint sid, ALenum param, const ALfloat* values );
|
||||
void (ALAPIENTRY *alSourcei)( ALuint sid, ALenum param, ALint value);
|
||||
void (ALAPIENTRY *alSource3i)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
void (ALAPIENTRY *alSourceiv)( ALuint sid, ALenum param, const ALint* values );
|
||||
void (ALAPIENTRY *alGetSourcef)( ALuint sid, ALenum param, ALfloat* value );
|
||||
void (ALAPIENTRY *alGetSource3f)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
void (ALAPIENTRY *alGetSourcefv)( ALuint sid, ALenum param, ALfloat* values );
|
||||
void (ALAPIENTRY *alGetSourcei)( ALuint sid, ALenum param, ALint* value );
|
||||
void (ALAPIENTRY *alGetSource3i)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
void (ALAPIENTRY *alGetSourceiv)( ALuint sid, ALenum param, ALint* values );
|
||||
void (ALAPIENTRY *alSourcePlayv)( ALsizei ns, const ALuint *sids );
|
||||
void (ALAPIENTRY *alSourceStopv)( ALsizei ns, const ALuint *sids );
|
||||
void (ALAPIENTRY *alSourceRewindv)( ALsizei ns, const ALuint *sids );
|
||||
void (ALAPIENTRY *alSourcePausev)( ALsizei ns, const ALuint *sids );
|
||||
void (ALAPIENTRY *alSourcePlay)( ALuint sid );
|
||||
void (ALAPIENTRY *alSourceStop)( ALuint sid );
|
||||
void (ALAPIENTRY *alSourceRewind)( ALuint sid );
|
||||
void (ALAPIENTRY *alSourcePause)( ALuint sid );
|
||||
void (ALAPIENTRY *alSourceQueueBuffers)( ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||
void (ALAPIENTRY *alSourceUnqueueBuffers)( ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
void (ALAPIENTRY *alGenBuffers)( ALsizei n, ALuint* buffers );
|
||||
void (ALAPIENTRY *alDeleteBuffers)( ALsizei n, const ALuint* buffers );
|
||||
ALboolean (ALAPIENTRY *alIsBuffer)( ALuint bid );
|
||||
void (ALAPIENTRY *alBufferData)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
void (ALAPIENTRY *alBufferf)( ALuint bid, ALenum param, ALfloat value);
|
||||
void (ALAPIENTRY *alBuffer3f)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
void (ALAPIENTRY *alBufferfv)( ALuint bid, ALenum param, const ALfloat* values );
|
||||
void (ALAPIENTRY *alBufferi)( ALuint bid, ALenum param, ALint value);
|
||||
void (ALAPIENTRY *alBuffer3i)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
void (ALAPIENTRY *alBufferiv)( ALuint bid, ALenum param, const ALint* values );
|
||||
void (ALAPIENTRY *alGetBufferf)( ALuint bid, ALenum param, ALfloat* value );
|
||||
void (ALAPIENTRY *alGetBuffer3f)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
void (ALAPIENTRY *alGetBufferfv)( ALuint bid, ALenum param, ALfloat* values );
|
||||
void (ALAPIENTRY *alGetBufferi)( ALuint bid, ALenum param, ALint* value );
|
||||
void (ALAPIENTRY *alGetBuffer3i)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
void (ALAPIENTRY *alGetBufferiv)( ALuint bid, ALenum param, ALint* values );
|
||||
void (ALAPIENTRY *alDopplerFactor)( ALfloat value );
|
||||
void (ALAPIENTRY *alDopplerVelocity)( ALfloat value );
|
||||
void (ALAPIENTRY *alSpeedOfSound)( ALfloat value );
|
||||
void (ALAPIENTRY *alDistanceModel)( ALenum distanceModel );
|
||||
*/
|
||||
/* Type Definitions */
|
||||
|
||||
typedef void (ALAPIENTRY *LPALENABLE)( ALenum capability );
|
||||
typedef void (ALAPIENTRY *LPALDISABLE)( ALenum capability );
|
||||
typedef ALboolean (ALAPIENTRY *LPALISENABLED)( ALenum capability );
|
||||
typedef const ALchar* (ALAPIENTRY *LPALGETSTRING)( ALenum param );
|
||||
typedef void (ALAPIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
|
||||
typedef void (ALAPIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
|
||||
typedef void (ALAPIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
|
||||
typedef void (ALAPIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
|
||||
typedef ALboolean (ALAPIENTRY *LPALGETBOOLEAN)( ALenum param );
|
||||
typedef ALint (ALAPIENTRY *LPALGETINTEGER)( ALenum param );
|
||||
typedef ALfloat (ALAPIENTRY *LPALGETFLOAT)( ALenum param );
|
||||
typedef ALdouble (ALAPIENTRY *LPALGETDOUBLE)( ALenum param );
|
||||
typedef ALenum (ALAPIENTRY *LPALGETERROR)( );
|
||||
typedef ALboolean (ALAPIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
|
||||
typedef void* (ALAPIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
|
||||
typedef ALenum (ALAPIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
|
||||
typedef void (ALAPIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
|
||||
typedef void (ALAPIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (ALAPIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALLISTENERI)( ALenum param, ALint value );
|
||||
typedef void (ALAPIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (ALAPIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
|
||||
typedef void (ALAPIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
|
||||
typedef void (ALAPIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
|
||||
typedef ALboolean (ALAPIENTRY *LPALISSOURCE)( ALuint sid );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
|
||||
typedef void (ALAPIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
|
||||
typedef void (ALAPIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
typedef void (ALAPIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (ALAPIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEPLAY)( ALuint sid );
|
||||
typedef void (ALAPIENTRY *LPALSOURCESTOP)( ALuint sid );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEREWIND)( ALuint sid );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEPAUSE)( ALuint sid );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||
typedef void (ALAPIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
typedef void (ALAPIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
|
||||
typedef void (ALAPIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
|
||||
typedef ALboolean (ALAPIENTRY *LPALISBUFFER)( ALuint bid );
|
||||
typedef void (ALAPIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
typedef void (ALAPIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
|
||||
typedef void (ALAPIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (ALAPIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
|
||||
typedef void (ALAPIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (ALAPIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
typedef void (ALAPIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
|
||||
typedef void (ALAPIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
|
||||
typedef void (ALAPIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
|
||||
typedef void (ALAPIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
|
||||
typedef void (ALAPIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
|
||||
|
||||
#endif /* AL_NO_PROTOTYPES */
|
||||
|
||||
#ifdef TARGET_OS_MAC
|
||||
#if TARGET_OS_MAC
|
||||
#pragma export off
|
||||
#endif /* TARGET_OS_MAC */
|
||||
#endif /* TARGET_OS_MAC */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __al_h_ */
|
166
Sources/Audio/AL/alc.h
Normal file
166
Sources/Audio/AL/alc.h
Normal file
@ -0,0 +1,166 @@
|
||||
#ifndef ALC_CONTEXT_H_
|
||||
#define ALC_CONTEXT_H_
|
||||
|
||||
#include "altypes.h"
|
||||
#include "alctypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALC_VERSION_0_1 1
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef struct ALCdevice_struct ALCdevice;
|
||||
typedef struct ALCcontext_struct ALCcontext;
|
||||
#ifndef _XBOX
|
||||
#ifdef _OPENAL32LIB
|
||||
#define ALCAPI __declspec(dllexport)
|
||||
#else
|
||||
#define ALCAPI __declspec(dllimport)
|
||||
#endif
|
||||
#define ALCAPIENTRY __cdecl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_OS_MAC
|
||||
#if TARGET_OS_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALCAPI
|
||||
#define ALCAPI
|
||||
#endif
|
||||
|
||||
#ifndef ALCAPIENTRY
|
||||
#define ALCAPIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ALC_NO_PROTOTYPES
|
||||
|
||||
/*
|
||||
* Context Management
|
||||
*/
|
||||
ALCAPI ALCcontext * ALCAPIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
|
||||
|
||||
ALCAPI ALCboolean ALCAPIENTRY alcMakeContextCurrent( ALCcontext *context );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcProcessContext( ALCcontext *context );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcSuspendContext( ALCcontext *context );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcDestroyContext( ALCcontext *context );
|
||||
|
||||
ALCAPI ALCcontext * ALCAPIENTRY alcGetCurrentContext( );
|
||||
|
||||
ALCAPI ALCdevice* ALCAPIENTRY alcGetContextsDevice( ALCcontext *context );
|
||||
|
||||
|
||||
/*
|
||||
* Device Management
|
||||
*/
|
||||
ALCAPI ALCdevice * ALCAPIENTRY alcOpenDevice( const ALchar *devicename );
|
||||
|
||||
ALCAPI ALCboolean ALCAPIENTRY alcCloseDevice( ALCdevice *device );
|
||||
|
||||
|
||||
/*
|
||||
* Error support.
|
||||
* Obtain the most recent Context error
|
||||
*/
|
||||
ALCAPI ALCenum ALCAPIENTRY alcGetError( ALCdevice *device );
|
||||
|
||||
|
||||
/*
|
||||
* Extension support.
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
ALCAPI ALCboolean ALCAPIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
|
||||
|
||||
ALCAPI void * ALCAPIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
|
||||
|
||||
ALCAPI ALCenum ALCAPIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
|
||||
|
||||
|
||||
/*
|
||||
* Query functions
|
||||
*/
|
||||
ALCAPI const ALCchar * ALCAPIENTRY alcGetString( ALCdevice *device, ALCenum param );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
|
||||
|
||||
|
||||
/*
|
||||
* Capture functions
|
||||
*/
|
||||
ALCAPI ALCdevice* ALCAPIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
|
||||
ALCAPI ALCboolean ALCAPIENTRY alcCaptureCloseDevice( ALCdevice *device );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcCaptureStart( ALCdevice *device );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcCaptureStop( ALCdevice *device );
|
||||
|
||||
ALCAPI void ALCAPIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
|
||||
#else /* ALC_NO_PROTOTYPES */
|
||||
/*
|
||||
ALCAPI ALCcontext * (ALCAPIENTRY *alcCreateContext)( ALCdevice *device, const ALCint* attrlist );
|
||||
ALCAPI ALCboolean (ALCAPIENTRY *alcMakeContextCurrent)( ALCcontext *context );
|
||||
ALCAPI void (ALCAPIENTRY *alcProcessContext)( ALCcontext *context );
|
||||
ALCAPI void (ALCAPIENTRY *alcSuspendContext)( ALCcontext *context );
|
||||
ALCAPI void (ALCAPIENTRY *alcDestroyContext)( ALCcontext *context );
|
||||
ALCAPI ALCcontext * (ALCAPIENTRY *alcGetCurrentContext)( ALCvoid );
|
||||
ALCAPI ALCdevice * (ALCAPIENTRY *alcGetContextsDevice)( ALCcontext *context );
|
||||
ALCAPI ALCdevice * (ALCAPIENTRY *alcOpenDevice)( const ALCchar *devicename );
|
||||
ALCAPI ALCboolean (ALCAPIENTRY *alcCloseDevice)( ALCdevice *device );
|
||||
ALCAPI ALCenum (ALCAPIENTRY *alcGetError)( ALCdevice *device );
|
||||
ALCAPI ALCboolean (ALCAPIENTRY *alcIsExtensionPresent)( ALCdevice *device, const ALCchar *extname );
|
||||
ALCAPI void * (ALCAPIENTRY *alcGetProcAddress)( ALCdevice *device, const ALCchar *funcname );
|
||||
ALCAPI ALCenum (ALCAPIENTRY *alcGetEnumValue)( ALCdevice *device, const ALCchar *enumname );
|
||||
ALCAPI const ALCchar* (ALCAPIENTRY *alcGetString)( ALCdevice *device, ALCenum param );
|
||||
ALCAPI void (ALCAPIENTRY *alcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
||||
ALCAPI ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
ALCAPI ALCboolean (ALCAPIENTRY *alcCaptureCloseDevice)( ALCdevice *device );
|
||||
ALCAPI void (ALCAPIENTRY *alcCaptureStart)( ALCdevice *device );
|
||||
ALCAPI void (ALCAPIENTRY *alcCaptureStop)( ALCdevice *device );
|
||||
ALCAPI void (ALCAPIENTRY *alcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
*/
|
||||
/* Type definitions */
|
||||
typedef ALCcontext * (ALCAPIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (ALCAPIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
|
||||
typedef void (ALCAPIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALCAPIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALCAPIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
|
||||
typedef ALCcontext * (ALCAPIENTRY *LPALCGETCURRENTCONTEXT)( );
|
||||
typedef ALCdevice * (ALCAPIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
|
||||
typedef ALCdevice * (ALCAPIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
|
||||
typedef ALCboolean (ALCAPIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
|
||||
typedef ALCenum (ALCAPIENTRY *LPALCGETERROR)( ALCdevice *device );
|
||||
typedef ALCboolean (ALCAPIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
|
||||
typedef void * (ALCAPIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
|
||||
typedef ALCenum (ALCAPIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
|
||||
typedef const ALCchar* (ALCAPIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
|
||||
typedef void (ALCAPIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
||||
typedef ALCdevice * (ALCAPIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
typedef ALCboolean (ALCAPIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
|
||||
typedef void (ALCAPIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
|
||||
typedef void (ALCAPIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
|
||||
typedef void (ALCAPIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
|
||||
#endif /* ALC_NO_PROTOTYPES */
|
||||
|
||||
#ifdef TARGET_OS_MAC
|
||||
#if TARGET_OS_MAC
|
||||
#pragma export off
|
||||
#endif /* TARGET_OS_MAC */
|
||||
#endif /* TARGET_OS_MAC */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ALC_CONTEXT_H_ */
|
142
Sources/Audio/AL/alctypes.h
Normal file
142
Sources/Audio/AL/alctypes.h
Normal file
@ -0,0 +1,142 @@
|
||||
#ifndef _ALCTYPES_H_
|
||||
#define _ALCTYPES_H_
|
||||
|
||||
#if !defined(_WIN32)
|
||||
struct _AL_device;
|
||||
typedef struct _AL_device ALCdevice;
|
||||
|
||||
typedef void ALCcontext;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
typedef int ALCenum;
|
||||
|
||||
/** ALC boolean type. */
|
||||
typedef char ALCboolean;
|
||||
|
||||
/** ALC 8bit signed byte. */
|
||||
typedef char ALCbyte;
|
||||
|
||||
/** ALC 8bit unsigned byte. */
|
||||
typedef unsigned char ALCubyte;
|
||||
|
||||
/** OpenAL 8bit char */
|
||||
typedef char ALCchar;
|
||||
|
||||
/** ALC 16bit signed short integer type. */
|
||||
typedef short ALCshort;
|
||||
|
||||
/** ALC 16bit unsigned short integer type. */
|
||||
typedef unsigned short ALCushort;
|
||||
|
||||
/** ALC 32bit unsigned integer type. */
|
||||
typedef unsigned ALCuint;
|
||||
|
||||
/** ALC 32bit signed integer type. */
|
||||
typedef int ALCint;
|
||||
|
||||
/** ALC 32bit floating point type. */
|
||||
typedef float ALCfloat;
|
||||
|
||||
/** ALC 64bit double point type. */
|
||||
typedef double ALCdouble;
|
||||
|
||||
/** ALC 32bit type. */
|
||||
typedef int ALCsizei;
|
||||
|
||||
/** ALC void type */
|
||||
typedef void ALCvoid;
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/* bad value */
|
||||
#define ALC_INVALID 0
|
||||
|
||||
/* Boolean False. */
|
||||
#define ALC_FALSE 0
|
||||
|
||||
/* Boolean True. */
|
||||
#define ALC_TRUE 1
|
||||
|
||||
/**
|
||||
* followed by <int> Hz
|
||||
*/
|
||||
#define ALC_FREQUENCY 0x1007
|
||||
|
||||
/**
|
||||
* followed by <int> Hz
|
||||
*/
|
||||
#define ALC_REFRESH 0x1008
|
||||
|
||||
/**
|
||||
* followed by AL_TRUE, AL_FALSE
|
||||
*/
|
||||
#define ALC_SYNC 0x1009
|
||||
|
||||
/**
|
||||
* followed by <int> Num of requested Mono (3D) Sources
|
||||
*/
|
||||
#define ALC_MONO_SOURCES 0x1010
|
||||
|
||||
/**
|
||||
* followed by <int> Num of requested Stereo Sources
|
||||
*/
|
||||
#define ALC_STEREO_SOURCES 0x1011
|
||||
|
||||
/**
|
||||
* errors
|
||||
*/
|
||||
|
||||
/**
|
||||
* No error
|
||||
*/
|
||||
#define ALC_NO_ERROR ALC_FALSE
|
||||
|
||||
/**
|
||||
* No device
|
||||
*/
|
||||
#define ALC_INVALID_DEVICE 0xA001
|
||||
|
||||
/**
|
||||
* invalid context ID
|
||||
*/
|
||||
#define ALC_INVALID_CONTEXT 0xA002
|
||||
|
||||
/**
|
||||
* bad enum
|
||||
*/
|
||||
#define ALC_INVALID_ENUM 0xA003
|
||||
|
||||
/**
|
||||
* bad value
|
||||
*/
|
||||
#define ALC_INVALID_VALUE 0xA004
|
||||
|
||||
/**
|
||||
* Out of memory.
|
||||
*/
|
||||
#define ALC_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Specifier string for default device
|
||||
*/
|
||||
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
|
||||
#define ALC_DEVICE_SPECIFIER 0x1005
|
||||
#define ALC_EXTENSIONS 0x1006
|
||||
|
||||
#define ALC_MAJOR_VERSION 0x1000
|
||||
#define ALC_MINOR_VERSION 0x1001
|
||||
|
||||
#define ALC_ATTRIBUTES_SIZE 0x1002
|
||||
#define ALC_ALL_ATTRIBUTES 0x1003
|
||||
|
||||
/**
|
||||
* Capture extension
|
||||
*/
|
||||
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
|
||||
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
|
||||
#define ALC_CAPTURE_SAMPLES 0x312
|
||||
|
||||
|
||||
#endif /* _ALCTYPES_H */
|
352
Sources/Audio/AL/altypes.h
Normal file
352
Sources/Audio/AL/altypes.h
Normal file
@ -0,0 +1,352 @@
|
||||
#ifndef _AL_TYPES_H_
|
||||
#define _AL_TYPES_H_
|
||||
|
||||
/* define platform type */
|
||||
#if !defined(MACINTOSH_AL) && !defined(LINUX_AL) && !defined(WINDOWS_AL)
|
||||
#ifdef __APPLE__
|
||||
#define MACINTOSH_AL
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define WINDOWS_AL
|
||||
#else
|
||||
#define LINUX_AL
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** OpenAL bool type. */
|
||||
typedef char ALboolean;
|
||||
|
||||
/** OpenAL 8bit signed byte. */
|
||||
typedef char ALbyte;
|
||||
|
||||
/** OpenAL 8bit unsigned byte. */
|
||||
typedef unsigned char ALubyte;
|
||||
|
||||
/** OpenAL 8bit char */
|
||||
typedef char ALchar;
|
||||
|
||||
/** OpenAL 16bit signed short integer type. */
|
||||
typedef short ALshort;
|
||||
|
||||
/** OpenAL 16bit unsigned short integer type. */
|
||||
typedef unsigned short ALushort;
|
||||
|
||||
/** OpenAL 32bit unsigned integer type. */
|
||||
typedef unsigned int ALuint;
|
||||
|
||||
/** OpenAL 32bit signed integer type. */
|
||||
typedef int ALint;
|
||||
|
||||
/** OpenAL 32bit floating point type. */
|
||||
typedef float ALfloat;
|
||||
|
||||
/** OpenAL 64bit double point type. */
|
||||
typedef double ALdouble;
|
||||
|
||||
/** OpenAL 32bit type. */
|
||||
typedef int ALsizei;
|
||||
|
||||
/** OpenAL void type (for params, not returns). */
|
||||
typedef void ALvoid;
|
||||
|
||||
/** OpenAL enumerations. */
|
||||
typedef int ALenum;
|
||||
|
||||
/** OpenAL bitfields. */
|
||||
typedef unsigned int ALbitfield;
|
||||
|
||||
/** OpenAL clamped float. */
|
||||
typedef ALfloat ALclampf;
|
||||
|
||||
/** Openal clamped double. */
|
||||
typedef ALdouble ALclampd;
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/* bad value */
|
||||
#define AL_INVALID -1
|
||||
|
||||
#define AL_NONE 0
|
||||
|
||||
/* Boolean False. */
|
||||
#define AL_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define AL_TRUE 1
|
||||
|
||||
/** Indicate Source has relative coordinates. */
|
||||
#define AL_SOURCE_RELATIVE 0x202
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Directional source, inner cone angle, in degrees.
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
#define AL_CONE_INNER_ANGLE 0x1001
|
||||
|
||||
/**
|
||||
* Directional source, outer cone angle, in degrees.
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
#define AL_CONE_OUTER_ANGLE 0x1002
|
||||
|
||||
/**
|
||||
* Specify the pitch to be applied, either at source,
|
||||
* or on mixer results, at listener.
|
||||
* Range: [0.5-2.0]
|
||||
* Default: 1.0
|
||||
*/
|
||||
#define AL_PITCH 0x1003
|
||||
|
||||
/**
|
||||
* Specify the current location in three dimensional space.
|
||||
* OpenAL, like OpenGL, uses a right handed coordinate system,
|
||||
* where in a frontal default view X (thumb) points right,
|
||||
* Y points up (index finger), and Z points towards the
|
||||
* viewer/camera (middle finger).
|
||||
* To switch from a left handed coordinate system, flip the
|
||||
* sign on the Z coordinate.
|
||||
* Listener position is always in the world coordinate system.
|
||||
*/
|
||||
#define AL_POSITION 0x1004
|
||||
|
||||
/** Specify the current direction. */
|
||||
#define AL_DIRECTION 0x1005
|
||||
|
||||
/** Specify the current velocity in three dimensional space. */
|
||||
#define AL_VELOCITY 0x1006
|
||||
|
||||
/**
|
||||
* Indicate whether source is looping.
|
||||
* Type: ALboolean?
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: FALSE.
|
||||
*/
|
||||
#define AL_LOOPING 0x1007
|
||||
|
||||
/**
|
||||
* Indicate the buffer to provide sound samples.
|
||||
* Type: ALuint.
|
||||
* Range: any valid Buffer id.
|
||||
*/
|
||||
#define AL_BUFFER 0x1009
|
||||
|
||||
/**
|
||||
* Indicate the gain (volume amplification) applied.
|
||||
* Type: ALfloat.
|
||||
* Range: ]0.0- ]
|
||||
* A value of 1.0 means un-attenuated/unchanged.
|
||||
* Each division by 2 equals an attenuation of -6dB.
|
||||
* Each multiplicaton with 2 equals an amplification of +6dB.
|
||||
* A value of 0.0 is meaningless with respect to a logarithmic
|
||||
* scale; it is interpreted as zero volume - the channel
|
||||
* is effectively disabled.
|
||||
*/
|
||||
#define AL_GAIN 0x100A
|
||||
|
||||
/*
|
||||
* Indicate minimum source attenuation
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* Logarthmic
|
||||
*/
|
||||
#define AL_MIN_GAIN 0x100D
|
||||
|
||||
/**
|
||||
* Indicate maximum source attenuation
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* Logarthmic
|
||||
*/
|
||||
#define AL_MAX_GAIN 0x100E
|
||||
|
||||
/**
|
||||
* Indicate listener orientation.
|
||||
*
|
||||
* at/up
|
||||
*/
|
||||
#define AL_ORIENTATION 0x100F
|
||||
|
||||
/**
|
||||
* Specify the channel mask. (Creative)
|
||||
* Type: ALuint
|
||||
* Range: [0 - 255]
|
||||
*/
|
||||
#define AL_CHANNEL_MASK 0x3000
|
||||
|
||||
|
||||
/**
|
||||
* Source state information.
|
||||
*/
|
||||
#define AL_SOURCE_STATE 0x1010
|
||||
#define AL_INITIAL 0x1011
|
||||
#define AL_PLAYING 0x1012
|
||||
#define AL_PAUSED 0x1013
|
||||
#define AL_STOPPED 0x1014
|
||||
|
||||
/**
|
||||
* Buffer Queue params
|
||||
*/
|
||||
#define AL_BUFFERS_QUEUED 0x1015
|
||||
#define AL_BUFFERS_PROCESSED 0x1016
|
||||
|
||||
/**
|
||||
* Source buffer position information
|
||||
*/
|
||||
#define AL_SEC_OFFSET 0x1024
|
||||
#define AL_SAMPLE_OFFSET 0x1025
|
||||
#define AL_BYTE_OFFSET 0x1026
|
||||
|
||||
/*
|
||||
* Source type (Static, Streaming or undetermined)
|
||||
* Source is Static if a Buffer has been attached using AL_BUFFER
|
||||
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
|
||||
* Source is undetermined when it has the NULL buffer attached
|
||||
*/
|
||||
#define AL_SOURCE_TYPE 0x1027
|
||||
#define AL_STATIC 0x1028
|
||||
#define AL_STREAMING 0x1029
|
||||
#define AL_UNDETERMINED 0x1030
|
||||
|
||||
/** Sound samples: format specifier. */
|
||||
#define AL_FORMAT_MONO8 0x1100
|
||||
#define AL_FORMAT_MONO16 0x1101
|
||||
#define AL_FORMAT_STEREO8 0x1102
|
||||
#define AL_FORMAT_STEREO16 0x1103
|
||||
|
||||
/**
|
||||
* source specific reference distance
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*
|
||||
* At 0.0, no distance attenuation occurs. Default is
|
||||
* 1.0.
|
||||
*/
|
||||
#define AL_REFERENCE_DISTANCE 0x1020
|
||||
|
||||
/**
|
||||
* source specific rolloff factor
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*
|
||||
*/
|
||||
#define AL_ROLLOFF_FACTOR 0x1021
|
||||
|
||||
/**
|
||||
* Directional source, outer cone gain.
|
||||
*
|
||||
* Default: 0.0
|
||||
* Range: [0.0 - 1.0]
|
||||
* Logarithmic
|
||||
*/
|
||||
#define AL_CONE_OUTER_GAIN 0x1022
|
||||
|
||||
/**
|
||||
* Indicate distance above which sources are not
|
||||
* attenuated using the inverse clamped distance model.
|
||||
*
|
||||
* Default: +inf
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*/
|
||||
#define AL_MAX_DISTANCE 0x1023
|
||||
|
||||
/**
|
||||
* Sound samples: frequency, in units of Hertz [Hz].
|
||||
* This is the number of samples per second. Half of the
|
||||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
#define AL_FREQUENCY 0x2001
|
||||
#define AL_BITS 0x2002
|
||||
#define AL_CHANNELS 0x2003
|
||||
#define AL_SIZE 0x2004
|
||||
#define AL_DATA 0x2005
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not supported for public use (yet).
|
||||
*/
|
||||
#define AL_UNUSED 0x2010
|
||||
#define AL_PENDING 0x2011
|
||||
#define AL_PROCESSED 0x2012
|
||||
|
||||
|
||||
/** Errors: No Error. */
|
||||
#define AL_NO_ERROR AL_FALSE
|
||||
|
||||
/**
|
||||
* Invalid Name paramater passed to AL call.
|
||||
*/
|
||||
#define AL_INVALID_NAME 0xA001
|
||||
|
||||
/**
|
||||
* Invalid parameter passed to AL call.
|
||||
*/
|
||||
#define AL_ILLEGAL_ENUM 0xA002
|
||||
#define AL_INVALID_ENUM 0xA002
|
||||
|
||||
/**
|
||||
* Invalid enum parameter value.
|
||||
*/
|
||||
#define AL_INVALID_VALUE 0xA003
|
||||
|
||||
/**
|
||||
* Illegal call.
|
||||
*/
|
||||
#define AL_ILLEGAL_COMMAND 0xA004
|
||||
#define AL_INVALID_OPERATION 0xA004
|
||||
|
||||
|
||||
/**
|
||||
* No mojo.
|
||||
*/
|
||||
#define AL_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Context strings: Vendor Name. */
|
||||
#define AL_VENDOR 0xB001
|
||||
#define AL_VERSION 0xB002
|
||||
#define AL_RENDERER 0xB003
|
||||
#define AL_EXTENSIONS 0xB004
|
||||
|
||||
/** Global tweakage. */
|
||||
|
||||
/**
|
||||
* Doppler scale. Default 1.0
|
||||
*/
|
||||
#define AL_DOPPLER_FACTOR 0xC000
|
||||
|
||||
/**
|
||||
* Tweaks speed of propagation.
|
||||
*/
|
||||
#define AL_DOPPLER_VELOCITY 0xC001
|
||||
|
||||
/**
|
||||
* Speed of Sound in units per second
|
||||
*/
|
||||
#define AL_SPEED_OF_SOUND 0xC003
|
||||
|
||||
/**
|
||||
* Distance models
|
||||
*
|
||||
* used in conjunction with DistanceModel
|
||||
*
|
||||
* implicit: NONE, which disances distance attenuation.
|
||||
*/
|
||||
#define AL_DISTANCE_MODEL 0xD000
|
||||
#define AL_INVERSE_DISTANCE 0xD001
|
||||
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
|
||||
#define AL_LINEAR_DISTANCE 0xD003
|
||||
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
|
||||
#define AL_EXPONENT_DISTANCE 0xD005
|
||||
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user