Blender V5.0
curves.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <pxr/base/vt/array.h>
8#include <pxr/imaging/hd/sceneDelegate.h>
9
10#include "BLI_set.hh"
11
12#include "DNA_particle_types.h"
13
14#include "material.hh"
15#include "object.hh"
16
17namespace blender::io::hydra {
18
19class CurvesData : public ObjectData {
20 protected:
21 pxr::VtIntArray curve_vertex_counts_;
22 pxr::VtVec3fArray vertices_;
23 pxr::VtVec2fArray uvs_;
24 pxr::VtFloatArray widths_;
25
27
28 public:
29 CurvesData(HydraSceneDelegate *scene_delegate,
30 const Object *object,
31 pxr::SdfPath const &prim_id);
32
33 void init() override;
34 void insert() override;
35 void remove() override;
36 void update() override;
37
38 pxr::VtValue get_data(pxr::TfToken const &key) const override;
39 pxr::SdfPath material_id() const override;
40 void available_materials(Set<pxr::SdfPath> &paths) const override;
41
42 pxr::HdBasisCurvesTopology topology() const;
43 pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
44
45 protected:
46 void write_materials() override;
47 virtual void write_curves();
48};
49
50class HairData : public CurvesData {
51 private:
52 ParticleSystem *particle_system_;
53
54 public:
55 HairData(HydraSceneDelegate *scene_delegate,
56 const Object *object,
57 pxr::SdfPath const &prim_id,
58 ParticleSystem *particle_system);
59
60 static bool is_supported(const ParticleSystem *particle_system);
61 static bool is_visible(HydraSceneDelegate *scene_delegate,
62 Object *object,
63 ParticleSystem *particle_system);
64
65 void update() override;
66
67 protected:
68 void write_transform() override;
69 void write_curves() override;
70};
71
72} // namespace blender::io::hydra
void available_materials(Set< pxr::SdfPath > &paths) const override
pxr::VtVec2fArray uvs_
Definition curves.hh:23
pxr::VtIntArray curve_vertex_counts_
Definition curves.hh:21
pxr::VtFloatArray widths_
Definition curves.hh:24
pxr::VtValue get_data(pxr::TfToken const &key) const override
pxr::HdBasisCurvesTopology topology() const
pxr::VtVec3fArray vertices_
Definition curves.hh:22
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)
static bool is_supported(const ParticleSystem *particle_system)
static bool is_visible(HydraSceneDelegate *scene_delegate, Object *object, ParticleSystem *particle_system)
pxr::SdfPath prim_id
Definition id.hh:36
ObjectData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id)