Add texture matrix support in vulkan
This commit is contained in:
parent
7a5f14cb37
commit
0b4bf178d7
@ -9,7 +9,7 @@ void main()
|
||||
u_object_buffer.m_objects[gl_InstanceIndex].m_scale.xyz, v_position);
|
||||
gl_Position = u_camera.m_projection_view_matrix * v_world_position;
|
||||
f_vertex_color = v_color.zyxw;
|
||||
f_uv = v_uv;
|
||||
f_uv = v_uv + u_object_buffer.m_objects[gl_InstanceIndex].m_texture_trans;
|
||||
f_uv_two = v_uv_two;
|
||||
f_material_id = u_object_buffer.m_objects[gl_InstanceIndex].m_material_id;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ void main()
|
||||
v_skinning_position.xyz);
|
||||
gl_Position = u_camera.m_projection_view_matrix * v_world_position;
|
||||
f_vertex_color = v_color.zyxw;
|
||||
f_uv = v_uv;
|
||||
f_uv = v_uv + u_object_buffer.m_objects[gl_InstanceIndex].m_texture_trans;
|
||||
f_uv_two = v_uv_two;
|
||||
f_material_id = u_object_buffer.m_objects[gl_InstanceIndex].m_material_id;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace GE
|
||||
{
|
||||
// ============================================================================
|
||||
ObjectData::ObjectData(irr::scene::ISceneNode* node, int material_id,
|
||||
int skinning_offset)
|
||||
int skinning_offset, int irrlicht_material_id)
|
||||
{
|
||||
using namespace MiniGLM;
|
||||
const irr::core::matrix4& model_mat = node->getAbsoluteTransformation();
|
||||
@ -53,8 +53,10 @@ ObjectData::ObjectData(irr::scene::ISceneNode* node, int material_id,
|
||||
memcpy(m_scale, &scale, sizeof(irr::core::vector3df));
|
||||
m_skinning_offset = skinning_offset;
|
||||
m_material_id = material_id;
|
||||
m_texture_trans[0] = 0.0f;
|
||||
m_texture_trans[1] = 0.0f;
|
||||
const irr::core::matrix4& texture_matrix =
|
||||
node->getMaterial(irrlicht_material_id).getTextureMatrix(0);
|
||||
m_texture_trans[0] = texture_matrix[8];
|
||||
m_texture_trans[1] = texture_matrix[9];
|
||||
} // ObjectData
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -243,7 +245,7 @@ void GEVulkanDrawCall::generate()
|
||||
if (it != skinning_offets.end())
|
||||
skinning_offset = it->second;
|
||||
m_visible_objects.emplace_back(node, material_id,
|
||||
skinning_offset);
|
||||
skinning_offset, r.second);
|
||||
}
|
||||
VkDrawIndexedIndirectCommand cmd;
|
||||
cmd.indexCount = p.first->getIndexCount();
|
||||
|
@ -36,7 +36,7 @@ struct ObjectData
|
||||
float m_texture_trans[2];
|
||||
// ------------------------------------------------------------------------
|
||||
ObjectData(irr::scene::ISceneNode* node, int material_id,
|
||||
int skinning_offset);
|
||||
int skinning_offset, int irrlicht_material_id);
|
||||
};
|
||||
|
||||
struct PipelineSettings
|
||||
|
Loading…
Reference in New Issue
Block a user