Separating projects into separate workspaces

--HG--
rename : KREngine/3rdparty/forsyth/forsyth.cpp => 3rdparty/forsyth/forsyth.cpp
rename : KREngine/3rdparty/forsyth/forsyth.h => 3rdparty/forsyth/forsyth.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTArray.h => 3rdparty/pvrtexlib/include/PVRTArray.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTDecompress.h => 3rdparty/pvrtexlib/include/PVRTDecompress.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTError.h => 3rdparty/pvrtexlib/include/PVRTError.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTGlobal.h => 3rdparty/pvrtexlib/include/PVRTGlobal.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTMap.h => 3rdparty/pvrtexlib/include/PVRTMap.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTString.h => 3rdparty/pvrtexlib/include/PVRTString.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTTexture.h => 3rdparty/pvrtexlib/include/PVRTTexture.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTexture.h => 3rdparty/pvrtexlib/include/PVRTexture.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTextureDefines.h => 3rdparty/pvrtexlib/include/PVRTextureDefines.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTextureFormat.h => 3rdparty/pvrtexlib/include/PVRTextureFormat.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTextureHeader.h => 3rdparty/pvrtexlib/include/PVRTextureHeader.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTextureUtilities.h => 3rdparty/pvrtexlib/include/PVRTextureUtilities.h
rename : KREngine/3rdparty/pvrtexlib/include/PVRTextureVersion.h => 3rdparty/pvrtexlib/include/PVRTextureVersion.h
rename : KREngine/3rdparty/pvrtexlib/static_osx/libPVRTexLib.a => 3rdparty/pvrtexlib/static_osx/libPVRTexLib.a
rename : KREngine/3rdparty/tinyxml2/tinyxml2.cpp => 3rdparty/tinyxml2/tinyxml2.cpp
rename : KREngine/3rdparty/tinyxml2/tinyxml2.h => 3rdparty/tinyxml2/tinyxml2.h
rename : KREngine/3rdparty/tinyxml2/tinyxml2_readme.txt => 3rdparty/tinyxml2/tinyxml2_readme.txt
rename : KREngine/Kraken.xcodeproj/project.pbxproj => Kraken.xcodeproj/project.pbxproj
rename : KREngine/Kraken.xcodeproj/project.xcworkspace/contents.xcworkspacedata => Kraken.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename : KREngine/kraken/KRAABB.cpp => kraken/KRAABB.cpp
rename : KREngine/kraken/KRAABB.h => kraken/KRAABB.h
rename : KREngine/kraken/KRAmbientZone.cpp => kraken/KRAmbientZone.cpp
rename : KREngine/kraken/KRAmbientZone.h => kraken/KRAmbientZone.h
rename : KREngine/kraken/KRAnimation.cpp => kraken/KRAnimation.cpp
rename : KREngine/kraken/KRAnimation.h => kraken/KRAnimation.h
rename : KREngine/kraken/KRAnimationAttribute.cpp => kraken/KRAnimationAttribute.cpp
rename : KREngine/kraken/KRAnimationAttribute.h => kraken/KRAnimationAttribute.h
rename : KREngine/kraken/KRAnimationCurve.cpp => kraken/KRAnimationCurve.cpp
rename : KREngine/kraken/KRAnimationCurve.h => kraken/KRAnimationCurve.h
rename : KREngine/kraken/KRAnimationCurveManager.cpp => kraken/KRAnimationCurveManager.cpp
rename : KREngine/kraken/KRAnimationCurveManager.h => kraken/KRAnimationCurveManager.h
rename : KREngine/kraken/KRAnimationLayer.cpp => kraken/KRAnimationLayer.cpp
rename : KREngine/kraken/KRAnimationLayer.h => kraken/KRAnimationLayer.h
rename : KREngine/kraken/KRAnimationManager.cpp => kraken/KRAnimationManager.cpp
rename : KREngine/kraken/KRAnimationManager.h => kraken/KRAnimationManager.h
rename : KREngine/kraken/KRAudioBuffer.cpp => kraken/KRAudioBuffer.cpp
rename : KREngine/kraken/KRAudioBuffer.h => kraken/KRAudioBuffer.h
rename : KREngine/kraken/KRAudioManager.cpp => kraken/KRAudioManager.cpp
rename : KREngine/kraken/KRAudioManager.h => kraken/KRAudioManager.h
rename : KREngine/kraken/KRAudioSample.cpp => kraken/KRAudioSample.cpp
rename : KREngine/kraken/KRAudioSample.h => kraken/KRAudioSample.h
rename : KREngine/kraken/KRAudioSource.cpp => kraken/KRAudioSource.cpp
rename : KREngine/kraken/KRAudioSource.h => kraken/KRAudioSource.h
rename : KREngine/kraken/KRBehavior.cpp => kraken/KRBehavior.cpp
rename : KREngine/kraken/KRBehavior.h => kraken/KRBehavior.h
rename : KREngine/kraken/KRBone.cpp => kraken/KRBone.cpp
rename : KREngine/kraken/KRBone.h => kraken/KRBone.h
rename : KREngine/kraken/KRBundle.cpp => kraken/KRBundle.cpp
rename : KREngine/kraken/KRBundle.h => kraken/KRBundle.h
rename : KREngine/kraken/KRBundleManager.cpp => kraken/KRBundleManager.cpp
rename : KREngine/kraken/KRBundleManager.h => kraken/KRBundleManager.h
rename : KREngine/kraken/KRCamera.cpp => kraken/KRCamera.cpp
rename : KREngine/kraken/KRCamera.h => kraken/KRCamera.h
rename : KREngine/kraken/KRCollider.cpp => kraken/KRCollider.cpp
rename : KREngine/kraken/KRCollider.h => kraken/KRCollider.h
rename : KREngine/kraken/KRContext.cpp => kraken/KRContext.cpp
rename : KREngine/kraken/KRContext.h => kraken/KRContext.h
rename : KREngine/kraken/KRContextObject.cpp => kraken/KRContextObject.cpp
rename : KREngine/kraken/KRContextObject.h => kraken/KRContextObject.h
rename : KREngine/kraken/KRDataBlock.cpp => kraken/KRDataBlock.cpp
rename : KREngine/kraken/KRDataBlock.h => kraken/KRDataBlock.h
rename : KREngine/kraken/KRDirectionalLight.cpp => kraken/KRDirectionalLight.cpp
rename : KREngine/kraken/KRDirectionalLight.h => kraken/KRDirectionalLight.h
rename : KREngine/kraken/KREngine-common.h => kraken/KREngine-common.h
rename : KREngine/kraken/KREngine.h => kraken/KREngine.h
rename : KREngine/kraken/KREngine.mm => kraken/KREngine.mm
rename : KREngine/kraken/KRFloat.cpp => kraken/KRFloat.cpp
rename : KREngine/kraken/KRFloat.h => kraken/KRFloat.h
rename : KREngine/kraken/KRHitInfo.cpp => kraken/KRHitInfo.cpp
rename : KREngine/kraken/KRHitInfo.h => kraken/KRHitInfo.h
rename : KREngine/kraken/KRLODGroup.cpp => kraken/KRLODGroup.cpp
rename : KREngine/kraken/KRLODGroup.h => kraken/KRLODGroup.h
rename : KREngine/kraken/KRLODSet.cpp => kraken/KRLODSet.cpp
rename : KREngine/kraken/KRLODSet.h => kraken/KRLODSet.h
rename : KREngine/kraken/KRLight.cpp => kraken/KRLight.cpp
rename : KREngine/kraken/KRLight.h => kraken/KRLight.h
rename : KREngine/kraken/KRLocator.cpp => kraken/KRLocator.cpp
rename : KREngine/kraken/KRLocator.h => kraken/KRLocator.h
rename : KREngine/kraken/KRMat4.cpp => kraken/KRMat4.cpp
rename : KREngine/kraken/KRMat4.h => kraken/KRMat4.h
rename : KREngine/kraken/KRMaterial.cpp => kraken/KRMaterial.cpp
rename : KREngine/kraken/KRMaterial.h => kraken/KRMaterial.h
rename : KREngine/kraken/KRMaterialManager.cpp => kraken/KRMaterialManager.cpp
rename : KREngine/kraken/KRMaterialManager.h => kraken/KRMaterialManager.h
rename : KREngine/kraken/KRMesh.cpp => kraken/KRMesh.cpp
rename : KREngine/kraken/KRMesh.h => kraken/KRMesh.h
rename : KREngine/kraken/KRMeshCube.cpp => kraken/KRMeshCube.cpp
rename : KREngine/kraken/KRMeshCube.h => kraken/KRMeshCube.h
rename : KREngine/kraken/KRMeshManager.cpp => kraken/KRMeshManager.cpp
rename : KREngine/kraken/KRMeshManager.h => kraken/KRMeshManager.h
rename : KREngine/kraken/KRMeshQuad.cpp => kraken/KRMeshQuad.cpp
rename : KREngine/kraken/KRMeshQuad.h => kraken/KRMeshQuad.h
rename : KREngine/kraken/KRMeshSphere.cpp => kraken/KRMeshSphere.cpp
rename : KREngine/kraken/KRMeshSphere.h => kraken/KRMeshSphere.h
rename : KREngine/kraken/KRMeshStreamer.mm => kraken/KRMeshStreamer.mm
rename : KREngine/kraken/KRModel.cpp => kraken/KRModel.cpp
rename : KREngine/kraken/KRModel.h => kraken/KRModel.h
rename : KREngine/kraken/KRNode.cpp => kraken/KRNode.cpp
rename : KREngine/kraken/KRNode.h => kraken/KRNode.h
rename : KREngine/kraken/KROctree.cpp => kraken/KROctree.cpp
rename : KREngine/kraken/KROctree.h => kraken/KROctree.h
rename : KREngine/kraken/KROctreeNode.cpp => kraken/KROctreeNode.cpp
rename : KREngine/kraken/KROctreeNode.h => kraken/KROctreeNode.h
rename : KREngine/kraken/KRParticleSystem.cpp => kraken/KRParticleSystem.cpp
rename : KREngine/kraken/KRParticleSystem.h => kraken/KRParticleSystem.h
rename : KREngine/kraken/KRParticleSystemNewtonian.cpp => kraken/KRParticleSystemNewtonian.cpp
rename : KREngine/kraken/KRParticleSystemNewtonian.h => kraken/KRParticleSystemNewtonian.h
rename : KREngine/kraken/KRPointLight.cpp => kraken/KRPointLight.cpp
rename : KREngine/kraken/KRPointLight.h => kraken/KRPointLight.h
rename : KREngine/kraken/KRQuaternion.cpp => kraken/KRQuaternion.cpp
rename : KREngine/kraken/KRQuaternion.h => kraken/KRQuaternion.h
rename : KREngine/kraken/KRRenderSettings.cpp => kraken/KRRenderSettings.cpp
rename : KREngine/kraken/KRRenderSettings.h => kraken/KRRenderSettings.h
rename : KREngine/kraken/KRResource+blend.cpp => kraken/KRResource+blend.cpp
rename : KREngine/kraken/KRResource+blend.h => kraken/KRResource+blend.h
rename : KREngine/kraken/KRResource+fbx.cpp => kraken/KRResource+fbx.cpp
rename : KREngine/kraken/KRResource+obj.cpp => kraken/KRResource+obj.cpp
rename : KREngine/kraken/KRResource.cpp => kraken/KRResource.cpp
rename : KREngine/kraken/KRResource.h => kraken/KRResource.h
rename : KREngine/kraken/KRReverbZone.cpp => kraken/KRReverbZone.cpp
rename : KREngine/kraken/KRReverbZone.h => kraken/KRReverbZone.h
rename : KREngine/kraken/KRScene.cpp => kraken/KRScene.cpp
rename : KREngine/kraken/KRScene.h => kraken/KRScene.h
rename : KREngine/kraken/KRSceneManager.cpp => kraken/KRSceneManager.cpp
rename : KREngine/kraken/KRSceneManager.h => kraken/KRSceneManager.h
rename : KREngine/kraken/KRShader.cpp => kraken/KRShader.cpp
rename : KREngine/kraken/KRShader.h => kraken/KRShader.h
rename : KREngine/kraken/KRShaderManager.cpp => kraken/KRShaderManager.cpp
rename : KREngine/kraken/KRShaderManager.h => kraken/KRShaderManager.h
rename : KREngine/kraken/KRSpotLight.cpp => kraken/KRSpotLight.cpp
rename : KREngine/kraken/KRSpotLight.h => kraken/KRSpotLight.h
rename : KREngine/kraken/KRSprite.cpp => kraken/KRSprite.cpp
rename : KREngine/kraken/KRSprite.h => kraken/KRSprite.h
rename : KREngine/kraken/KRStockGeometry.h => kraken/KRStockGeometry.h
rename : KREngine/kraken/KRStreamer.h => kraken/KRStreamer.h
rename : KREngine/kraken/KRStreamer.mm => kraken/KRStreamer.mm
rename : KREngine/kraken/KRTexture.cpp => kraken/KRTexture.cpp
rename : KREngine/kraken/KRTexture.h => kraken/KRTexture.h
rename : KREngine/kraken/KRTexture2D.cpp => kraken/KRTexture2D.cpp
rename : KREngine/kraken/KRTexture2D.h => kraken/KRTexture2D.h
rename : KREngine/kraken/KRTextureAnimated.cpp => kraken/KRTextureAnimated.cpp
rename : KREngine/kraken/KRTextureAnimated.h => kraken/KRTextureAnimated.h
rename : KREngine/kraken/KRTextureCube.cpp => kraken/KRTextureCube.cpp
rename : KREngine/kraken/KRTextureCube.h => kraken/KRTextureCube.h
rename : KREngine/kraken/KRTextureKTX.cpp => kraken/KRTextureKTX.cpp
rename : KREngine/kraken/KRTextureKTX.h => kraken/KRTextureKTX.h
rename : KREngine/kraken/KRTextureManager.cpp => kraken/KRTextureManager.cpp
rename : KREngine/kraken/KRTextureManager.h => kraken/KRTextureManager.h
rename : KREngine/kraken/KRTexturePVR.cpp => kraken/KRTexturePVR.cpp
rename : KREngine/kraken/KRTexturePVR.h => kraken/KRTexturePVR.h
rename : KREngine/kraken/KRTextureStreamer.mm => kraken/KRTextureStreamer.mm
rename : KREngine/kraken/KRTextureTGA.cpp => kraken/KRTextureTGA.cpp
rename : KREngine/kraken/KRTextureTGA.h => kraken/KRTextureTGA.h
rename : KREngine/kraken/KRTriangle3.cpp => kraken/KRTriangle3.cpp
rename : KREngine/kraken/KRTriangle3.h => kraken/KRTriangle3.h
rename : KREngine/kraken/KRUnknown.cpp => kraken/KRUnknown.cpp
rename : KREngine/kraken/KRUnknown.h => kraken/KRUnknown.h
rename : KREngine/kraken/KRUnknownManager.cpp => kraken/KRUnknownManager.cpp
rename : KREngine/kraken/KRUnknownManager.h => kraken/KRUnknownManager.h
rename : KREngine/kraken/KRVector2.cpp => kraken/KRVector2.cpp
rename : KREngine/kraken/KRVector2.h => kraken/KRVector2.h
rename : KREngine/kraken/KRVector3.cpp => kraken/KRVector3.cpp
rename : KREngine/kraken/KRVector3.h => kraken/KRVector3.h
rename : KREngine/kraken/KRVector4.cpp => kraken/KRVector4.cpp
rename : KREngine/kraken/KRVector4.h => kraken/KRVector4.h
rename : KREngine/kraken/KRViewport.cpp => kraken/KRViewport.cpp
rename : KREngine/kraken/KRViewport.h => kraken/KRViewport.h
rename : KREngine/kraken_ios/Kraken-Prefix.pch => kraken_ios/Kraken-Prefix.pch
rename : KREngine/kraken_osx/Kraken-Info.plist => kraken_osx/Kraken-Info.plist
rename : KRWorldBuilder/KRWorldBuilder/en.lproj/InfoPlist.strings => kraken_osx/en.lproj/InfoPlist.strings
rename : KREngine/kraken_osx/kraken-prefix.pch => kraken_osx/kraken-prefix.pch
rename : KREngine/kraken_osx/krengine_osx.h => kraken_osx/krengine_osx.h
rename : KREngine/kraken_osx/krengine_osx.mm => kraken_osx/krengine_osx.mm
rename : KREngine/kraken_standard_assets/hrtf_kemar.krbundle => kraken_standard_assets/hrtf_kemar.krbundle
rename : KREngine/kraken_standard_assets_osx/Resources-Info.plist => kraken_standard_assets_ios/Resources-Info.plist
rename : KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.fsh => kraken_standard_assets_ios/Shaders/ObjectShader.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh => kraken_standard_assets_ios/Shaders/ObjectShader.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/PostShader.fsh => kraken_standard_assets_ios/Shaders/PostShader.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh => kraken_standard_assets_ios/Shaders/PostShader.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh => kraken_standard_assets_ios/Shaders/ShadowShader.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/ShadowShader.vsh => kraken_standard_assets_ios/Shaders/ShadowShader.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/debug_font.fsh => kraken_standard_assets_ios/Shaders/debug_font.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh => kraken_standard_assets_ios/Shaders/debug_font.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/dust_particle.fsh => kraken_standard_assets_ios/Shaders/dust_particle.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh => kraken_standard_assets_ios/Shaders/dust_particle.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/flare.fsh => kraken_standard_assets_ios/Shaders/flare.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/flare.vsh => kraken_standard_assets_ios/Shaders/flare.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh => kraken_standard_assets_ios/Shaders/light_directional.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh => kraken_standard_assets_ios/Shaders/light_directional.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_osx.fsh => kraken_standard_assets_ios/Shaders/light_point.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_osx.vsh => kraken_standard_assets_ios/Shaders/light_point.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh => kraken_standard_assets_ios/Shaders/light_point_inside.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh => kraken_standard_assets_ios/Shaders/light_point_inside.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/occlusion_test.fsh => kraken_standard_assets_ios/Shaders/occlusion_test.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/occlusion_test.vsh => kraken_standard_assets_ios/Shaders/occlusion_test.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh => kraken_standard_assets_ios/Shaders/simple_blit.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/simple_blit.vsh => kraken_standard_assets_ios/Shaders/simple_blit.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/sky_box.fsh => kraken_standard_assets_ios/Shaders/sky_box.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/sky_box.vsh => kraken_standard_assets_ios/Shaders/sky_box.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.fsh => kraken_standard_assets_ios/Shaders/sprite.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.vsh => kraken_standard_assets_ios/Shaders/sprite.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh => kraken_standard_assets_ios/Shaders/visualize_overlay.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/visualize_overlay.vsh => kraken_standard_assets_ios/Shaders/visualize_overlay.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/volumetric_fog.fsh => kraken_standard_assets_ios/Shaders/volumetric_fog.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh => kraken_standard_assets_ios/Shaders/volumetric_fog.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/volumetric_fog_downsampled.fsh => kraken_standard_assets_ios/Shaders/volumetric_fog_downsampled.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/volumetric_fog_downsampled.vsh => kraken_standard_assets_ios/Shaders/volumetric_fog_downsampled.vsh
rename : KREngine/kraken_standard_assets_ios/font.pvr => kraken_standard_assets_ios/font.pvr
rename : KREngine/kraken_standard_assets_osx/Resources-Info.plist => kraken_standard_assets_osx/Resources-Info.plist
rename : KREngine/kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh => kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/ObjectShader.vsh => kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/PostShader_osx.fsh => kraken_standard_assets_osx/Shaders/PostShader_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh => kraken_standard_assets_osx/Shaders/PostShader_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh => kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/ShadowShader.vsh => kraken_standard_assets_osx/Shaders/ShadowShader_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/debug_font_osx.fsh => kraken_standard_assets_osx/Shaders/debug_font_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh => kraken_standard_assets_osx/Shaders/debug_font_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh => kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh => kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/flare.fsh => kraken_standard_assets_osx/Shaders/flare_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/flare_osx.vsh => kraken_standard_assets_osx/Shaders/flare_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh => kraken_standard_assets_osx/Shaders/light_directional_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh => kraken_standard_assets_osx/Shaders/light_directional_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh => kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh => kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_osx.fsh => kraken_standard_assets_osx/Shaders/light_point_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/light_point_osx.vsh => kraken_standard_assets_osx/Shaders/light_point_osx.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/occlusion_test.fsh => kraken_standard_assets_osx/Shaders/occlusion_test_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/occlusion_test.vsh => kraken_standard_assets_osx/Shaders/occlusion_test_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh => kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/simple_blit.vsh => kraken_standard_assets_osx/Shaders/simple_blit_osx.vsh
rename : KREngine/kraken_standard_assets_ios/Shaders/sky_box.fsh => kraken_standard_assets_osx/Shaders/sky_box_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/sky_box_osx.vsh => kraken_standard_assets_osx/Shaders/sky_box_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.fsh => kraken_standard_assets_osx/Shaders/sprite_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.vsh => kraken_standard_assets_osx/Shaders/sprite_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh => kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/visualize_overlay.vsh => kraken_standard_assets_osx/Shaders/visualize_overlay_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh => kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh
rename : KREngine/kraken_standard_assets_ios/Shaders/volumetric_fog_downsampled.vsh => kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.vsh
rename : KREngine/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh => kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh
rename : KREngine/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh => kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh
rename : KREngine/kraken_standard_assets_osx/font.tga => kraken_standard_assets_osx/font.tga
This commit is contained in:
2014-09-10 22:25:39 -07:00
parent 8c965c8f0d
commit 1afe308047
313 changed files with 0 additions and 12817 deletions

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.kearwood.kraken.assets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFPlugInDynamicRegisterFunction</key>
<string></string>
<key>CFPlugInDynamicRegistration</key>
<string>NO</string>
<key>CFPlugInFactories</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<string>MyFactoryFunction</string>
</dict>
<key>CFPlugInTypes</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<array>
<string>00000000-0000-0000-0000-000000000000</string>
</array>
</dict>
<key>CFPlugInUnloadFunction</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013 Kearwood Software. All rights reserved.</string>
</dict>
</plist>

