Commit 9b8b0d2e authored by Ilya Prokhorov's avatar Ilya Prokhorov

Cube builder test work in progress

parent 672284fc
......@@ -12,6 +12,9 @@
*/
#include "FSEGTObjectsContext.h"
#include <FlameSteelCore/FSCUtils.h>
using namespace FlameSteelCore::Utils;
FSEGTObjectsContext::FSEGTObjectsContext()
{
......@@ -50,6 +53,10 @@ void FSEGTObjectsContext::removeAllObjects()
void FSEGTObjectsContext::addObject(shared_ptr<Object> object)
{
if (objects.get() == nullptr) {
throwRuntimeException(string("objects object is null"));
}
objects->addObject(object);
for (auto subscriber : subscribers)
......
......@@ -50,9 +50,13 @@ bool FSEGTUtils::isSkyboxObject(shared_ptr<Object> object)
bool FSEGTUtils::contains3D(shared_ptr<Object> object)
{
return object->containsComponentWithIdentifier(make_shared<string>(FSEGTConstComponentsModel)) ||
auto contains3D = object->containsComponentWithIdentifier(make_shared<string>(FSEGTConstComponentsModel)) ||
object->containsComponentWithIdentifier(make_shared<string>(FSEGTConstComponentsSerializedModel));
cout << "contains3D: " << contains3D << endl;
return contains3D;
}
int FSEGTUtils::getCurrentFrame(shared_ptr<Object> object)
......@@ -213,9 +217,7 @@ shared_ptr<FSEGTText> FSEGTUtils::getText(shared_ptr<Object> object)
shared_ptr<FSEGTVector> FSEGTUtils::getObjectPosition(shared_ptr<Object> object)
{
auto positionComponent = object->getComponent(make_shared<string>(FSEGTConstComponentsPosition));
return static_pointer_cast<FSEGTVector>(positionComponent);
}
......
#include "Factory.h"
#include <FlameSteelEngineGameToolkit/Data/Components/FSEGTFactory.h>
using namespace FlameSteelEngine::GameToolkit;
shared_ptr<FSEGTSerializedModel> Factory::makeSerializedModel() {
auto serializedModel = FSEGTFactory::makeSerializedModelComponent(make_shared<string>());
return serializedModel;
};
shared_ptr<SurfaceMaterial> Factory::makeSurfaceMaterial(int width, int height) {
auto surfaceMaterial = FSEGTFactory::makeSurfaceMaterialComponent(width, height);
return surfaceMaterial;
};
shared_ptr<FSEGTVector> Factory::makePosition(int x, int y, int z) {
auto position = FSEGTFactory::makePositionComponent(x, y, z);
return position;
};
shared_ptr<FSEGTVector> Factory::makeRotation(float rotationX, float rotationY, float rotationZ) {
auto rotation = FSEGTFactory::makeRotationComponent(rotationX, rotationY, rotationZ);
return rotation;
};
shared_ptr <FSEGTVector> Factory::makeScale(float width, float height, float depth) {
auto scale = FSEGTFactory::makeScaleComponent(width, height, depth);
return scale;
};
shared_ptr<FloatComponent> Factory::makeBrightness(float factor) {
auto brightness = FSEGTFactory::makeBrightnessComponent(factor);
return brightness;
}
\ No newline at end of file
#ifndef FLAMESTEELENGINEGAMETOOLKITFACTORY_H_
#define FLAMESTEELENGINEGAMETOOLKITFACTORY_H_
#include <memory>
#include <FlameSteelCore/Object.h>
#include <FlameSteelCommonTraits/SerializedModel.h>
#include <FlameSteelEngineGameToolkit/Data/Components/Vector/FSEGTVector.h>
#include <FlameSteelEngineGameToolkit/Data/Components/Float/FloatComponent.h>
#include <FlameSteelEngineGameToolkit/Data/Components/SurfaceMaterial/SurfaceMaterial.h>
using namespace std;
using namespace FlameSteelCore;
namespace FlameSteelEngine {
namespace GameToolkit {
class Factory {
public:
static shared_ptr<FSEGTSerializedModel> makeSerializedModel();
static shared_ptr<SurfaceMaterial> makeSurfaceMaterial(int width, int height);
static shared_ptr<FSEGTVector> makePosition(int x, int y, int z);
static shared_ptr<FSEGTVector> makeRotation(float rotationX, float rotationY, float rotationZ);
static shared_ptr <FSEGTVector> makeScale(float width, float height, float depth);
static shared_ptr<FloatComponent> makeBrightness(float factor);
};
};
};
#endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment