This commit is contained in:
MegaMech
2025-03-19 21:12:56 -06:00
parent a422822506
commit 80c232a26f
3 changed files with 11 additions and 9 deletions
-5
View File
@@ -14,7 +14,6 @@ StaticMeshActor::StaticMeshActor(std::string name, FVector pos, IRotator rot, FV
void StaticMeshActor::Draw() {
Mat4 mtx;
printf("DRAWING \n");
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
if (!Model.empty()) {
@@ -23,10 +22,6 @@ printf("DRAWING \n");
gSPDisplayList(gDisplayListHead++, (Gfx*)Model.c_str());
}
}
FVector test = FVector(cameras[0].pos[0], cameras[0].pos[1], cameras[0].pos[2]);
FVector diff = test - Pos;
printf("Cam dist: %f", diff.Magnitude());
}
void StaticMeshActor::Destroy() {
+9 -3
View File
@@ -15,6 +15,7 @@
#include <defines.h>
#include "CoreMath.h"
#include "World.h"
#include "Crab.h"
namespace Editor {
@@ -39,18 +40,18 @@ namespace Editor {
// Query content in o2r and add them to Content
if (refresh) {
refresh = false;
Content.clear();
FindContent();
return;
}
AddStockContent();
// Display entries in Content
for (const auto& file : Content) {
if (ImGui::Button(file.c_str())) {
int coll;
//printf("ContentBrowser.cpp: name: %s\n", test.c_str());
printf("TEST %s\n", file.c_str());
std::string name = file.substr(file.find_last_of('/') + 1);
printf("NAME %s\n", name.c_str());
auto actor = gWorldInstance.AddStaticMeshActor(name, FVector(50, 100, 0), IRotator(0, 90, 0), FVector(1, 1, 1), "__OTR__" + file, &coll);
// This is required because ptr gets cleaned up.
actor->Model = "__OTR__" + file;
@@ -59,11 +60,16 @@ namespace Editor {
}
}
void ContentBrowserWindow::AddStockContent() {
if (ImGui::Button("Crab")) {
gWorldInstance.AddObject(new OCrab(FVector2D(0, 0), FVector2D(0, 100)));
}
}
void ContentBrowserWindow::FindContent() {
std::list<std::string> myList = {"tracks/*", "actors/*", "objects/*"};
std::list<std::string> myList2 = {""};
Content.clear();
auto ptr = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->ListFiles(myList, myList2);
if (ptr) {
+2 -1
View File
@@ -13,6 +13,7 @@ protected:
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
void AddStockContent();
void FindContent();
};
}
}