View File

@@ -0,0 +1,420 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
//#extension GL_EXT_shadow_samplers : require
#if ENABLE_RIM_COLOR == 1
uniform lowp vec3 rim_color;
uniform mediump float rim_power;
#endif
#if FOG_TYPE > 0
// FOG_TYPE 1 - Linear
// FOG_TYPE 2 - Exponential
// FOG_TYPE 3 - Exponential squared
uniform lowp vec3 fog_color;
uniform mediump float fog_near;
#if FOG_TYPE == 1
uniform mediump float fog_far;
uniform mediump float fog_scale;
#endif
#if FOG_TYPE > 1
uniform mediump float fog_density;
#endif
#if FOG_TYPE == 2
uniform mediump float fog_density_premultiplied_exponential;
#endif
#if FOG_TYPE == 3
uniform mediump float fog_density_premultiplied_squared;
#endif
#endif
#if ENABLE_PER_PIXEL == 1 || GBUFFER_PASS == 1
uniform mediump float material_shininess;
#if HAS_NORMAL_MAP == 1
uniform sampler2D normalTexture;
#else
varying mediump vec3 normal;
#endif
#if HAS_DIFFUSE_MAP == 1 || HAS_NORMAL_MAP == 1 || HAS_SPEC_MAP == 1 || HAS_REFLECTION_MAP == 1
varying highp vec2 texCoord;
#endif
#if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1
varying highp vec2 normal_uv;
#else
#define normal_uv texCoord
#endif
#else
#if HAS_DIFFUSE_MAP == 1
varying highp vec2 texCoord;
#endif
#endif
#if GBUFFER_PASS == 3
uniform sampler2D gbuffer_frame;
uniform sampler2D gbuffer_depth;
#endif
#if GBUFFER_PASS == 1
#if HAS_NORMAL_MAP == 1
varying highp mat3 tangent_to_view_matrix;
#else
uniform highp mat4 model_view_inverse_transpose_matrix;
#endif
#if HAS_DIFFUSE_MAP == 1 && ALPHA_TEST == 1
uniform sampler2D diffuseTexture;
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
varying highp vec2 diffuse_uv;
#else
#define diffuse_uv texCoord
#endif
#endif
#else
uniform lowp vec3 material_ambient, material_diffuse, material_specular;
uniform lowp float material_alpha;
#if HAS_DIFFUSE_MAP == 1
uniform sampler2D diffuseTexture;
#endif
#if HAS_SPEC_MAP == 1
uniform sampler2D specularTexture;
#endif
#if HAS_REFLECTION_MAP == 1
uniform sampler2D reflectionTexture;
#endif
#if ENABLE_RIM_COLOR == 1
#define NEED_EYEVEC
#endif
#if HAS_REFLECTION_CUBE_MAP == 1
uniform lowp vec3 material_reflection;
uniform samplerCube reflectionCubeTexture;
#if HAS_NORMAL_MAP == 1
varying highp mat3 tangent_to_world_matrix;
#define NEED_EYEVEC
uniform highp mat4 model_matrix;
#else
varying mediump vec3 reflectionVec;
#endif
#endif
#ifdef NEED_EYEVEC
varying mediump vec3 eyeVec;
#endif
#if SHADOW_QUALITY >= 1
#ifdef GL_EXT_shadow_samplers
uniform sampler2DShadow shadowTexture1;
#else
uniform sampler2D shadowTexture1;
#endif
varying highp vec4 shadowMapCoord1;
#endif
#if HAS_LIGHT_MAP == 1
uniform sampler2D lightmapTexture;
varying mediump vec2 lightmap_uv;
#endif
#if SHADOW_QUALITY >= 2
uniform sampler2D shadowTexture2;
varying highp vec4 shadowMapCoord2;
#endif
#if SHADOW_QUALITY >= 3
uniform sampler2D shadowTexture3;
varying highp vec4 shadowMapCoord3;
#endif
#if ENABLE_PER_PIXEL == 1
varying mediump vec3 lightVec;
varying mediump vec3 halfVec;
#else
varying mediump float lamberFactor;
varying mediump float specularFactor;
#endif
#if (HAS_SPEC_MAP_OFFSET == 1|| HAS_SPEC_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1
varying mediump vec2 spec_uv;
#else
#define spec_uv texCoord
#endif
#if (HAS_REFLECTION_MAP_OFFSET == 1|| HAS_REFLECTION_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1
varying mediump vec2 reflection_uv;
#else
#define reflection_uv texCoord
#endif
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
varying highp vec2 diffuse_uv;
#else
#define diffuse_uv texCoord
#endif
#endif
#if GBUFFER_PASS == 1 || GBUFFER_PASS == 3
uniform mediump vec4 viewport;
#endif
void main()
{
#if ALPHA_TEST == 1 && HAS_DIFFUSE_MAP == 1
mediump vec4 diffuseMaterial = texture2D(diffuseTexture, diffuse_uv);
if(diffuseMaterial.a < 0.5) discard;
#endif
#if GBUFFER_PASS == 1 && ALPHA_TEST == 1
if(texture2D(diffuseTexture, diffuse_uv).a < 0.5) discard;
#endif
#if GBUFFER_PASS == 2 || GBUFFER_PASS == 3
mediump vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
#endif
#if GBUFFER_PASS == 3
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
mediump vec3 gbuffer_lamber_factor = gbuffer_sample.rgb * 5.0;
lowp float gbuffer_specular_factor = gbuffer_sample.a;
#endif
#if GBUFFER_PASS == 1
#if HAS_NORMAL_MAP == 1
// lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize
mediump vec3 normal = normalize(2.0 * texture2D(normalTexture,normal_uv).rgb - 1.0);
mediump vec3 view_space_normal = tangent_to_view_matrix * normal;
#else
mediump vec3 view_space_normal = vec3(model_view_inverse_transpose_matrix * vec4(normal, 1.0));
#endif
gl_FragColor = vec4(view_space_normal * 0.5 + 0.5, material_shininess / 100.0);
#else
#if HAS_DIFFUSE_MAP == 1
#if ALPHA_TEST == 1
diffuseMaterial.a = 1.0;
#else
mediump vec4 diffuseMaterial = texture2D(diffuseTexture, diffuse_uv);
#endif
#else
mediump vec4 diffuseMaterial = vec4(1.0);
#endif
#if ENABLE_PER_PIXEL == 1
#if HAS_NORMAL_MAP == 1
// lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize
mediump vec3 normal = normalize(2.0 * texture2D(normalTexture,normal_uv).rgb - 1.0);
#endif
#if GBUFFER_PASS == 3
mediump vec3 lamberFactor = gbuffer_lamber_factor;
#else
mediump float lamberFactor = max(0.0,dot(lightVec, normal));
#endif
mediump float specularFactor = 0.0;
if(material_shininess > 0.0) {
#if GBUFFER_PASS == 3
specularFactor = gbuffer_specular_factor;
#else
specularFactor = max(0.0,pow(dot(halfVec,normal), material_shininess));
#endif
}
#ifdef GL_EXT_shadow_samplers
#if SHADOW_QUALITY == 1
lowp float shadow = shadow2DProjEXT(shadowTexture1, shadowMapCoord1);
lamberFactor *= shadow;
specularFactor *= shadow;
#endif
#else
#if SHADOW_QUALITY == 1
highp float shadowMapDepth = 1.0;
highp float vertexShadowDepth = 1.0;
highp vec2 shadowMapPos = (shadowMapCoord1 / shadowMapCoord1.w).st;
if(shadowMapCoord1.x >= -1.0 && shadowMapCoord1.x <= 1.0 && shadowMapCoord1.y >= -1.0 && shadowMapCoord1.y <= 1.0 && shadowMapCoord1.z >= 0.0 && shadowMapCoord1.z <= 1.0) {
#if DEBUG_PSSM == 1
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5, 0.0);
#endif
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
vertexShadowDepth = (shadowMapCoord1 / shadowMapCoord1.w).z;
}
#endif
#if SHADOW_QUALITY >= 2
highp float shadowMapDepth = 1.0;
highp float vertexShadowDepth = 1.0;
if(shadowMapCoord1.x >= -1.0 && shadowMapCoord1.x <= 1.0 && shadowMapCoord1.y >= -1.0 && shadowMapCoord1.y <= 1.0 && shadowMapCoord1.z >= 0.0 && shadowMapCoord1.z <= 1.0) {
#if DEBUG_PSSM == 1
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5 * diffuseMaterial.a, 0.0);
#endif
highp vec2 shadowMapPos = (shadowMapCoord1 / shadowMapCoord1.w).st;
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
vertexShadowDepth = (shadowMapCoord1 / shadowMapCoord1.w).z;
} else if(shadowMapCoord2.s >= -1.0 && shadowMapCoord2.s <= 1.0 && shadowMapCoord2.t >= -1.0 && shadowMapCoord2.t <= 1.0 && shadowMapCoord2.z >= 0.0 && shadowMapCoord2.z <= 1.0) {
#if DEBUG_PSSM == 1
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.50, 0.75, 1.0) + vec4(0.0, 0.5 * diffuseMaterial.a, 0.0, 0.0);
#endif
highp vec2 shadowMapPos = (shadowMapCoord2 / shadowMapCoord2.w).st;
shadowMapDepth = texture2D(shadowTexture2, shadowMapPos).z;
vertexShadowDepth = (shadowMapCoord2 / shadowMapCoord2.w).z;
}
#if SHADOW_QUALITY >= 3
else if(shadowMapCoord3.s >= -1.0 && shadowMapCoord3.s <= 1.0 && shadowMapCoord3.t >= -1.0 && shadowMapCoord3.t <= 1.0 && shadowMapCoord3.z >= 0.0 && shadowMapCoord3.z <= 1.0) {
#if DEBUG_PSSM == 1
diffuseMaterial = diffuseMaterial * vec4(0.50, 0.75, 0.75, 1.0) + vec4(0.5 * diffuseMaterial.a, 0.0, 0.0, 0.0);
#endif
highp vec2 shadowMapPos = (shadowMapCoord3 / shadowMapCoord3.w).st;
shadowMapDepth = texture2D(shadowTexture3, shadowMapPos).z;
vertexShadowDepth = (shadowMapCoord3 / shadowMapCoord3.w).z;
}
#endif
#endif
#if SHADOW_QUALITY >= 1
if(vertexShadowDepth >= shadowMapDepth && shadowMapDepth < 1.0) {
#if GBUFFER_PASS == 3
lamberFactor = vec3(0.0);
#else
lamberFactor = 0.0;
#endif
specularFactor = 0.0;
}
#endif
#endif
#endif
#if ENABLE_AMBIENT == 1
// -------------------- Add ambient light and alpha component --------------------
gl_FragColor = vec4(vec3(diffuseMaterial) * material_ambient, 0.0);
#else
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
#endif
#if ENABLE_DIFFUSE == 1
// -------------------- Add diffuse light --------------------
gl_FragColor += diffuseMaterial * vec4(material_diffuse * lamberFactor, 1.0);
#endif
// -------------------- Apply material_alpha --------------------
#if ALPHA_BLEND == 1
gl_FragColor.a = diffuseMaterial.a;
gl_FragColor *= material_alpha;
#endif
// -------------------- Add specular light --------------------
// Additive, not masked against diffuse alpha
#if ENABLE_SPECULAR == 1
#if HAS_SPEC_MAP == 1 && ENABLE_PER_PIXEL == 1
gl_FragColor.rgb += material_specular * vec3(texture2D(specularTexture, spec_uv)) * specularFactor;
#else
gl_FragColor.rgb += material_specular * specularFactor;
#endif
#endif
// -------------------- Multiply light map --------------------
#if HAS_LIGHT_MAP == 1
mediump vec3 lightMapColor = vec3(texture2D(lightmapTexture, lightmap_uv));
//gl_FragColor = vec4(gl_FragColor.r * lightMapColor.r, gl_FragColor.g * lightMapColor.g, gl_FragColor.b * lightMapColor.b, gl_FragColor.a);
gl_FragColor.rgb *= lightMapColor;
#endif
// -------------------- Add reflected light --------------------
#if HAS_REFLECTION_CUBE_MAP == 1
// Reflected light is additive and not modulated by the light map
#if HAS_NORMAL_MAP == 1
// Calculate reflection vector as I - 2.0 * dot(N, I) * N
mediump vec3 incidenceVec = -normalize(eyeVec);
highp vec3 world_space_normal = tangent_to_world_matrix * normal;
mediump vec3 reflectionVec = mat3(model_matrix) * (incidenceVec - 2.0 * dot(world_space_normal, incidenceVec) * world_space_normal);
#endif
#if HAS_REFLECTION_MAP == 1
gl_FragColor += vec4(material_reflection, 0.0) * texture2D(reflectionTexture, reflection_uv) * vec4(textureCube(reflectionCubeTexture, reflectionVec).rgb, 1.0);
#else
gl_FragColor += vec4(material_reflection, 0.0) * vec4(textureCube(reflectionCubeTexture, reflectionVec).rgb, 1.0);
#endif
#endif
// -------------------- Apply Fog --------------------
#if FOG_TYPE == 1 || FOG_TYPE == 2 || FOG_TYPE == 3
#if FOG_TYPE == 1
// Linear fog
lowp float fog_alpha = clamp((fog_far - gl_FragCoord.z / gl_FragCoord.w) * fog_scale, 0.0, 1.0);
#endif
#if FOG_TYPE == 2
// Exponential fog
mediump float fog_z = gl_FragCoord.z / gl_FragCoord.w - fog_near;
lowp float fog_alpha = clamp(exp2(fog_density_premultiplied_exponential * fog_z), 0.0, 1.0);
#endif
#if FOG_TYPE == 3
// Exponential squared fog
mediump float fog_z = max(gl_FragCoord.z / gl_FragCoord.w - fog_near, 0.0);
lowp float fog_alpha = clamp(exp2(fog_density_premultiplied_squared * fog_z * fog_z), 0.0, 1.0);
#endif
#if ALPHA_BLEND == 1
gl_FragColor.rgb = mix(fog_color.rgb * gl_FragColor.a, gl_FragColor.rgb, fog_alpha);
#else
gl_FragColor.rgb = mix(fog_color.rgb, gl_FragColor.rgb, fog_alpha);
#endif
#endif
#endif
#if ENABLE_RIM_COLOR == 1
lowp float rim = 1.0 - clamp(dot(normalize(eyeVec), normal), 0.0, 1.0);
gl_FragColor += vec4(rim_color, 1.0) * pow(rim, rim_power);
#endif
#if BONE_COUNT > 0
gl_FragColor.b = 1.0;
#endif
}

