Skip to content

Commit

Permalink
fix vector type data size error
Browse files Browse the repository at this point in the history
  • Loading branch information
T-rvw committed Dec 18, 2023
1 parent e5059d8 commit 4f5e7df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions make_win64_vs2022.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ if exist "./auto/commercial_sdk_locations.bat" (
)
@echo on
cd auto
call "./Premake/Windows/premake5" --os=windows vs2022
pause
call "./Premake/Windows/premake5" --os=windows vs2022
7 changes: 0 additions & 7 deletions private/Producers/GenericProducer/GenericProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,6 @@ void GenericProducerImpl::AddMaterials(cd::SceneDatabase* pSceneDatabase, const
}

// Add materials and associated textures(a simple filepath or raw pixel data) to SceneDatabase.
uint32_t actualMaterialCount = optUsedMaterialIndexes.has_value() ? static_cast<uint32_t>(optUsedMaterialIndexes.value().size()) : pSourceScene->mNumMaterials;
pSceneDatabase->SetMaterialCount(actualMaterialCount);
for (uint32_t materialIndex = 0; materialIndex < pSourceScene->mNumMaterials; ++materialIndex)
{
if (optUsedMaterialIndexes.has_value() &&
Expand Down Expand Up @@ -644,7 +642,6 @@ void GenericProducerImpl::AddScene(cd::SceneDatabase* pSceneDatabase, const aiSc

if (pSourceScene->HasLights())
{
pSceneDatabase->SetLightCount(pSourceScene->mNumLights);
for (uint32_t lightIndex = 0U; lightIndex < pSourceScene->mNumLights; ++lightIndex)
{
AddLight(pSceneDatabase, pSourceScene->mLights[lightIndex]);
Expand All @@ -653,9 +650,6 @@ void GenericProducerImpl::AddScene(cd::SceneDatabase* pSceneDatabase, const aiSc

if (pSourceScene->HasMeshes())
{
pSceneDatabase->SetNodeCount(GetSceneNodesCount(pSourceScene->mRootNode));
pSceneDatabase->SetMeshCount(pSourceScene->mNumMeshes);

// Add nodes and associated meshes to SceneDatabase.
// For assimp, bones are also treated as nodes.
AddNodeRecursively(pSceneDatabase, pSourceScene, pSourceScene->mRootNode, m_nodeIDGenerator.AllocateID().Data());
Expand All @@ -670,7 +664,6 @@ void GenericProducerImpl::AddScene(cd::SceneDatabase* pSceneDatabase, const aiSc
// Add animations.
if (pSourceScene->HasAnimations())
{
pSceneDatabase->SetAnimationCount(pSourceScene->mNumAnimations);
for (uint32_t animationIndex = 0U; animationIndex < pSourceScene->mNumAnimations; ++animationIndex)
{
AddAnimation(pSceneDatabase, pSourceScene->mAnimations[animationIndex]);
Expand Down
10 changes: 8 additions & 2 deletions public/Scene/APIMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public: \
Class##TypeTraits::Type Get##Type() const; \

#define PIMPL_SIMPLE_TYPE_APIS(Class, Type) \
void Class::Set##Type(Class##TypeTraits::Type value) { return m_p##Class##Impl->Set##Type(cd::MoveTemp(value)); } \
void Class::Set##Type(Class##TypeTraits::Type value) { return m_p##Class##Impl->Set##Type(value); } \
Class##TypeTraits::Type& Class::Get##Type() { return m_p##Class##Impl->Get##Type(); } \
Class##TypeTraits::Type Class::Get##Type() const { return m_p##Class##Impl->Get##Type(); } \

#define IMPLEMENT_SIMPLE_TYPE_APIS(Class, Type) \
public: \
void Set##Type(Class##TypeTraits::Type value) { m_##Type = MoveTemp(value); } \
void Set##Type(Class##TypeTraits::Type value) { m_##Type = value; } \
Class##TypeTraits::Type& Get##Type() { return m_##Type; } \
Class##TypeTraits::Type Get##Type() const { return m_##Type; } \
private: \
Expand Down Expand Up @@ -129,6 +129,8 @@ public: \
Class##TypeTraits::Type& Get##Type(uint32_t index); \
const Class##TypeTraits::Type& Get##Type(uint32_t index) const; \
void Add##Type(Class##TypeTraits::Type element); \
void Shrink##Type##Plural##ToFit(); \
void Clear##Type##Plural(); \

#define PIMPL_VECTOR_TYPE_APIS_WITH_PLURAL(Class, Type, Plural) \
void Class::Set##Type##Capacity(uint32_t count) { m_p##Class##Impl->Set##Type##Capacity(count); } \
Expand All @@ -141,6 +143,8 @@ public: \
Class##TypeTraits::Type& Class::Get##Type(uint32_t index) { return m_p##Class##Impl->Get##Type(index); } \
const Class##TypeTraits::Type& Class::Get##Type(uint32_t index) const { return m_p##Class##Impl->Get##Type(index); } \
void Class::Add##Type(Class##TypeTraits::Type element) { m_p##Class##Impl->Add##Type(cd::MoveTemp(element)); } \
void Class::Shrink##Type##Plural##ToFit() { m_p##Class##Impl->Shrink##Type##Plural##ToFit(); } \
void Class::Clear##Type##Plural() { m_p##Class##Impl->Clear##Type##Plural(); } \

#define IMPLEMENT_VECTOR_TYPE_APIS_WITH_PLURAL(Class, Type, Plural) \
public: \
Expand All @@ -154,6 +158,8 @@ public: \
Class##TypeTraits::Type& Get##Type(uint32_t index) { return m_##Type##Plural[index]; } \
const Class##TypeTraits::Type& Get##Type(uint32_t index) const { return m_##Type##Plural[index]; } \
void Add##Type(Class##TypeTraits::Type element) { m_##Type##Plural.push_back(cd::MoveTemp(element)); } \
void Shrink##Type##Plural##ToFit() { m_##Type##Plural.shrink_to_fit(); } \
void Clear##Type##Plural() { m_##Type##Plural.clear(); } \
private: \
std::vector<Class##TypeTraits::Type> m_##Type##Plural; \
public: \
Expand Down

0 comments on commit 4f5e7df

Please sign in to comment.