Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-03-01 05:52:54 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-01 05:53:25 +0300
commit68015f9d397124b66fd8b435b729fbc0daa6e9ad (patch)
treee12a804bd733360d8581ddfe81af18b0a1b9b5b4 /source/blender/draw/intern/draw_manager.h
parentdee2efb968a498d65e3ffd62592f0ae7dbf8f2ae (diff)
DRW: Initial implementation of Frustum culling.
This is very efficient and add a pretty low overhead (0.1ms of drawing time for 10K objects passing through all tests, on my i3-4100M). The like the rest of the DRWCallState, test is "cached" until the view matrices changes.
Diffstat (limited to 'source/blender/draw/intern/draw_manager.h')
-rw-r--r--source/blender/draw/intern/draw_manager.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index cfc49320f3b..37646ec6dbb 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -76,6 +76,12 @@
#endif /* USE_PROFILE */
+/* TODO Put it somewhere else? */
+typedef struct BoundSphere {
+ float center[3], radius;
+} BoundSphere;
+
+
/* ------------ Data Structure --------------- */
/**
* Data structure containing all drawcalls organized by passes and materials.
@@ -107,9 +113,7 @@ typedef struct DRWCallState {
uint16_t matflag; /* Which matrices to compute. */
/* Culling: Using Bounding Sphere for now for faster culling.
* Not ideal for planes. */
- struct {
- float loc[3], rad; /* Bypassed if radius is < 0.0. */
- } bsphere;
+ BoundSphere bsphere;
/* Matrices */
float model[4][4];
float modelinverse[4][4];
@@ -305,6 +309,12 @@ typedef struct DRWManager {
float clip_planes_eq[MAX_CLIP_PLANES][4];
} view_data;
+ struct {
+ float frustum_planes[6][4];
+ BoundSphere frustum_bsphere;
+ bool updated;
+ } clipping;
+
#ifdef USE_GPU_SELECT
unsigned int select_id;
#endif