View File

@@ -0,0 +1,344 @@
//
// Shader.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute highp vec3 vertex_position, vertex_normal;
#if HAS_NORMAL_MAP == 1
attribute highp vec3 vertex_tangent;
#endif
attribute mediump vec2 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
#if BONE_COUNT > 0
attribute highp vec4 bone_weights;
attribute highp vec4 bone_indexes;
uniform highp mat4 bone_transforms[BONE_COUNT];
#else
#define vertex_position_skinned vertex_position
#define vertex_normal_skinned vertex_normal
#define vertex_tangent_skinned vertex_tangent
#endif
#if ENABLE_PER_PIXEL == 1 || GBUFFER_PASS == 1
#if HAS_DIFFUSE_MAP == 1 || HAS_NORMAL_MAP == 1 || HAS_SPEC_MAP == 1 || HAS_REFLECTION_MAP == 1
varying highp vec2 texCoord;
#endif
#if HAS_NORMAL_MAP == 1
#if HAS_NORMAL_MAP_SCALE == 1
uniform highp vec2 normalTexture_Scale;
#endif
#if HAS_NORMAL_MAP_OFFSET == 1
uniform highp vec2 normalTexture_Offset;
#endif
#if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1
varying highp vec2 normal_uv;
#endif
#else
varying mediump vec3 normal;
#endif
#else
uniform mediump float material_shininess;
#if HAS_DIFFUSE_MAP == 1
varying highp vec2 texCoord;
#endif
#endif
#if GBUFFER_PASS == 1
#if HAS_NORMAL_MAP == 1
uniform highp mat4 model_view_inverse_transpose_matrix;
varying highp mat3 tangent_to_view_matrix;
#endif
#else
uniform highp vec3 light_direction_model_space; // Must be normalized before entering shader
uniform highp vec3 camera_position_model_space;
#if HAS_LIGHT_MAP == 1
attribute mediump vec2 vertex_lightmap_uv;
varying mediump vec2 lightmap_uv;
#endif
#if ENABLE_PER_PIXEL == 1
varying mediump vec3 lightVec;
varying mediump vec3 halfVec;
#if HAS_SPEC_MAP_OFFSET == 1 || HAS_SPEC_MAP_SCALE == 1
varying highp vec2 spec_uv;
#endif
#if HAS_SPEC_MAP_SCALE == 1
uniform highp vec2 specularTexture_Scale;
#endif
#if HAS_SPEC_MAP_OFFSET == 1
uniform highp vec2 specularTexture_Offset;
#endif
#if HAS_REFLECTION_MAP_OFFSET == 1 || HAS_REFLECTION_MAP_SCALE == 1
varying highp vec2 reflection_uv;
#endif
#if HAS_REFLECTION_MAP_SCALE == 1
uniform highp vec2 reflectionTexture_Scale;
#endif
#if HAS_REFLECTION_MAP_OFFSET == 1
uniform highp vec2 reflectionTexture_Offset;
#endif
#if SHADOW_QUALITY >= 1
uniform highp mat4 shadow_mvp1;
varying highp vec4 shadowMapCoord1;
#endif
#if SHADOW_QUALITY >= 2
uniform highp mat4 shadow_mvp2;
varying highp vec4 shadowMapCoord2;
#endif
#if SHADOW_QUALITY >= 3
uniform highp mat4 shadow_mvp3;
varying highp vec4 shadowMapCoord3;
#endif
#else
varying mediump float lamberFactor;
varying mediump float specularFactor;
#endif
#if ENABLE_RIM_COLOR == 1
#define NEED_EYEVEC
#endif
#if HAS_REFLECTION_CUBE_MAP == 1
#if HAS_NORMAL_MAP == 1
#define NEED_EYEVEC
uniform highp mat4 model_inverse_transpose_matrix;
varying highp mat3 tangent_to_world_matrix;
#else
uniform highp mat4 model_matrix;
varying mediump vec3 reflectionVec;
#endif
#endif
#ifdef NEED_EYEVEC
varying mediump vec3 eyeVec;
#endif
#if HAS_DIFFUSE_MAP_SCALE == 1
uniform highp vec2 diffuseTexture_Scale;
#endif
#if HAS_DIFFUSE_MAP_OFFSET == 1
uniform highp vec2 diffuseTexture_Offset;
#endif
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
varying highp vec2 diffuse_uv;
#endif
#endif
void main()
{
#if BONE_COUNT > 0
mediump vec4 scaled_bone_indexes = bone_indexes;
mediump vec4 scaled_bone_weights = bone_weights;
//scaled_bone_indexes = vec4(0.0, 0.0, 0.0, 0.0);
//scaled_bone_weights = vec4(1.0, 0.0, 0.0, 0.0);
highp mat4 skin_matrix =
bone_transforms[ int(scaled_bone_indexes.x) ] * scaled_bone_weights.x +
bone_transforms[ int(scaled_bone_indexes.y) ] * scaled_bone_weights.y +
bone_transforms[ int(scaled_bone_indexes.z) ] * scaled_bone_weights.z +
bone_transforms[ int(scaled_bone_indexes.w) ] * scaled_bone_weights.w;
//skin_matrix = bone_transforms[0];
highp vec3 vertex_position_skinned = (skin_matrix * vec4(vertex_position, 1)).xyz;
highp vec3 vertex_normal_skinned = normalize(mat3(skin_matrix) * vertex_normal);
#if HAS_NORMAL_MAP == 1
highp vec3 vertex_tangent_skinned = normalize(mat3(skin_matrix) * vertex_tangent);
#endif
#endif
// Transform position
gl_Position = mvp_matrix * vec4(vertex_position_skinned,1.0);
#if HAS_DIFFUSE_MAP == 1 || (HAS_NORMAL_MAP == 1 && ENABLE_PER_PIXEL == 1) || (HAS_SPEC_MAP == 1 && ENABLE_PER_PIXEL == 1) || (HAS_REFLECTION_MAP == 1 && ENABLE_PER_PIXEL == 1)
// Pass UV co-ordinates
texCoord = vertex_uv.st;
#endif
// Scaled and translated normal map UV's
#if (HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1
normal_uv = texCoord;
#if HAS_NORMAL_MAP_OFFSET == 1
normal_uv += normalTexture_Offset;
#endif
#if HAS_NORMAL_MAP_SCALE == 1
normal_uv *= normalTexture_Scale;
#endif
#endif
#if GBUFFER_PASS != 1 || ALPHA_TEST == 1
// Scaled and translated diffuse map UV's
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
diffuse_uv = texCoord;
#if HAS_DIFFUSE_MAP_OFFSET == 1
diffuse_uv += diffuseTexture_Offset;
#endif
#if HAS_DIFFUSE_MAP_SCALE == 1
diffuse_uv *= diffuseTexture_Scale;
#endif
#endif
#endif
#if GBUFFER_PASS == 1
#if HAS_NORMAL_MAP == 1
mediump vec3 a_bitangent = cross(vertex_normal_skinned, vertex_tangent_skinned);
tangent_to_view_matrix[0] = vec3(model_view_inverse_transpose_matrix * vec4(vertex_tangent_skinned, 1.0));
tangent_to_view_matrix[1] = vec3(model_view_inverse_transpose_matrix * vec4(a_bitangent, 1.0));
tangent_to_view_matrix[2] = vec3(model_view_inverse_transpose_matrix * vec4(vertex_normal_skinned, 1.0));
#else
normal = vertex_normal_skinned;
#endif
#else
#if HAS_REFLECTION_CUBE_MAP == 1
#if HAS_NORMAL_MAP == 1
#else
// Calculate reflection vector as I - 2.0 * dot(N, I) * N
mediump vec3 eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
mediump vec3 incidenceVec = -eyeVec;
reflectionVec = mat3(model_matrix) * (incidenceVec - 2.0 * dot(vertex_normal_skinned, incidenceVec) * vertex_normal_skinned);
#endif
#endif
#ifdef NEED_EYEVEC
eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
#endif
#if HAS_LIGHT_MAP == 1
// Pass shadow UV co-ordinates
lightmap_uv = vertex_lightmap_uv.st;
#endif
#if ENABLE_PER_PIXEL == 1
// Scaled and translated specular map UV's
#if HAS_SPEC_MAP_OFFSET == 1 || HAS_SPEC_MAP_SCALE == 1
spec_uv = texCoord;
#if HAS_SPEC_MAP_OFFSET == 1
spec_uv += specularTexture_Offset;
#endif
#if HAS_SPEC_MAP_SCALE == 1
spec_uv *= specularTexture_Scale;
#endif
#endif
// Scaled and translated reflection map UV's
#if HAS_REFLECTION_MAP_OFFSET == 1 || HAS_REFLECTION_MAP_SCALE == 1
reflection_uv = texCoord;
#if HAS_REFLECTION_MAP_OFFSET == 1
reflection_uv += reflectionTexture_Offset;
#endif
#if HAS_REFLECTION_MAP_SCALE == 1
reflection_uv *= reflectionTexture_Scale;
#endif
#endif
#if SHADOW_QUALITY >= 1
shadowMapCoord1 = shadow_mvp1 * vec4(vertex_position_skinned,1.0);
#endif
#if SHADOW_QUALITY >= 2
shadowMapCoord2 = shadow_mvp2 * vec4(vertex_position_skinned,1.0);
#endif
#if SHADOW_QUALITY >= 3
shadowMapCoord3 = shadow_mvp3 * vec4(vertex_position_skinned,1.0);
#endif
// ----------- Directional Light (Sun) -----------
#if HAS_NORMAL_MAP == 1
// ----- Calculate per-pixel lighting in tangent space, for normal mapping ------
mediump vec3 a_bitangent = cross(vertex_normal_skinned, vertex_tangent_skinned);
#if HAS_REFLECTION_CUBE_MAP == 0
// The cube map reflections also require an eyeVec as a varying attribute when normal mapping, so only re-calculate here when needed
mediump vec3 eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
#else
tangent_to_world_matrix[0] = vec3(model_inverse_transpose_matrix * vec4(vertex_tangent_skinned, 1.0));
tangent_to_world_matrix[1] = vec3(model_inverse_transpose_matrix * vec4(a_bitangent, 1.0));
tangent_to_world_matrix[2] = vec3(model_inverse_transpose_matrix * vec4(vertex_normal_skinned, 1.0));
#endif
lightVec = normalize(vec3(dot(light_direction_model_space, vertex_tangent_skinned), dot(light_direction_model_space, a_bitangent), dot(light_direction_model_space, vertex_normal_skinned)));
halfVec = normalize(vec3(dot(eyeVec, vertex_tangent_skinned), dot(eyeVec, a_bitangent), dot(eyeVec, vertex_normal_skinned)));
halfVec = normalize(halfVec + lightVec); // Normalizing anyways, no need to divide by 2
#else
// ------ Calculate per-pixel lighting without normal mapping ------
normal = vertex_normal_skinned;
lightVec = light_direction_model_space;
halfVec = normalize((normalize(camera_position_model_space - vertex_position_skinned) + lightVec)); // Normalizing anyways, no need to divide by 2
#endif
#else
// ------ Calculate per-vertex lighting ------
mediump vec3 halfVec = normalize((normalize(camera_position_model_space - vertex_position_skinned) + light_direction_model_space)); // Normalizing anyways, no need to divide by 2
lamberFactor = max(0.0,dot(light_direction_model_space, vertex_normal_skinned));
specularFactor = max(0.0,pow(dot(halfVec,vertex_normal_skinned), material_shininess));
#endif
#endif
}

View File

@@ -0,0 +1,189 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#define ENABLE_VIDEO_BG 0
#define PIXEL_SHIFT_1 0.001
#define PIXEL_SHIFT_2 0.002
#define PIXEL_SHIFT_3 0.003
#define PIXEL_SHIFT_4 0.004
varying mediump vec2 textureCoordinate;
//precision lowp float;
#if ENABLE_VIDEO_BG == 1
uniform lowp sampler2D videoFrame;
#endif
#if ENABLE_FADE_COLOR == 1
uniform lowp vec4 fade_color;
#endif
uniform lowp sampler2D renderFrame;
uniform lowp sampler2D depthFrame;
#if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1
uniform lowp sampler2D volumetricEnvironmentFrame;
#endif
void main()
{
lowp vec4 renderColor = texture2D(renderFrame, textureCoordinate);
#if DOF_QUALITY > 0 || ENABLE_FLASH == 1
mediump float depth = texture2D(depthFrame, textureCoordinate).r;
#endif
mediump vec4 pixelColor = renderColor;
#if DOF_QUALITY == 2
// Render high quality circle of confusion
// __XXX__
// _XXXXX_
// _XXXXX_
// _XXXXX_
// __XXX__
mediump float cf1 = PIXEL_SHIFT_1;
mediump float cf2 = PIXEL_SHIFT_2;
mediump float bx1 = textureCoordinate.s + cf1;
mediump float bx2 = textureCoordinate.s + cf2;
mediump float bxm1 = textureCoordinate.s - cf1;
mediump float bxm2 = textureCoordinate.s - cf2;
mediump float by1 = textureCoordinate.t + cf1;
mediump float by2 = textureCoordinate.t + cf2;
mediump float bym1 = textureCoordinate.t - cf1;
mediump float bym2 = textureCoordinate.t - cf2;
pixelColor += texture2D(renderFrame, vec2(bx1, textureCoordinate.t));
pixelColor += texture2D(renderFrame, vec2(bxm1, textureCoordinate.t));
pixelColor += texture2D(renderFrame, vec2(bx2, textureCoordinate.t));
pixelColor += texture2D(renderFrame, vec2(bxm2, textureCoordinate.t));
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s, by1));
pixelColor += texture2D(renderFrame, vec2(bx1, by1));
pixelColor += texture2D(renderFrame, vec2(bxm1, by1));
pixelColor += texture2D(renderFrame, vec2(bx2, by1));
pixelColor += texture2D(renderFrame, vec2(bxm2, by1));
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s, by2));
pixelColor += texture2D(renderFrame, vec2(bx1, by2));
pixelColor += texture2D(renderFrame, vec2(bxm1, by2));
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s,bym1));
pixelColor += texture2D(renderFrame, vec2(bx1,bym1));
pixelColor += texture2D(renderFrame, vec2(bxm1,bym1));
pixelColor += texture2D(renderFrame, vec2(bx2,bym1));
pixelColor += texture2D(renderFrame, vec2(bxm2,bym1));
pixelColor += texture2D(renderFrame, vec2(bx1, bym2));
pixelColor += texture2D(renderFrame, vec2(bx1, bym2));
pixelColor += texture2D(renderFrame, vec2(bxm1, bym2));
pixelColor /= 21.0;
#endif
// DOF_QUALITY == 2
#if DOF_QUALITY == 1
// Render low quality circle of confusion
// ___X___
// __XXX__
// _XXXXX_
// __XXX__
// ___X___
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_2, 0));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, 0));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, 0));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_2, 0));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
pixelColor /= 13.0;
#endif
// DOF_QUALITY == 1
#if DOF_QUALITY > 0
mediump float focusDepth = texture2D(depthFrame, vec2(0.5, 0.5)).r;
mediump float blurAmount = clamp((depth - DOF_DEPTH - focusDepth) / DOF_FALLOFF, 0.0, 1.0);
pixelColor = pixelColor * blurAmount + renderColor * (1.0 - blurAmount);
#endif
// ---- DEPTH_OF_FIELD END ----
// ---- NIGHT_TIME START ----
#if ENABLE_FLASH == 1
// Un-comment to enable night time / flash effect
pixelColor *= vec4(vec3(1.0 - clamp((depth - FLASH_DEPTH) / FLASH_FALLOFF, 0.0, 1.0)) * FLASH_INTENSITY, 1.0);
//pixelColor *= vec4(vec3(clamp(1.0 / (depth - FLASH_DEPTH) * FLASH_FALLOFF, 0.0, 1.0) * FLASH_INTENSITY), 1.0);
#endif
// ---- NIGHT_TIME END ----
// ---- VIDEO_BG START ----
// ---- VIDEO_BG END ----
#if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1
pixelColor += texture2D(volumetricEnvironmentFrame, textureCoordinate);
#endif
// ---- VIGNETTE START ----
// Render vignette effect
#if ENABLE_VIGNETTE == 1
pixelColor *= vec4(vec3(clamp(1.0 - (distance(textureCoordinate, vec2(0.5, 0.5)) - VIGNETTE_RADIUS) / VIGNETTE_FALLOFF, 0.0, 1.0)), 1.0);
#endif
// ---- VIGNETTE END ----
#if ENABLE_FADE_COLOR == 1
pixelColor.rgb = mix(pixelColor.rgb, fade_color.rgb, fade_color.a);
#endif
gl_FragColor = pixelColor;
//PASSTHROUGH STATEMENT
// gl_FragColor = texture2D(depthFrame, textureCoordinate);
//gl_FragColor = vec4(vec3(blurAmount), 1.0);
}

