CodeCleanup: Added View3DShading enums
Added the core enums that workbench draw engine uses.
This commit is contained in:
@@ -844,7 +844,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedat
|
||||
Material *mat,
|
||||
Image *ima,
|
||||
ImageUser *iuser,
|
||||
int color_type,
|
||||
eV3DShadingColorType color_type,
|
||||
int interp)
|
||||
{
|
||||
WORKBENCH_StorageList *stl = vedata->stl;
|
||||
@@ -908,7 +908,8 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, part->omat, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, false);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, false);
|
||||
WORKBENCH_MaterialData *material = get_or_create_material_data(
|
||||
vedata, ob, mat, image, iuser, color_type, interp);
|
||||
|
||||
@@ -946,7 +947,8 @@ static void workbench_cache_populate_texture_paint_mode(WORKBENCH_Data *vedata,
|
||||
Image *image = imapaint->canvas;
|
||||
int interp = (imapaint->interp == IMAGEPAINT_INTERP_LINEAR) ? SHD_INTERP_LINEAR :
|
||||
SHD_INTERP_CLOSEST;
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
struct GPUBatch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
|
||||
material = get_or_create_material_data(vedata, ob, NULL, image, NULL, color_type, interp);
|
||||
|
||||
@@ -963,7 +965,8 @@ static void workbench_cache_populate_texture_paint_mode(WORKBENCH_Data *vedata,
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
material = get_or_create_material_data(vedata, ob, mat, image, iuser, color_type, interp);
|
||||
DRW_shgroup_call(material->shgrp, geom_array[i], ob);
|
||||
}
|
||||
@@ -981,7 +984,8 @@ static void workbench_cache_populate_vertex_paint_mode(WORKBENCH_Data *vedata, O
|
||||
!DRW_state_is_image_render();
|
||||
WORKBENCH_MaterialData *material;
|
||||
|
||||
int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, NULL, ob, use_sculpt_pbvh);
|
||||
struct GPUBatch *geom = DRW_cache_mesh_surface_vertpaint_get(ob);
|
||||
material = get_or_create_material_data(vedata, ob, NULL, NULL, NULL, color_type, false);
|
||||
DRW_shgroup_call(material->shgrp, geom, ob);
|
||||
@@ -1055,7 +1059,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
if (color_type == V3D_SHADING_MATERIAL_COLOR && mat && mat->a < 1.0) {
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
@@ -1075,7 +1079,8 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
||||
V3D_SHADING_OBJECT_COLOR,
|
||||
V3D_SHADING_RANDOM_COLOR,
|
||||
V3D_SHADING_VERTEX_COLOR)) {
|
||||
int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, NULL, ob, use_sculpt_pbvh);
|
||||
|
||||
if ((ob->color[3] < 1.0f) && (color_type == V3D_SHADING_OBJECT_COLOR)) {
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
|
@@ -134,12 +134,13 @@ static char *workbench_build_forward_composite_frag(void)
|
||||
return str;
|
||||
}
|
||||
|
||||
WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_Data *vedata,
|
||||
WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(
|
||||
WORKBENCH_Data *vedata,
|
||||
Object *ob,
|
||||
Material *mat,
|
||||
Image *ima,
|
||||
ImageUser *iuser,
|
||||
int color_type,
|
||||
eV3DShadingColorType color_type,
|
||||
int interp)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
@@ -487,7 +488,8 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, part->omat, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, false);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, false);
|
||||
WORKBENCH_MaterialData *material = workbench_forward_get_or_create_material_data(
|
||||
vedata, ob, mat, image, iuser, color_type, interp);
|
||||
|
||||
@@ -543,7 +545,8 @@ static void workbench_forward_cache_populate_texture_paint_mode(WORKBENCH_Data *
|
||||
Image *image = imapaint->canvas;
|
||||
int interp = (imapaint->interp == IMAGEPAINT_INTERP_LINEAR) ? SHD_INTERP_LINEAR :
|
||||
SHD_INTERP_CLOSEST;
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
struct GPUBatch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
vedata, ob, NULL, image, NULL, color_type, interp);
|
||||
@@ -562,7 +565,8 @@ static void workbench_forward_cache_populate_texture_paint_mode(WORKBENCH_Data *
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
vedata, ob, mat, image, iuser, color_type, interp);
|
||||
|
||||
@@ -582,7 +586,8 @@ static void workbench_forward_cache_populate_vertex_paint_mode(WORKBENCH_Data *v
|
||||
!DRW_state_is_image_render();
|
||||
WORKBENCH_MaterialData *material;
|
||||
|
||||
int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, NULL, ob, use_sculpt_pbvh);
|
||||
struct GPUBatch *geom = DRW_cache_mesh_surface_vertpaint_get(ob);
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
vedata, ob, NULL, NULL, NULL, color_type, false);
|
||||
@@ -653,7 +658,8 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
||||
ImageUser *iuser;
|
||||
int interp;
|
||||
workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
|
||||
int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, image, ob, use_sculpt_pbvh);
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
vedata, ob, mat, image, iuser, color_type, interp);
|
||||
DRW_shgroup_call(material->shgrp_object_outline, geom_array[i], ob);
|
||||
@@ -666,7 +672,8 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
||||
V3D_SHADING_RANDOM_COLOR,
|
||||
V3D_SHADING_VERTEX_COLOR)) {
|
||||
/* No material split needed */
|
||||
int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh);
|
||||
eV3DShadingColorType color_type = workbench_material_determine_color_type(
|
||||
wpd, NULL, ob, use_sculpt_pbvh);
|
||||
|
||||
if (use_sculpt_pbvh) {
|
||||
material = workbench_forward_get_or_create_material_data(
|
||||
|
@@ -292,12 +292,12 @@ int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd,
|
||||
return index;
|
||||
}
|
||||
|
||||
int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd,
|
||||
eV3DShadingColorType workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd,
|
||||
Image *ima,
|
||||
Object *ob,
|
||||
bool use_sculpt_pbvh)
|
||||
{
|
||||
int color_type = wpd->shading.color_type;
|
||||
eV3DShadingColorType color_type = wpd->shading.color_type;
|
||||
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
|
||||
|
||||
if ((color_type == V3D_SHADING_TEXTURE_COLOR) &&
|
||||
|
@@ -285,7 +285,7 @@ typedef struct WORKBENCH_EffectInfo {
|
||||
typedef struct WORKBENCH_MaterialData {
|
||||
float base_color[3], metallic;
|
||||
float roughness, alpha;
|
||||
int color_type;
|
||||
eV3DShadingColorType color_type;
|
||||
int interp;
|
||||
Image *ima;
|
||||
ImageUser *iuser;
|
||||
@@ -452,12 +452,13 @@ void workbench_forward_cache_finish(WORKBENCH_Data *vedata);
|
||||
/* For OIT in deferred */
|
||||
void workbench_forward_outline_shaders_ensure(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg);
|
||||
void workbench_forward_choose_shaders(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg);
|
||||
WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_Data *vedata,
|
||||
WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(
|
||||
WORKBENCH_Data *vedata,
|
||||
Object *ob,
|
||||
Material *mat,
|
||||
Image *ima,
|
||||
ImageUser *iuser,
|
||||
int color_type,
|
||||
eV3DShadingColorType color_type,
|
||||
int interp);
|
||||
|
||||
/* workbench_effect_aa.c */
|
||||
@@ -488,7 +489,7 @@ void workbench_dof_create_pass(WORKBENCH_Data *vedata,
|
||||
void workbench_dof_draw_pass(WORKBENCH_Data *vedata);
|
||||
|
||||
/* workbench_materials.c */
|
||||
int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd,
|
||||
eV3DShadingColorType workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd,
|
||||
Image *ima,
|
||||
Object *ob,
|
||||
bool use_sculpt_pbvh);
|
||||
|
59
source/blender/makesdna/DNA_view3d_enums.h
Normal file
59
source/blender/makesdna/DNA_view3d_enums.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup DNA
|
||||
*/
|
||||
|
||||
#ifndef __DNA_VIEW3D_ENUMS_H__
|
||||
#define __DNA_VIEW3D_ENUMS_H__
|
||||
|
||||
/** Settings for offscreen rendering */
|
||||
typedef enum eV3DOffscreenDrawFlag {
|
||||
V3D_OFSDRAW_NONE = (0),
|
||||
V3D_OFSDRAW_SHOW_ANNOTATION = (1 << 0),
|
||||
V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS = (1 << 1),
|
||||
} eV3DOffscreenDrawFlag;
|
||||
|
||||
/** #View3DShading.light */
|
||||
typedef enum eV3DShadingLightingMode {
|
||||
V3D_LIGHTING_FLAT = 0,
|
||||
V3D_LIGHTING_STUDIO = 1,
|
||||
V3D_LIGHTING_MATCAP = 2,
|
||||
} eV3DShadingLightingMode;
|
||||
|
||||
/** #View3DShading.color_type, #View3DShading.wire_color_type */
|
||||
typedef enum eV3DShadingColorType {
|
||||
V3D_SHADING_MATERIAL_COLOR = 0,
|
||||
V3D_SHADING_RANDOM_COLOR = 1,
|
||||
V3D_SHADING_SINGLE_COLOR = 2,
|
||||
V3D_SHADING_TEXTURE_COLOR = 3,
|
||||
V3D_SHADING_OBJECT_COLOR = 4,
|
||||
V3D_SHADING_VERTEX_COLOR = 5,
|
||||
|
||||
/* Is used to display the object using the error color. For example when in
|
||||
* solid texture paint mode without any textures configured */
|
||||
V3D_SHADING_ERROR_COLOR = 999,
|
||||
} eV3DShadingColorType;
|
||||
|
||||
/** #View3DShading.background_type */
|
||||
typedef enum eV3DShadingBackgroundType {
|
||||
V3D_SHADING_BACKGROUND_THEME = 0,
|
||||
V3D_SHADING_BACKGROUND_WORLD = 1,
|
||||
V3D_SHADING_BACKGROUND_VIEWPORT = 2,
|
||||
} eV3DShadingBackgroundType;
|
||||
|
||||
#endif
|
@@ -38,6 +38,7 @@ struct wmTimer;
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_view3d_enums.h"
|
||||
|
||||
typedef struct RegionView3D {
|
||||
|
||||
@@ -422,13 +423,6 @@ enum {
|
||||
#define V3D_GP_FADE_NOACTIVE_LAYERS (1 << 5) /* fade layers not active */
|
||||
#define V3D_GP_FADE_NOACTIVE_GPENCIL (1 << 6) /* Fade other GPencil objects */
|
||||
|
||||
/** #View3DShading.light */
|
||||
enum {
|
||||
V3D_LIGHTING_FLAT = 0,
|
||||
V3D_LIGHTING_STUDIO = 1,
|
||||
V3D_LIGHTING_MATCAP = 2,
|
||||
};
|
||||
|
||||
/** #View3DShading.flag */
|
||||
enum {
|
||||
V3D_SHADING_OBJECT_OUTLINE = (1 << 0),
|
||||
@@ -447,27 +441,6 @@ enum {
|
||||
V3D_SHADING_SCENE_WORLD_RENDER = (1 << 13),
|
||||
};
|
||||
|
||||
/** #View3DShading.color_type */
|
||||
enum {
|
||||
V3D_SHADING_MATERIAL_COLOR = 0,
|
||||
V3D_SHADING_RANDOM_COLOR = 1,
|
||||
V3D_SHADING_SINGLE_COLOR = 2,
|
||||
V3D_SHADING_TEXTURE_COLOR = 3,
|
||||
V3D_SHADING_OBJECT_COLOR = 4,
|
||||
V3D_SHADING_VERTEX_COLOR = 5,
|
||||
|
||||
/* Is used to display the object using the error color. For example when in
|
||||
* solid texture paint mode without any textures configured */
|
||||
V3D_SHADING_ERROR_COLOR = 999,
|
||||
};
|
||||
|
||||
/** #View3DShading.background_type */
|
||||
enum {
|
||||
V3D_SHADING_BACKGROUND_THEME = 0,
|
||||
V3D_SHADING_BACKGROUND_WORLD = 1,
|
||||
V3D_SHADING_BACKGROUND_VIEWPORT = 2,
|
||||
};
|
||||
|
||||
/** #View3DShading.cavity_type */
|
||||
enum {
|
||||
V3D_SHADING_CAVITY_SSAO = 0,
|
||||
@@ -607,13 +580,6 @@ enum {
|
||||
V3D_GIZMO_SHOW_CAMERA_DOF_DIST = (1 << 2),
|
||||
};
|
||||
|
||||
/** Settings for offscreen rendering */
|
||||
typedef enum eV3DOffscreenDrawFlag {
|
||||
V3D_OFSDRAW_NONE = (0),
|
||||
V3D_OFSDRAW_SHOW_ANNOTATION = (1 << 0),
|
||||
V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS = (1 << 1),
|
||||
} eV3DOffscreenDrawFlag;
|
||||
|
||||
#define RV3D_CAMZOOM_MIN -30
|
||||
#define RV3D_CAMZOOM_MAX 600
|
||||
|
||||
|
Reference in New Issue
Block a user