diff --git a/KREngine/Kraken.xcodeproj/project.pbxproj b/KREngine/Kraken.xcodeproj/project.pbxproj index f66c598..eef1240 100644 --- a/KREngine/Kraken.xcodeproj/project.pbxproj +++ b/KREngine/Kraken.xcodeproj/project.pbxproj @@ -291,8 +291,8 @@ E4E6F68716BA5DF700E410F8 /* debug_font.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64B16BA5D9400E410F8 /* debug_font.vsh */; }; E4E6F68816BA5DF700E410F8 /* dust_particle.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64C16BA5D9400E410F8 /* dust_particle.fsh */; }; E4E6F68916BA5DF700E410F8 /* dust_particle.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64D16BA5D9400E410F8 /* dust_particle.vsh */; }; - E4E6F68A16BA5DF700E410F8 /* flare.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64E16BA5D9400E410F8 /* flare.fsh */; }; - E4E6F68B16BA5DF700E410F8 /* flare.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64F16BA5D9400E410F8 /* flare.vsh */; }; + E4E6F68A16BA5DF700E410F8 /* sprite.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64E16BA5D9400E410F8 /* sprite.fsh */; }; + E4E6F68B16BA5DF700E410F8 /* sprite.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F64F16BA5D9400E410F8 /* sprite.vsh */; }; E4E6F68C16BA5DF700E410F8 /* light_directional.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F65016BA5D9400E410F8 /* light_directional.fsh */; }; E4E6F68D16BA5DF700E410F8 /* light_directional.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F65116BA5D9400E410F8 /* light_directional.vsh */; }; E4E6F68E16BA5DF700E410F8 /* light_point_inside.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F65216BA5D9400E410F8 /* light_point_inside.fsh */; }; @@ -323,8 +323,8 @@ E4E6F6A716BA5E0A00E410F8 /* debug_font_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61116BA5D8300E410F8 /* debug_font_osx.vsh */; }; E4E6F6A816BA5E0A00E410F8 /* dust_particle_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61216BA5D8300E410F8 /* dust_particle_osx.fsh */; }; E4E6F6A916BA5E0A00E410F8 /* dust_particle_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61316BA5D8300E410F8 /* dust_particle_osx.vsh */; }; - E4E6F6AA16BA5E0A00E410F8 /* flare_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61416BA5D8300E410F8 /* flare_osx.fsh */; }; - E4E6F6AB16BA5E0A00E410F8 /* flare_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61516BA5D8300E410F8 /* flare_osx.vsh */; }; + E4E6F6AA16BA5E0A00E410F8 /* sprite_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61416BA5D8300E410F8 /* sprite_osx.fsh */; }; + E4E6F6AB16BA5E0A00E410F8 /* sprite_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61516BA5D8300E410F8 /* sprite_osx.vsh */; }; E4E6F6AC16BA5E0A00E410F8 /* light_directional_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61616BA5D8300E410F8 /* light_directional_osx.fsh */; }; E4E6F6AD16BA5E0A00E410F8 /* light_directional_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61716BA5D8300E410F8 /* light_directional_osx.vsh */; }; E4E6F6AE16BA5E0A00E410F8 /* light_point_inside_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F61816BA5D8300E410F8 /* light_point_inside_osx.fsh */; }; @@ -428,6 +428,10 @@ 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; }; + 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 = ""; }; + 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 = ""; }; E428C2F71669612500A16EDF /* KRAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAnimation.h; sourceTree = ""; }; @@ -581,8 +585,8 @@ 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 /* flare_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare_osx.fsh; sourceTree = ""; }; - E4E6F61516BA5D8300E410F8 /* flare_osx.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare_osx.vsh; sourceTree = ""; }; + E4E6F61416BA5D8300E410F8 /* sprite_osx.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sprite_osx.fsh; sourceTree = ""; }; + 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 = ""; }; 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 = ""; }; @@ -609,8 +613,8 @@ E4E6F64B16BA5D9400E410F8 /* debug_font.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = debug_font.vsh; sourceTree = ""; }; E4E6F64C16BA5D9400E410F8 /* dust_particle.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dust_particle.fsh; sourceTree = ""; }; E4E6F64D16BA5D9400E410F8 /* dust_particle.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dust_particle.vsh; sourceTree = ""; }; - E4E6F64E16BA5D9400E410F8 /* flare.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare.fsh; sourceTree = ""; }; - E4E6F64F16BA5D9400E410F8 /* flare.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = flare.vsh; sourceTree = ""; }; + E4E6F64E16BA5D9400E410F8 /* sprite.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sprite.fsh; sourceTree = ""; }; + E4E6F64F16BA5D9400E410F8 /* sprite.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = sprite.vsh; sourceTree = ""; }; E4E6F65016BA5D9400E410F8 /* light_directional.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_directional.fsh; sourceTree = ""; }; E4E6F65116BA5D9400E410F8 /* light_directional.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_directional.vsh; sourceTree = ""; }; E4E6F65216BA5D9400E410F8 /* light_point_inside.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = light_point_inside.fsh; sourceTree = ""; }; @@ -734,8 +738,8 @@ E4E6F64B16BA5D9400E410F8 /* debug_font.vsh */, E4E6F64C16BA5D9400E410F8 /* dust_particle.fsh */, E4E6F64D16BA5D9400E410F8 /* dust_particle.vsh */, - E4E6F64E16BA5D9400E410F8 /* flare.fsh */, - E4E6F64F16BA5D9400E410F8 /* flare.vsh */, + E4E6F64E16BA5D9400E410F8 /* sprite.fsh */, + E4E6F64F16BA5D9400E410F8 /* sprite.vsh */, E4E6F65016BA5D9400E410F8 /* light_directional.fsh */, E4E6F65116BA5D9400E410F8 /* light_directional.vsh */, E4E6F65216BA5D9400E410F8 /* light_point_inside.fsh */, @@ -759,6 +763,8 @@ E4E6F66416BA5D9400E410F8 /* volumetric_fog_downsampled.vsh */, E4E6F66516BA5D9400E410F8 /* volumetric_fog.fsh */, E4E6F66616BA5D9400E410F8 /* volumetric_fog.vsh */, + E42559AA184DD4490081BB20 /* flare.fsh */, + E42559AC184DD45A0081BB20 /* flare.vsh */, ); path = Shaders; sourceTree = ""; @@ -1153,8 +1159,8 @@ E4E6F61116BA5D8300E410F8 /* debug_font_osx.vsh */, E4E6F61216BA5D8300E410F8 /* dust_particle_osx.fsh */, E4E6F61316BA5D8300E410F8 /* dust_particle_osx.vsh */, - E4E6F61416BA5D8300E410F8 /* flare_osx.fsh */, - E4E6F61516BA5D8300E410F8 /* flare_osx.vsh */, + E4E6F61416BA5D8300E410F8 /* sprite_osx.fsh */, + E4E6F61516BA5D8300E410F8 /* sprite_osx.vsh */, E4E6F61616BA5D8300E410F8 /* light_directional_osx.fsh */, E4E6F61716BA5D8300E410F8 /* light_directional_osx.vsh */, E4E6F61816BA5D8300E410F8 /* light_point_inside_osx.fsh */, @@ -1176,6 +1182,8 @@ E4E6F62816BA5D8300E410F8 /* volumetric_fog_downsampled_osx.vsh */, E4E6F62916BA5D8300E410F8 /* volumetric_fog_osx.fsh */, E4E6F62A16BA5D8300E410F8 /* volumetric_fog_osx.vsh */, + E42559AE184DD4730081BB20 /* flare_osx.fsh */, + E42559B0184DD48B0081BB20 /* flare_osx.vsh */, ); path = Shaders; sourceTree = ""; @@ -1511,8 +1519,8 @@ E4E6F68716BA5DF700E410F8 /* debug_font.vsh in Resources */, E4E6F68816BA5DF700E410F8 /* dust_particle.fsh in Resources */, E4E6F68916BA5DF700E410F8 /* dust_particle.vsh in Resources */, - E4E6F68A16BA5DF700E410F8 /* flare.fsh in Resources */, - E4E6F68B16BA5DF700E410F8 /* flare.vsh in Resources */, + E4E6F68A16BA5DF700E410F8 /* sprite.fsh in Resources */, + E4E6F68B16BA5DF700E410F8 /* sprite.vsh in Resources */, E4E6F68C16BA5DF700E410F8 /* light_directional.fsh in Resources */, E4E6F68D16BA5DF700E410F8 /* light_directional.vsh in Resources */, E4E6F68E16BA5DF700E410F8 /* light_point_inside.fsh in Resources */, @@ -1551,8 +1559,8 @@ E4E6F6A716BA5E0A00E410F8 /* debug_font_osx.vsh in Resources */, E4E6F6A816BA5E0A00E410F8 /* dust_particle_osx.fsh in Resources */, E4E6F6A916BA5E0A00E410F8 /* dust_particle_osx.vsh in Resources */, - E4E6F6AA16BA5E0A00E410F8 /* flare_osx.fsh in Resources */, - E4E6F6AB16BA5E0A00E410F8 /* flare_osx.vsh in Resources */, + E4E6F6AA16BA5E0A00E410F8 /* sprite_osx.fsh in Resources */, + E4E6F6AB16BA5E0A00E410F8 /* sprite_osx.vsh in Resources */, E4E6F6AC16BA5E0A00E410F8 /* light_directional_osx.fsh in Resources */, E4E6F6AD16BA5E0A00E410F8 /* light_directional_osx.vsh in Resources */, E4E6F6AE16BA5E0A00E410F8 /* light_point_inside_osx.fsh in Resources */, diff --git a/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - ios.xcscheme b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - ios.xcscheme new file mode 100644 index 0000000..832c872 --- /dev/null +++ b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - ios.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - osx.xcscheme b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - osx.xcscheme new file mode 100644 index 0000000..03db38e --- /dev/null +++ b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken - osx.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - OSX.xcscheme b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - OSX.xcscheme new file mode 100644 index 0000000..a5f6a90 --- /dev/null +++ b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - OSX.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - iOS.xcscheme b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - iOS.xcscheme new file mode 100644 index 0000000..b95caa0 --- /dev/null +++ b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/Kraken Standard Assets - iOS.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/xcschememanagement.plist b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..46ad7fe --- /dev/null +++ b/KREngine/Kraken.xcodeproj/xcuserdata/admin8onf.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,60 @@ + + + + + SchemeUserState + + Kraken - ios.xcscheme + + isShown + + orderHint + 30 + + Kraken - osx.xcscheme + + isShown + + orderHint + 31 + + Kraken Standard Assets - OSX.xcscheme + + isShown + + orderHint + 33 + + Kraken Standard Assets - iOS.xcscheme + + isShown + + orderHint + 32 + + + SuppressBuildableAutocreation + + E491016013C99B9E0098455B + + primary + + + E4BBBB7D1512A40300F43B5B + + primary + + + E4C8E4E316B9B2D50031DDCB + + primary + + + E4C8E4F316B9B2E20031DDCB + + primary + + + + + diff --git a/KREngine/kraken/KRCollider.h b/KREngine/kraken/KRCollider.h index cabf368..5c68693 100644 --- a/KREngine/kraken/KRCollider.h +++ b/KREngine/kraken/KRCollider.h @@ -36,6 +36,7 @@ #define KRAKEN_COLLIDER_PHYSICS 1 #define KRAKEN_COLLIDER_AUDIO 2 +#define KRAKEN_COLLIDER_INTERACTABLE 16 // ADDED Dec 3, 2013 by Peter for collider_so layer mask type #include "KRMesh.h" #include "KRMat4.h" diff --git a/KREngine/kraken/KRLight.cpp b/KREngine/kraken/KRLight.cpp index d6162f5..80a5e3d 100644 --- a/KREngine/kraken/KRLight.cpp +++ b/KREngine/kraken/KRLight.cpp @@ -333,6 +333,7 @@ void KRLight::render(KRCamera *pCamera, std::vector &point_light // Render light flare on transparency pass KRShader *pShader = getContext().getShaderManager()->getShader("flare", pCamera, point_lights, directional_lights, spot_lights, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass); if(getContext().getShaderManager()->selectShader(*pCamera, pShader, viewport, getModelMatrix(), point_lights, directional_lights, spot_lights, 0, renderPass)) { + pShader->setUniform(KRShader::KRENGINE_UNIFORM_MATERIAL_ALPHA, 1.0f); pShader->setUniform(KRShader::KRENGINE_UNIFORM_FLARE_SIZE, m_flareSize); m_pContext->getTextureManager()->selectTexture(0, m_pFlareTexture); m_pContext->getModelManager()->bindVBO(getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_VERTICES, getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_INDEXES, getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_ATTRIBS, true); diff --git a/KREngine/kraken/KRMeshQuad.cpp b/KREngine/kraken/KRMeshQuad.cpp index 6ca1f55..875f8a7 100644 --- a/KREngine/kraken/KRMeshQuad.cpp +++ b/KREngine/kraken/KRMeshQuad.cpp @@ -36,21 +36,15 @@ KRMeshQuad::KRMeshQuad(KRContext &context) : KRMesh(context, "__quad") { KRMesh::mesh_info mi; + mi.vertices.push_back(KRVector3(-1.0f, -1.0f, 0.0f)); + mi.vertices.push_back(KRVector3(1.0f, -1.0f, 0.0f)); + mi.vertices.push_back(KRVector3(-1.0f, 1.0f, 0.0f)); + mi.vertices.push_back(KRVector3(1.0f, 1.0f, 0.0f)); - mi.vertices.push_back(KRVector3(1.0, 1.0, 1.0)); - mi.vertices.push_back(KRVector3(-1.0, 1.0, 1.0)); - mi.vertices.push_back(KRVector3(1.0,-1.0, 1.0)); - mi.vertices.push_back(KRVector3(-1.0,-1.0, 1.0)); - mi.vertices.push_back(KRVector3(-1.0,-1.0,-1.0)); - mi.vertices.push_back(KRVector3(-1.0, 1.0, 1.0)); - mi.vertices.push_back(KRVector3(-1.0, 1.0,-1.0)); - mi.vertices.push_back(KRVector3(1.0, 1.0, 1.0)); - mi.vertices.push_back(KRVector3(1.0, 1.0,-1.0)); - mi.vertices.push_back(KRVector3(1.0,-1.0, 1.0)); - mi.vertices.push_back(KRVector3(1.0,-1.0,-1.0)); - mi.vertices.push_back(KRVector3(-1.0,-1.0,-1.0)); - mi.vertices.push_back(KRVector3(1.0, 1.0,-1.0)); - mi.vertices.push_back(KRVector3(-1.0, 1.0,-1.0)); + mi.uva.push_back(KRVector2(0.0f, 0.0f)); + mi.uva.push_back(KRVector2(1.0f, 0.0f)); + mi.uva.push_back(KRVector2(0.0f, 1.0f)); + mi.uva.push_back(KRVector2(1.0f, 1.0f)); mi.submesh_starts.push_back(0); diff --git a/KREngine/kraken/KRNode.cpp b/KREngine/kraken/KRNode.cpp index b307036..e8ac49e 100644 --- a/KREngine/kraken/KRNode.cpp +++ b/KREngine/kraken/KRNode.cpp @@ -920,4 +920,9 @@ void KRNode::addBehavior(KRBehavior *behavior) m_behaviors.insert(behavior); behavior->__setNode(this); getScene().notify_sceneGraphModify(this); -} \ No newline at end of file +} + +std::set &KRNode::getBehaviors() +{ + return m_behaviors; +} diff --git a/KREngine/kraken/KRNode.h b/KREngine/kraken/KRNode.h index e8d0f9d..eb074fa 100644 --- a/KREngine/kraken/KRNode.h +++ b/KREngine/kraken/KRNode.h @@ -227,6 +227,17 @@ private: public: void addBehavior(KRBehavior *behavior); + std::set &getBehaviors(); + template T *getBehavior() + { + for(std::set::iterator itr=m_behaviors.begin(); itr != m_behaviors.end(); itr++) { + T *behavior = dynamic_cast(*itr); + if(behavior) { + return behavior; + } + } + return NULL; + } void removeFromOctreeNodes(); void addToOctreeNode(KROctreeNode *octree_node); void childDeleted(KRNode *child_node); diff --git a/KREngine/kraken/KRResource+fbx.cpp b/KREngine/kraken/KRResource+fbx.cpp index 26179de..a327e39 100644 --- a/KREngine/kraken/KRResource+fbx.cpp +++ b/KREngine/kraken/KRResource+fbx.cpp @@ -146,6 +146,7 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path) // POSSIBLE UPGRADE .. grab the key frame and output it as the start location to the kranimation file if(new_curve) { + printf("Adding a curve\n"); context.getAnimationCurveManager()->addAnimationCurve(new_curve); } } @@ -587,6 +588,12 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG // Transform = T * Roff * Rp * Rpre * R * Rpost * inverse(Rp) * Soff * Sp * S * inverse(Sp) + int node_has_n_points = 0; // this will be 3 if the node_frame_key_position is complete after the import animated properties loop + KRVector3 node_key_frame_position = KRVector3(0.0, 0.0, 0.0); + // ADDED 3, 2013 by Peter to store the key frame (start location) of an animation + // the x, y, z translation position of the animation will be extracted from the curves + // as they are added to the animation layer in the loop below .. + // Import animated properties int animation_count = pFbxScene->GetSrcObjectCount(); for(int i = 0; i < animation_count; i++) { @@ -594,12 +601,11 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG FbxAnimStack* pAnimStack = pFbxScene->GetSrcObject(i); KRAnimation *pAnimation = parent_node->getContext().getAnimationManager()->getAnimation(pAnimStack->GetName()); if(pAnimation) { - int cLayers = pAnimStack->GetMemberCount(); + int cLayers = pAnimStack->GetMemberCount(); for(int iLayer=0; iLayer < cLayers; iLayer++) { FbxAnimLayer *pFbxAnimLayer = pAnimStack->GetMember(iLayer); // float weight = pFbxAnimLayer->Weight.Get(); KRAnimationLayer *pAnimationLayer = pAnimation->getLayer(pFbxAnimLayer->GetName()); - FbxAnimCurve *pAnimCurve = pNode->LclRotation.GetCurve(pFbxAnimLayer, FBXSDK_CURVENODE_COMPONENT_X); if(pAnimCurve) { KRAnimationAttribute *new_attribute = new KRAnimationAttribute(parent_node->getContext()); @@ -633,7 +639,13 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG new_attribute->setCurveName(GetFbxObjectName(pAnimCurve)); new_attribute->setTargetName(GetFbxObjectName(pNode)); new_attribute->setTargetAttribute(KRNode::KRENGINE_NODE_ATTRIBUTE_TRANSLATE_X); - pAnimationLayer->addAttribute(new_attribute); + + KRAnimationCurve *curve = new_attribute->getCurve(); + node_key_frame_position.x = curve->getValue(curve->getFrameStart()); + node_has_n_points++; + // ADDED Dec 3, 2013 by Peter to extract start location key frame + + pAnimationLayer->addAttribute(new_attribute); } pAnimCurve = pNode->LclTranslation.GetCurve(pFbxAnimLayer, FBXSDK_CURVENODE_COMPONENT_Y); @@ -642,6 +654,12 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG new_attribute->setCurveName(GetFbxObjectName(pAnimCurve)); new_attribute->setTargetName(GetFbxObjectName(pNode)); new_attribute->setTargetAttribute(KRNode::KRENGINE_NODE_ATTRIBUTE_TRANSLATE_Y); + + KRAnimationCurve *curve = new_attribute->getCurve(); + node_key_frame_position.y = curve->getValue(curve->getFrameStart()); + node_has_n_points++; + // ADDED Dec 3, 2013 by Peter to extract start location key frame + pAnimationLayer->addAttribute(new_attribute); } @@ -651,6 +669,12 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG new_attribute->setCurveName(GetFbxObjectName(pAnimCurve)); new_attribute->setTargetName(GetFbxObjectName(pNode)); new_attribute->setTargetAttribute(KRNode::KRENGINE_NODE_ATTRIBUTE_TRANSLATE_Z); + + KRAnimationCurve *curve = new_attribute->getCurve(); + node_key_frame_position.z = curve->getValue(curve->getFrameStart()); + node_has_n_points++; + // ADDED Dec 3, 2013 by Peter to extract start location key frame + pAnimationLayer->addAttribute(new_attribute); } @@ -848,7 +872,7 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG } } } - + FbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSourcePivot); FbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSourcePivot); FbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSourcePivot); @@ -874,6 +898,22 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG assert(geometric_translation == lZero); assert(geometric_scaling == lOne); assert(rotation_order == eEulerXYZ); + + // FINDME - node_key_frame_position contains the key frame (start location) for an animation node + // node_has_n_points + // node_key_frame_position + if (3 == node_has_n_points) + printf("key frame at %2.3f, %2.3f, %2.3f\n", + node_key_frame_position.x, + node_key_frame_position.y, + node_key_frame_position.z); + // + // The animation curve data is output to the KRNode::KRENGINE_NODE_ATTRIBUTE_TRANSLATE_ X, Y, Z attribute targets + // The actor scripts 'move' command modifies the node's world translations using setWorldTranslation() + // + // QUESTION - where should we store the key frame within the node to make sure it is output into the KRBundle ?? + // do we store it as node_local or store it as the world translation? or somewhere else ?? + // KRVector3 node_translation = KRVector3(local_translation[0], local_translation[1], local_translation[2]); // T * Roff * Rp KRVector3 node_rotation = KRVector3(local_rotation[0], local_rotation[1], local_rotation[2]) / 180.0 * M_PI; @@ -1006,27 +1046,6 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG } if(is_locator) { -//**** HACK A BIT TO FIND OUT HOW IT WORKS - printf("IS LOCATOR!\n"); - FbxProperty myprop = pNode->FindProperty("locRadius", true); - if (myprop.IsValid()) { - printf("locRadius found!\n"); - FbxDataType pdt = myprop.GetPropertyDataType(); - EFbxType ptype= pdt.GetType(); - if (eFbxDouble == ptype) { - double radius = myprop.Get(); - printf("The radius is %3.4f\n", radius); - } - } - // FbxProperty p = GetFirstProperty(); - // p = GetNextProperty(p); - // FbxDataType pdt = p->GetPropertyDataType(); - // EFbxType = pdt->GetType(); // this is an enumerated type - // FbxString pname = p->GetName(); - // const char * s = p->GetNameAsCStr(); // owned by the fbx library - // void *datap = p->GetUserDataPtr(); - -//**** END OF HACK new_node = LoadLocator(parent_node, pFbxScene, pNode); } else { if(pNode->GetChildCount() > 0) { @@ -1051,7 +1070,7 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG break; } - + // this is a KRNode if(new_node != NULL) { new_node->setLocalRotation(node_rotation); new_node->setLocalTranslation(node_translation); @@ -1063,7 +1082,7 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG new_node->setPreRotation(node_pre_rotation); new_node->setPostRotation(node_post_rotation); parent_node->addChild(new_node); - + // Load child nodes for(int i = 0; i < pNode->GetChildCount(); i++) { @@ -1544,8 +1563,8 @@ KRNode *LoadMesh(KRNode *parent_node, FbxScene* pFbxScene, FbxGeometryConverter std::string light_map = pNode->GetName(); light_map.append("_lightmap"); -//**** THIS IS WHERE THE collider in house names are parsed and handled .. and then the collider_ names are done -// in CircaViewController.mm postLoadSetup +//FINDME - THIS IS WHERE THE collider in house names are parsed and handled .. and then the collider_ names are done +// in CircaViewController.mm postLoadSetup .. with the addition of KRAKEN_COLLIDER_INTERACTABLE the postLoadSetup is redundant. // // FINDME, HACK - Until we have a GUI, we're using prefixes to select correct object type @@ -1554,6 +1573,9 @@ KRNode *LoadMesh(KRNode *parent_node, FbxScene* pFbxScene, FbxGeometryConverter return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_PHYSICS, 0.0f); } else if(strncmp(node_name, "audio_collider_", strlen("audio_collider_")) == 0) { return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_AUDIO, 1.0f); + } else if(0 == strncmp(node_name, "collider_so_", strlen("collider_so_"))) { + // ADDED Dec 3, 2013 by Peter to handle the scene object colliders that are layerMask 'Interactable' (16) + return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_INTERACTABLE, 1.0f); } else if(strncmp(node_name, "collider_", strlen("collider_")) == 0) { return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_PHYSICS | KRAKEN_COLLIDER_AUDIO, 1.0f); @@ -1588,6 +1610,80 @@ KRNode *LoadLocator(KRNode *parent_node, FbxScene* pFbxScene, FbxNode* pNode) { // either through to the normal locator block within the scene, or we can dump it out // to another destination .. a script file, an xml file, whatever we need. //**** + + //**** HACK A BIT TO FIND OUT HOW IT WORKS + const char *node_name = pNode->GetName(); +// if(strncmp(node_name, "physics_collider_", strlen("physics_collider_")) == 0) { +// // example hard coded compare +// } + // + // Place all the zone markers at listening (head) height + // + // is a number with the letter 'H' (hotel) or 'A' (alley) at the end of it + // + // KRReverbZone .. see CircaActorStep_CreateReverbZone::execute + // RZcorner_ .. with no meta data + // RZpoint_ .. with meta data locRadius + // + // KRAmbientZone .. see CircaActorStep_CreateAmbientZone::execute + // AZcorner_ .. all ambient sounds will be numbered somewhere in a master sound list file + // AZpoint_ .. with meta data locRadius + // + // KRModel .. see CircaActorStep_CreateDummyProp::execute + // AN_ .. an audio prop location that can be referenced by name in a trigger script + // + // QUESTION - should we do AN__ + // and then trigger the sound by activating the prop point (i.e. the sound file is already associated with the point) + // but the dummy prop doesn't have anywhere to store the sound file name + // + + // This is how it's done in the actor files .. + // + // create_ambient_zone entrance_ambient_zone entrance 99.0728 2.9885 -35.3381 10.0 10.0 10.0 0.25 p1_s1.0_1_traffic_general_loop 1.0 + // create_reverb_zone telegraph_office_reverb_zone telegraph_office -53.3345 3.58721 58.2977 20.0 20.0 20.0 0.25 reverb_telegraph 1.0 + // + // create_prop telegraph_radio dummyprop 94.371559 4.400661 31.469673 0.05 + // - creates a reference point that the radio sound is 'located at' later in the script + // + + // TO BE ADDED + // + // bool GetDoubleProperty(const char **match_list, double &value); + // pass in a c-string array of case insensitive property names that are all treated as identical + // return true if the property is found + // i.e. if(GetDoubleProperty({"locradius","radius",NULL}, value)) .. + // + + // TO BE ADDED + // + // bool ParseLocator(FbxNode* pNode); + // returns true is we should add the locator to the scene and false otherwise + // parses the locator and either returns it to be added to the scene or sends it somewhere else + // somewhere else would be: ambient_zone, reverb_zone, dummy_prop + // + + FbxProperty myprop = pNode->FindProperty("locRadius", true); // (name, is_case_sensitive) + if (myprop.IsValid()) { + printf("locRadius found!\n"); + FbxDataType pdt = myprop.GetPropertyDataType(); + EFbxType ptype= pdt.GetType(); + if (eFbxDouble == ptype) { + double radius = myprop.Get(); + printf("The radius is %3.4f\n", radius); + } + } + + // FbxProperty p = GetFirstProperty(); + // p = GetNextProperty(p); + // if (p.IsValid()) .. + // FbxDataType pdt = p.GetPropertyDataType(); + // EFbxType = pdt.GetType(); // this is an enumerated type + // FbxString pname = p.GetName(); + // const char * s = p.GetNameAsCStr(); // owned by the fbx library + + + + //**** END OF HACK KRLocator *new_locator = new KRLocator(parent_node->getScene(), name.c_str()); diff --git a/KREngine/kraken/KRSprite.cpp b/KREngine/kraken/KRSprite.cpp index 949f433..33807a0 100644 --- a/KREngine/kraken/KRSprite.cpp +++ b/KREngine/kraken/KRSprite.cpp @@ -28,7 +28,8 @@ KRSprite::KRSprite(KRScene &scene, std::string name) : KRNode(scene, name) { m_spriteTexture = ""; m_pSpriteTexture = NULL; - m_spriteSize = 0.0; + m_spriteSize = 0.0f; + m_spriteAlpha = 1.0f; } KRSprite::~KRSprite() @@ -44,6 +45,7 @@ tinyxml2::XMLElement *KRSprite::saveXML( tinyxml2::XMLNode *parent) tinyxml2::XMLElement *e = KRNode::saveXML(parent); e->SetAttribute("sprite_size", m_spriteSize); e->SetAttribute("sprite_texture", m_spriteTexture.c_str()); + e->SetAttribute("sprite_alpha", m_spriteAlpha); return e; } @@ -51,7 +53,10 @@ void KRSprite::loadXML(tinyxml2::XMLElement *e) { KRNode::loadXML(e); if(e->QueryFloatAttribute("sprite_size", &m_spriteSize) != tinyxml2::XML_SUCCESS) { - m_spriteSize = 0.0; + m_spriteSize = 0.0f; + } + if(e->QueryFloatAttribute("sprite_alpha", &m_spriteAlpha) != tinyxml2::XML_SUCCESS) { + m_spriteAlpha = 1.0f; } const char *szSpriteTexture = e->Attribute("sprite_texture"); @@ -73,6 +78,16 @@ void KRSprite::setSpriteSize(float sprite_size) { m_spriteSize = sprite_size; } +void KRSprite::setSpriteAlpha(float alpha) +{ + m_spriteAlpha = alpha; +} + +float KRSprite::getSpriteAlpha() const +{ + return m_spriteAlpha; +} + KRAABB KRSprite::getBounds() { return KRAABB(KRVector3(-m_spriteSize), KRVector3(m_spriteSize), getModelMatrix()); } @@ -84,7 +99,7 @@ void KRSprite::render(KRCamera *pCamera, std::vector &point_ligh if(renderPass == KRNode::RENDER_PASS_ADDITIVE_PARTICLES) { - if(m_spriteTexture.size() && m_spriteSize > 0.0f) { + if(m_spriteTexture.size() && m_spriteSize > 0.0f && m_spriteAlpha > 0.0f) { if(!m_pSpriteTexture && m_spriteTexture.size()) { @@ -109,8 +124,9 @@ void KRSprite::render(KRCamera *pCamera, std::vector &point_ligh GLDEBUG(glDepthRangef(0.0, 1.0)); // Render light sprite on transparency pass - KRShader *pShader = getContext().getShaderManager()->getShader("flare", pCamera, point_lights, directional_lights, spot_lights, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass); + KRShader *pShader = getContext().getShaderManager()->getShader("sprite", pCamera, point_lights, directional_lights, spot_lights, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass); if(getContext().getShaderManager()->selectShader(*pCamera, pShader, viewport, getModelMatrix(), point_lights, directional_lights, spot_lights, 0, renderPass)) { + pShader->setUniform(KRShader::KRENGINE_UNIFORM_MATERIAL_ALPHA, m_spriteAlpha); pShader->setUniform(KRShader::KRENGINE_UNIFORM_FLARE_SIZE, m_spriteSize); m_pContext->getTextureManager()->selectTexture(0, m_pSpriteTexture); m_pContext->getModelManager()->bindVBO(getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_VERTICES, getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_INDEXES, getContext().getModelManager()->KRENGINE_VBO_2D_SQUARE_ATTRIBS, true); diff --git a/KREngine/kraken/KRSprite.h b/KREngine/kraken/KRSprite.h index dbe5f2f..e64be0f 100644 --- a/KREngine/kraken/KRSprite.h +++ b/KREngine/kraken/KRSprite.h @@ -24,6 +24,8 @@ public: void setSpriteTexture(std::string sprite_texture); void setSpriteSize(float sprite_size); + void setSpriteAlpha(float alpha); + float getSpriteAlpha() const; virtual void render(KRCamera *pCamera, std::vector &point_lights, std::vector &directional_lights, std::vector&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass); @@ -34,6 +36,7 @@ protected: std::string m_spriteTexture; KRTexture *m_pSpriteTexture; float m_spriteSize; + float m_spriteAlpha; }; #endif diff --git a/KREngine/kraken_standard_assets_ios/Shaders/flare.fsh b/KREngine/kraken_standard_assets_ios/Shaders/flare.fsh index aa8d43b..7fce713 100644 --- a/KREngine/kraken_standard_assets_ios/Shaders/flare.fsh +++ b/KREngine/kraken_standard_assets_ios/Shaders/flare.fsh @@ -3,17 +3,17 @@ // 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 @@ -23,7 +23,7 @@ // 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. @@ -31,7 +31,8 @@ varying mediump vec2 texCoord; uniform sampler2D diffuseTexture; +uniform lowp float material_alpha; void main() { - gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0); + gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha; } \ No newline at end of file diff --git a/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh b/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh index 785bf5e..fc0c4d4 100644 --- a/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh +++ b/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh @@ -3,17 +3,17 @@ // 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 @@ -23,7 +23,7 @@ // 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. diff --git a/KREngine/kraken_standard_assets_ios/Shaders/sprite.fsh b/KREngine/kraken_standard_assets_ios/Shaders/sprite.fsh new file mode 100644 index 0000000..4519d5d --- /dev/null +++ b/KREngine/kraken_standard_assets_ios/Shaders/sprite.fsh @@ -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; +} \ No newline at end of file diff --git a/KREngine/kraken_standard_assets_ios/Shaders/sprite.vsh b/KREngine/kraken_standard_assets_ios/Shaders/sprite.vsh new file mode 100644 index 0000000..347191e --- /dev/null +++ b/KREngine/kraken_standard_assets_ios/Shaders/sprite.vsh @@ -0,0 +1,42 @@ +// +// 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; +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; +} diff --git a/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.fsh b/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.fsh index aa8d43b..7fce713 100644 --- a/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.fsh +++ b/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.fsh @@ -3,17 +3,17 @@ // 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 @@ -23,7 +23,7 @@ // 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. @@ -31,7 +31,8 @@ varying mediump vec2 texCoord; uniform sampler2D diffuseTexture; +uniform lowp float material_alpha; void main() { - gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0); + gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha; } \ No newline at end of file diff --git a/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.vsh b/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.vsh index 785bf5e..fc0c4d4 100644 --- a/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.vsh +++ b/KREngine/kraken_standard_assets_osx/Shaders/flare_osx.vsh @@ -3,17 +3,17 @@ // 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 @@ -23,7 +23,7 @@ // 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. diff --git a/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.fsh b/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.fsh new file mode 100644 index 0000000..4519d5d --- /dev/null +++ b/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.fsh @@ -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; +} \ No newline at end of file diff --git a/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.vsh b/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.vsh new file mode 100644 index 0000000..347191e --- /dev/null +++ b/KREngine/kraken_standard_assets_osx/Shaders/sprite_osx.vsh @@ -0,0 +1,42 @@ +// +// 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; +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; +}