Levels of detail for brush stroke decreased to save on memory
This commit is contained in:
parent
241a0a9588
commit
f82e626686
6 changed files with 6 additions and 32 deletions
|
|
@ -101,23 +101,12 @@ void DrawBrushStroke::initialize_draw_data(DrawingProgram& drawP) {
|
|||
vertices_to_draw_data(vertices, vertexData);
|
||||
vertexData.clear();
|
||||
|
||||
create_triangles(triangleFunc, points, 2);
|
||||
create_triangles(triangleFunc, points, 4);
|
||||
vertices_to_draw_data(verticesMipMap[0], vertexData);
|
||||
vertexData.clear();
|
||||
|
||||
create_triangles(triangleFunc, points, 4);
|
||||
vertices_to_draw_data(verticesMipMap[1], vertexData);
|
||||
vertexData.clear();
|
||||
|
||||
create_triangles(triangleFunc, points, 6);
|
||||
vertices_to_draw_data(verticesMipMap[2], vertexData);
|
||||
vertexData.clear();
|
||||
|
||||
create_triangles(triangleFunc, points, 10);
|
||||
vertices_to_draw_data(verticesMipMap[3], vertexData);
|
||||
|
||||
create_triangles(triangleFunc, points, 30);
|
||||
vertices_to_draw_data(verticesMipMap[4], vertexData);
|
||||
vertices_to_draw_data(verticesMipMap[1], vertexData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class DrawBrushStroke : public DrawComponent {
|
|||
virtual SCollision::AABB<float> get_obj_coord_bounds() const override;
|
||||
|
||||
sk_sp<SkVertices> vertices;
|
||||
std::array<sk_sp<SkVertices>, 5> verticesMipMap;
|
||||
std::array<sk_sp<SkVertices>, 3> verticesMipMap;
|
||||
SCollision::BVHContainer<float> collisionTree;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -204,13 +204,7 @@ void DrawComponent::calculate_draw_transform(const DrawData& drawData) {
|
|||
if(drawSetupData.shouldDraw) {
|
||||
drawSetupData.shouldDraw = updateDraw || !worldAABB || SCollision::collide(*worldAABB, drawData.cam.viewingAreaGenerousCollider);
|
||||
if(drawSetupData.shouldDraw) {
|
||||
if(drawData.mipMapLevelFive > coords.inverseScale)
|
||||
drawSetupData.mipmapLevel = 5;
|
||||
if(drawData.mipMapLevelFour > coords.inverseScale)
|
||||
drawSetupData.mipmapLevel = 4;
|
||||
else if(drawData.mipMapLevelThree > coords.inverseScale)
|
||||
drawSetupData.mipmapLevel = 3;
|
||||
else if(drawData.mipMapLevelTwo > coords.inverseScale)
|
||||
if(drawData.mipMapLevelTwo > coords.inverseScale)
|
||||
drawSetupData.mipmapLevel = 2;
|
||||
else if(drawData.mipMapLevelOne > coords.inverseScale)
|
||||
drawSetupData.mipmapLevel = 1;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,8 @@
|
|||
|
||||
#define DRAWCOMP_MAX_SHIFT_BEFORE_DISAPPEAR 20
|
||||
#define DRAWCOMP_MIN_SHIFT_BEFORE_DISAPPEAR 11
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_ONE 1
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_TWO 2
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_THREE 3
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_FOUR 4
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_FIVE 5
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_ONE 2
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_TWO 5
|
||||
|
||||
class DrawingProgram;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,5 @@ void DrawData::refresh_draw_optimizing_values() {
|
|||
clampDrawMinimum = cam.c.inverseScale >> DRAWCOMP_MIN_SHIFT_BEFORE_DISAPPEAR;
|
||||
mipMapLevelOne = cam.c.inverseScale >> DRAWCOMP_MIPMAP_LEVEL_ONE;
|
||||
mipMapLevelTwo = cam.c.inverseScale >> DRAWCOMP_MIPMAP_LEVEL_TWO;
|
||||
mipMapLevelThree = cam.c.inverseScale >> DRAWCOMP_MIPMAP_LEVEL_THREE;
|
||||
mipMapLevelFour = cam.c.inverseScale >> DRAWCOMP_MIPMAP_LEVEL_FOUR;
|
||||
mipMapLevelFive = cam.c.inverseScale >> DRAWCOMP_MIPMAP_LEVEL_FOUR;
|
||||
clampDrawMaximum = cam.c.inverseScale << DRAWCOMP_MAX_SHIFT_BEFORE_DISAPPEAR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,5 @@ struct DrawData {
|
|||
WorldScalar clampDrawMaximum;
|
||||
WorldScalar mipMapLevelOne;
|
||||
WorldScalar mipMapLevelTwo;
|
||||
WorldScalar mipMapLevelThree;
|
||||
WorldScalar mipMapLevelFour;
|
||||
WorldScalar mipMapLevelFive;
|
||||
void refresh_draw_optimizing_values();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue