eb1593a19c
These changes allow for usage of different asset import SDKs to process scene files.
Move AssImp specific code out of node, scene & material wrapper parent classes and into child wrapper classes (AssImpNodeWrapper, etc.), allowing child classes to expose import SDK code. Allows for more convenient implementation of other import SDK's elsewhere (such as in a gem).
Add a loadingComponentUuid parameter to LoadSceneFromVerifiedPath to allow for usage of different loading components. Changed tests and all calls to this function accordingly.
* Move AssImp specific code out of wrapper parent classes and into child classes for gem usage
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Add loadingComponentUuid parameter to LoadSceneFromVerifiedPath function
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Make wrapper members protected, change pointer cast
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Adding spaces to fix style
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Fix for pointer cast causing test failures
Signed-off-by: Victor Huang <huavicto@amazon.com>
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
#pragma once
|
|
#include <SceneAPI/SDKWrapper/SceneWrapper.h>
|
|
#include <assimp/Importer.hpp>
|
|
|
|
struct aiScene;
|
|
|
|
namespace AZ
|
|
{
|
|
namespace AssImpSDKWrapper
|
|
{
|
|
class AssImpSceneWrapper : public SDKScene::SceneWrapperBase
|
|
{
|
|
public:
|
|
AZ_RTTI(AssImpSceneWrapper, "{43A61F62-DCD4-4132-B80B-F2FBC80740BC}", SDKScene::SceneWrapperBase);
|
|
AssImpSceneWrapper();
|
|
AssImpSceneWrapper(aiScene* aiScene);
|
|
~AssImpSceneWrapper() override = default;
|
|
|
|
bool LoadSceneFromFile(const char* fileName) override;
|
|
bool LoadSceneFromFile(const AZStd::string& fileName) override;
|
|
|
|
const std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() const override;
|
|
std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() override;
|
|
virtual const aiScene* GetAssImpScene() const;
|
|
void Clear() override;
|
|
|
|
enum class AxisVector
|
|
{
|
|
X = 0,
|
|
Y = 1,
|
|
Z = 2,
|
|
Unknown
|
|
};
|
|
|
|
AZStd::pair<AxisVector, int32_t> GetUpVectorAndSign() const;
|
|
AZStd::pair<AxisVector, int32_t> GetFrontVectorAndSign() const;
|
|
|
|
AZStd::string GetSceneFileName() const { return m_sceneFileName; }
|
|
protected:
|
|
const aiScene* m_assImpScene = nullptr;
|
|
Assimp::Importer m_importer;
|
|
|
|
// FBX SDK automatically resolved relative paths to textures based on the current file location.
|
|
// AssImp does not, so it needs to be specifically handled.
|
|
AZStd::string m_sceneFileName;
|
|
};
|
|
|
|
} // namespace AssImpSDKWrapper
|
|
} // namespace AZ
|