diff --git a/kraken/KRPipeline.cpp b/kraken/KRPipeline.cpp index a9db344..f9074cd 100644 --- a/kraken/KRPipeline.cpp +++ b/kraken/KRPipeline.cpp @@ -77,6 +77,14 @@ KRPipeline::KRPipeline(KRContext& context, KrDeviceHandle deviceHandle, const KR KRMesh::KRENGINE_ATTRIB_VERTEX, KRMesh::KRENGINE_ATTRIB_NORMAL, KRMesh::KRENGINE_ATTRIB_TANGENT, + KRMesh::KRENGINE_ATTRIB_COLOR0, + KRMesh::KRENGINE_ATTRIB_COLOR1, + KRMesh::KRENGINE_ATTRIB_COLOR2, + KRMesh::KRENGINE_ATTRIB_COLOR3, + KRMesh::KRENGINE_ATTRIB_COLOR4, + KRMesh::KRENGINE_ATTRIB_COLOR5, + KRMesh::KRENGINE_ATTRIB_COLOR6, + KRMesh::KRENGINE_ATTRIB_COLOR7, KRMesh::KRENGINE_ATTRIB_TEXCOORD0, KRMesh::KRENGINE_ATTRIB_TEXCOORD1, KRMesh::KRENGINE_ATTRIB_TEXCOORD2, @@ -142,10 +150,38 @@ KRPipeline::KRPipeline(KRContext& context, KrDeviceHandle deviceHandle, const KR attribute_locations[KRMesh::KRENGINE_ATTRIB_NORMAL] = input_var.location + 1; } else if (strcmp(input_var.name, "vertex_tangent") == 0) { attribute_locations[KRMesh::KRENGINE_ATTRIB_TANGENT] = input_var.location + 1; - } else if (strcmp(input_var.name, "vertex_uv") == 0) { + } else if (strcmp(input_var.name, "vertex_texcoord0") == 0) { attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD0] = input_var.location + 1; - } else if (strcmp(input_var.name, "vertex_lightmap_uv") == 0) { + } else if (strcmp(input_var.name, "vertex_texcoord1") == 0) { attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD1] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord2") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD2] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord3") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD3] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord4") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD4] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord5") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD5] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord6") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD6] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_texcoord7") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_TEXCOORD7] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color0") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR0] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color1") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR1] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color2") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR2] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color3") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR3] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color4") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR4] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color5") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR5] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color6") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR6] = input_var.location + 1; + } else if (strcmp(input_var.name, "vertex_color7") == 0) { + attribute_locations[KRMesh::KRENGINE_ATTRIB_COLOR7] = input_var.location + 1; } else if (strcmp(input_var.name, "bone_indexes") == 0) { attribute_locations[KRMesh::KRENGINE_ATTRIB_BONEINDEXES] = input_var.location + 1; } else if (strcmp(input_var.name, "bone_weights") == 0) { diff --git a/kraken/resources/mesh/KRMesh.cpp b/kraken/resources/mesh/KRMesh.cpp index 5bd8253..a460ffd 100755 --- a/kraken/resources/mesh/KRMesh.cpp +++ b/kraken/resources/mesh/KRMesh.cpp @@ -547,15 +547,6 @@ void KRMesh::LoadData(const KRMesh::mesh_info& mi, bool calculate_normals, bool } } } - - if (use_short_texcoord[set]) { - for (std::vector::const_iterator itr = mi.texcoord[set].begin(); itr != mi.texcoord[set].end(); itr++) { - if (fabsf((*itr).x) > 1.0f || fabsf((*itr).y) > 1.0f) { - use_short_texcoord[set] = false; - break; - } - } - } } __int32_t vertex_attrib_flags = 0; @@ -568,38 +559,36 @@ void KRMesh::LoadData(const KRMesh::mesh_info& mi, bool calculate_normals, bool } if (mi.normals.size() || calculate_normals) { if (use_short_normals) { - vertex_attrib_flags += (1 << KRENGINE_ATTRIB_NORMAL_SHORT); + vertex_attrib_flags |= (1 << KRENGINE_ATTRIB_NORMAL_SHORT); } else { - vertex_attrib_flags += (1 << KRENGINE_ATTRIB_NORMAL); + vertex_attrib_flags |= (1 << KRENGINE_ATTRIB_NORMAL); } } if (mi.tangents.size() || calculate_tangents) { if (use_short_tangents) { - vertex_attrib_flags += (1 << KRENGINE_ATTRIB_TANGENT_SHORT); + vertex_attrib_flags |= (1 << KRENGINE_ATTRIB_TANGENT_SHORT); } else { - vertex_attrib_flags += (1 << KRENGINE_ATTRIB_TANGENT); + vertex_attrib_flags |= (1 << KRENGINE_ATTRIB_TANGENT); } } for (int set = 0; set < 8; set++) { if (mi.texcoord[set].size()) { if (use_short_texcoord[set]) { - vertex_attrib_flags += (1 << (KRENGINE_ATTRIB_TEXCOORD0_SHORT + set)); + vertex_attrib_flags |= (1 << (KRENGINE_ATTRIB_TEXCOORD0_SHORT + set)); } else { - vertex_attrib_flags += (1 << (KRENGINE_ATTRIB_TEXCOORD0 + set)); + vertex_attrib_flags |= (1 << (KRENGINE_ATTRIB_TEXCOORD0 + set)); } } - if (mi.texcoord[set].size()) { - if (use_short_texcoord[set]) { - vertex_attrib_flags += (1 << (KRENGINE_ATTRIB_TEXCOORD1_SHORT + set)); - } else { - vertex_attrib_flags += (1 << (KRENGINE_ATTRIB_TEXCOORD1 + set)); - } + + if (mi.color[set].size()) { + vertex_attrib_flags |= (1 << (KRENGINE_ATTRIB_COLOR0 + set)); } } if (mi.bone_names.size()) { vertex_attrib_flags += (1 << KRENGINE_ATTRIB_BONEINDEXES) + (1 << KRENGINE_ATTRIB_BONEWEIGHTS); } size_t vertex_size = VertexSizeForAttributes(vertex_attrib_flags); + size_t index_count = mi.vertex_indexes.size(); size_t index_base_count = mi.vertex_index_bases.size(); size_t submesh_count = mi.submesh_lengths.size(); @@ -662,6 +651,10 @@ void KRMesh::LoadData(const KRMesh::mesh_info& mi, bool calculate_normals, bool if ((int)mi.texcoord[set].size() > iVertex) { setVertexTexCoord(set, iVertex, mi.texcoord[set][iVertex]); } + + if ((int)mi.color[set].size() > iVertex) { + setVertexColor(set, iVertex, mi.color[set][iVertex]); + } } if ((int)mi.normals.size() > iVertex) { setVertexNormal(iVertex, Vector3::Normalize(mi.normals[iVertex])); @@ -907,7 +900,7 @@ Vector2 KRMesh::getVertexTexCoord(int set, int index) const { if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_TEXCOORD0_SHORT + set))) { short* v = (short*)(getVertexData(index) + m_vertex_attribute_offset[KRENGINE_ATTRIB_TEXCOORD0_SHORT + set]); - return Vector2::Create((float)v[0] / 32767.0f, (float)v[1] / 32767.0f); + return Vector2::Create((float)v[0] / 32767.0f); } else if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_TEXCOORD0 + set))) { return Vector2::Create((float*)(getVertexData(index) + m_vertex_attribute_offset[KRENGINE_ATTRIB_TEXCOORD0 + set])); } else { @@ -915,6 +908,16 @@ Vector2 KRMesh::getVertexTexCoord(int set, int index) const } } +Vector4 KRMesh::getVertexColor(int set, int index) const +{ + if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_COLOR0 + set))) { + uint8_t* v = (uint8_t*)(getVertexData(index) + m_vertex_attribute_offset[KRENGINE_ATTRIB_COLOR0 + set]); + return Vector4::Create((float)v[0] / 255.0f, (float)v[1] / 255.0f, (float)v[2] / 255.0f, (float)v[3] / 255.0f); + } else { + return Vector4::Zero(); + } +} + void KRMesh::setVertexPosition(int index, const Vector3& v) { if (has_vertex_attribute(KRENGINE_ATTRIB_VERTEX_SHORT)) { @@ -974,6 +977,17 @@ void KRMesh::setVertexTexCoord(int set, int index, const Vector2& v) } } +void KRMesh::setVertexColor(int set, int index, const Vector4& v) +{ + if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_COLOR0 + set))) { + uint8_t* vert = (uint8_t*)(getVertexData(index) + m_vertex_attribute_offset[KRENGINE_ATTRIB_COLOR0 + set]); + vert[0] = (uint8_t)(v.x * 255.0f); + vert[1] = (uint8_t)(v.y * 255.0f); + vert[2] = (uint8_t)(v.z * 255.0f); + vert[3] = (uint8_t)(v.w * 255.0f); + } +} + int KRMesh::getBoneIndex(int index, int weight_index) const { unsigned char* vert = (unsigned char*)(getVertexData(index) + m_vertex_attribute_offset[KRENGINE_ATTRIB_BONEINDEXES]); @@ -1010,6 +1024,30 @@ size_t KRMesh::VertexSizeForAttributes(__int32_t vertex_attrib_flags) if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_TANGENT)) { data_size += sizeof(float) * 3; } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR0)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR1)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR2)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR3)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR4)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR5)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR6)) { + data_size += 4; + } + if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_COLOR7)) { + data_size += 4; + } if (has_vertex_attribute(vertex_attrib_flags, KRENGINE_ATTRIB_TEXCOORD0)) { data_size += sizeof(float) * 2; } @@ -1110,8 +1148,23 @@ VkFormat KRMesh::AttributeVulkanFormat(__int32_t vertex_attrib) case KRENGINE_ATTRIB_TANGENT: case KRENGINE_ATTRIB_BONEWEIGHTS: return VK_FORMAT_R32G32B32_SFLOAT; + case KRENGINE_ATTRIB_COLOR0: + case KRENGINE_ATTRIB_COLOR1: + case KRENGINE_ATTRIB_COLOR2: + case KRENGINE_ATTRIB_COLOR3: + case KRENGINE_ATTRIB_COLOR4: + case KRENGINE_ATTRIB_COLOR5: + case KRENGINE_ATTRIB_COLOR6: + case KRENGINE_ATTRIB_COLOR7: + return VK_FORMAT_R8G8B8A8_UNORM; case KRENGINE_ATTRIB_TEXCOORD0: case KRENGINE_ATTRIB_TEXCOORD1: + case KRENGINE_ATTRIB_TEXCOORD2: + case KRENGINE_ATTRIB_TEXCOORD3: + case KRENGINE_ATTRIB_TEXCOORD4: + case KRENGINE_ATTRIB_TEXCOORD5: + case KRENGINE_ATTRIB_TEXCOORD6: + case KRENGINE_ATTRIB_TEXCOORD7: return VK_FORMAT_R32G32_SFLOAT; case KRENGINE_ATTRIB_BONEINDEXES: return VK_FORMAT_R8G8B8A8_UINT; @@ -1121,6 +1174,12 @@ VkFormat KRMesh::AttributeVulkanFormat(__int32_t vertex_attrib) return VK_FORMAT_R16G16B16A16_SNORM; case KRENGINE_ATTRIB_TEXCOORD0_SHORT: case KRENGINE_ATTRIB_TEXCOORD1_SHORT: + case KRENGINE_ATTRIB_TEXCOORD2_SHORT: + case KRENGINE_ATTRIB_TEXCOORD3_SHORT: + case KRENGINE_ATTRIB_TEXCOORD4_SHORT: + case KRENGINE_ATTRIB_TEXCOORD5_SHORT: + case KRENGINE_ATTRIB_TEXCOORD6_SHORT: + case KRENGINE_ATTRIB_TEXCOORD7_SHORT: return VK_FORMAT_R16G16_SNORM; } return VK_FORMAT_UNDEFINED; @@ -1380,8 +1439,10 @@ void KRMesh::convertToIndexed() Vector3 vertex_position = getVertexPosition(source_index); Vector2 vertex_texcoord[8]; + Vector4 vertex_color[8]; for (int set = 0; set < 8; set++) { vertex_texcoord[set] = getVertexTexCoord(set, source_index); + vertex_color[set] = getVertexColor(set, source_index); } Vector3 vertex_normal = getVertexNormal(source_index); Vector3 vertex_tangent = getVertexTangent(source_index); @@ -1428,6 +1489,10 @@ void KRMesh::convertToIndexed() if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_TEXCOORD0 + set)) || has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_TEXCOORD0_SHORT + set))) { mi.texcoord[set].push_back(vertex_texcoord[set]); } + + if (has_vertex_attribute((vertex_attrib_t)(KRENGINE_ATTRIB_COLOR0 + set))) { + mi.color[set].push_back(vertex_color[set]); + } } if (has_vertex_attribute(KRENGINE_ATTRIB_BONEINDEXES)) { mi.bone_indexes.push_back(vertex_bone_indexes); diff --git a/kraken/resources/mesh/KRMesh.h b/kraken/resources/mesh/KRMesh.h index 31d7690..7b81160 100755 --- a/kraken/resources/mesh/KRMesh.h +++ b/kraken/resources/mesh/KRMesh.h @@ -87,6 +87,14 @@ public: KRENGINE_ATTRIB_VERTEX = 0, KRENGINE_ATTRIB_NORMAL, KRENGINE_ATTRIB_TANGENT, + KRENGINE_ATTRIB_COLOR0, + KRENGINE_ATTRIB_COLOR1, + KRENGINE_ATTRIB_COLOR2, + KRENGINE_ATTRIB_COLOR3, + KRENGINE_ATTRIB_COLOR4, + KRENGINE_ATTRIB_COLOR5, + KRENGINE_ATTRIB_COLOR6, + KRENGINE_ATTRIB_COLOR7, KRENGINE_ATTRIB_TEXCOORD0, KRENGINE_ATTRIB_TEXCOORD1, KRENGINE_ATTRIB_TEXCOORD2, @@ -118,6 +126,7 @@ public: std::vector<__uint16_t> vertex_indexes; std::vector > vertex_index_bases; std::vector texcoord[8]; + std::vector color[8]; std::vector normals; std::vector tangents; std::vector submesh_starts; @@ -216,6 +225,7 @@ public: hydra::Vector3 getVertexNormal(int index) const; hydra::Vector3 getVertexTangent(int index) const; hydra::Vector2 getVertexTexCoord(int set, int index) const; + hydra::Vector4 getVertexColor(int set, int index) const; int getBoneIndex(int index, int weight_index) const; float getBoneWeight(int index, int weight_index) const; @@ -223,6 +233,7 @@ public: void setVertexNormal(int index, const hydra::Vector3& v); void setVertexTangent(int index, const hydra::Vector3& v); void setVertexTexCoord(int set, int index, const hydra::Vector2& v); + void setVertexColor(int set, int index, const hydra::Vector4& v); void setBoneIndex(int index, int weight_index, int bone_index); void setBoneWeight(int index, int weight_index, float bone_weight); diff --git a/standard_assets/shaders/ShadowShader_osx.vsh b/standard_assets/shaders/ShadowShader_osx.vsh index c779072..1b1839a 100644 --- a/standard_assets/shaders/ShadowShader_osx.vsh +++ b/standard_assets/shaders/ShadowShader_osx.vsh @@ -46,7 +46,7 @@ void main() gl_Position.z += SHADOW_BIAS; /* // Pass UV co-ordinates - texCoord = vertex_uv.st; + texCoord = vertex_texcoord0.st; */ } diff --git a/standard_assets/shaders/debug_font.vert b/standard_assets/shaders/debug_font.vert index 4f80cee..885f41e 100644 --- a/standard_assets/shaders/debug_font.vert +++ b/standard_assets/shaders/debug_font.vert @@ -33,12 +33,12 @@ layout(location = 0) out mediump vec2 textureCoordinate; layout(location = 0) in vec3 vertex_position; -layout(location = 1) in lowp vec2 vertex_uv; +layout(location = 1) in lowp vec2 vertex_texcoord0; void main() { gl_Position = vec4(vertex_position, 1.0); - textureCoordinate = vertex_uv; + textureCoordinate = vertex_texcoord0; } diff --git a/standard_assets/shaders/dust_particle_osx.vsh b/standard_assets/shaders/dust_particle_osx.vsh index f086bfb..8996a70 100644 --- a/standard_assets/shaders/dust_particle_osx.vsh +++ b/standard_assets/shaders/dust_particle_osx.vsh @@ -30,7 +30,7 @@ // -in mediump vec2 vertex_uv; +in mediump vec2 vertex_texcoord0; 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; @@ -49,8 +49,8 @@ void main() { offset_center.xyz += vec3(sin((time_absolute + vertex_position.x * 100.0) * 0.05), sin((time_absolute + vertex_position.y * 100.0) * 0.07), sin((time_absolute + vertex_position.z * 100.0) * 0.03)) * 0.05; offset_center = vec4(mod(offset_center.x + 1.0, 2.0) - 1.0, mod(offset_center.y + 1.0, 2.0) - 1.0, mod(offset_center.z + 1.0, 2.0) - 1.0, 1.0); highp vec4 particle_center = mvp_matrix * offset_center; - texCoord = vertex_uv * 3.46410161513775; // 3.46410161513775 = 2 * sqrt(3); 1 / (2 * sqrt(3)) is the radius of a circle encompased by a equilateral triangle with a side length of 1. - gl_Position = particle_center + vec4(vertex_uv.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 0.0) * flare_size; + texCoord = vertex_texcoord0 * 3.46410161513775; // 3.46410161513775 = 2 * sqrt(3); 1 / (2 * sqrt(3)) is the radius of a circle encompased by a equilateral triangle with a side length of 1. + gl_Position = particle_center + vec4(vertex_texcoord0.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_texcoord0.y * 2.0 - 1.0, 0.0, 0.0) * flare_size; shadowMapCoord1 = shadow_mvp1 * offset_center; diff --git a/standard_assets/shaders/flare_osx.vsh b/standard_assets/shaders/flare_osx.vsh index 55de817..2b3ee71 100644 --- a/standard_assets/shaders/flare_osx.vsh +++ b/standard_assets/shaders/flare_osx.vsh @@ -30,7 +30,7 @@ // -in vec2 vertex_uv; +in vec2 vertex_texcoord0; uniform mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices uniform vec4 viewport; uniform float flare_size; @@ -38,6 +38,6 @@ uniform float flare_size; out 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; + texCoord = vertex_texcoord0; + gl_Position = mvp_matrix * vec4(0.0, 0.0, 0.0, 1.0) + vec4(vertex_texcoord0.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_texcoord0.y * 2.0 - 1.0, 0.0, 0.0) * flare_size; } diff --git a/standard_assets/shaders/object.vert b/standard_assets/shaders/object.vert index 5a2d7e1..243ed67 100644 --- a/standard_assets/shaders/object.vert +++ b/standard_assets/shaders/object.vert @@ -42,10 +42,10 @@ layout(location = 1) in vec3 vertex_normal; #if HAS_NORMAL_MAP == 1 layout(location = 2) in vec3 vertex_tangent; #endif -layout(location = 3) in lowp vec3 vertex_uv; +layout(location = 3) in lowp vec3 vertex_texcoord0; #if BONE_COUNT > 0 - layout(location = 4) in lowp vec3 vertex_uv; + layout(location = 4) in lowp vec3 vertex_texcoord0; layout(location = 5) in highp vec4 bone_weights; layout(location = 6) in highp vec4 bone_indexes; #else @@ -60,7 +60,7 @@ layout(location = 3) in lowp vec3 vertex_uv; #endif #else #if HAS_LIGHT_MAP == 1 - layout(loction = 7) in mediump vec2 vertex_lightmap_uv; + layout(loction = 7) in mediump vec2 vertex_texcoord1; #endif //HAS_LIGHT_MAP #endif // GBUFFER_PASS @@ -357,7 +357,7 @@ void main() #if HAS_DIFFUSE_MAP == 1 || (HAS_NORMAL_MAP == 1 && ENABLE_PER_PIXEL == 1) || (HAS_SPEC_MAP == 1 && ENABLE_PER_PIXEL == 1) || (HAS_REFLECTION_MAP == 1 && ENABLE_PER_PIXEL == 1) // Pass UV co-ordinates - texCoord = vertex_uv.st; + texCoord = vertex_texcoord0.st; #endif @@ -421,7 +421,7 @@ void main() #if HAS_LIGHT_MAP == 1 // Pass shadow UV co-ordinates - lightmap_uv = vertex_lightmap_uv.st; + lightmap_uv = vertex_texcoord1.st; #endif diff --git a/standard_assets/shaders/post_fx.vert b/standard_assets/shaders/post_fx.vert index d023ccf..a3df3ab 100644 --- a/standard_assets/shaders/post_fx.vert +++ b/standard_assets/shaders/post_fx.vert @@ -30,12 +30,12 @@ // in vec4 vertex_position; -in vec4 vertex_uv; +in vec4 vertex_texcoord0; out vec2 textureCoordinate; void main() { gl_Position = vertex_position; - textureCoordinate = vertex_uv.xy; + textureCoordinate = vertex_texcoord0.xy; } \ No newline at end of file diff --git a/standard_assets/shaders/simple_blit.vert b/standard_assets/shaders/simple_blit.vert index 1f956a5..c86c6a9 100644 --- a/standard_assets/shaders/simple_blit.vert +++ b/standard_assets/shaders/simple_blit.vert @@ -38,10 +38,10 @@ layout (std140, binding = 0) uniform buf { mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices } ubuf; layout (location = 0) in vec4 vertex_position; -layout (location = 1) in vec2 vertex_uv; +layout (location = 1) in vec2 vertex_texcoord0; layout (location = 0) out vec2 textureCoordinate; void main() { - textureCoordinate = vertex_uv; + textureCoordinate = vertex_texcoord0; gl_Position = ubuf.mvp_matrix * vertex_position; } diff --git a/standard_assets/shaders/sprite.vert b/standard_assets/shaders/sprite.vert index f5d5b14..7a63126 100644 --- a/standard_assets/shaders/sprite.vert +++ b/standard_assets/shaders/sprite.vert @@ -38,10 +38,10 @@ layout (std140, binding = 0) uniform buf { mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices vec4 viewport; } ubuf; -layout (location = 0) in vec2 vertex_uv; +layout (location = 0) in vec2 vertex_texcoord0; layout (location = 0) out vec2 textureCoordinate; void main() { - textureCoordinate = vertex_uv; - gl_Position = ubuf.mvp_matrix * vec4(vertex_uv.x * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 1.0); + textureCoordinate = vertex_texcoord0; + gl_Position = ubuf.mvp_matrix * vec4(vertex_texcoord0.x * 2.0 - 1.0, vertex_texcoord0.y * 2.0 - 1.0, 0.0, 1.0); }