temp
This commit is contained in:
@@ -44,10 +44,11 @@ void LightKeeper::customInit() {
|
||||
|
||||
auto& scene = SceneManager::GetInstance().CreateScene("Main");
|
||||
|
||||
auto testCube = std::make_shared<GameObject>("TestCube");
|
||||
auto meshComp = testCube->AddComponent<MeshRendererComponent>();
|
||||
meshComp->SetMeshID(testMeshID);
|
||||
meshComp->SetMaterialID(testMaterialID);const int count = 100;
|
||||
// auto testCube = std::make_shared<GameObject>("TestCube");
|
||||
// auto meshComp = testCube->AddComponent<MeshRendererComponent>();
|
||||
// meshComp->SetMeshID(testMeshID);
|
||||
// meshComp->SetMaterialID(testMaterialID);
|
||||
const int count = 100;
|
||||
const float radius = 5.0f;
|
||||
|
||||
const float orbitRadius = 5.0f;
|
||||
@@ -67,9 +68,9 @@ void LightKeeper::customInit() {
|
||||
//
|
||||
// scene.Add(childCube);
|
||||
}
|
||||
testCube->AddComponent<Spinner>(glm::vec3(0, 1, 0), glm::radians(10.0f)); // spin around Y, rad/sec
|
||||
// testCube->AddComponent<Spinner>(glm::vec3(0, 1, 0), glm::radians(10.0f)); // spin around Y, rad/sec
|
||||
//rotate 180 around X axis
|
||||
testCube->GetTransform().SetLocalRotation(glm::quat(glm::vec3(glm::radians(180.0f), 0.0f, 0.0f)));
|
||||
// testCube->GetTransform().SetLocalRotation(glm::quat(glm::vec3(glm::radians(180.0f), 0.0f, 0.0f)));
|
||||
//
|
||||
auto globeRoot = std::make_shared<GameObject>("GlobeRoot");
|
||||
globeRoot->GetTransform().SetWorldPosition(glm::vec3(0.0f));
|
||||
@@ -78,7 +79,7 @@ void LightKeeper::customInit() {
|
||||
|
||||
|
||||
|
||||
scene.Add(testCube);
|
||||
// scene.Add(testCube);
|
||||
|
||||
// const auto skyboxID = AssetFS::GetInstance().GetFullPath("engine://textures/skybox.jpg");
|
||||
// const auto skyboxID = AssetFS::GetInstance().GetFullPath("engine://textures/mars.jpg");
|
||||
@@ -96,7 +97,7 @@ void LightKeeper::customInit() {
|
||||
|
||||
renderer.setSkyboxTexture(skyboxCubemap->GetCubeMapImageID());
|
||||
|
||||
|
||||
//
|
||||
const auto planeObj = std::make_shared<GameObject>("GroundPlane");
|
||||
const auto planeMeshComp = planeObj->AddComponent<MeshRendererComponent>();
|
||||
const auto planeModel = ModelLoader::LoadGLTF_CPUMeshes_MergedPerMesh(AssetFS::GetInstance().GetFullPath("game://plane.glb").generic_string());
|
||||
@@ -104,10 +105,10 @@ void LightKeeper::customInit() {
|
||||
|
||||
const auto planeTextureID = gfxDevice.loadImageFromFile(AssetFS::GetInstance().GetFullPath("game://grass.png"));
|
||||
const auto planeMaterialID = materialCache.addMaterial(gfxDevice, {
|
||||
.baseColor = glm::vec3(1.f),
|
||||
.textureFilteringMode = TextureFilteringMode::Nearest,
|
||||
.diffuseTexture = planeTextureID,
|
||||
.name = "GroundPlaneMaterial",
|
||||
.baseColor = glm::vec3(1.f),
|
||||
.textureFilteringMode = TextureFilteringMode::Nearest,
|
||||
.diffuseTexture = planeTextureID,
|
||||
.name = "GroundPlaneMaterial",
|
||||
});
|
||||
planeMeshComp->SetMeshID(planeMeshID);
|
||||
planeMeshComp->SetMaterialID(planeMaterialID);
|
||||
@@ -121,13 +122,12 @@ void LightKeeper::customInit() {
|
||||
const auto CharObj = std::make_shared<GameObject>("Character");
|
||||
|
||||
auto charModel = ModelLoader::LoadSkinnedModel(
|
||||
AssetFS::GetInstance().GetFullPath("engine://char.fbx").generic_string()
|
||||
AssetFS::GetInstance().GetFullPath("engine://char2.fbx").generic_string()
|
||||
);
|
||||
|
||||
const auto charMeshID = meshCache.addMesh(gfxDevice, charModel.meshes[0]);
|
||||
|
||||
const auto charTextureID = gfxDevice.loadImageFromFile(
|
||||
AssetFS::GetInstance().GetFullPath("engine://char.jpg"));
|
||||
const auto charTextureID = gfxDevice.loadImageFromFile(AssetFS::GetInstance().GetFullPath("engine://char.jpg"));
|
||||
const auto charMaterialID = materialCache.addMaterial(gfxDevice, {
|
||||
.baseColor = glm::vec3(1.f),
|
||||
.diffuseTexture = charTextureID,
|
||||
@@ -146,16 +146,16 @@ void LightKeeper::customInit() {
|
||||
}
|
||||
|
||||
for (const auto& clip : charModel.animations)
|
||||
spdlog::info("Loaded animation: '{}' ({:.2f}s)", clip.name, clip.duration);
|
||||
spdlog::info("Loaded animation: '{}' ({:.2f}s)", clip.name, clip.duration);
|
||||
|
||||
if (!charModel.animations.empty())
|
||||
// animator->play(charModel.animations[0].name);
|
||||
// animator->play("Armature|main");
|
||||
animator->play("Armature|mixamo.com");
|
||||
// animator->play("Armature|Armature|mixamo.com");
|
||||
// // animator->play(charModel.animations[0].name);
|
||||
animator->play("Armature|Armature|Armature|main");
|
||||
// or: animator->play("Run", 0.2f); // 0.2s cross-fade
|
||||
|
||||
CharObj->GetTransform().SetWorldPosition(glm::vec3(0.f, 0.f, 0.f));
|
||||
CharObj->GetTransform().SetWorldScale(0.01f, 0.01f, 0.01f);
|
||||
// CharObj->GetTransform().SetWorldScale(0.01f, 0.01f, 0.01f);
|
||||
scene.Add(CharObj);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user