Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_data.c
| Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| BLI_assert(ob); | BLI_assert(ob); | ||||
| /* Index. */ | /* Index. */ | ||||
| ob_infos->ob_index = ob->index; | ob_infos->ob_index = ob->index; | ||||
| /* Orco factors. */ | /* Orco factors. */ | ||||
| drw_call_calc_orco(ob, ob_infos->orcotexfac); | drw_call_calc_orco(ob, ob_infos->orcotexfac); | ||||
| /* Random float value. */ | /* Random float value. */ | ||||
| uint random = (DST.dupli_source) ? | uint random = (DST.dupli_source) ? | ||||
| DST.dupli_source->random_id : | DST.dupli_source->random_id : | ||||
| /* TODO(fclem): this is rather costly to do at runtime. Maybe we can | /* TODO(fclem): this is rather costly to do at runtime. Maybe we can | ||||
| * put it in ob->runtime and make depsgraph ensure it is up to date. */ | * put it in ob->runtime and make depsgraph ensure it is up to date. */ | ||||
| BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0); | BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0); | ||||
| ob_infos->ob_random = random * (1.0f / (float)0xFFFFFFFF); | ob_infos->ob_random = random * (1.0f / (float)0xFFFFFFFF); | ||||
| /* Object State. */ | /* Object State. */ | ||||
| ob_infos->ob_flag = 1.0f; /* Required to have a correct sign */ | ob_infos->ob_flag = 1.0f; /* Required to have a correct sign */ | ||||
| ob_infos->ob_flag += (ob->base_flag & BASE_SELECTED) ? (1 << 1) : 0; | ob_infos->ob_flag += (ob->base_flag & BASE_SELECTED) ? (1 << 1) : 0; | ||||
| ob_infos->ob_flag += (ob->base_flag & BASE_FROM_DUPLI) ? (1 << 2) : 0; | ob_infos->ob_flag += (ob->base_flag & BASE_FROM_DUPLI) ? (1 << 2) : 0; | ||||
| ▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader) | ||||
| int view_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_VIEW); | int view_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_VIEW); | ||||
| int model_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_MODEL); | int model_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_MODEL); | ||||
| int info_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_INFO); | int info_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_INFO); | ||||
| int baseinst_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_BASE_INSTANCE); | int baseinst_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_BASE_INSTANCE); | ||||
| int chunkid_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_RESOURCE_CHUNK); | int chunkid_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_RESOURCE_CHUNK); | ||||
| int resourceid_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_RESOURCE_ID); | int resourceid_location = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_RESOURCE_ID); | ||||
| /* TODO(fclem) Will take the place of the above after the GPUShaderCreateInfo port. */ | |||||
| if (view_ubo_location == -1) { | |||||
| view_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_DRW_VIEW); | |||||
| } | |||||
| if (model_ubo_location == -1) { | |||||
| model_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_DRW_MODEL); | |||||
| } | |||||
| if (info_ubo_location == -1) { | |||||
| info_ubo_location = GPU_shader_get_builtin_block(shader, GPU_UNIFORM_BLOCK_DRW_INFOS); | |||||
| } | |||||
| if (chunkid_location != -1) { | if (chunkid_location != -1) { | ||||
| drw_shgroup_uniform_create_ex( | drw_shgroup_uniform_create_ex( | ||||
| shgroup, chunkid_location, DRW_UNIFORM_RESOURCE_CHUNK, NULL, 0, 0, 1); | shgroup, chunkid_location, DRW_UNIFORM_RESOURCE_CHUNK, NULL, 0, 0, 1); | ||||
| } | } | ||||
| if (resourceid_location != -1) { | if (resourceid_location != -1) { | ||||
| drw_shgroup_uniform_create_ex( | drw_shgroup_uniform_create_ex( | ||||
| shgroup, resourceid_location, DRW_UNIFORM_RESOURCE_ID, NULL, 0, 0, 1); | shgroup, resourceid_location, DRW_UNIFORM_RESOURCE_ID, NULL, 0, 0, 1); | ||||
| ▲ Show 20 Lines • Show All 869 Lines • Show Last 20 Lines | |||||