large refactor

This commit is contained in:
Turanszki Janos
2019-12-12 22:15:16 +00:00
parent c495ce0088
commit fa267b0e7d
115 changed files with 1348 additions and 1739 deletions
+14 -14
View File
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "Editor.h"
#include "ObjectWindow.h"
#include "wiSceneSystem.h"
#include "wiScene.h"
#include "xatlas.h"
@@ -10,7 +10,7 @@
#include <unordered_map>
using namespace wiECS;
using namespace wiSceneSystem;
using namespace wiScene;
static void SetPixel(uint8_t *dest, int destWidth, int x, int y, const uint8_t *color)
@@ -270,7 +270,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
renderableCheckBox->SetPos(XMFLOAT2(x, y += 30));
renderableCheckBox->SetCheck(true);
renderableCheckBox->OnClick([&](wiEventArgs args) {
ObjectComponent* object = wiSceneSystem::GetScene().objects.GetComponent(entity);
ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->SetRenderable(args.bValue);
@@ -283,7 +283,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
ditherSlider->SetSize(XMFLOAT2(100, 30));
ditherSlider->SetPos(XMFLOAT2(x, y += 30));
ditherSlider->OnSlide([&](wiEventArgs args) {
ObjectComponent* object = wiSceneSystem::GetScene().objects.GetComponent(entity);
ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->color.w = 1 - args.fValue;
@@ -296,7 +296,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
cascadeMaskSlider->SetSize(XMFLOAT2(100, 30));
cascadeMaskSlider->SetPos(XMFLOAT2(x, y += 30));
cascadeMaskSlider->OnSlide([&](wiEventArgs args) {
ObjectComponent* object = wiSceneSystem::GetScene().objects.GetComponent(entity);
ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->cascadeMask = (uint32_t)args.iValue;
@@ -311,7 +311,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
colorPicker->SetVisible(true);
colorPicker->SetEnabled(true);
colorPicker->OnColorChanged([&](wiEventArgs args) {
ObjectComponent* object = wiSceneSystem::GetScene().objects.GetComponent(entity);
ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
XMFLOAT3 col = args.color.toFloat3();
@@ -336,7 +336,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
rigidBodyCheckBox->SetCheck(false);
rigidBodyCheckBox->OnClick([&](wiEventArgs args)
{
Scene& scene = wiSceneSystem::GetScene();
Scene& scene = wiScene::GetScene();
RigidBodyPhysicsComponent* physicscomponent = scene.rigidbodies.GetComponent(entity);
if (args.bValue)
@@ -365,7 +365,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
kinematicCheckBox->SetPos(XMFLOAT2(x, y += 30));
kinematicCheckBox->SetCheck(false);
kinematicCheckBox->OnClick([&](wiEventArgs args) {
RigidBodyPhysicsComponent* physicscomponent = wiSceneSystem::GetScene().rigidbodies.GetComponent(entity);
RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->SetKinematic(args.bValue);
@@ -378,7 +378,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
disabledeactivationCheckBox->SetPos(XMFLOAT2(x, y += 30));
disabledeactivationCheckBox->SetCheck(false);
disabledeactivationCheckBox->OnClick([&](wiEventArgs args) {
RigidBodyPhysicsComponent* physicscomponent = wiSceneSystem::GetScene().rigidbodies.GetComponent(entity);
RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->SetDisableDeactivation(args.bValue);
@@ -396,7 +396,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
collisionShapeComboBox->AddItem("Triangle Mesh");
collisionShapeComboBox->OnSelect([&](wiEventArgs args)
{
RigidBodyPhysicsComponent* physicscomponent = wiSceneSystem::GetScene().rigidbodies.GetComponent(entity);
RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
switch (args.iValue)
@@ -457,7 +457,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
generateLightmapButton->SetSize(XMFLOAT2(140,30));
generateLightmapButton->OnClick([&](wiEventArgs args) {
Scene& scene = wiSceneSystem::GetScene();
Scene& scene = wiScene::GetScene();
enum UV_GEN_TYPE
{
@@ -538,7 +538,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
stopLightmapGenButton->SetSize(XMFLOAT2(140, 30));
stopLightmapGenButton->OnClick([&](wiEventArgs args) {
Scene& scene = wiSceneSystem::GetScene();
Scene& scene = wiScene::GetScene();
for (auto& x : this->editor->selected)
{
@@ -559,7 +559,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor)
clearLightmapButton->SetSize(XMFLOAT2(140, 30));
clearLightmapButton->OnClick([&](wiEventArgs args) {
Scene& scene = wiSceneSystem::GetScene();
Scene& scene = wiScene::GetScene();
for (auto& x : this->editor->selected)
{
@@ -594,7 +594,7 @@ void ObjectWindow::SetEntity(Entity entity)
{
this->entity = entity;
Scene& scene = wiSceneSystem::GetScene();
Scene& scene = wiScene::GetScene();
const ObjectComponent* object = scene.objects.GetComponent(entity);