View File

@@ -0,0 +1,38 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
uniform mediump vec2 viewport_downsample;
attribute vec4 vertex_position;
attribute lowp vec4 vertex_uv;
varying mediump vec2 textureCoordinate;
void main()
{
gl_Position = vertex_position;
textureCoordinate = vertex_uv.xy * viewport_downsample.xy;
}

View File

@@ -0,0 +1,33 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
//varying mediump vec2 texCoord;
void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}

View File

@@ -0,0 +1,47 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#define SHADOW_BIAS 0.01
attribute highp vec4 vertex_position;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
// Transform position
/*
position = shadow_mvp1 * vec4(vertex_position,1.0);
*/
gl_Position = mvp_matrix * vertex_position;
gl_Position.z += SHADOW_BIAS;
/*
// Pass UV co-ordinates
texCoord = vertex_uv.st;
*/
}

View File

@@ -0,0 +1,36 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 textureCoordinate;
uniform sampler2D diffuseTexture;
void main()
{
vec4 font_color = texture2D(diffuseTexture, textureCoordinate);
gl_FragColor = vec4(font_color.r, font_color.g, font_color.b, font_color.r + 0.50);
}

View File

@@ -0,0 +1,38 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 textureCoordinate;
attribute vec4 vertex_position;
attribute lowp vec2 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
gl_Position = /*mvp_matrix * */vertex_position;
textureCoordinate = vertex_uv;
}

