Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/includes/components/effectrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ENGINE_EXPORT EffectRender : public Renderable {
void deltaUpdate(float dt);

private:
AABBox localBound() const override;
AABBox localBound() override;

Mesh *meshToDraw(int instance) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/components/meshrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ENGINE_EXPORT MeshRender : public Renderable {
protected:
void setMaterialsList(const std::list<Material *> &materials) override;

AABBox localBound() const override;
AABBox localBound() override;

Mesh *meshToDraw(int instance) override;

Expand Down
10 changes: 4 additions & 6 deletions engine/includes/components/renderable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RENDERABLE_H
#define RENDERABLE_H

#include "nativebehaviour.h"
#include <nativebehaviour.h>

#include <amath.h>

Expand All @@ -16,15 +16,13 @@ class ENGINE_EXPORT Renderable : public NativeBehaviour {
A_OBJECT(Renderable, NativeBehaviour, General)

A_NOPROPERTIES()
A_METHODS(
A_METHOD(AABBox, Renderable::bound)
)
A_NOMETHODS()

public:
Renderable();
~Renderable();

virtual AABBox bound() const;
virtual AABBox bound();

Material *material() const;
virtual void setMaterial(Material *material);
Expand All @@ -37,7 +35,7 @@ class ENGINE_EXPORT Renderable : public NativeBehaviour {

virtual uint32_t subMesh(int instance) const;

virtual AABBox localBound() const;
virtual AABBox localBound();

virtual void setMaterialsList(const std::list<Material *> &materials);

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/components/skinnedmeshrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ENGINE_EXPORT SkinnedMeshRender : public MeshRender {
private:
void setMaterialsList(const std::list<Material *> &materials) override;

AABBox localBound() const override;
AABBox localBound() const;

void onReferenceDestroyed() override;

Expand Down
9 changes: 5 additions & 4 deletions engine/includes/components/spriterender.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#ifndef SPRITERENDER
#define SPRITERENDER

#include "renderable.h"
#include <renderable.h>

#include <sprite.h>
#include <material.h>

class Sprite;
class Texture;
class Material;
class MaterialInstance;
class Mesh;

Expand Down Expand Up @@ -66,7 +67,7 @@ class ENGINE_EXPORT SpriteRender : public Renderable {

void setMaterialsList(const std::list<Material *> &materials) override;

AABBox localBound() const override;
AABBox localBound() override;

void composeComponent() override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/components/textrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ENGINE_EXPORT TextRender : public Renderable {

Mesh *meshToDraw(int instance) override;

AABBox localBound() const override;
AABBox localBound() override;

void setMaterialsList(const std::list<Material *> &materials) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/components/tilemaprender.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ENGINE_EXPORT TileMapRender : public Renderable {
void setLayer(int layer);

private:
AABBox localBound() const override;
AABBox localBound() override;

Mesh *meshToDraw(int instance) override;

Expand Down
5 changes: 5 additions & 0 deletions engine/includes/editor/assetconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class ENGINE_EXPORT AssetConverterSettings : public Object {
AssetConverterSettings();
~AssetConverterSettings();

AssetConverter *converter();
void setConverter(AssetConverter *converter);

uint32_t type() const;

virtual StringList typeNames() const;
Expand Down Expand Up @@ -139,6 +142,8 @@ class ENGINE_EXPORT AssetConverterSettings : public Object {

static std::map<TString, TString> m_defaultIcons;

AssetConverter *m_converter;

};

#endif // ASSETCONVERTER_H
2 changes: 0 additions & 2 deletions engine/includes/editor/projectsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ class ENGINE_EXPORT ProjectSettings : public Object {

TString m_myProjectsPath;



TString m_firstMap;

};
Expand Down
2 changes: 1 addition & 1 deletion engine/src/components/effectrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void EffectRender::setEffect(VisualEffect *effect) {
/*!
\internal
*/
AABBox EffectRender::localBound() const {
AABBox EffectRender::localBound() {
if(m_effect) {
m_effect->bound();
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/components/meshrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void MeshRender::setMaterialsList(const std::list<Material *> &materials) {
/*!
\internal
*/
AABBox MeshRender::localBound() const {
AABBox MeshRender::localBound() {
if(m_mesh) {
return m_mesh->bound();
}
Expand Down
4 changes: 2 additions & 2 deletions engine/src/components/renderable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Renderable::~Renderable() {
/*!
Returns a bound box of the renderable object.
*/
AABBox Renderable::bound() const {
AABBox Renderable::bound() {
AABBox bb = localBound();
Transform *t = transform();
if(t) {
Expand Down Expand Up @@ -119,7 +119,7 @@ void Renderable::setMaterialsList(const std::list<Material *> &materials) {
/*!
\internal
*/
AABBox Renderable::localBound() const {
AABBox Renderable::localBound() {
return AABBox();
}
/*!
Expand Down
21 changes: 12 additions & 9 deletions engine/src/components/spriterender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <math.h>

namespace {
const char *gColor = "mainColor";
const char *gTexture = "mainTexture";
const char *gDefaultSprite = ".embedded/DefaultSprite.shader";
const char *gColor("mainColor");
const char *gTexture("mainTexture");
const char *gDefaultSprite(".embedded/DefaultSprite.shader");
}

/*!
Expand Down Expand Up @@ -67,6 +67,7 @@ Mesh *SpriteRender::meshToDraw(int instance) {
if(m_drawMode == Sprite::Simple) {
m_size = mesh->bound().extent * 2.0f;
}

} else {
m_mesh = PipelineContext::defaultPlane();
}
Expand Down Expand Up @@ -103,11 +104,10 @@ MaterialInstance *SpriteRender::materialInstance(int index) {
/*!
\internal
*/
AABBox SpriteRender::localBound() const {
if(m_useCustom) {
return m_customMesh->bound();
} else if(m_mesh) {
return m_mesh->bound();
AABBox SpriteRender::localBound() {
Mesh *mesh = meshToDraw(0);
if(mesh) {
return mesh->bound();
}
return Renderable::localBound();
}
Expand Down Expand Up @@ -192,7 +192,10 @@ Vector2 SpriteRender::size() const {
Sets a new \a size of sprite.
*/
void SpriteRender::setSize(const Vector2 &size) {
m_size = size;
if(m_size != size) {
m_size = size;
m_dirtyMesh = true;
}
}
/*!
Returns a draw mode for the sprite.
Expand Down
2 changes: 1 addition & 1 deletion engine/src/components/textrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void TextRender::composeComponent() {
/*!
\internal
*/
AABBox TextRender::localBound() const {
AABBox TextRender::localBound() {
if(m_mesh) {
return m_mesh->bound();
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/components/tilemaprender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Mesh *TileMapRender::meshToDraw(int instance) {
/*!
\internal
*/
AABBox TileMapRender::localBound() const {
AABBox TileMapRender::localBound() {
if(m_tileMap) {
return m_tileMap->tileMesh()->bound();
}
Expand Down
15 changes: 14 additions & 1 deletion engine/src/editor/assetconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,25 @@ AssetConverterSettings::AssetConverterSettings() :
m_modified(false),
m_dir(false),
m_version(0),
m_currentVersion(0) {
m_currentVersion(0),
m_converter(nullptr) {

}

AssetConverterSettings::~AssetConverterSettings() {

}
/*!
Returns assotiated AssetConverter.
*/
AssetConverter *AssetConverterSettings::converter() {
return m_converter;
}
/*!
Sets assotiated asset \a converter.
*/
void AssetConverterSettings::setConverter(AssetConverter *converter) {
m_converter = converter;
}
/*!
Returns the asset type for conversion for more details see MetaType.
Expand Down
16 changes: 8 additions & 8 deletions engine/src/editor/assetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ AssetConverterSettings *AssetManager::fetchSettings(const TString &source) {
AssetConverterSettings *settings = nullptr;

if(!path.isEmpty() && File::exists(source)) {
TString suffix(Url(source).completeSuffix().toLower());
auto it = m_converters.find(suffix);

if(it != m_converters.end()) {
settings = it->second->createSettings();
AssetConverter *converter = getConverter(source);
if(converter) {
settings = converter->createSettings();
settings->setConverter(converter);
} else {
TString suffix(Url(source).suffix().toLower());
CodeBuilder *currentBuilder = m_projectManager->currentBuilder();
CodeBuilder *builder = nullptr;
for(auto it : m_builders) {
Expand Down Expand Up @@ -424,7 +424,7 @@ Actor *AssetManager::createActor(const TString &source) {
if(!source.isEmpty()) {
TString uuid;
TString path = source;
if(source.at(0) == '{') {
if(source.front() == '{') {
uuid = source;
path = uuidToPath(uuid);
} else {
Expand All @@ -433,7 +433,7 @@ Actor *AssetManager::createActor(const TString &source) {

AssetConverterSettings *settings = fetchSettings(path);
if(settings) {
AssetConverter *converter = getConverter(path);
AssetConverter *converter = settings->converter();
if(converter) {
return converter->createActor(settings, uuid);
}
Expand Down Expand Up @@ -534,7 +534,7 @@ void AssetManager::onPerform() {
}

AssetConverter *AssetManager::getConverter(const TString &source) {
auto it = m_converters.find(Url(source).suffix().toLower());
auto it = m_converters.find(Url(source).completeSuffix().toLower());
if(it != m_converters.end()) {
return it->second;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/editor/viewport/cameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void CameraController::resetCamera() {

m_cameras.clear();
m_cameras.push_back({rotation, position, dist, 0.0f, false});
m_cameras.push_back({Vector3(), Vector3(0.0f, 0.0f, -10.0f), 0.0f, dist, true});
m_cameras.push_back({Vector3(), Vector3(0.0f, 0.0f, 10.0f), 0.0f, dist, true});

m_currentCamera = 0;

Expand Down
1 change: 1 addition & 0 deletions modules/editor/particletools/converter/effectbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ float EffectBuilderSettings::thumbnailWarmup() const {
void EffectBuilderSettings::setThumbnailWarmup(float value) {
if(m_thumbnailWarmup != value) {
m_thumbnailWarmup = value;
setModified();
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/editor/particletools/editor/particleedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ParticleProxy : public Object {
ParticleEdit::ParticleEdit() :
ui(new Ui::ParticleEdit),
m_builder(new EffectBuilder),
m_controller(new CameraController()),
m_controller(new CameraController),
m_light(nullptr),
m_effect(nullptr),
m_render(nullptr),
Expand Down
2 changes: 1 addition & 1 deletion modules/editor/shadertools/editor/materialedit.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1024</width>
<height>800</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
12 changes: 8 additions & 4 deletions worldeditor/src/managers/assetimporter/iconrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ const QImage IconRender::render(const TString &uuid) {

m_render->update(m_world);

QImage result;

if(m_color) {
ByteArray data(m_color->getPixels(0));
QImage result(data.data(), m_color->width(), m_color->height(), QImage::Format_RGBA8888);
result = QImage(data.data(), m_color->width(), m_color->height(), QImage::Format_RGBA8888);

result = result.mirrored();
}

if(object) {
object->setParent(nullptr);
delete object;

return result.mirrored();
}

return QImage();
return result;
}
2 changes: 2 additions & 0 deletions worldeditor/src/screens/scenecomposer/objectcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "tools/movetool.h"
#include "tools/rotatetool.h"
#include "tools/scaletool.h"
#include "tools/transformtool.h"
#include "tools/spline/splinetool.h"

#include "actions/selectobjects.h"
Expand Down Expand Up @@ -195,6 +196,7 @@ ObjectController::ObjectController(SceneComposer *editor) :
new RotateTool(this),
new ScaleTool(this),
new SplineTool(this),
new TransformTool(this),
};
}

Expand Down
Loading
Loading