7#include <pxr/base/gf/vec2f.h>
8#include <pxr/imaging/hd/tokens.h>
27static const pxr::TfToken
st(
"st", pxr::TfToken::Immortal);
62 pxr::HdDirtyBits
bits = pxr::HdChangeTracker::Clean;
65 bits = pxr::HdChangeTracker::AllDirty;
69 bits |= pxr::HdChangeTracker::DirtyMaterialId | pxr::HdChangeTracker::DirtyDoubleSided;
73 bits |= pxr::HdChangeTracker::DirtyTransform;
76 if (
bits == pxr::HdChangeTracker::Clean) {
86 if (key == pxr::HdTokens->points) {
89 else if (key == pxr::HdTokens->widths) {
93 return pxr::VtValue(
uvs_);
95 return pxr::VtValue();
101 return pxr::SdfPath();
115 return pxr::HdBasisCurvesTopology(pxr::HdTokens->linear,
117 pxr::HdTokens->nonperiodic,
123 pxr::HdInterpolation interpolation)
const
125 pxr::HdPrimvarDescriptorVector primvars;
126 if (interpolation == pxr::HdInterpolationVertex) {
128 primvars.emplace_back(pxr::HdTokens->points, interpolation, pxr::HdPrimvarRoleTokens->
point);
131 primvars.emplace_back(pxr::HdTokens->widths, interpolation, pxr::HdPrimvarRoleTokens->none);
134 else if (interpolation == pxr::HdInterpolationUniform) {
136 primvars.emplace_back(
137 usdtokens::st, interpolation, pxr::HdPrimvarRoleTokens->textureCoordinate);
212 prim_id, pxr::HdChangeTracker::AllDirty);
225 if (cache ==
nullptr) {
233 uvs_.reserve(particle_system_->totpart);
236 float scale = particle_system_->part->rad_scale *
237 (std::abs(object->object_to_world().ptr()[0][0]) +
238 std::abs(object->object_to_world().ptr()[1][1]) +
239 std::abs(object->object_to_world().ptr()[2][2])) /
241 float root = scale * particle_system_->part->rad_root;
242 float tip = scale * particle_system_->part->rad_tip;
243 float shape = particle_system_->part->shape;
246 for (
int pa_index = 0; pa_index < particle_system_->totpart; ++pa_index) {
247 strand = cache[pa_index];
249 int point_count = strand->
segments + 1;
252 for (
int point_index = 0; point_index < point_count; ++point_index, ++strand) {
254 float x =
float(point_index) / (point_count - 1);
255 float radius =
pow(
x,
pow(10.0f, -shape));
256 widths_.push_back(root + (tip - root) * radius);
263 if (particle_system_->particles) {
264 ParticleData &pa = particle_system_->particles[pa_index];
268 float r_uv[2] = {0.0f, 0.0f};
272 const MFace *mface =
static_cast<const MFace *
>(
277 if (mface && mtface) {
282 uvs_.push_back(pxr::GfVec2f(r_uv[0], r_uv[1]));
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
General operations, lookup, etc. for materials.
int BKE_object_material_count_eval(const struct Object *ob)
struct Material * BKE_object_material_get_eval(struct Object *ob, short act)
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2])
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
constexpr void copy_from(Span< T > values) const
Span< NewT > constexpr cast() const
constexpr bool is_empty() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
OffsetIndices< int > points_by_curve() const
IndexRange curves_range() const
IndexRange points_range() const
Span< float3 > positions() const
AttributeAccessor attributes() const
Span< float2 > surface_uv_coords() const
virtual void write_curves()
void available_materials(Set< pxr::SdfPath > &paths) const override
pxr::VtIntArray curve_vertex_counts_
void write_materials() override
pxr::VtFloatArray widths_
pxr::VtValue get_data(pxr::TfToken const &key) const override
pxr::HdBasisCurvesTopology topology() const
pxr::VtVec3fArray vertices_
pxr::SdfPath material_id() const override
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const
CurvesData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id)
HairData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id, ParticleSystem *particle_system)
void write_curves() override
void write_transform() override
static bool is_supported(const ParticleSystem *particle_system)
static bool is_visible(HydraSceneDelegate *scene_delegate, Object *object, ParticleSystem *particle_system)
HydraSceneDelegate * scene_delegate_
pxr::GfMatrix4d transform
MaterialData * get_or_create_material(const Material *mat)
virtual void write_transform()
ObjectData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id)
pow(value.r - subtrahend, 2.0)") .do_static_compilation(true)
draw_view in_light_buf[] float
#define ID_LOG(level, msg,...)
#define ID_LOGN(level, msg,...)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
void copy_group_sizes(OffsetIndices< int > offsets, const IndexMask &mask, MutableSpan< int > sizes)
struct ParticleSystem * psys