Material update, before changing prefabs
This commit is contained in:
@ -4,4 +4,4 @@
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(shader)
|
||||
add_subdirectory(material)
|
@ -6,5 +6,5 @@
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
SimpleTexturedShaderInterface.cpp
|
||||
SimpleTexturedMaterial.cpp
|
||||
)
|
@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SimpleTexturedMaterial.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
SimpleTexturedMaterial::SimpleTexturedMaterial(SceneItem *i) :
|
||||
Material(i)
|
||||
{
|
||||
}
|
||||
|
||||
Shader * SimpleTexturedMaterial::getShader() {
|
||||
return this->shader;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "display/shader/SimpleTexturedShader.hpp"
|
||||
#include "scene/components/display/Material.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SimpleTexturedMaterial : public Material {
|
||||
public:
|
||||
SimpleTexturedShader *shader = nullptr;
|
||||
Texture *texture = nullptr;
|
||||
struct Color color = COLOR_WHITE;
|
||||
|
||||
/**
|
||||
* SimpleTexturedShader scene item component interface.
|
||||
*
|
||||
* @param i Scene Item this interface belongs to.
|
||||
*/
|
||||
SimpleTexturedMaterial(SceneItem *i);
|
||||
|
||||
Shader * getShader() override;
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SimpleTexturedShaderInterface.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
SimpleTexturedShaderInterface::SimpleTexturedShaderInterface(SceneItem *i) :
|
||||
ShaderInterface<SimpleTexturedShader>(i)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SimpleTexturedShaderInterface::setTexture(Texture *texture) {
|
||||
this->getMaterial()->textureValues[this->getShader()->paramTexture] = texture;
|
||||
}
|
||||
|
||||
void SimpleTexturedShaderInterface::setColor(struct Color color) {
|
||||
this->getMaterial()->colorValues[this->getShader()->paramColor] = color;
|
||||
}
|
||||
|
||||
struct Color SimpleTexturedShaderInterface::getColor() {
|
||||
return this->getMaterial()->colorValues[this->getShader()->paramColor];
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/components/display/ShaderInterface.hpp"
|
||||
#include "display/shader/SimpleTexturedShader.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SimpleTexturedShaderInterface :
|
||||
public ShaderInterface<SimpleTexturedShader>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* SimpleTexturedShader scene item component interface.
|
||||
*
|
||||
* @param i Scene Item this interface belongs to.
|
||||
*/
|
||||
SimpleTexturedShaderInterface(SceneItem *i);
|
||||
|
||||
/**
|
||||
* Sets the primary colour texture to be used by the shader.
|
||||
*
|
||||
* @param texture Texture to use.
|
||||
*/
|
||||
void setTexture(Texture *texture);
|
||||
|
||||
/**
|
||||
* Sets the multiplicitive color to be used by the shader.
|
||||
*
|
||||
* @param color Color to be used.
|
||||
*/
|
||||
void setColor(struct Color color);
|
||||
|
||||
/**
|
||||
* Returns the current color from the shader.
|
||||
*
|
||||
* @return Current color.
|
||||
*/
|
||||
struct Color getColor();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user