View File

@@ -0,0 +1,43 @@
//
// dust_particle.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
//#extension GL_EXT_shadow_samplers : require
varying mediump vec2 texCoord;
varying mediump vec4 shadowMapCoord1;
uniform sampler2DShadow shadowTexture1;
uniform mediump vec3 light_color;
varying lowp float intensity_modulate;
void main() {
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1) * max(1.0 - texCoord.x*texCoord.x-texCoord.y*texCoord.y, 0.0) * intensity_modulate;
}

View File

@@ -0,0 +1,57 @@
//
// dust_particle.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute mediump vec2 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
uniform mediump vec4 viewport;
uniform mediump float flare_size;
attribute vec4 vertex_position;
uniform highp vec3 particle_origin;
uniform highp mat4 shadow_mvp1;
varying mediump vec4 shadowMapCoord1;
varying mediump vec2 texCoord;
uniform highp float time_absolute;
varying lowp float intensity_modulate;
void main() {
highp vec4 offset_center = vertex_position + vec4(particle_origin, 0.0);
offset_center.xyz += vec3(sin((time_absolute + vertex_position.x * 100.0) * 0.05), sin((time_absolute + vertex_position.y * 100.0) * 0.07), sin((time_absolute + vertex_position.z * 100.0) * 0.03)) * 0.05;
offset_center = vec4(mod(offset_center.x + 1.0, 2.0) - 1.0, mod(offset_center.y + 1.0, 2.0) - 1.0, mod(offset_center.z + 1.0, 2.0) - 1.0, 1.0);
highp vec4 particle_center = mvp_matrix * offset_center;
texCoord = vertex_uv * 3.46410161513775; // 3.46410161513775 = 2 * sqrt(3); 1 / (2 * sqrt(3)) is the radius of a circle encompased by a equilateral triangle with a side length of 1.
gl_Position = particle_center + vec4(vertex_uv.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 0.0) * flare_size;
shadowMapCoord1 = shadow_mvp1 * offset_center;
intensity_modulate = sin(time_absolute + mod(vertex_position.x * 100.0, 6.28318530717959)) * 0.5 + 0.5;
}

View File

@@ -0,0 +1,38 @@
//
// flare.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 texCoord;
uniform sampler2D diffuseTexture;
uniform lowp float material_alpha;
void main() {
gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha;
}

View File

@@ -0,0 +1,42 @@
//
// flare.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute mediump vec2 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
uniform mediump vec4 viewport;
uniform mediump float flare_size;
varying mediump vec2 texCoord;
void main() {
texCoord = vertex_uv;
gl_Position = mvp_matrix * vec4(0.0, 0.0, 0.0, 1.0) + vec4(vertex_uv.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 0.0) * flare_size;
}

View File

@@ -0,0 +1,60 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
uniform sampler2D gbuffer_frame;
uniform sampler2D gbuffer_depth;
uniform mediump vec3 light_direction_view_space; // Must be normalized and converted to view space before entering shader
uniform lowp vec3 light_color;
uniform highp float light_intensity;
uniform mediump vec4 viewport;
void main()
{
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
mediump vec3 view_space_vertex_position = vec3(
((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.0,
(2.0 * -texture2D(gbuffer_depth, gbuffer_uv).r - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near)
);
//mediump float lamberFactor = max(0.0,dot(light_direction_view_space, gbuffer_normal)) * 0.2;
mediump float lamberFactor = dot(light_direction_view_space, gbuffer_normal) * 0.2;
mediump float specularFactor = 0.0;
mediump vec3 halfVec = normalize((normalize(- view_space_vertex_position) + light_direction_view_space)); // Normalizing anyways, no need to divide by 2
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_intensity;
}

View File

@@ -0,0 +1,33 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute vec4 vertex_position;
void main()
{
gl_Position = vertex_position;
}

View File

@@ -0,0 +1,73 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
uniform sampler2D gbuffer_frame;
uniform sampler2D gbuffer_depth;
uniform lowp vec3 light_color;
uniform highp float light_intensity;
uniform highp float light_decay_start;
uniform highp float light_cutoff;
uniform mediump vec4 viewport;
uniform highp mat4 inv_projection_matrix;
uniform highp vec3 view_space_model_origin;
void main()
{
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
mediump vec4 clip_space_vertex_position = vec4(
gl_FragCoord.xy / viewport.zw * 2.0 - 1.0,
texture2D(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
1.0
);
mediump vec4 view_space_vertex_position = inv_projection_matrix * clip_space_vertex_position;
view_space_vertex_position.xyz /= view_space_vertex_position.w;
mediump float light_distance = max(0.0, distance(view_space_model_origin.xyz, view_space_vertex_position.xyz) - light_decay_start);
mediump float light_attenuation = (light_intensity / ((light_distance + 1.0) * (light_distance + 1.0)) - light_cutoff) / (1.0 - light_cutoff);
mediump vec3 light_vec = normalize(view_space_model_origin.xyz - view_space_vertex_position.xyz);
mediump float lamberFactor = dot(light_vec, gbuffer_normal) * 0.2;
mediump float specularFactor = 0.0;
//if(gbuffer_specular_exponent > 0.0) {
mediump vec3 halfVec = normalize((normalize(- view_space_vertex_position.xyz) + light_vec));
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
//}
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
}

View File

@@ -0,0 +1,33 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute vec4 vertex_position;
void main()
{
gl_Position = vertex_position;
}

View File

@@ -0,0 +1,73 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
uniform sampler2D gbuffer_frame;
uniform sampler2D gbuffer_depth;
uniform lowp vec3 light_color;
uniform highp float light_intensity;
uniform highp float light_decay_start;
uniform highp float light_cutoff;
uniform mediump vec4 viewport;
uniform highp mat4 inv_projection_matrix;
uniform highp vec3 view_space_model_origin; // For point lights, this is the position of the light
void main()
{
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
mediump vec4 clip_space_vertex_position = vec4(
gl_FragCoord.xy / viewport.zw * 2.0 - 1.0,
texture2D(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
1.0
);
mediump vec4 view_space_vertex_position = inv_projection_matrix * clip_space_vertex_position;
view_space_vertex_position.xyz /= view_space_vertex_position.w;
mediump float light_distance = max(0.0, distance(view_space_model_origin.xyz, view_space_vertex_position.xyz) - light_decay_start);
mediump float light_attenuation = (light_intensity / ((light_distance + 1.0) * (light_distance + 1.0)) - light_cutoff) / (1.0 - light_cutoff);
mediump vec3 light_vec = normalize(view_space_model_origin.xyz - view_space_vertex_position.xyz);
mediump float lamberFactor = dot(light_vec, gbuffer_normal) * 0.2;
mediump float specularFactor = 0.0;
//if(gbuffer_specular_exponent > 0.0) {
mediump vec3 halfVec = normalize((normalize(- view_space_vertex_position.xyz) + light_vec));
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
//}
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
}

View File

@@ -0,0 +1,35 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute vec4 vertex_position;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
gl_Position = mvp_matrix * vertex_position;
gl_Position.z = max(gl_Position.z / gl_Position.w, 0.00) * gl_Position.w;
}

View File

@@ -0,0 +1,35 @@
//
// flare.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
void main() {
//gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00);
gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00);
}

View File

@@ -0,0 +1,34 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute vec4 vertex_position;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
gl_Position = mvp_matrix * vertex_position;
}

View File

@@ -0,0 +1,35 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 textureCoordinate;
uniform sampler2D diffuseTexture;
void main()
{
gl_FragColor = texture2D(diffuseTexture, textureCoordinate);
}

View File

@@ -0,0 +1,38 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 textureCoordinate;
attribute vec4 vertex_position;
attribute lowp vec4 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
gl_Position = mvp_matrix * vertex_position;
textureCoordinate = vertex_uv.xy;
}

