Blender V5.3
eevee_geom_volume.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "draw_model.bsl.hh"
8#include "draw_view.bsl.hh"
12#include "eevee_uniform.bsl.hh"
13
14namespace eevee {
15
18};
19
21 [[resource_table]] const Uniform & /*uni*/,
22 [[instance_index]] const int inst_index,
23 [[resource_table]] const draw::View &views,
24 [[resource_table]] const draw::Model &models,
25 [[resource_table]] const draw::Infos &infos,
26 [[resource_table]] const draw::Resource &res_id,
28 [[in]] const GeomVolumeIn &vert_in,
29 [[position]] float4 &out_position)
30{
31 const draw::ID id = res_id.get(inst_index);
32 const uint view_id = 0;
33 const uint resource_id = id.resource_id<1>();
34
35 const ViewMatrices view = views.get(view_id);
36 const ObjectMatrices obj = models.get(resource_id);
37
38 init_interface(interp, id.raw_id);
39
40 /* TODO(fclem): Find a better way? This is reverting what draw_resource_finalize does. */
41 ObjectInfos info = infos.get(resource_id);
42 float3 size = safe_rcp(info.orco_mul * 2.0f); /* Box half-extent. */
43 float3 loc = size + (info.orco_add / -info.orco_mul); /* Box center. */
44
45 /* Use bounding box geometry for now. */
46 float3 lP = loc + vert_in.pos * size;
47 interp.P = obj.point_object_to_world(lP);
48
50}
51
52} // namespace eevee
#define instance_index
#define position
#define resource_table
#define attribute(slot)
#define clip_control
#define vertex
float safe_rcp(float a)
ccl_device_inline float interp(const float a, const float b, const float t)
Definition math_base.h:549
void init_interface(VertOutCommon &interp, uint resource_id_raw)
void geom_volume(const PipelineConstants &, const Uniform &, const int inst_index, const draw::View &views, const draw::Model &models, const draw::Infos &infos, const draw::Resource &res_id, VertOutCommon &interp, const GeomVolumeIn &vert_in, float4 &out_position)
float4 transform(float4 hs_position)
packed_float3 orco_add
packed_float3 orco_mul
float3 point_object_to_world(float3 lP) const
float4 point_world_to_homogenous(float3 P) const