mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Copy material schema buffers as new ref
This commit is contained in:
parent
864def31ea
commit
af55547766
1 changed files with 16 additions and 8 deletions
|
@ -18,26 +18,34 @@ using namespace gpu;
|
|||
Material::Material() :
|
||||
_key(0),
|
||||
_schemaBuffer(),
|
||||
_textureMaps() {
|
||||
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
_textureMaps()
|
||||
{
|
||||
// created from nothing: create the Buffer to store the properties
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
|
||||
|
||||
}
|
||||
|
||||
Material::Material(const Material& material) :
|
||||
_key(material._key),
|
||||
_schemaBuffer(material._schemaBuffer),
|
||||
_textureMaps(material._textureMaps) {
|
||||
_textureMaps(material._textureMaps)
|
||||
{
|
||||
// copied: create the Buffer to store the properties, avoid holding a ref to the old Buffer
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
_schemaBuffer.edit<Schema>() = material._schemaBuffer.get<Schema>();
|
||||
}
|
||||
|
||||
Material& Material::operator= (const Material& material) {
|
||||
_key = (material._key);
|
||||
_schemaBuffer = (material._schemaBuffer);
|
||||
_textureMaps = (material._textureMaps);
|
||||
|
||||
// copied: create the Buffer to store the properties, avoid holding a ref to the old Buffer
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
_schemaBuffer.edit<Schema>() = material._schemaBuffer.get<Schema>();
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue