diff --git a/Kraken.xcodeproj/project.pbxproj b/Kraken.xcodeproj/project.pbxproj index 0919cae..4606c04 100644 --- a/Kraken.xcodeproj/project.pbxproj +++ b/Kraken.xcodeproj/project.pbxproj @@ -180,6 +180,9 @@ E416AA9D1671375C000F6786 /* KRAnimationCurveManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */; }; E41843921678704000DBD6CF /* KRCollider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 104A335C1672D31B001C8BA6 /* KRCollider.cpp */; }; E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41B6BA916BE437800B510EB /* CoreAudio.framework */; }; + E41CAB8D1B75D8DF00F3387D /* KrakenView.h in Headers */ = {isa = PBXBuildFile; fileRef = E41CAB8B1B75D8DF00F3387D /* KrakenView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E41CAB8E1B75D8DF00F3387D /* KrakenView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E41CAB8C1B75D8DF00F3387D /* KrakenView.mm */; }; + E41CAB921B75DFF100F3387D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41CAB911B75DFF100F3387D /* QuartzCore.framework */; }; E428C2F31669610500A16EDF /* KRAnimationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C2F11669610500A16EDF /* KRAnimationManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; E428C2F61669611600A16EDF /* KRAnimationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C2F41669611600A16EDF /* KRAnimationManager.cpp */; }; E428C2F91669612500A16EDF /* KRAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C2F71669612500A16EDF /* KRAnimation.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -283,6 +286,8 @@ E499BF2216AE760F007FCDBE /* kraken.h in Headers */ = {isa = PBXBuildFile; fileRef = E4BBBB8C1512A40300F43B5B /* kraken.h */; settings = {ATTRIBUTES = (Public, ); }; }; E499BF2316AE7636007FCDBE /* kraken-prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = E4BBBB8B1512A40300F43B5B /* kraken-prefix.pch */; }; E499BF2516AE8C20007FCDBE /* KREngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = E491016F13C99BDC0098455B /* KREngine.mm */; }; + E4A0B8201B2007130059018B /* flare_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E42559B0184DD48B0081BB20 /* flare_osx.vsh */; }; + E4A0B8211B2007160059018B /* flare_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E42559AE184DD4730081BB20 /* flare_osx.fsh */; }; E4AE635E1704FB0A00B460CD /* KRLODGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AE635B1704FB0A00B460CD /* KRLODGroup.cpp */; }; E4AE63601704FB0A00B460CD /* KRLODGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE635C1704FB0A00B460CD /* KRLODGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */ = {isa = PBXBuildFile; fileRef = E40BA45215EFF79500D7C3DD /* KRAABB.cpp */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -297,6 +302,8 @@ E4B175B5161F5FAF00B8FB80 /* KRTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B175B1161F5FAF00B8FB80 /* KRTextureCube.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4B2A4391523B027004CB0EC /* KRMaterial.h in Headers */ = {isa = PBXBuildFile; fileRef = E491017D13C99BDC0098455B /* KRMaterial.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4B2A43B1523B02E004CB0EC /* KRMaterial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E491017C13C99BDC0098455B /* KRMaterial.cpp */; }; + E4B74A621AD79F9600067A78 /* KRContext_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B74A611AD79F9600067A78 /* KRContext_osx.mm */; }; + E4B74A641AD7A02C00067A78 /* KRContext_ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B74A631AD7A02C00067A78 /* KRContext_ios.mm */; }; E4BBBB8A1512A40300F43B5B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E4BBBB881512A40300F43B5B /* InfoPlist.strings */; }; E4BBBB8E1512A40300F43B5B /* kraken.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4BBBB8D1512A40300F43B5B /* kraken.mm */; }; E4BBBB9C1512A4A900F43B5B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4BBBB9A1512A48200F43B5B /* Foundation.framework */; }; @@ -393,7 +400,7 @@ E4F027E11697BFFF00D4427D /* KRAudioBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F027DD1697BFFF00D4427D /* KRAudioBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4F027F71698115600D4427D /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4F027F61698115600D4427D /* AudioToolbox.framework */; }; E4F89BB518A6DB1200015637 /* KRTriangle3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F89BB218A6DB1200015637 /* KRTriangle3.cpp */; }; - E4F89BB718A6DB1200015637 /* KRTriangle3.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F89BB318A6DB1200015637 /* KRTriangle3.h */; }; + E4F89BB718A6DB1200015637 /* KRTriangle3.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F89BB318A6DB1200015637 /* KRTriangle3.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4F975331536220900FD60B2 /* KRNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F975311536220900FD60B2 /* KRNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4F975371536221C00FD60B2 /* KRNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F975351536221C00FD60B2 /* KRNode.cpp */; }; E4F9754015362CD400FD60B2 /* KRScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E414BAE81435585A00A668C4 /* KRScene.cpp */; }; @@ -456,9 +463,12 @@ E41AE1DD16B124CA00980428 /* font.tga */ = {isa = PBXFileReference; lastKnownFileType = file; path = font.tga; sourceTree = ""; }; E41B6BA716BE436100B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; E41B6BA916BE437800B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; }; + E41CAB8B1B75D8DF00F3387D /* KrakenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KrakenView.h; sourceTree = ""; }; + E41CAB8C1B75D8DF00F3387D /* KrakenView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KrakenView.mm; sourceTree = ""; }; + E41CAB911B75DFF100F3387D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; E42559AA184DD4490081BB20 /* flare.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare.fsh; sourceTree = ""; }; E42559AC184DD45A0081BB20 /* flare.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare.vsh; sourceTree = ""; }; - E42559AE184DD4730081BB20 /* flare_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare_osx.fsh; sourceTree = ""; }; + E42559AE184DD4730081BB20 /* flare_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = flare_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E42559B0184DD48B0081BB20 /* flare_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare_osx.vsh; sourceTree = ""; }; E428C2F11669610500A16EDF /* KRAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAnimationManager.h; sourceTree = ""; }; E428C2F41669611600A16EDF /* KRAnimationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRAnimationManager.cpp; sourceTree = ""; }; @@ -588,12 +598,16 @@ E497B952151BEDA600D3DC67 /* KRResource+fbx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = "KRResource+fbx.cpp"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; E497B95C151BF05F00D3DC67 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = ../../../../MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; E497B95E151BF09600D3DC67 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = ../../../../MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + E4A5C33E1BEDD6CC00CA40E5 /* kraken.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = kraken.h; sourceTree = ""; }; + E4A5C3401BEDD6CC00CA40E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E4AE635B1704FB0A00B460CD /* KRLODGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRLODGroup.cpp; sourceTree = ""; }; E4AE635C1704FB0A00B460CD /* KRLODGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRLODGroup.h; sourceTree = ""; }; E4B175AA161F5A1000B8FB80 /* KRTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTexture.cpp; sourceTree = ""; }; E4B175AB161F5A1000B8FB80 /* KRTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRTexture.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; E4B175B0161F5FAE00B8FB80 /* KRTextureCube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTextureCube.cpp; sourceTree = ""; }; E4B175B1161F5FAF00B8FB80 /* KRTextureCube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRTextureCube.h; sourceTree = ""; }; + E4B74A611AD79F9600067A78 /* KRContext_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KRContext_osx.mm; sourceTree = ""; }; + E4B74A631AD7A02C00067A78 /* KRContext_ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KRContext_ios.mm; sourceTree = ""; }; E4BBBB7E1512A40300F43B5B /* kraken.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = kraken.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E4BBBB871512A40300F43B5B /* Kraken-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Kraken-Info.plist"; sourceTree = ""; }; E4BBBB891512A40300F43B5B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -623,24 +637,24 @@ E4CA11731639CBD1005D9400 /* KRViewport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRViewport.h; sourceTree = ""; }; E4CA11771639CC8E005D9400 /* KRViewport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRViewport.cpp; sourceTree = ""; }; E4CE184815FEEDA200F80870 /* font.pvr */ = {isa = PBXFileReference; lastKnownFileType = file; path = font.pvr; sourceTree = ""; }; - E4E6F60D16BA5D8300E410F8 /* PostShader_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = PostShader_osx.fsh; sourceTree = ""; }; + E4E6F60D16BA5D8300E410F8 /* PostShader_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = PostShader_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F60E16BA5D8300E410F8 /* PostShader_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = PostShader_osx.vsh; sourceTree = ""; }; - E4E6F60F16BA5D8300E410F8 /* sky_box_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sky_box_osx.fsh; sourceTree = ""; }; - E4E6F61016BA5D8300E410F8 /* debug_font_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = debug_font_osx.fsh; sourceTree = ""; }; + E4E6F60F16BA5D8300E410F8 /* sky_box_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = sky_box_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; + E4E6F61016BA5D8300E410F8 /* debug_font_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = debug_font_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61116BA5D8300E410F8 /* debug_font_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = debug_font_osx.vsh; sourceTree = ""; }; E4E6F61216BA5D8300E410F8 /* dust_particle_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dust_particle_osx.fsh; sourceTree = ""; }; E4E6F61316BA5D8300E410F8 /* dust_particle_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dust_particle_osx.vsh; sourceTree = ""; }; - E4E6F61416BA5D8300E410F8 /* sprite_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sprite_osx.fsh; sourceTree = ""; }; + E4E6F61416BA5D8300E410F8 /* sprite_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = sprite_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61516BA5D8300E410F8 /* sprite_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sprite_osx.vsh; sourceTree = ""; }; - E4E6F61616BA5D8300E410F8 /* light_directional_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_directional_osx.fsh; sourceTree = ""; }; + E4E6F61616BA5D8300E410F8 /* light_directional_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = light_directional_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61716BA5D8300E410F8 /* light_directional_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_directional_osx.vsh; sourceTree = ""; }; - E4E6F61816BA5D8300E410F8 /* light_point_inside_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_point_inside_osx.fsh; sourceTree = ""; }; + E4E6F61816BA5D8300E410F8 /* light_point_inside_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = light_point_inside_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61916BA5D8300E410F8 /* light_point_inside_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_point_inside_osx.vsh; sourceTree = ""; }; - E4E6F61A16BA5D8300E410F8 /* light_point_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_point_osx.fsh; sourceTree = ""; }; + E4E6F61A16BA5D8300E410F8 /* light_point_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = light_point_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61B16BA5D8300E410F8 /* light_point_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_point_osx.vsh; sourceTree = ""; }; - E4E6F61C16BA5D8300E410F8 /* ObjectShader_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ObjectShader_osx.fsh; sourceTree = ""; }; + E4E6F61C16BA5D8300E410F8 /* ObjectShader_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = ObjectShader_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61D16BA5D8300E410F8 /* ObjectShader_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ObjectShader_osx.vsh; sourceTree = ""; }; - E4E6F61E16BA5D8300E410F8 /* occlusion_test_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = occlusion_test_osx.fsh; sourceTree = ""; }; + E4E6F61E16BA5D8300E410F8 /* occlusion_test_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; path = occlusion_test_osx.fsh; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.glsl; }; E4E6F61F16BA5D8300E410F8 /* occlusion_test_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = occlusion_test_osx.vsh; sourceTree = ""; }; E4E6F62016BA5D8300E410F8 /* ShadowShader_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ShadowShader_osx.fsh; sourceTree = ""; }; E4E6F62116BA5D8300E410F8 /* ShadowShader_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ShadowShader_osx.vsh; sourceTree = ""; }; @@ -719,6 +733,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E41CAB921B75DFF100F3387D /* QuartzCore.framework in Frameworks */, E45E03C018790DF5006DA23F /* libPVRTexLib.a in Frameworks */, E459040416C30CC5002B00A0 /* AudioUnit.framework in Frameworks */, E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */, @@ -1158,6 +1173,7 @@ E4C8E4E616B9B2D50031DDCB /* kraken_standard_assets_ios */, E4C8E4F616B9B2E20031DDCB /* kraken_standard_assets_osx */, E48C528519C570C50062E439 /* krakenTests */, + E4A5C33D1BEDD6CB00CA40E5 /* kraken */, E491016213C99B9E0098455B /* Products */, ); sourceTree = ""; @@ -1182,6 +1198,8 @@ E45134B41746A4A300443C21 /* KRBehavior.cpp */, E45134B51746A4A300443C21 /* KRBehavior.h */, E48C697115374F7E00232E28 /* KRContext.cpp */, + E4B74A631AD7A02C00067A78 /* KRContext_ios.mm */, + E4B74A611AD79F9600067A78 /* KRContext_osx.mm */, E48C696E15374F5A00232E28 /* KRContext.h */, E43B0AD415DDCA0C00A5CB9F /* KRContextObject.cpp */, E43B0AD515DDCA0D00A5CB9F /* KRContextObject.h */, @@ -1207,11 +1225,22 @@ path = kraken; sourceTree = ""; }; + E4A5C33D1BEDD6CB00CA40E5 /* kraken */ = { + isa = PBXGroup; + children = ( + E4A5C33E1BEDD6CC00CA40E5 /* kraken.h */, + E4A5C3401BEDD6CC00CA40E5 /* Info.plist */, + ); + path = kraken; + sourceTree = ""; + }; E4BBBB851512A40300F43B5B /* kraken_osx */ = { isa = PBXGroup; children = ( E4BBBB8C1512A40300F43B5B /* kraken.h */, E4BBBB8D1512A40300F43B5B /* kraken.mm */, + E41CAB8B1B75D8DF00F3387D /* KrakenView.h */, + E41CAB8C1B75D8DF00F3387D /* KrakenView.mm */, E4BBBB861512A40300F43B5B /* Supporting Files */, E4BBBB931512A41500F43B5B /* Frameworks */, ); @@ -1231,6 +1260,7 @@ E4BBBB931512A41500F43B5B /* Frameworks */ = { isa = PBXGroup; children = ( + E41CAB911B75DFF100F3387D /* QuartzCore.framework */, E459040316C30CC5002B00A0 /* AudioUnit.framework */, E41B6BA916BE437800B510EB /* CoreAudio.framework */, E460292916682BD900261BB9 /* libfbxsdk.a */, @@ -1478,7 +1508,6 @@ E4F027CA16979CCD00D4427D /* KRAudioManager.h in Headers */, E4F027D116979CE200D4427D /* KRAudioSample.h in Headers */, E4F027E11697BFFF00D4427D /* KRAudioBuffer.h in Headers */, - E4F89BB718A6DB1200015637 /* KRTriangle3.h in Headers */, E4943234169E08D200BCB891 /* KRAmbientZone.h in Headers */, E414F9AF1694DA37000B3D58 /* KRUnknown.h in Headers */, E45E03BD18790DD1006DA23F /* PVRTTexture.h in Headers */, @@ -1508,7 +1537,9 @@ E4AE63601704FB0A00B460CD /* KRLODGroup.h in Headers */, E45134B91746A4A300443C21 /* KRBehavior.h in Headers */, E43F70E81824D9AB00136169 /* KRStreamer.h in Headers */, + E4F89BB718A6DB1200015637 /* KRTriangle3.h in Headers */, E40F982F184A7A2700CFA4D8 /* KRMeshQuad.h in Headers */, + E41CAB8D1B75D8DF00F3387D /* KrakenView.h in Headers */, E40F9835184A7BAC00CFA4D8 /* KRSprite.h in Headers */, E48CF945173453990005EBBB /* KRFloat.h in Headers */, E499BF1F16AE753E007FCDBE /* KRCollider.h in Headers */, @@ -1695,6 +1726,7 @@ E4E6F6A616BA5E0A00E410F8 /* debug_font_osx.fsh in Resources */, E4E6F6A716BA5E0A00E410F8 /* debug_font_osx.vsh in Resources */, E4E6F6A816BA5E0A00E410F8 /* dust_particle_osx.fsh in Resources */, + E4A0B8201B2007130059018B /* flare_osx.vsh in Resources */, E4E6F6A916BA5E0A00E410F8 /* dust_particle_osx.vsh in Resources */, E4E6F6AA16BA5E0A00E410F8 /* sprite_osx.fsh in Resources */, E4E6F6AB16BA5E0A00E410F8 /* sprite_osx.vsh in Resources */, @@ -1714,6 +1746,7 @@ E4E6F6B916BA5E0A00E410F8 /* simple_blit_osx.vsh in Resources */, E4E6F6BA16BA5E0A00E410F8 /* sky_box_osx.vsh in Resources */, E4E6F6BB16BA5E0A00E410F8 /* visualize_overlay_osx.fsh in Resources */, + E4A0B8211B2007160059018B /* flare_osx.fsh in Resources */, E4E6F6BC16BA5E0A00E410F8 /* visualize_overlay_osx.vsh in Resources */, E4E6F6BD16BA5E0A00E410F8 /* volumetric_fog_downsampled_osx.fsh in Resources */, E4E6F6BE16BA5E0A00E410F8 /* volumetric_fog_downsampled_osx.vsh in Resources */, @@ -1754,6 +1787,7 @@ E4159BA319C5762F00622D1E /* KRMeshQuad.cpp in Sources */, E4159BA419C5762F00622D1E /* KRTextureManager.cpp in Sources */, E4159BA519C5762F00622D1E /* KRTexture2D.cpp in Sources */, + E4B74A641AD7A02C00067A78 /* KRContext_ios.mm in Sources */, E4159BA619C5762F00622D1E /* KRTexture.cpp in Sources */, E4159BA719C5762F00622D1E /* KRTextureCube.cpp in Sources */, E4159BA819C5762F00622D1E /* KRTexturePVR.cpp in Sources */, @@ -1840,6 +1874,7 @@ E4D13364153767ED0070068C /* KRShaderManager.cpp in Sources */, E4AFC6B915F7C7B200DDB4C8 /* KROctree.cpp in Sources */, E46C214C15364DEC009CABF3 /* KRSceneManager.cpp in Sources */, + E4B74A621AD79F9600067A78 /* KRContext_osx.mm in Sources */, E48C697315374F7E00232E28 /* KRContext.cpp in Sources */, E46A6B6D1559E97D000DBD37 /* KRResource+blend.cpp in Sources */, E40F982D184A7A2700CFA4D8 /* KRMeshQuad.cpp in Sources */, @@ -1857,6 +1892,7 @@ E4CA10EA1637BD2B005D9400 /* KRTexturePVR.cpp in Sources */, E4CA10F01637BD58005D9400 /* KRTextureTGA.cpp in Sources */, E4F89BB518A6DB1200015637 /* KRTriangle3.cpp in Sources */, + E41CAB8E1B75D8DF00F3387D /* KrakenView.mm in Sources */, E4CA11791639CC90005D9400 /* KRViewport.cpp in Sources */, E41843921678704000DBD6CF /* KRCollider.cpp in Sources */, E4324BAF16444E120043185B /* KRParticleSystemNewtonian.cpp in Sources */, @@ -1944,6 +1980,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1971,6 +2008,7 @@ ONLY_ACTIVE_ARCH = NO; PRODUCT_NAME = kraken; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1990,6 +2028,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -2012,6 +2051,7 @@ ONLY_ACTIVE_ARCH = NO; PRODUCT_NAME = kraken; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2068,6 +2108,7 @@ ALWAYS_SEARCH_USER_PATHS = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_SEARCH_PATHS = ( diff --git a/kraken/Info.plist b/kraken/Info.plist new file mode 100644 index 0000000..5b15498 --- /dev/null +++ b/kraken/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.krakenengine.kraken + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/kraken/KRCamera.cpp b/kraken/KRCamera.cpp index 32c4bc1..08075c3 100644 --- a/kraken/KRCamera.cpp +++ b/kraken/KRCamera.cpp @@ -105,7 +105,7 @@ void KRCamera::renderFrame(float deltaTime, GLint renderBufferWidth, GLint rende } m_last_frame_start = current_time; - GLint defaultFBO; + GLint defaultFBO = -1; GLDEBUG(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO)); createBuffers(renderBufferWidth, renderBufferHeight); diff --git a/kraken/KRContext.cpp b/kraken/KRContext.cpp index c1d6eb2..dfb0bd3 100644 --- a/kraken/KRContext.cpp +++ b/kraken/KRContext.cpp @@ -18,6 +18,19 @@ int KRContext::KRENGINE_MAX_TEXTURE_DIM; int KRContext::KRENGINE_MIN_TEXTURE_DIM; int KRContext::KRENGINE_PRESTREAM_DISTANCE; +#if TARGET_OS_IPHONE + + +#elif TARGET_OS_MAC + + +#else + +#error Unsupported Platform + +#endif + + const char *KRContext::extension_names[KRENGINE_NUM_EXTENSIONS] = { "GL_EXT_texture_storage" }; @@ -48,7 +61,7 @@ KRContext::KRContext() : m_streamer(*this) m_pUnknownManager = new KRUnknownManager(*this); m_streamingEnabled = true; - + createDeviceContexts(); } KRContext::~KRContext() { @@ -103,6 +116,8 @@ KRContext::~KRContext() { delete m_pBundleManager; m_pBundleManager = NULL; } + + destroyDeviceContexts(); } void KRContext::SetLogCallback(log_callback *log_callback, void *user_data) diff --git a/kraken/KRContext.h b/kraken/KRContext.h index 5bb49d9..73770fb 100644 --- a/kraken/KRContext.h +++ b/kraken/KRContext.h @@ -87,6 +87,13 @@ public: void doStreaming(); void receivedMemoryWarning(); + + static void activateStreamerContext(); + static void activateRenderContext(); + +#if TARGET_OS_MAC + static void attachToView(void *view); +#endif private: KRBundleManager *m_pBundleManager; @@ -117,6 +124,9 @@ private: static void *s_log_callback_user_data; KRStreamer m_streamer; + + static void createDeviceContexts(); + void destroyDeviceContexts(); }; #endif diff --git a/kraken/KRContext_ios.mm b/kraken/KRContext_ios.mm new file mode 100644 index 0000000..df4c1e5 --- /dev/null +++ b/kraken/KRContext_ios.mm @@ -0,0 +1,40 @@ +// +// KRContext-ios.mm +// Kraken +// +// Created by Kearwood Gilbert on 11/1/2013. +// Copyright (c) 2013 Kearwood Software. All rights reserved. +// + +#include "KREngine-common.h" + +#include "KRContext.h" + +EAGLContext *gStreamerContext = nil; +EAGLContext *gRenderContext = nil; + +void KRContext::destroyDeviceContexts() +{ + [gStreamerContext release]; + [gRenderContext release]; +} + +void KRContext::createDeviceContexts() +{ + gRenderContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + gTextureStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: gStreamerContext.sharegroup]; + + // FIXME: need to add code check for iOS 7 and also this appears to cause crashing + + //gTextureStreamerContext.multiThreaded = TRUE; +} + +void KRContext::activateStreamerContext() +{ + [EAGLContext setCurrentContext: gStreamerContext]; +} + +void KRContext::activateRenderContext() +{ + [EAGLContext setCurrentContext: gRenderContext]; +} diff --git a/kraken/KRContext_osx.mm b/kraken/KRContext_osx.mm new file mode 100644 index 0000000..80baebe --- /dev/null +++ b/kraken/KRContext_osx.mm @@ -0,0 +1,82 @@ +// +// KRContext-osx.mm +// Kraken +// +// Created by Kearwood Gilbert on 11/1/2013. +// Copyright (c) 2013 Kearwood Software. All rights reserved. +// + +#include "KREngine-common.h" + +#include "KRContext.h" + +NSOpenGLContext *gStreamerContext = nil; +NSOpenGLContext *gRenderContext = nil; + +void KRContext::destroyDeviceContexts() +{ + [gStreamerContext release]; + [gRenderContext release]; +} + +void KRContext::createDeviceContexts() +{ + if(gRenderContext == nil) { + + /* + NSOpenGLPixelFormatAttribute attribs[] = + { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFADepthSize, 32, + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, + 0 + }; + */ + NSOpenGLPixelFormatAttribute attribs[] = { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAAccelerated, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFADepthSize, 24, + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, + 0 + }; + NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attribs] autorelease]; + gRenderContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil ]; + gStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: gRenderContext ]; + + // set synch to VBL to eliminate tearing + GLint vblSynch = 1; + [gRenderContext setValues:&vblSynch forParameter:NSOpenGLCPSwapInterval]; + +/* + CGLEnable([gRenderContext CGLContextObj], kCGLCESurfaceBackingSize); + + const GLint dim[2] = {1920, 1080}; + + [gRenderContext setValues: &dim[0] forParameter: NSOpenGLCPSurfaceBackingSize]; + [gRenderContext update]; +*/ + } +} + +void KRContext::activateStreamerContext() +{ + createDeviceContexts(); + [gStreamerContext makeCurrentContext]; +} + +void KRContext::activateRenderContext() +{ + createDeviceContexts(); + [gRenderContext update]; + [gRenderContext makeCurrentContext]; +} + +void KRContext::attachToView(void *view) +{ + createDeviceContexts(); + NSView *v = (NSView *)view; + [gRenderContext setView: v]; + [gRenderContext update]; +} \ No newline at end of file diff --git a/kraken/KREngine-common.h b/kraken/KREngine-common.h index c02b537..ac8b720 100644 --- a/kraken/KREngine-common.h +++ b/kraken/KREngine-common.h @@ -107,6 +107,16 @@ using std::hash; #define GL_ANY_SAMPLES_PASSED_EXT GL_ANY_SAMPLES_PASSED #define GL_QUERY_RESULT_EXT GL_QUERY_RESULT +#define GL_OES_mapbuffer 1 +#define glMapBufferOES glMapBuffer +#define glUnmapBufferOES glUnmapBuffer +#define GL_WRITE_ONLY_OES GL_WRITE_ONLY + +#define GL_OES_vertex_array_object 1 +#define glGenVertexArraysOES glGenVertexArrays +#define glBindVertexArrayOES glBindVertexArray +#define glDeleteVertexArraysOES glDeleteVertexArrays + #endif #include diff --git a/kraken/KRShader.cpp b/kraken/KRShader.cpp index 1ee4ad9..47941aa 100644 --- a/kraken/KRShader.cpp +++ b/kraken/KRShader.cpp @@ -558,7 +558,7 @@ bool KRShader::bind(KRCamera &camera, const KRViewport &viewport, const KRMat4 & setUniform(KRENGINE_UNIFORM_VOLUMETRIC_ENVIRONMENT_FRAME, 2); #if DEBUG - if(shander_changed) { + if(shander_changed) { // FINDME!! KIP!! HACK!! GLint logLength; GLint validate_status = GL_FALSE; diff --git a/kraken/KRShaderManager.cpp b/kraken/KRShaderManager.cpp index ae11e88..9431a35 100644 --- a/kraken/KRShaderManager.cpp +++ b/kraken/KRShaderManager.cpp @@ -145,7 +145,7 @@ KRShader *KRShaderManager::getShader(const std::string &shader_name, KRCamera *p #if TARGET_OS_IPHONE #else - stream << "\n#version 120"; + stream << "\n#version 150"; stream << "\n#define lowp"; stream << "\n#define mediump"; stream << "\n#define highp"; diff --git a/kraken/KRStreamer.mm b/kraken/KRStreamer.mm index b8c6f03..dc287a6 100644 --- a/kraken/KRStreamer.mm +++ b/kraken/KRStreamer.mm @@ -14,19 +14,6 @@ #include -#if TARGET_OS_IPHONE - -EAGLContext *gTextureStreamerContext = nil; - -#elif TARGET_OS_MAC - -NSOpenGLContext *gTextureStreamerContext = nil; - -#else - -#error Unsupported Platform -#endif - KRStreamer::KRStreamer(KRContext &context) : m_context(context) { m_running = false; @@ -37,29 +24,7 @@ void KRStreamer::startStreamer() { if(!m_running) { m_running = true; - -#if TARGET_OS_IPHONE - - gTextureStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup]; - // FIXME: need to add code check for iOS 7 and also this appears to cause crashing - - //gTextureStreamerContext.multiThreaded = TRUE; - - -#elif TARGET_OS_MAC - - NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = - { -// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, - 0 - }; - NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease]; - gTextureStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ]; - -#else - - #error Unsupported Platform -#endif + KRContext::activateStreamerContext(); m_thread = std::thread(&KRStreamer::run, this); } @@ -72,8 +37,6 @@ KRStreamer::~KRStreamer() m_thread.join(); m_running = false; } - - [gTextureStreamerContext release]; } void KRStreamer::run() @@ -82,13 +45,7 @@ void KRStreamer::run() std::chrono::microseconds sleep_duration( 15000 ); -#if TARGET_OS_IPHONE - [EAGLContext setCurrentContext: gTextureStreamerContext]; -#elif TARGET_OS_MAC - [gTextureStreamerContext makeCurrentContext]; -#else -#error Unsupported Platform -#endif + KRContext::activateStreamerContext(); while(!m_stop) { diff --git a/kraken/kraken.h b/kraken/kraken.h new file mode 100644 index 0000000..e86ff20 --- /dev/null +++ b/kraken/kraken.h @@ -0,0 +1,19 @@ +// +// kraken.h +// kraken +// +// Created by Kearwood Gilbert on 2015-11-06. +// Copyright © 2015 Kearwood Software. All rights reserved. +// + +#import + +//! Project version number for kraken. +FOUNDATION_EXPORT double krakenVersionNumber; + +//! Project version string for kraken. +FOUNDATION_EXPORT const unsigned char krakenVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/kraken_osx/Kraken-Info.plist b/kraken_osx/Kraken-Info.plist index 9b026c0..30f579c 100644 --- a/kraken_osx/Kraken-Info.plist +++ b/kraken_osx/Kraken-Info.plist @@ -23,7 +23,7 @@ CFBundleVersion 1 NSHumanReadableCopyright - Copyright © 2014 Kearwood Software. All rights reserved. + Copyright © 2015 Kearwood Software. All rights reserved. NSPrincipalClass diff --git a/kraken_osx/KrakenView.h b/kraken_osx/KrakenView.h new file mode 100644 index 0000000..e041c1b --- /dev/null +++ b/kraken_osx/KrakenView.h @@ -0,0 +1,16 @@ +// +// KrakenView.h +// Kraken +// +// Created by Kearwood Gilbert on 2015-08-07. +// Copyright © 2015 Kearwood Software. All rights reserved. +// + +#import + +class KRCamera; + +@interface KrakenView : NSView +@property (nonatomic, assign) KRCamera *camera; +- (void)drawFrameWithDeltaTime: (float)deltaTime; +@end diff --git a/kraken_osx/KrakenView.mm b/kraken_osx/KrakenView.mm new file mode 100644 index 0000000..4e3166a --- /dev/null +++ b/kraken_osx/KrakenView.mm @@ -0,0 +1,186 @@ +// +// KrakenView.m +// Kraken +// +// Created by Kearwood Gilbert on 2015-08-07. +// Copyright © 2015 Kearwood Software. All rights reserved. +// + +#import "KrakenView.h" +#include "KREngine-common.h" + +#include "KREngine.h" + +#import +#import + +@interface KrakenView() { + CVDisplayLinkRef displayLink; +}; + +- (void)getFrameForTime:(const CVTimeStamp *)outputTime; +- (void)drawFrameWithDeltaTime: (float)deltaTime; + +@end + +@implementation KrakenView + +- (void)dealloc +{ + CVDisplayLinkRelease(displayLink); + + [super dealloc]; +} + + +- (void)drawFrameWithDeltaTime: (float)deltaTime +{ + + if(_camera) { + KRContext::activateRenderContext(); + NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; + + // must lock GL context because display link is threaded + CGLLockContext((CGLContextObj)[currentContext CGLContextObj]); + + GLint hasDrawable = 0; + [currentContext getValues: &hasDrawable forParameter:NSOpenGLCPHasDrawable]; + + if(!hasDrawable) { + KRContext::attachToView(self); + const GLint dim[2] = {1920, 1080}; + + [currentContext setValues: &dim[0] forParameter: NSOpenGLCPSurfaceBackingSize]; + [currentContext update]; + } + + GLint backingDim[2] = {0, 0}; + [currentContext getValues: &backingDim[0] forParameter:NSOpenGLCPSurfaceBackingSize]; + + GLint rendererID = 0; + [currentContext getValues: &rendererID forParameter:NSOpenGLCPCurrentRendererID]; + + + GLint renderBufferWidth = 0, renderBufferHeight = 0; +// GLDEBUG(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &renderBufferWidth)); +// GLDEBUG(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &renderBufferHeight)); + + renderBufferWidth = 1920; + renderBufferHeight = 1080; + + glViewport(0, 0, renderBufferWidth, renderBufferHeight); + GLDEBUG(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); + GLDEBUG(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); + + + [[KREngine sharedInstance] renderScene: &_camera->getScene() WithDeltaTime:deltaTime AndWidth:renderBufferWidth AndHeight:renderBufferHeight]; + //[[KREngine sharedInstance] renderScene: &_camera->getScene() WithDeltaTime:deltaTime]; + + [currentContext flushBuffer]; + + CGLUnlockContext((CGLContextObj)[currentContext CGLContextObj]); + } +} + +- (void)viewDidMoveToSuperview +{ +// KRContext::attachToView(self); + + // set up the display link + CVDisplayLinkCreateWithActiveCGDisplays(&displayLink); + CVDisplayLinkSetOutputCallback(displayLink, MyDisplayLinkCallback, self); + /* + CGLContextObj cglContext = (CGLContextObj)[context CGLContextObj]; + CGLPixelFormatObj cglPixelFormat = (CGLPixelFormatObj)[[context.pixelFormat] CGLPixelFormatObj]; + CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(displayLink, cglContext, cglPixelFormat); + */ + + // ----====---- activate the display link ----====---- + CVDisplayLinkStart(displayLink); +} + +static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, + const CVTimeStamp *outputTime, CVOptionFlags flagsIn, + CVOptionFlags *flagsOut, void *displayLinkContext) +{ + // go back to Obj-C for easy access to instance variables + [(KrakenView *)displayLinkContext getFrameForTime:outputTime]; + return kCVReturnSuccess; +} + +- (void)getFrameForTime:(const CVTimeStamp *)outputTime +{ + // deltaTime is unused in this bare bones demo, but here's how to calculate it using display link info + float deltaTime = 1.0 / (outputTime->rateScalar * (double)outputTime->videoTimeScale / (double)outputTime->videoRefreshPeriod); + + [self drawFrameWithDeltaTime: deltaTime]; +} + +/* + - (id)initWithCoder:(NSCoder *)aDecoder + { + self = [super initWithCoder:aDecoder]; + if (self == nil) + { + NSLog(@"Unable to create a windowed OpenGL context."); + exit(0); + } + + [self commonInit]; + + return self; + + } + + - (id)initWithFrame:(NSRect)frameRect + { + // context setup + NSOpenGLPixelFormat *windowedPixelFormat; + NSOpenGLPixelFormatAttribute attribs[] = { + NSOpenGLPFAWindow, + NSOpenGLPFAColorSize, 32, + NSOpenGLPFADepthSize, 24, + NSOpenGLPFAAccelerated, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFASingleRenderer, + 0 }; + + windowedPixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + if (windowedPixelFormat == nil) + { + NSLog(@"Unable to create windowed pixel format."); + exit(0); + } + self = [super initWithFrame:frameRect pixelFormat:windowedPixelFormat]; + if (self == nil) + { + NSLog(@"Unable to create a windowed OpenGL context."); + exit(0); + } + [windowedPixelFormat release]; + + [self commonInit]; + + return self; + } + + - (void)reshape + { + NSSize viewBounds = [self bounds].size; + viewWidth = viewBounds.width; + viewHeight = viewBounds.height; + + NSOpenGLContext *currentContext = [self openGLContext]; + [currentContext makeCurrentContext]; + + // remember to lock the context before we touch it since display link is threaded + CGLLockContext((CGLContextObj)[currentContext CGLContextObj]); + + // let the context know we've changed size + [[self openGLContext] update]; + + CGLUnlockContext((CGLContextObj)[currentContext CGLContextObj]); + } + */ + +@end diff --git a/kraken_standard_assets_ios/Shaders/occlusion_test.fsh b/kraken_standard_assets_ios/Shaders/occlusion_test.fsh index 5beec00..682a212 100644 --- a/kraken_standard_assets_ios/Shaders/occlusion_test.fsh +++ b/kraken_standard_assets_ios/Shaders/occlusion_test.fsh @@ -30,6 +30,5 @@ // void main() { - //gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00); - gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00); + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } diff --git a/kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh b/kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh index 1a18867..52952e3 100644 --- a/kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/ObjectShader_osx.fsh @@ -27,6 +27,8 @@ //#extension GL_EXT_shadow_samplers : require +out vec4 colorOut; + #if ENABLE_RIM_COLOR == 1 uniform lowp vec3 rim_color; uniform mediump float rim_power; @@ -61,20 +63,20 @@ #if HAS_NORMAL_MAP == 1 uniform sampler2D normalTexture; #else - varying mediump vec3 normal; + in 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; + in highp vec2 texCoord; #endif #if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1 - varying highp vec2 normal_uv; + in highp vec2 normal_uv; #else #define normal_uv texCoord #endif #else #if HAS_DIFFUSE_MAP == 1 - varying highp vec2 texCoord; + in highp vec2 texCoord; #endif #endif @@ -86,7 +88,7 @@ #if GBUFFER_PASS == 1 #if HAS_NORMAL_MAP == 1 - varying highp mat3 tangent_to_view_matrix; + in highp mat3 tangent_to_view_matrix; #else uniform highp mat4 model_view_inverse_transpose_matrix; #endif @@ -94,7 +96,7 @@ #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; + in highp vec2 diffuse_uv; #else #define diffuse_uv texCoord #endif @@ -124,17 +126,17 @@ uniform lowp vec3 material_reflection; uniform samplerCube reflectionCubeTexture; #if HAS_NORMAL_MAP == 1 - varying highp mat3 tangent_to_world_matrix; + in highp mat3 tangent_to_world_matrix; #define NEED_EYEVEC uniform highp mat4 model_matrix; #else - varying mediump vec3 reflectionVec; + in mediump vec3 reflectionVec; #endif #endif #ifdef NEED_EYEVEC - varying mediump vec3 eyeVec; + in mediump vec3 eyeVec; #endif @@ -144,46 +146,46 @@ #else uniform sampler2D shadowTexture1; #endif - varying highp vec4 shadowMapCoord1; + in highp vec4 shadowMapCoord1; #endif #if HAS_LIGHT_MAP == 1 uniform sampler2D lightmapTexture; - varying mediump vec2 lightmap_uv; + in mediump vec2 lightmap_uv; #endif #if SHADOW_QUALITY >= 2 uniform sampler2D shadowTexture2; - varying highp vec4 shadowMapCoord2; + in highp vec4 shadowMapCoord2; #endif #if SHADOW_QUALITY >= 3 uniform sampler2D shadowTexture3; - varying highp vec4 shadowMapCoord3; + in highp vec4 shadowMapCoord3; #endif #if ENABLE_PER_PIXEL == 1 - varying mediump vec3 lightVec; - varying mediump vec3 halfVec; + in mediump vec3 lightVec; + in mediump vec3 halfVec; #else - varying mediump float lamberFactor; - varying mediump float specularFactor; + in mediump float lamberFactor; + in mediump float specularFactor; #endif #if (HAS_SPEC_MAP_OFFSET == 1|| HAS_SPEC_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1 - varying mediump vec2 spec_uv; + in 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; + in 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; + in highp vec2 diffuse_uv; #else #define diffuse_uv texCoord #endif @@ -197,12 +199,12 @@ void main() { #if ALPHA_TEST == 1 && HAS_DIFFUSE_MAP == 1 - mediump vec4 diffuseMaterial = texture2D(diffuseTexture, diffuse_uv); + mediump vec4 diffuseMaterial = texture(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; + if(texture(diffuseTexture, diffuse_uv).a < 0.5) discard; #endif #if GBUFFER_PASS == 2 || GBUFFER_PASS == 3 @@ -210,7 +212,7 @@ void main() #endif #if GBUFFER_PASS == 3 - lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv); + lowp vec4 gbuffer_sample = texture(gbuffer_frame, gbuffer_uv); mediump vec3 gbuffer_lamber_factor = gbuffer_sample.rgb * 5.0; lowp float gbuffer_specular_factor = gbuffer_sample.a; #endif @@ -218,18 +220,18 @@ void main() #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 normal = normalize(2.0 * texture(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); + colorOut = 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); + mediump vec4 diffuseMaterial = texture(diffuseTexture, diffuse_uv); #endif #else @@ -239,7 +241,7 @@ void main() #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); + mediump vec3 normal = normalize(2.0 * texture(normalTexture,normal_uv).rgb - 1.0); #endif #if GBUFFER_PASS == 3 @@ -277,7 +279,7 @@ void main() #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; + shadowMapDepth = texture(shadowTexture1, shadowMapPos).z; vertexShadowDepth = (shadowMapCoord1 / shadowMapCoord1.w).z; } #endif @@ -292,14 +294,14 @@ void main() 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; + shadowMapDepth = texture(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; + shadowMapDepth = texture(shadowTexture2, shadowMapPos).z; vertexShadowDepth = (shadowMapCoord2 / shadowMapCoord2.w).z; } #if SHADOW_QUALITY >= 3 @@ -308,7 +310,7 @@ void main() 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; + shadowMapDepth = texture(shadowTexture3, shadowMapPos).z; vertexShadowDepth = (shadowMapCoord3 / shadowMapCoord3.w).z; } @@ -330,38 +332,38 @@ void main() #if ENABLE_AMBIENT == 1 // -------------------- Add ambient light and alpha component -------------------- - gl_FragColor = vec4(vec3(diffuseMaterial) * material_ambient, 0.0); + colorOut = vec4(vec3(diffuseMaterial) * material_ambient, 0.0); #else - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + colorOut = 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); + colorOut += diffuseMaterial * vec4(material_diffuse * lamberFactor, 1.0); #endif // -------------------- Apply material_alpha -------------------- #if ALPHA_BLEND == 1 - gl_FragColor.a = diffuseMaterial.a; - gl_FragColor *= material_alpha; + colorOut.a = diffuseMaterial.a; + colorOut *= 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; + colorOut.rgb += material_specular * vec3(texture(specularTexture, spec_uv)) * specularFactor; #else - gl_FragColor.rgb += material_specular * specularFactor; + colorOut.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; + mediump vec3 lightMapColor = vec3(texture(lightmapTexture, lightmap_uv)); + //colorOut = vec4(colorOut.r * lightMapColor.r, colorOut.g * lightMapColor.g, colorOut.b * lightMapColor.b, colorOut.a); + colorOut.rgb *= lightMapColor; #endif @@ -375,9 +377,9 @@ void main() 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); + colorOut += vec4(material_reflection, 0.0) * texture(reflectionTexture, reflection_uv) * vec4(texture(reflectionCubeTexture, reflectionVec).rgb, 1.0); #else - gl_FragColor += vec4(material_reflection, 0.0) * vec4(textureCube(reflectionCubeTexture, reflectionVec).rgb, 1.0); + colorOut += vec4(material_reflection, 0.0) * vec4(texture(reflectionCubeTexture, reflectionVec).rgb, 1.0); #endif #endif @@ -402,9 +404,9 @@ void main() #endif #if ALPHA_BLEND == 1 - gl_FragColor.rgb = mix(fog_color.rgb * gl_FragColor.a, gl_FragColor.rgb, fog_alpha); + colorOut.rgb = mix(fog_color.rgb * colorOut.a, colorOut.rgb, fog_alpha); #else - gl_FragColor.rgb = mix(fog_color.rgb, gl_FragColor.rgb, fog_alpha); + colorOut.rgb = mix(fog_color.rgb, colorOut.rgb, fog_alpha); #endif #endif @@ -414,10 +416,10 @@ void main() #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); + colorOut += vec4(rim_color, 1.0) * pow(rim, rim_power); #endif #if BONE_COUNT > 0 - gl_FragColor.b = 1.0; + colorOut.b = 1.0; #endif } diff --git a/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh b/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh index 904a3a4..aadb768 100644 --- a/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/ObjectShader_osx.vsh @@ -30,16 +30,16 @@ // -attribute highp vec3 vertex_position, vertex_normal; +in highp vec3 vertex_position, vertex_normal; #if HAS_NORMAL_MAP == 1 - attribute highp vec3 vertex_tangent; + in highp vec3 vertex_tangent; #endif -attribute mediump vec2 vertex_uv; +in 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; + in highp vec4 bone_weights; + in highp vec4 bone_indexes; uniform highp mat4 bone_transforms[BONE_COUNT]; #else #define vertex_position_skinned vertex_position @@ -51,7 +51,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #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; + out highp vec2 texCoord; #endif #if HAS_NORMAL_MAP == 1 #if HAS_NORMAL_MAP_SCALE == 1 @@ -63,22 +63,22 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #endif #if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1 - varying highp vec2 normal_uv; + out highp vec2 normal_uv; #endif #else - varying mediump vec3 normal; + out mediump vec3 normal; #endif #else uniform mediump float material_shininess; #if HAS_DIFFUSE_MAP == 1 - varying highp vec2 texCoord; + out 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; + out highp mat3 tangent_to_view_matrix; #endif #else @@ -86,16 +86,16 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t uniform highp vec3 camera_position_model_space; #if HAS_LIGHT_MAP == 1 - attribute mediump vec2 vertex_lightmap_uv; - varying mediump vec2 lightmap_uv; + in mediump vec2 vertex_lightmap_uv; + out mediump vec2 lightmap_uv; #endif #if ENABLE_PER_PIXEL == 1 - varying mediump vec3 lightVec; - varying mediump vec3 halfVec; + out mediump vec3 lightVec; + out mediump vec3 halfVec; #if HAS_SPEC_MAP_OFFSET == 1 || HAS_SPEC_MAP_SCALE == 1 - varying highp vec2 spec_uv; + out highp vec2 spec_uv; #endif #if HAS_SPEC_MAP_SCALE == 1 @@ -107,7 +107,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #endif #if HAS_REFLECTION_MAP_OFFSET == 1 || HAS_REFLECTION_MAP_SCALE == 1 - varying highp vec2 reflection_uv; + out highp vec2 reflection_uv; #endif #if HAS_REFLECTION_MAP_SCALE == 1 @@ -120,22 +120,22 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #if SHADOW_QUALITY >= 1 uniform highp mat4 shadow_mvp1; - varying highp vec4 shadowMapCoord1; + out highp vec4 shadowMapCoord1; #endif #if SHADOW_QUALITY >= 2 uniform highp mat4 shadow_mvp2; - varying highp vec4 shadowMapCoord2; + out highp vec4 shadowMapCoord2; #endif #if SHADOW_QUALITY >= 3 uniform highp mat4 shadow_mvp3; - varying highp vec4 shadowMapCoord3; + out highp vec4 shadowMapCoord3; #endif #else - varying mediump float lamberFactor; - varying mediump float specularFactor; + out mediump float lamberFactor; + out mediump float specularFactor; #endif #if ENABLE_RIM_COLOR == 1 @@ -146,15 +146,15 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #if HAS_NORMAL_MAP == 1 #define NEED_EYEVEC uniform highp mat4 model_inverse_transpose_matrix; - varying highp mat3 tangent_to_world_matrix; + out highp mat3 tangent_to_world_matrix; #else uniform highp mat4 model_matrix; - varying mediump vec3 reflectionVec; + out mediump vec3 reflectionVec; #endif #endif #ifdef NEED_EYEVEC - varying mediump vec3 eyeVec; + out mediump vec3 eyeVec; #endif #if HAS_DIFFUSE_MAP_SCALE == 1 @@ -166,7 +166,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t #endif #if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1 - varying highp vec2 diffuse_uv; + out highp vec2 diffuse_uv; #endif #endif diff --git a/kraken_standard_assets_osx/Shaders/PostShader_osx.fsh b/kraken_standard_assets_osx/Shaders/PostShader_osx.fsh index 34a274b..eba229c 100644 --- a/kraken_standard_assets_osx/Shaders/PostShader_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/PostShader_osx.fsh @@ -31,32 +31,33 @@ #define PIXEL_SHIFT_3 0.003 #define PIXEL_SHIFT_4 0.004 -varying mediump vec2 textureCoordinate; -//precision lowp float; +in vec2 textureCoordinate; #if ENABLE_VIDEO_BG == 1 -uniform lowp sampler2D videoFrame; +uniform sampler2D videoFrame; #endif #if ENABLE_FADE_COLOR == 1 -uniform lowp vec4 fade_color; +uniform vec4 fade_color; #endif -uniform lowp sampler2D renderFrame; -uniform lowp sampler2D depthFrame; +uniform sampler2D renderFrame; +uniform sampler2D depthFrame; #if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1 -uniform lowp sampler2D volumetricEnvironmentFrame; +uniform sampler2D volumetricEnvironmentFrame; #endif +out vec4 colorOut; + void main() { - lowp vec4 renderColor = texture2D(renderFrame, textureCoordinate); + vec4 renderColor = texture(renderFrame, textureCoordinate); #if DOF_QUALITY > 0 || ENABLE_FLASH == 1 - mediump float depth = texture2D(depthFrame, textureCoordinate).r; + float depth = texture(depthFrame, textureCoordinate).r; #endif - mediump vec4 pixelColor = renderColor; + vec4 pixelColor = renderColor; #if DOF_QUALITY == 2 @@ -67,43 +68,43 @@ void main() // _XXXXX_ // _XXXXX_ // __XXX__ - mediump float cf1 = PIXEL_SHIFT_1; - mediump float cf2 = PIXEL_SHIFT_2; + float cf1 = PIXEL_SHIFT_1; + 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; + float bx1 = textureCoordinate.s + cf1; + float bx2 = textureCoordinate.s + cf2; + float bxm1 = textureCoordinate.s - cf1; + 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; + float by1 = textureCoordinate.t + cf1; + float by2 = textureCoordinate.t + cf2; + float bym1 = textureCoordinate.t - cf1; + 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 += texture(renderFrame, vec2(bx1, textureCoordinate.t)); + pixelColor += texture(renderFrame, vec2(bxm1, textureCoordinate.t)); + pixelColor += texture(renderFrame, vec2(bx2, textureCoordinate.t)); + pixelColor += texture(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 += texture(renderFrame, vec2(textureCoordinate.s, by1)); + pixelColor += texture(renderFrame, vec2(bx1, by1)); + pixelColor += texture(renderFrame, vec2(bxm1, by1)); + pixelColor += texture(renderFrame, vec2(bx2, by1)); + pixelColor += texture(renderFrame, vec2(bxm2, by1)); - pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s, by2)); - pixelColor += texture2D(renderFrame, vec2(bx1, by2)); - pixelColor += texture2D(renderFrame, vec2(bxm1, by2)); + pixelColor += texture(renderFrame, vec2(textureCoordinate.s, by2)); + pixelColor += texture(renderFrame, vec2(bx1, by2)); + pixelColor += texture(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 += texture(renderFrame, vec2(textureCoordinate.s,bym1)); + pixelColor += texture(renderFrame, vec2(bx1,bym1)); + pixelColor += texture(renderFrame, vec2(bxm1,bym1)); + pixelColor += texture(renderFrame, vec2(bx2,bym1)); + pixelColor += texture(renderFrame, vec2(bxm2,bym1)); - pixelColor += texture2D(renderFrame, vec2(bx1, bym2)); - pixelColor += texture2D(renderFrame, vec2(bx1, bym2)); - pixelColor += texture2D(renderFrame, vec2(bxm1, bym2)); + pixelColor += texture(renderFrame, vec2(bx1, bym2)); + pixelColor += texture(renderFrame, vec2(bx1, bym2)); + pixelColor += texture(renderFrame, vec2(bxm1, bym2)); pixelColor /= 21.0; #endif @@ -117,26 +118,26 @@ void main() // _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 += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_2, 0)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, 0)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, 0)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_2, 0)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1)); + pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1)); + pixelColor += texture(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); + float focusDepth = texture(depthFrame, vec2(0.5, 0.5)).r; + float blurAmount = clamp((depth - DOF_DEPTH - focusDepth) / DOF_FALLOFF, 0.0, 1.0); pixelColor = pixelColor * blurAmount + renderColor * (1.0 - blurAmount); #endif @@ -160,7 +161,7 @@ void main() // ---- VIDEO_BG END ---- #if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1 - pixelColor += texture2D(volumetricEnvironmentFrame, textureCoordinate); + pixelColor += texture(volumetricEnvironmentFrame, textureCoordinate); #endif @@ -177,13 +178,13 @@ void main() pixelColor.rgb = mix(pixelColor.rgb, fade_color.rgb, fade_color.a); #endif - gl_FragColor = pixelColor; - + colorOut = pixelColor; //PASSTHROUGH STATEMENT - // gl_FragColor = texture2D(depthFrame, textureCoordinate); + // colorOut = texture(depthFrame, textureCoordinate); - //gl_FragColor = vec4(vec3(blurAmount), 1.0); - + //colorOut = vec4(vec3(blurAmount), 1.0); + + colorOut = vec4(0.0, 0.0, 1.0, 1.0); // FINDME, KIP!!, HACK!! } diff --git a/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh b/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh index c147629..600f844 100644 --- a/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/PostShader_osx.vsh @@ -25,11 +25,11 @@ // or implied, of Kearwood Gilbert. // -uniform mediump vec2 viewport_downsample; -attribute vec4 vertex_position; -attribute lowp vec4 vertex_uv; +uniform vec2 viewport_downsample; +in vec4 vertex_position; +in vec4 vertex_uv; -varying mediump vec2 textureCoordinate; +out vec2 textureCoordinate; void main() { diff --git a/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh b/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh index 81802b9..8c19e35 100644 --- a/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/ShadowShader_osx.fsh @@ -25,9 +25,11 @@ // or implied, of Kearwood Gilbert. // -//varying mediump vec2 texCoord; +//in mediump vec2 texCoord; + +out vec4 colorOut; void main() { - gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); + colorOut = vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/kraken_standard_assets_osx/Shaders/ShadowShader_osx.vsh b/kraken_standard_assets_osx/Shaders/ShadowShader_osx.vsh index b8241a0..382558f 100644 --- a/kraken_standard_assets_osx/Shaders/ShadowShader_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/ShadowShader_osx.vsh @@ -28,7 +28,7 @@ #define SHADOW_BIAS 0.01 -attribute highp vec4 vertex_position; +in highp vec4 vertex_position; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/debug_font_osx.fsh b/kraken_standard_assets_osx/Shaders/debug_font_osx.fsh index e4fee7f..bfda860 100644 --- a/kraken_standard_assets_osx/Shaders/debug_font_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/debug_font_osx.fsh @@ -25,12 +25,14 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 textureCoordinate; +out vec4 colorOut; + +in 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); + vec4 font_color = texture(diffuseTexture, textureCoordinate); + colorOut = vec4(font_color.r, font_color.g, font_color.b, font_color.r + 0.50); } diff --git a/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh b/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh index 5d7bdea..c6680d4 100644 --- a/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/debug_font_osx.vsh @@ -25,10 +25,10 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 textureCoordinate; +out mediump vec2 textureCoordinate; -attribute vec4 vertex_position; -attribute lowp vec2 vertex_uv; +in vec4 vertex_position; +in lowp vec2 vertex_uv; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh b/kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh index 039a636..92a36eb 100644 --- a/kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/dust_particle_osx.fsh @@ -31,13 +31,15 @@ //#extension GL_EXT_shadow_samplers : require -varying mediump vec2 texCoord; +out vec4 colorOut; -varying mediump vec4 shadowMapCoord1; +in mediump vec2 texCoord; + +in mediump vec4 shadowMapCoord1; uniform sampler2DShadow shadowTexture1; uniform mediump vec3 light_color; -varying lowp float intensity_modulate; +in 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; + colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1) * max(1.0 - texCoord.x*texCoord.x-texCoord.y*texCoord.y, 0.0) * intensity_modulate; } \ No newline at end of file diff --git a/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh b/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh index c49fb87..66aee7d 100644 --- a/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/dust_particle_osx.vsh @@ -29,19 +29,19 @@ // or implied, of Kearwood Gilbert. // -attribute mediump vec2 vertex_uv; +in 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; +in vec4 vertex_position; uniform highp vec3 particle_origin; uniform highp mat4 shadow_mvp1; -varying mediump vec4 shadowMapCoord1; +out mediump vec4 shadowMapCoord1; -varying mediump vec2 texCoord; +out mediump vec2 texCoord; uniform highp float time_absolute; -varying lowp float intensity_modulate; +out lowp float intensity_modulate; void main() { highp vec4 offset_center = vertex_position + vec4(particle_origin, 0.0); diff --git a/kraken_standard_assets_osx/Shaders/flare_osx.fsh b/kraken_standard_assets_osx/Shaders/flare_osx.fsh index 7fce713..0d2831c 100644 --- a/kraken_standard_assets_osx/Shaders/flare_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/flare_osx.fsh @@ -29,10 +29,12 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 texCoord; +out vec4 colorOut; + +in vec2 texCoord; uniform sampler2D diffuseTexture; -uniform lowp float material_alpha; +uniform float material_alpha; void main() { - gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha; + colorOut = vec4(vec3(texture(diffuseTexture, texCoord)), 1.0) * material_alpha; } \ No newline at end of file diff --git a/kraken_standard_assets_osx/Shaders/flare_osx.vsh b/kraken_standard_assets_osx/Shaders/flare_osx.vsh index fc0c4d4..d168d5c 100644 --- a/kraken_standard_assets_osx/Shaders/flare_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/flare_osx.vsh @@ -29,12 +29,12 @@ // 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; +in vec2 vertex_uv; +uniform mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices +uniform vec4 viewport; +uniform float flare_size; -varying mediump vec2 texCoord; +out vec2 texCoord; void main() { texCoord = vertex_uv; diff --git a/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh b/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh index f92a412..77c8a6f 100644 --- a/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/light_directional_osx.fsh @@ -25,6 +25,7 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; uniform sampler2D gbuffer_frame; uniform sampler2D gbuffer_depth; @@ -37,14 +38,14 @@ 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); + lowp vec4 gbuffer_sample = texture(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) + (2.0 * -texture(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; @@ -56,5 +57,5 @@ void main() specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent); - gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_intensity; + colorOut = vec4(light_color * lamberFactor, specularFactor) * light_intensity; } diff --git a/kraken_standard_assets_osx/Shaders/light_directional_osx.vsh b/kraken_standard_assets_osx/Shaders/light_directional_osx.vsh index 62c7fd9..d99548a 100644 --- a/kraken_standard_assets_osx/Shaders/light_directional_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/light_directional_osx.vsh @@ -25,7 +25,7 @@ // or implied, of Kearwood Gilbert. // -attribute vec4 vertex_position; +in vec4 vertex_position; void main() { diff --git a/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh b/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh index f3e9aa1..07f032d 100644 --- a/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/light_point_inside_osx.fsh @@ -25,6 +25,7 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; uniform sampler2D gbuffer_frame; uniform sampler2D gbuffer_depth; @@ -43,14 +44,14 @@ 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); + lowp vec4 gbuffer_sample = texture(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, + texture(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0, 1.0 ); @@ -69,5 +70,5 @@ void main() specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent); //} - gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation; + colorOut = vec4(light_color * lamberFactor, specularFactor) * light_attenuation; } diff --git a/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh b/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh index 62c7fd9..d99548a 100644 --- a/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/light_point_inside_osx.vsh @@ -25,7 +25,7 @@ // or implied, of Kearwood Gilbert. // -attribute vec4 vertex_position; +in vec4 vertex_position; void main() { diff --git a/kraken_standard_assets_osx/Shaders/light_point_osx.fsh b/kraken_standard_assets_osx/Shaders/light_point_osx.fsh index 5c9b4bb..2921cf1 100644 --- a/kraken_standard_assets_osx/Shaders/light_point_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/light_point_osx.fsh @@ -25,6 +25,7 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; uniform sampler2D gbuffer_frame; uniform sampler2D gbuffer_depth; @@ -43,14 +44,14 @@ 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); + lowp vec4 gbuffer_sample = texture(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, + texture(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0, 1.0 ); @@ -69,5 +70,5 @@ void main() specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent); //} - gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation; + colorOut = vec4(light_color * lamberFactor, specularFactor) * light_attenuation; } diff --git a/kraken_standard_assets_osx/Shaders/light_point_osx.vsh b/kraken_standard_assets_osx/Shaders/light_point_osx.vsh index 14bf865..84c6687 100644 --- a/kraken_standard_assets_osx/Shaders/light_point_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/light_point_osx.vsh @@ -25,7 +25,7 @@ // or implied, of Kearwood Gilbert. // -attribute vec4 vertex_position; +in vec4 vertex_position; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/occlusion_test_osx.fsh b/kraken_standard_assets_osx/Shaders/occlusion_test_osx.fsh index 5beec00..7e484ab 100644 --- a/kraken_standard_assets_osx/Shaders/occlusion_test_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/occlusion_test_osx.fsh @@ -29,7 +29,9 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; + void main() { - //gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00); - gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00); + //colorOut = vec4(0.00, 0.00, 0.00, 0.00); + colorOut = vec4(0.00, 0.00, 0.00, 0.00); } diff --git a/kraken_standard_assets_osx/Shaders/occlusion_test_osx.vsh b/kraken_standard_assets_osx/Shaders/occlusion_test_osx.vsh index f76551f..f095553 100644 --- a/kraken_standard_assets_osx/Shaders/occlusion_test_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/occlusion_test_osx.vsh @@ -25,7 +25,7 @@ // or implied, of Kearwood Gilbert. // -attribute vec4 vertex_position; +in vec4 vertex_position; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh b/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh index abc6fe4..f91ab2a 100644 --- a/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/simple_blit_osx.fsh @@ -25,11 +25,13 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 textureCoordinate; +out vec4 colorOut; + +in mediump vec2 textureCoordinate; uniform sampler2D diffuseTexture; void main() { - gl_FragColor = texture2D(diffuseTexture, textureCoordinate); + colorOut = texture(diffuseTexture, textureCoordinate); } diff --git a/kraken_standard_assets_osx/Shaders/simple_blit_osx.vsh b/kraken_standard_assets_osx/Shaders/simple_blit_osx.vsh index fbc9319..ca983bc 100644 --- a/kraken_standard_assets_osx/Shaders/simple_blit_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/simple_blit_osx.vsh @@ -25,10 +25,10 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 textureCoordinate; +out mediump vec2 textureCoordinate; -attribute vec4 vertex_position; -attribute lowp vec4 vertex_uv; +in vec4 vertex_position; +in lowp vec4 vertex_uv; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/sky_box_osx.fsh b/kraken_standard_assets_osx/Shaders/sky_box_osx.fsh index cc4326a..0876d09 100644 --- a/kraken_standard_assets_osx/Shaders/sky_box_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/sky_box_osx.fsh @@ -29,10 +29,12 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; + uniform samplerCube diffuseTexture; -varying mediump vec3 texCoord; +in mediump vec3 texCoord; void main() { - gl_FragColor = textureCube(diffuseTexture, normalize(texCoord)); + colorOut = textureCube(diffuseTexture, normalize(texCoord)); } \ No newline at end of file diff --git a/kraken_standard_assets_osx/Shaders/sky_box_osx.vsh b/kraken_standard_assets_osx/Shaders/sky_box_osx.vsh index 3540e26..c6b6207 100644 --- a/kraken_standard_assets_osx/Shaders/sky_box_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/sky_box_osx.vsh @@ -30,12 +30,9 @@ // // -attribute vec4 vertex_position; -//attribute lowp vec4 vertex_uv; -// -//varying mediump vec2 textureCoordinate; +in vec4 vertex_position; -varying mediump vec3 texCoord; +out 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; diff --git a/kraken_standard_assets_osx/Shaders/sprite_osx.fsh b/kraken_standard_assets_osx/Shaders/sprite_osx.fsh index 4519d5d..feb61b3 100644 --- a/kraken_standard_assets_osx/Shaders/sprite_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/sprite_osx.fsh @@ -29,10 +29,12 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec2 texCoord; +out vec4 colorOut; + +in mediump vec2 texCoord; uniform sampler2D diffuseTexture; uniform lowp float material_alpha; void main() { - gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha; + colorOut = vec4(vec3(texture(diffuseTexture, texCoord)), 1.0) * material_alpha; } \ No newline at end of file diff --git a/kraken_standard_assets_osx/Shaders/sprite_osx.vsh b/kraken_standard_assets_osx/Shaders/sprite_osx.vsh index 1e8682a..b367a1c 100644 --- a/kraken_standard_assets_osx/Shaders/sprite_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/sprite_osx.vsh @@ -29,11 +29,11 @@ // or implied, of Kearwood Gilbert. // -attribute mediump vec2 vertex_uv; +in 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; +out mediump vec2 texCoord; void main() { texCoord = vertex_uv; diff --git a/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh b/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh index 42aae77..de29a57 100644 --- a/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.fsh @@ -29,7 +29,9 @@ // or implied, of Kearwood Gilbert. // +out vec4 colorOut; + void main() { - gl_FragColor = vec4(0.0, 0.05, 0.05, 0.0); + colorOut = vec4(0.0, 0.05, 0.05, 0.0); } diff --git a/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.vsh b/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.vsh index ade5a63..b508cd3 100644 --- a/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/visualize_overlay_osx.vsh @@ -29,7 +29,7 @@ // or implied, of Kearwood Gilbert. // -attribute vec4 vertex_position; +in vec4 vertex_position; uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices void main() diff --git a/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh b/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh index 8e1f7ee..ac905b1 100644 --- a/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.fsh @@ -25,7 +25,9 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec4 shadowMapCoord1; +out vec4 colorOut; + +in mediump vec4 shadowMapCoord1; uniform sampler2DShadow shadowTexture1; uniform lowp sampler2D depthFrame; uniform mediump vec4 viewport; @@ -33,7 +35,7 @@ uniform mediump vec3 light_color; void main() { - if(gl_FragCoord.z > texture2D(depthFrame, vec2(gl_FragCoord.xy / viewport.zw)).r) discard; + if(gl_FragCoord.z > texture(depthFrame, vec2(gl_FragCoord.xy / viewport.zw)).r) discard; - gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1); + colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1); } diff --git a/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.vsh b/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.vsh index 9bde6f3..976996a 100644 --- a/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/volumetric_fog_downsampled_osx.vsh @@ -25,13 +25,13 @@ // or implied, of Kearwood Gilbert. // -attribute highp vec4 vertex_position; +in 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; +out mediump vec4 shadowMapCoord1; uniform highp mat4 projection_matrix; diff --git a/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh b/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh index ec1112f..362b452 100644 --- a/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh +++ b/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.fsh @@ -25,11 +25,13 @@ // or implied, of Kearwood Gilbert. // -varying mediump vec4 shadowMapCoord1; +out vec4 colorOut; + +in mediump vec4 shadowMapCoord1; uniform sampler2DShadow shadowTexture1; uniform mediump vec3 light_color; void main() { - gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1); + colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1); } diff --git a/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh b/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh index 2f98b72..4d8183d 100644 --- a/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh +++ b/kraken_standard_assets_osx/Shaders/volumetric_fog_osx.vsh @@ -25,13 +25,13 @@ // or implied, of Kearwood Gilbert. // -attribute highp vec4 vertex_position; +in 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; +out mediump vec4 shadowMapCoord1; uniform highp mat4 projection_matrix;