View File

@@ -0,0 +1,38 @@
//
// sky_box.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
uniform samplerCube diffuseTexture;
varying mediump vec3 texCoord;
void main() {
gl_FragColor = textureCube(diffuseTexture, normalize(texCoord));
}

View File

@@ -0,0 +1,49 @@
//
// sky_box.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
//
attribute vec4 vertex_position;
//attribute lowp vec4 vertex_uv;
//
//varying mediump vec2 textureCoordinate;
varying mediump vec3 texCoord;
uniform highp mat4 inv_mvp_matrix_no_translate; // Inverse of the model-view-projection matrix, without view translation component
uniform mediump vec4 viewport;
void main()
{
gl_Position = vec4(vertex_position.xy, 1.0, 1.0);
vec4 t = inv_mvp_matrix_no_translate * vec4(vertex_position.xy, 1.0, 1.0);
t *= 1.0 / t.w;
texCoord = vec3(t);
}

View File

@@ -0,0 +1,38 @@
//
// sprite.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec2 texCoord;
uniform sampler2D diffuseTexture;
uniform lowp float material_alpha;
void main() {
gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha;
}

View File

@@ -0,0 +1,41 @@
//
// sprite.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute mediump vec2 vertex_uv;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
uniform mediump vec4 viewport;
varying mediump vec2 texCoord;
void main() {
texCoord = vertex_uv;
gl_Position = mvp_matrix * vec4(vertex_uv.x * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 1.0);
}

View File

@@ -0,0 +1,35 @@
//
// visualize_overlay.fsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
void main() {
gl_FragColor = vec4(0.0, 0.05, 0.05, 0.0);
}

View File

@@ -0,0 +1,38 @@
//
// visualize_overlay.vsh
// KREngine
//
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute vec4 vertex_position;
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
void main()
{
gl_Position = mvp_matrix * vertex_position;
}

View File

@@ -0,0 +1,39 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec4 shadowMapCoord1;
uniform sampler2DShadow shadowTexture1;
uniform lowp sampler2D depthFrame;
uniform mediump vec4 viewport;
uniform mediump vec3 light_color;
void main()
{
if(gl_FragCoord.z > texture2D(depthFrame, vec2(gl_FragCoord.xy / viewport.zw)).r) discard;
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
}

View File

@@ -0,0 +1,50 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute highp vec4 vertex_position;
uniform highp mat4 inv_mvp_matrix;
uniform highp vec2 slice_depth_scale; // First component is the depth for the nearest plane, in view space. Second component is the distance between planes, in view space
uniform highp mat4 shadow_mvp1;
varying mediump vec4 shadowMapCoord1;
uniform highp mat4 projection_matrix;
void main()
{
highp vec4 d = projection_matrix * vec4(0.0, 0.0, slice_depth_scale.x + vertex_position.z * slice_depth_scale.y, 1.0);
d /= d.w;
gl_Position = vec4(vertex_position.x, vertex_position.y, d.z, 1.0);
shadowMapCoord1 = inv_mvp_matrix * gl_Position;
shadowMapCoord1 /= shadowMapCoord1.w;
shadowMapCoord1.w = 1.0;
shadowMapCoord1 = shadow_mvp1 * shadowMapCoord1;
}

View File

@@ -0,0 +1,35 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
varying mediump vec4 shadowMapCoord1;
uniform sampler2DShadow shadowTexture1;
uniform mediump vec3 light_color;
void main()
{
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
}

View File

@@ -0,0 +1,51 @@
// Copyright 2012 Kearwood Gilbert. 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.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''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 KEARWOOD GILBERT OR
// 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.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
attribute highp vec4 vertex_position;
uniform highp mat4 inv_mvp_matrix;
uniform highp vec2 slice_depth_scale; // First component is the depth for the nearest plane, in view space. Second component is the distance between planes, in view space
uniform highp mat4 shadow_mvp1;
varying mediump vec4 shadowMapCoord1;
uniform highp mat4 projection_matrix;
void main()
{
highp vec4 d = projection_matrix * vec4(0.0, 0.0, slice_depth_scale.x + vertex_position.z * slice_depth_scale.y, 1.0);
d /= d.w;
gl_Position = vec4(vertex_position.x, vertex_position.y, d.z, 1.0);
shadowMapCoord1 = inv_mvp_matrix * gl_Position;
shadowMapCoord1 /= shadowMapCoord1.w;
shadowMapCoord1.w = 1.0;
shadowMapCoord1 = shadow_mvp1 * shadowMapCoord1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB