Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_draw.c
| Show First 20 Lines • Show All 1,457 Lines • ▼ Show 20 Lines | static struct GPUMaterialState { | ||||
| Material **gmatbuf; | Material **gmatbuf; | ||||
| Material *gmatbuf_fixed[FIXEDMAT]; | Material *gmatbuf_fixed[FIXEDMAT]; | ||||
| Material *gboundmat; | Material *gboundmat; | ||||
| Object *gob; | Object *gob; | ||||
| DupliObject *dob; | DupliObject *dob; | ||||
| Scene *gscene; | Scene *gscene; | ||||
| int glay; | int glay; | ||||
| bool gscenelock; | |||||
| float (*gviewmat)[4]; | float (*gviewmat)[4]; | ||||
| float (*gviewinv)[4]; | float (*gviewinv)[4]; | ||||
| float (*gviewcamtexcofac); | float (*gviewcamtexcofac); | ||||
| bool backface_culling; | bool backface_culling; | ||||
| bool two_sided_lighting; | bool two_sided_lighting; | ||||
| GPUBlendMode *alphablend; | GPUBlendMode *alphablend; | ||||
| ▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | #endif | ||||
| if (ob && ob->type == OB_MESH) | if (ob && ob->type == OB_MESH) | ||||
| GMS.two_sided_lighting = (((Mesh *)ob->data)->flag & ME_TWOSIDED) != 0; | GMS.two_sided_lighting = (((Mesh *)ob->data)->flag & ME_TWOSIDED) != 0; | ||||
| GMS.gob = ob; | GMS.gob = ob; | ||||
| GMS.gscene = scene; | GMS.gscene = scene; | ||||
| GMS.is_opensubdiv = use_opensubdiv; | GMS.is_opensubdiv = use_opensubdiv; | ||||
| GMS.totmat = use_matcap ? 1 : ob->totcol + 1; /* materials start from 1, default material is 0 */ | GMS.totmat = use_matcap ? 1 : ob->totcol + 1; /* materials start from 1, default material is 0 */ | ||||
| GMS.glay = (v3d->localvd) ? v3d->localvd->lay : v3d->lay; /* keep lamps visible in local view */ | GMS.glay = (v3d->localvd) ? v3d->localvd->lay : v3d->lay; /* keep lamps visible in local view */ | ||||
| GMS.gscenelock = (v3d->scenelock != 0); | |||||
| GMS.gviewmat = rv3d->viewmat; | GMS.gviewmat = rv3d->viewmat; | ||||
| GMS.gviewinv = rv3d->viewinv; | GMS.gviewinv = rv3d->viewinv; | ||||
| GMS.gviewcamtexcofac = rv3d->viewcamtexcofac; | GMS.gviewcamtexcofac = rv3d->viewcamtexcofac; | ||||
| /* alpha pass setup. there's various cases to handle here: | /* alpha pass setup. there's various cases to handle here: | ||||
| * - object transparency on: only solid materials draw in the first pass, | * - object transparency on: only solid materials draw in the first pass, | ||||
| * and only transparent in the second 'alpha' pass. | * and only transparent in the second 'alpha' pass. | ||||
| * - object transparency off: for glsl we draw both in a single pass, and | * - object transparency off: for glsl we draw both in a single pass, and | ||||
| ▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | if (gattribs && GMS.gmatbuf[nr]) { | ||||
| } | } | ||||
| if ((GPU_get_material_builtins(gpumat) & GPU_OBJECT_INFO) != 0) { | if ((GPU_get_material_builtins(gpumat) & GPU_OBJECT_INFO) != 0) { | ||||
| GPU_get_object_info(object_info, mat); | GPU_get_object_info(object_info, mat); | ||||
| } | } | ||||
| GPU_material_bind( | GPU_material_bind( | ||||
| gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT), | gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT), | ||||
| GMS.gviewmat, GMS.gviewinv, GMS.gviewcamtexcofac, GMS.gscenelock); | GMS.gviewmat, GMS.gviewinv, GMS.gviewcamtexcofac); | ||||
| auto_bump_scale = GMS.gob->derivedFinal != NULL ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f; | auto_bump_scale = GMS.gob->derivedFinal != NULL ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f; | ||||
| GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info, object_info); | GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info, object_info); | ||||
| GMS.gboundmat = mat; | GMS.gboundmat = mat; | ||||
| /* for glsl use alpha blend mode, unless it's set to solid and | /* for glsl use alpha blend mode, unless it's set to solid and | ||||
| * we are already drawing in an alpha pass */ | * we are already drawing in an alpha pass */ | ||||
| if (mat->game.alpha_blend != GPU_BLEND_SOLID) | if (mat->game.alpha_blend != GPU_BLEND_SOLID) | ||||
| ▲ Show 20 Lines • Show All 663 Lines • Show Last 20 Lines | |||||