Refactor KRResourceBinding setName method to set
This commit is contained in:
@@ -109,7 +109,7 @@ void KRAudioSource::loadXML(tinyxml2::XMLElement* e)
|
|||||||
if (szAudioSampleName == nullptr) {
|
if (szAudioSampleName == nullptr) {
|
||||||
m_sample.clear();
|
m_sample.clear();
|
||||||
} else {
|
} else {
|
||||||
m_sample.setName(szAudioSampleName);
|
m_sample.set(szAudioSampleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
float gain = 1.0f;
|
float gain = 1.0f;
|
||||||
@@ -364,7 +364,7 @@ bool KRAudioSource::isPlaying()
|
|||||||
|
|
||||||
void KRAudioSource::setSample(const std::string& sound_name)
|
void KRAudioSource::setSample(const std::string& sound_name)
|
||||||
{
|
{
|
||||||
m_sample.setName(sound_name);
|
m_sample.set(sound_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string KRAudioSource::getSample()
|
std::string KRAudioSource::getSample()
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void KRCamera::loadXML(tinyxml2::XMLElement* e)
|
|||||||
KRNode::loadXML(e);
|
KRNode::loadXML(e);
|
||||||
const char* szSkyBoxName = e->Attribute("skybox");
|
const char* szSkyBoxName = e->Attribute("skybox");
|
||||||
if (szSkyBoxName) {
|
if (szSkyBoxName) {
|
||||||
m_skyBox.setName(szSkyBoxName);
|
m_skyBox.set(szSkyBoxName);
|
||||||
} else {
|
} else {
|
||||||
m_skyBox.clear();
|
m_skyBox.clear();
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ void KRCamera::loadXML(tinyxml2::XMLElement* e)
|
|||||||
|
|
||||||
void KRCamera::setSkyBox(const std::string& skyBox)
|
void KRCamera::setSkyBox(const std::string& skyBox)
|
||||||
{
|
{
|
||||||
m_skyBox.setName(skyBox);
|
m_skyBox.set(skyBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string KRCamera::getSkyBox() const
|
const std::string KRCamera::getSkyBox() const
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ KRCollider::KRCollider(KRScene& scene, std::string collider_name, std::string mo
|
|||||||
, m_layer_mask(layer_mask)
|
, m_layer_mask(layer_mask)
|
||||||
, m_audio_occlusion(audio_occlusion)
|
, m_audio_occlusion(audio_occlusion)
|
||||||
{
|
{
|
||||||
m_model.setName(model_name);
|
m_model.set(model_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRCollider::~KRCollider()
|
KRCollider::~KRCollider()
|
||||||
@@ -84,7 +84,7 @@ tinyxml2::XMLElement* KRCollider::saveXML(tinyxml2::XMLNode* parent)
|
|||||||
void KRCollider::loadXML(tinyxml2::XMLElement* e)
|
void KRCollider::loadXML(tinyxml2::XMLElement* e)
|
||||||
{
|
{
|
||||||
KRNode::loadXML(e);
|
KRNode::loadXML(e);
|
||||||
m_model.setName(e->Attribute("mesh"));
|
m_model.set(e->Attribute("mesh"));
|
||||||
|
|
||||||
m_layer_mask = 65535;
|
m_layer_mask = 65535;
|
||||||
if (e->QueryUnsignedAttribute("layer_mask", &m_layer_mask) != tinyxml2::XML_SUCCESS) {
|
if (e->QueryUnsignedAttribute("layer_mask", &m_layer_mask) != tinyxml2::XML_SUCCESS) {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void KRLight::loadXML(tinyxml2::XMLElement* e)
|
|||||||
|
|
||||||
const char* szFlareTexture = e->Attribute("flare_texture");
|
const char* szFlareTexture = e->Attribute("flare_texture");
|
||||||
if (szFlareTexture) {
|
if (szFlareTexture) {
|
||||||
m_flareTexture.setName(szFlareTexture);
|
m_flareTexture.set(szFlareTexture);
|
||||||
} else {
|
} else {
|
||||||
m_flareTexture.clear();
|
m_flareTexture.clear();
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ void KRLight::loadXML(tinyxml2::XMLElement* e)
|
|||||||
|
|
||||||
void KRLight::setFlareTexture(std::string flare_texture)
|
void KRLight::setFlareTexture(std::string flare_texture)
|
||||||
{
|
{
|
||||||
m_flareTexture.setName(flare_texture);
|
m_flareTexture.set(flare_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRLight::setFlareSize(float flare_size)
|
void KRLight::setFlareSize(float flare_size)
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ KRModel::KRModel(KRScene& scene, std::string name)
|
|||||||
KRModel::KRModel(KRScene& scene, std::string instance_name, std::string model_name[kMeshLODCount], std::string light_map, float lod_min_coverage, bool receives_shadow, bool faces_camera, Vector3 rim_color, float rim_power)
|
KRModel::KRModel(KRScene& scene, std::string instance_name, std::string model_name[kMeshLODCount], std::string light_map, float lod_min_coverage, bool receives_shadow, bool faces_camera, Vector3 rim_color, float rim_power)
|
||||||
: KRNode(scene, instance_name)
|
: KRNode(scene, instance_name)
|
||||||
{
|
{
|
||||||
m_lightMap.setName(light_map);
|
m_lightMap.set(light_map);
|
||||||
for (int lod = 0; lod < kMeshLODCount; lod++) {
|
for (int lod = 0; lod < kMeshLODCount; lod++) {
|
||||||
m_meshes[lod].setName(model_name[lod]);
|
m_meshes[lod].set(model_name[lod]);
|
||||||
}
|
}
|
||||||
m_min_lod_coverage = lod_min_coverage;
|
m_min_lod_coverage = lod_min_coverage;
|
||||||
m_receivesShadow = receives_shadow;
|
m_receivesShadow = receives_shadow;
|
||||||
@@ -196,7 +196,7 @@ float KRModel::getRimPower()
|
|||||||
|
|
||||||
void KRModel::setLightMap(const std::string& name)
|
void KRModel::setLightMap(const std::string& name)
|
||||||
{
|
{
|
||||||
m_lightMap.setName(name);
|
m_lightMap.set(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string KRModel::getLightMap()
|
std::string KRModel::getLightMap()
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void KRSprite::loadXML(tinyxml2::XMLElement* e)
|
|||||||
|
|
||||||
const char* szSpriteTexture = e->Attribute("sprite_texture");
|
const char* szSpriteTexture = e->Attribute("sprite_texture");
|
||||||
if (szSpriteTexture) {
|
if (szSpriteTexture) {
|
||||||
m_spriteTexture.setName(szSpriteTexture);
|
m_spriteTexture.set(szSpriteTexture);
|
||||||
} else {
|
} else {
|
||||||
m_spriteTexture.clear();
|
m_spriteTexture.clear();
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ void KRSprite::loadXML(tinyxml2::XMLElement* e)
|
|||||||
|
|
||||||
void KRSprite::setSpriteTexture(std::string sprite_texture)
|
void KRSprite::setSpriteTexture(std::string sprite_texture)
|
||||||
{
|
{
|
||||||
m_spriteTexture.setName(sprite_texture);
|
m_spriteTexture.set(sprite_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRSprite::setSpriteAlpha(float alpha)
|
void KRSprite::setSpriteAlpha(float alpha)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const std::string& KRResourceBinding::getName() const
|
|||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRResourceBinding::setName(const std::string& name)
|
void KRResourceBinding::set(const std::string& name)
|
||||||
{
|
{
|
||||||
if (m_name == name) {
|
if (m_name == name) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ public:
|
|||||||
|
|
||||||
KRResource* get();
|
KRResource* get();
|
||||||
void set(KRResource* resource);
|
void set(KRResource* resource);
|
||||||
|
void set(const std::string& name);
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
void setName(const std::string& name);
|
|
||||||
|
|
||||||
virtual bool bind(KRContext* context) = 0;
|
virtual bool bind(KRContext* context) = 0;
|
||||||
bool isBound() const;
|
bool isBound() const;
|
||||||
|
|||||||
@@ -142,42 +142,42 @@ bool KRMaterial::save(Block& data)
|
|||||||
|
|
||||||
void KRMaterial::setAmbientMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
void KRMaterial::setAmbientMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
||||||
{
|
{
|
||||||
m_ambientMap.setName(texture_name);
|
m_ambientMap.set(texture_name);
|
||||||
m_ambientMapScale = texture_scale;
|
m_ambientMapScale = texture_scale;
|
||||||
m_ambientMapOffset = texture_offset;
|
m_ambientMapOffset = texture_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setDiffuseMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
void KRMaterial::setDiffuseMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
||||||
{
|
{
|
||||||
m_diffuseMap.setName(texture_name);
|
m_diffuseMap.set(texture_name);
|
||||||
m_diffuseMapScale = texture_scale;
|
m_diffuseMapScale = texture_scale;
|
||||||
m_diffuseMapOffset = texture_offset;
|
m_diffuseMapOffset = texture_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setSpecularMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
void KRMaterial::setSpecularMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
||||||
{
|
{
|
||||||
m_specularMap.setName(texture_name);
|
m_specularMap.set(texture_name);
|
||||||
m_specularMapScale = texture_scale;
|
m_specularMapScale = texture_scale;
|
||||||
m_specularMapOffset = texture_offset;
|
m_specularMapOffset = texture_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setNormalMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
void KRMaterial::setNormalMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
||||||
{
|
{
|
||||||
m_normalMap.setName(texture_name);
|
m_normalMap.set(texture_name);
|
||||||
m_normalMapScale = texture_scale;
|
m_normalMapScale = texture_scale;
|
||||||
m_normalMapOffset = texture_offset;
|
m_normalMapOffset = texture_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setReflectionMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
void KRMaterial::setReflectionMap(std::string texture_name, Vector2 texture_scale, Vector2 texture_offset)
|
||||||
{
|
{
|
||||||
m_reflectionMap.setName(texture_name);
|
m_reflectionMap.set(texture_name);
|
||||||
m_reflectionMapScale = texture_scale;
|
m_reflectionMapScale = texture_scale;
|
||||||
m_reflectionMapOffset = texture_offset;
|
m_reflectionMapOffset = texture_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setReflectionCube(std::string texture_name)
|
void KRMaterial::setReflectionCube(std::string texture_name)
|
||||||
{
|
{
|
||||||
m_reflectionCube.setName(texture_name);
|
m_reflectionCube.set(texture_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMaterial::setAlphaMode(KRMaterial::alpha_mode_type alpha_mode)
|
void KRMaterial::setAlphaMode(KRMaterial::alpha_mode_type alpha_mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user