74 lines
1.6 KiB
C++
74 lines
1.6 KiB
C++
#include "resourcebase.h"
|
|
|
|
ResourceBase::~ResourceBase()
|
|
{
|
|
for(std::string str : textureNames)
|
|
delete(textures[str]);
|
|
for(std::string str : meshNames)
|
|
delete(meshes[str]);
|
|
for(std::string str : materialNames)
|
|
delete(materials[str]);
|
|
for(std::string str : shaderNames)
|
|
delete(shaders[str]);
|
|
for(std::string str : entityNames)
|
|
delete(entities[str]);
|
|
}
|
|
|
|
void ResourceBase::addTexture(std::string textureName, Texture* myTexture)
|
|
{
|
|
textureNames.push_back(textureName);
|
|
textures[textureName] = myTexture;
|
|
}
|
|
|
|
void ResourceBase::addMesh(std::string meshName, Mesh* myMesh)
|
|
{
|
|
meshNames.push_back(meshName);
|
|
meshes[meshName] = myMesh;
|
|
}
|
|
|
|
void ResourceBase::addMaterial(std::string materialName, Material* myMaterial)
|
|
{
|
|
materialNames.push_back(materialName);
|
|
materials[materialName] = myMaterial;
|
|
}
|
|
|
|
void ResourceBase::addShader(std::string shaderName, Shader* myShader)
|
|
{
|
|
shaderNames.push_back(shaderName);
|
|
shaders[shaderName] = myShader;
|
|
}
|
|
|
|
void ResourceBase::addEntity(std::string entityName, Entity* myEntity)
|
|
{
|
|
entityNames.push_back(entityName);
|
|
entities[entityName] = myEntity;
|
|
}
|
|
|
|
|
|
Texture* ResourceBase::getTexture(std::string textureName)
|
|
{
|
|
return textures[textureName];
|
|
}
|
|
|
|
Mesh* ResourceBase::getMesh(std::string meshName)
|
|
{
|
|
return meshes[meshName];
|
|
}
|
|
|
|
Material* ResourceBase::getMaterial(std::string materialName)
|
|
{
|
|
return materials[materialName];
|
|
}
|
|
|
|
Shader* ResourceBase::getShader(std::string shaderName)
|
|
{
|
|
return shaders[shaderName];
|
|
}
|
|
|
|
Entity* ResourceBase::getEntity(std::string entityName)
|
|
{
|
|
return entities[entityName];
|
|
}
|
|
|
|
|