diff options
author | Ton Roosendaal <ton@blender.org> | 2013-01-22 15:18:41 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-01-22 15:18:41 +0400 |
commit | e11d22a6b751c750c40226cb027e7805adb7d4e4 (patch) | |
tree | c7a7afd211db440cbcbd154f76379e7685cb03fe /source/blender/makesdna | |
parent | 1e3a2931ac0cfc9af790717bf19577e22ebda4f5 (diff) |
Matcap support in 3D Viewport.
Full log is here:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability#Matcap_in_3D_viewport
Implementation notes:
- Matcaps are an extension of Solid draw mode, and don't show in other drawmodes.
(It's mostly intended to aid modeling/sculpt)
- By design, Matcaps are a UI feature, and only stored locally for the UI itself, and
won't affect rendering or materials.
- Currently a set of 16 (GPL licensed) Matcaps have been compiled into Blender.
It doesn't take memory or cpu time, until you use it.
- Brush Icons and Matcaps use same code now, and only get generated/allocated on
actually using it (instead of on startup).
- The current set might get new or different images still, based on user feedback.
- Matcap images are 512x512 pixels, so each image takes 1 Mb memory. Unused matcaps get
freed immediately. The Matcap icon previews (128x128 pixels) stay in memory.
- Loading own matcap image files will be added later. That needs design and code work
to get it stable and memory-friendly.
- The GLSL code uses the ID PreviewImage for matcaps. I tested it using the existing
Material previews, which has its limits... especially for textured previews the
normal-mapped matcap won't look good.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 19 |
2 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index cf3f6176ba7..91e98181ab9 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -43,7 +43,8 @@ struct Library; struct FileData; struct ID; struct PackedFile; - +struct GPUTexture; + typedef struct IDPropertyData { void *pointer; ListBase group; @@ -154,6 +155,7 @@ typedef struct PreviewImage { short changed[2]; short changed_timestamp[2]; unsigned int *rect[2]; + struct GPUTexture *gputexture[2]; } PreviewImage; /** diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index dbe54a4fcdf..d9d6db5ff91 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -46,6 +46,7 @@ struct RenderEngine; struct bGPdata; struct SmoothView3DStore; struct wmTimer; +struct Material; /* This is needed to not let VC choke on near and far... old * proprietary MS extensions... */ @@ -160,8 +161,8 @@ typedef struct View3D { float bundle_size; /* size of bundles in reconstructed data */ short bundle_drawtype; /* display style for bundle */ - - char pad[6]; + short pad; + int matcap_icon; /* icon id */ unsigned int lay_used; /* used while drawing */ @@ -209,11 +210,11 @@ typedef struct View3D { /* drawflags, denoting state */ short zbuf, transp, xray; - char pad3[2]; - void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */ - + void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */ + struct Material *defmaterial; /* used by matcap now */ + /* XXX deprecated? */ struct bGPdata *gpd DNA_DEPRECATED; /* Grease-Pencil Data (annotation layers) */ @@ -264,12 +265,14 @@ typedef struct View3D { #define V3D_SOLID_TEX 8 #define V3D_SHOW_GPENCIL 16 #define V3D_LOCK_CAMERA 32 -#define V3D_RENDER_SHADOW 64 /* This is a runtime only flag that's used to tell draw_mesh_object() that we're doing a shadow pass instead of a regular draw */ -#define V3D_SHOW_RECONSTRUCTION 128 +#define V3D_RENDER_SHADOW 64 /* This is a runtime only flag that's used to tell draw_mesh_object() that we're doing a shadow pass instead of a regular draw */ +#define V3D_SHOW_RECONSTRUCTION 128 #define V3D_SHOW_CAMERAPATH 256 #define V3D_SHOW_BUNDLENAME 512 #define V3D_BACKFACE_CULLING 1024 -#define V3D_RENDER_BORDER 2048 +#define V3D_RENDER_BORDER 2048 +#define V3D_SOLID_MATCAP 4096 /* user flag */ +#define V3D_SHOW_SOLID_MATCAP 8192 /* runtime flag */ /* View3D->around */ #define V3D_CENTER 0 |