mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:56:52 +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() :
|
Material::Material() :
|
||||||
_key(0),
|
_key(0),
|
||||||
_schemaBuffer(),
|
_schemaBuffer(),
|
||||||
_textureMaps() {
|
_textureMaps()
|
||||||
|
{
|
||||||
// only if created from nothing shall we create the Buffer to store the properties
|
// created from nothing: create the Buffer to store the properties
|
||||||
Schema schema;
|
Schema schema;
|
||||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Material::Material(const Material& material) :
|
Material::Material(const Material& material) :
|
||||||
_key(material._key),
|
_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) {
|
Material& Material::operator= (const Material& material) {
|
||||||
_key = (material._key);
|
_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>();
|
||||||
|
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue