Code cleanup and small refactoring

This commit is contained in:
enricoturri1966 2021-08-26 14:37:09 +02:00
parent 39ec1a6318
commit c471c3c7c4
2 changed files with 51 additions and 41 deletions

View file

@ -288,6 +288,7 @@ class GCodeViewer
#if ENABLE_SEAMS_USING_MODELS
struct Model
{
#if !ENABLE_SEAMS_USING_INSTANCED_MODELS
struct Instance
{
Vec3f position;
@ -296,12 +297,14 @@ class GCodeViewer
size_t s_id;
};
using Instances = std::vector<Instance>;
#endif // !ENABLE_SEAMS_USING_INSTANCED_MODELS
GLModel model;
Color color;
Instances instances;
#if ENABLE_SEAMS_USING_INSTANCED_MODELS
InstanceVBuffer instances2;
InstanceVBuffer instances;
#else
Instances instances;
#endif // ENABLE_SEAMS_USING_INSTANCED_MODELS
void reset();
@ -367,7 +370,11 @@ class GCodeViewer
case ERenderPrimitiveType::Triangle: {
return !vertices.vbos.empty() && vertices.vbos.front() != 0 && !indices.empty() && indices.front().ibo != 0;
}
#if ENABLE_SEAMS_USING_INSTANCED_MODELS
case ERenderPrimitiveType::Model: { return model.model.is_initialized() && !model.instances.buffer.empty(); }
#else
case ERenderPrimitiveType::Model: { return model.model.is_initialized() && !model.instances.empty(); }
#endif // ENABLE_SEAMS_USING_INSTANCED_MODELS
default: { return false; }
}
}