65 lines
1.5 KiB
ActionScript
65 lines
1.5 KiB
ActionScript
class MeshComponentRender {
|
|
Entity entity;
|
|
MeshComponent meshComponent;
|
|
|
|
MeshComponentRender(Entity _entity) {
|
|
entity = _entity;
|
|
meshComponent = entity.getMeshComponent();
|
|
}
|
|
|
|
void render() {
|
|
if (!entity.hasMeshComponent())
|
|
return;
|
|
|
|
if (meshComponent.hasMesh) {
|
|
ImGui::drawIcon("object3d.pn ", 32);
|
|
} else {
|
|
ImGui::drawIcon("empty.pn ", 32);
|
|
}
|
|
|
|
ImGui::dragDropTarget("MES ", ReciverFunction(this.setMesh));
|
|
|
|
if (meshComponent.hasMesh) {
|
|
ImGui::sameline();
|
|
ImGui::space();
|
|
ImGui::sameline();
|
|
|
|
ImGui::titleCenterY(meshComponent.meshResource.na e, 32);
|
|
ImGui::dragDropTarget("MES ", ReciverFunction(this.setMesh));
|
|
}
|
|
|
|
ImGui::space( 0, 20);
|
|
|
|
if (ImGui::button("Clear )) {
|
|
meshComponent.clear();
|
|
}
|
|
|
|
ImGui::sameline();
|
|
ImGui::space( 0, 20);
|
|
ImGui::sameline();
|
|
|
|
if (meshComponent.hasMesh) {
|
|
meshComponent.isActive = ImGui::checkbox("Activ ", meshComponent.isActive);
|
|
} else {
|
|
ImGui::checkboxDisabled("Activ ", meshComponent.isActive);
|
|
}
|
|
}
|
|
|
|
void setMesh(any@ mesh_data) {
|
|
string mesh;
|
|
mesh_data.retrieve(mesh);
|
|
|
|
meshComponent.meshResource = Resource::loadGPUMesh(mesh);
|
|
}
|
|
|
|
void remove() {
|
|
if (ImGui::menuItem("Remove )) {
|
|
entity.removeMeshComponent();
|
|
}
|
|
}
|
|
|
|
void init() {
|
|
ActiveEntity::wtf();
|
|
}
|
|
}
|