Implemented SelectionService

This commit is contained in:
Vulpovile
2023-11-05 22:39:06 -08:00
parent ebfbade283
commit b58161cf81
9 changed files with 22073 additions and 62 deletions

View File

@@ -4,15 +4,15 @@ using namespace B3D;
#pragma once
// Instances
//#include "WorkspaceInstance.h"
#include "WorkspaceInstance.h"
#include "LevelInstance.h"
#include "PartInstance.h"
//#include "SelectionService.h"
#include "SelectionService.h"
//#include "GuiRootInstance.h"
//#include "ThumbnailGeneratorInstance.h"
#include "XplicitNgine/XplicitNgine.h"
//#include "SoundService.h"
//#include "LightingInstance.h"
#include "LightingInstance.h"
// Libraries
//#include "rapidxml/rapidxml.hpp"
@@ -28,36 +28,35 @@ namespace B3D {
void drawMessage(RenderDevice*);
// Instance getters
// WorkspaceInstance* getWorkspace();
WorkspaceInstance* getWorkspace();
LevelInstance* getLevel();
XplicitNgine* getEngine();
// ThumbnailGeneratorInstance* getThumbnailGenerator();
// SoundService* getSoundService();
// LightingInstance* getLighting();
LightingInstance* getLighting();
std::string message;
bool showMessage;
//Should probably not be here???
G3D::GFontRef font;
// GuiRootInstance* getGuiRoot();
// SelectionService* getSelectionService();
// PartInstance* makePart();
SelectionService* getSelectionService();
void clearLevel();
void toggleRun();
bool isRunning();
// void resetEngine();
void resetEngine();
private:
bool isBrickCount;
Color3 DataModelInstance::bcToRGB(short bc);
// Instances
// WorkspaceInstance* workspace;
WorkspaceInstance* workspace;
LevelInstance* level;
// GuiRootInstance* guiRoot;
// SelectionService* selectionService;
SelectionService* selectionService;
// ThumbnailGeneratorInstance* thumbnailGenerator;
XplicitNgine* xplicitNgine;
// SoundService* soundService;
// LightingInstance* lightingInstance;
LightingInstance* lightingInstance;
bool running;
};

View File

@@ -0,0 +1,41 @@
#pragma once
#include "Instance.h"
namespace B3D
{
class LightingInstance : public Instance
{
public:
LightingInstance(void);
~LightingInstance(void);
// Getters
G3D::Color3 getTopAmbient();
G3D::Color3 getBottomAmbient();
G3D::Color3 getSpotLight();
G3D::Color4 getClearColor();
G3D::SkyRef getSky();
G3D::LightingParameters getLightingParameters();
// Setters
void setTopAmbient(G3D::Color3 newValue);
void setBottomAmbient(G3D::Color3 newValue);
void setSpotLight(G3D::Color3 newValue);
void setClearColor(G3D::Color3 clearColor);
// Functions
void drawSky(RenderDevice* rd);
void suppressSky(bool doSuppress);
void update(RenderDevice* rd);
void drawEffects(RenderDevice* rd);
private:
Reflection::ReflectionProperty<G3D::Color3> topAmbient;
Reflection::ReflectionProperty<G3D::Color3> bottomAmbient;
Reflection::ReflectionProperty<G3D::Color3> spotLight;
Reflection::ReflectionProperty<G3D::Color4> clearColor;
G3D::SkyRef sky;
G3D::LightingParameters lighting;
bool _hideSky;
};
}

View File

@@ -0,0 +1,30 @@
#pragma once
#include "Instance.h"
// TODO Port PropertyWindow
//#include "PropertyWindow.h"
namespace B3D{
class SelectionService : public Instance
{
public:
SelectionService(void);
~SelectionService(void);
SelectionService(const SelectionService &oinst);
std::vector<Instance *> getSelection();
void clearSelection();
bool isSelected(Instance * instance);
void addSelected(Instance * instance);
void removeSelected(Instance * instance);
void addSelected(const std::vector<Instance *> &instances);
// TODO Port PropertyWindow
//void setPropertyWindow(PropertyWindow * propertyWindow);
void render(RenderDevice * rd);
private:
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c);
std::vector<Instance *> selection;
int mode;
// TODO Port PropertyWindow
//PropertyWindow * propertyWindow;
};
}

View File

@@ -17,14 +17,16 @@ namespace B3D{
};
enum ReflectionType {
TYPE_INT = 0,
TYPE_FLOAT = 1,
TYPE_STRING = 2,
TYPE_VECTOR3 = 3,
TYPE_COLOR3 = 4,
TYPE_CFRAME = 5,
TYPE_BOOLEAN = 6,
TYPE_ENUM = 7
TYPE_INT,
TYPE_FLOAT,
TYPE_STRING,
TYPE_VECTOR3,
TYPE_COLOR3,
TYPE_COLOR4,
TYPE_CFRAME,
TYPE_BOOLEAN,
TYPE_ENUM,
LENGTH
};
}
}