Remove friend class in GE::GESPMBuffer
This commit is contained in:
parent
76c39afd8b
commit
7cc238e101
@ -16,11 +16,9 @@ namespace GE
|
||||
{
|
||||
struct Armature;
|
||||
class GESPMBuffer;
|
||||
class GEVulkanSceneManager;
|
||||
|
||||
class GESPM : public IAnimatedMesh
|
||||
{
|
||||
friend class GEVulkanSceneManager;
|
||||
friend class ::B3DMeshLoader;
|
||||
friend class ::SPMeshLoader;
|
||||
private:
|
||||
@ -83,6 +81,8 @@ public:
|
||||
bool isStatic() const { return m_all_armatures.empty(); }
|
||||
// ------------------------------------------------------------------------
|
||||
unsigned getJointCount() const { return m_joint_using; }
|
||||
// ------------------------------------------------------------------------
|
||||
void addMeshBuffer(GESPMBuffer* mb) { m_buffer.push_back(mb); }
|
||||
|
||||
};
|
||||
|
||||
|
@ -9,18 +9,10 @@
|
||||
#include "ge_vma.hpp"
|
||||
#include "vulkan_wrapper.h"
|
||||
|
||||
class B3DMeshLoader;
|
||||
class SPMeshLoader;
|
||||
|
||||
namespace GE
|
||||
{
|
||||
class GEVulkanSceneManager;
|
||||
|
||||
class GESPMBuffer : public irr::scene::IMeshBuffer
|
||||
{
|
||||
friend class GEVulkanSceneManager;
|
||||
friend class ::B3DMeshLoader;
|
||||
friend class ::SPMeshLoader;
|
||||
private:
|
||||
irr::video::SMaterial m_material;
|
||||
|
||||
@ -59,10 +51,8 @@ public:
|
||||
{ return m_material; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual irr::video::SMaterial& getMaterial() { return m_material; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const void* getVertices() const
|
||||
{ return m_vertices.data(); }
|
||||
virtual const void* getVertices() const { return m_vertices.data(); }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void* getVertices() { return m_vertices.data(); }
|
||||
// ------------------------------------------------------------------------
|
||||
@ -181,6 +171,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool hasSkinning() const { return m_has_skinning; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setHasSkinning(bool val) { m_has_skinning = val; }
|
||||
// ------------------------------------------------------------------------
|
||||
void bindVertexIndexBuffer(VkCommandBuffer cmd)
|
||||
{
|
||||
std::array<VkBuffer, 2> vertex_buffer =
|
||||
@ -202,6 +194,11 @@ public:
|
||||
void createVertexIndexBuffer();
|
||||
// ------------------------------------------------------------------------
|
||||
void destroyVertexIndexBuffer();
|
||||
// ------------------------------------------------------------------------
|
||||
std::vector<irr::video::S3DVertexSkinnedMesh>& getVerticesVector()
|
||||
{ return m_vertices; }
|
||||
// ------------------------------------------------------------------------
|
||||
std::vector<irr::u16>& getIndicesVector() { return m_indices; }
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
@ -155,14 +155,14 @@ irr::scene::IMeshSceneNode* GEVulkanSceneManager::addMeshSceneNode(
|
||||
sp.m_color = orig.toSColor();
|
||||
sp.m_all_uvs[0] = MiniGLM::toFloat16(v_ptr[j].TCoords.X);
|
||||
sp.m_all_uvs[1] = MiniGLM::toFloat16(v_ptr[j].TCoords.Y);
|
||||
spm_mb->m_vertices.push_back(sp);
|
||||
spm_mb->getVerticesVector().push_back(sp);
|
||||
}
|
||||
uint16_t* idx_ptr = mb->getIndices();
|
||||
std::vector<uint16_t> indices(idx_ptr, idx_ptr + mb->getIndexCount());
|
||||
std::swap(spm_mb->m_indices, indices);
|
||||
spm_mb->m_material = mb->getMaterial();
|
||||
std::swap(spm_mb->getIndicesVector(), indices);
|
||||
spm_mb->getMaterial() = mb->getMaterial();
|
||||
spm_mb->recalculateBoundingBox();
|
||||
spm->m_buffer.push_back(spm_mb);
|
||||
spm->addMeshBuffer(spm_mb);
|
||||
}
|
||||
spm->finalize();
|
||||
std::stringstream oss;
|
||||
|
@ -105,10 +105,10 @@ scene::IAnimatedMesh* B3DMeshLoader::createMesh(io::IReadFile* f)
|
||||
{
|
||||
SP::SPMeshBuffer* spbuf = spm->getSPMeshBuffer(i);
|
||||
GE::GESPMBuffer* gebuf = new GE::GESPMBuffer();
|
||||
gebuf->m_has_skinning = !spm->isStatic();
|
||||
ge_spm->m_buffer.push_back(gebuf);
|
||||
std::swap(gebuf->m_vertices, spbuf->getVerticesRef());
|
||||
std::swap(gebuf->m_indices, spbuf->getIndicesRef());
|
||||
gebuf->setHasSkinning(!spm->isStatic());
|
||||
ge_spm->addMeshBuffer(gebuf);
|
||||
std::swap(gebuf->getVerticesVector(), spbuf->getVerticesRef());
|
||||
std::swap(gebuf->getIndicesVector(), spbuf->getIndicesRef());
|
||||
Material* stk_material = spbuf->getSTKMaterial(0);
|
||||
stk_material->setMaterialProperties(&gebuf->getMaterial(), gebuf);
|
||||
gebuf->getMaterial().TextureLayer[0].Texture =
|
||||
|
@ -453,8 +453,7 @@ void SPMeshLoader::decompressGESPM(irr::io::IReadFile* spm,
|
||||
assert(indices_count != 0);
|
||||
|
||||
GE::GESPMBuffer* mb = new GE::GESPMBuffer();
|
||||
static_cast<GE::GESPM*>(m_mesh)->m_buffer.push_back(mb);
|
||||
std::vector<video::S3DVertexSkinnedMesh> vertices;
|
||||
static_cast<GE::GESPM*>(m_mesh)->addMeshBuffer(mb);
|
||||
const unsigned idx_size = vertices_count > 255 ? 2 : 1;
|
||||
for (unsigned i = 0; i < vertices_count; i++)
|
||||
{
|
||||
@ -522,12 +521,12 @@ void SPMeshLoader::decompressGESPM(irr::io::IReadFile* spm,
|
||||
// 1.0 in half float (16bit)
|
||||
vertex.m_weight[0] = 15360;
|
||||
}
|
||||
mb->m_has_skinning = true;
|
||||
mb->setHasSkinning(true);
|
||||
}
|
||||
vertices.push_back(vertex);
|
||||
mb->getVerticesVector().push_back(vertex);
|
||||
}
|
||||
|
||||
std::vector<uint16_t> indices;
|
||||
std::vector<uint16_t>& indices = mb->getIndicesVector();
|
||||
indices.resize(indices_count);
|
||||
if (idx_size == 2)
|
||||
{
|
||||
@ -543,11 +542,9 @@ void SPMeshLoader::decompressGESPM(irr::io::IReadFile* spm,
|
||||
indices[i] = tmp_idx[i];
|
||||
}
|
||||
}
|
||||
std::swap(mb->m_vertices, vertices);
|
||||
std::swap(mb->m_indices, indices);
|
||||
if (m.TextureLayer[0].Texture != NULL)
|
||||
{
|
||||
mb->m_material = m;
|
||||
mb->getMaterial() = m;
|
||||
}
|
||||
mb->recalculateBoundingBox();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user