mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 23:17:56 +01:00
ecfb99db1a
# Conflicts: # model/AnimModel.h
485 lines
18 KiB
C++
485 lines
18 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "model/eu07m/eu07m_build.h"
|
|
|
|
#include <glm/gtc/quaternion.hpp>
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <cstring>
|
|
#include <limits>
|
|
#include <numbers>
|
|
#include <unordered_map>
|
|
|
|
namespace eu07m {
|
|
|
|
namespace {
|
|
|
|
constexpr float snorm16_scale{32767.f};
|
|
constexpr float minimum_length{1e-12f};
|
|
|
|
glm::vec3 perpendicular(glm::vec3 const &Normal) {
|
|
// the axis least along the normal gives the steadiest cross product
|
|
auto const absolute{glm::abs(Normal)};
|
|
glm::vec3 axis{1.f, 0.f, 0.f};
|
|
if (absolute.y < absolute.x && absolute.y <= absolute.z)
|
|
axis = {0.f, 1.f, 0.f};
|
|
else if (absolute.z < absolute.x && absolute.z < absolute.y)
|
|
axis = {0.f, 0.f, 1.f};
|
|
return glm::normalize(glm::cross(axis, Normal));
|
|
}
|
|
|
|
std::int16_t pack_snorm16(float const Value) {
|
|
return static_cast<std::int16_t>(std::lround(std::clamp(Value, -1.f, 1.f) * snorm16_scale));
|
|
}
|
|
|
|
glm::mat4 compose(node_record const &Node) {
|
|
glm::quat const rotation{Node.rotation[3], Node.rotation[0], Node.rotation[1], Node.rotation[2]};
|
|
auto transform{glm::mat4_cast(glm::normalize(rotation))};
|
|
transform[0] *= Node.scale[0];
|
|
transform[1] *= Node.scale[1];
|
|
transform[2] *= Node.scale[2];
|
|
transform[3] = glm::vec4{Node.translation[0], Node.translation[1], Node.translation[2], 1.f};
|
|
return transform;
|
|
}
|
|
|
|
std::unordered_map<std::uint32_t, std::size_t> matrix_lookup(model const &Model) {
|
|
std::unordered_map<std::uint32_t, std::size_t> lookup;
|
|
for (std::size_t idx = 0; idx < Model.transforms.size(); ++idx)
|
|
lookup.try_emplace(Model.transforms[idx].node, idx);
|
|
return lookup;
|
|
}
|
|
|
|
glm::mat4 node_transform(model const &Model, std::uint32_t const Node, std::unordered_map<std::uint32_t, std::size_t> const &Matrices) {
|
|
auto const &node{Model.nodes[Node]};
|
|
if ((node.flags & node_flags::matrix) != 0) {
|
|
if (auto const lookup{Matrices.find(Node)}; lookup != Matrices.end())
|
|
return glm::make_mat4(Model.transforms[lookup->second].matrix.data());
|
|
}
|
|
return compose(node);
|
|
}
|
|
|
|
std::string lowercase(std::string_view const Text) {
|
|
std::string result{Text};
|
|
for (auto &character : result) {
|
|
if (character >= 'A' && character <= 'Z')
|
|
character = static_cast<char>(character - 'A' + 'a');
|
|
}
|
|
return result;
|
|
}
|
|
|
|
struct box {
|
|
glm::vec3 min{std::numeric_limits<float>::max()};
|
|
glm::vec3 max{std::numeric_limits<float>::lowest()};
|
|
bool empty() const {
|
|
return min.x > max.x;
|
|
}
|
|
void add(glm::vec3 const &Point) {
|
|
min = glm::min(min, Point);
|
|
max = glm::max(max, Point);
|
|
}
|
|
glm::vec3 centre() const {
|
|
return empty() ? glm::vec3{0.f} : (min + max) * 0.5f;
|
|
}
|
|
};
|
|
|
|
glm::vec3 to_vec3(position const &Position) {
|
|
return {Position[0], Position[1], Position[2]};
|
|
}
|
|
|
|
// the sphere around the centre of the box of the vertices, reaching the farthest of them
|
|
std::array<float, 4> sphere_of(model const &Model, std::size_t const First, std::size_t const Count, box &Box) {
|
|
for (auto idx = First; idx < First + Count; ++idx)
|
|
Box.add(to_vec3(Model.positions[idx]));
|
|
auto const centre{Box.centre()};
|
|
float radius{0.f};
|
|
for (auto idx = First; idx < First + Count; ++idx)
|
|
radius = std::max(radius, glm::length(to_vec3(Model.positions[idx]) - centre));
|
|
return {centre.x, centre.y, centre.z, radius};
|
|
}
|
|
|
|
bounds_record to_bounds(box const &Box, float const Radius) {
|
|
bounds_record bounds;
|
|
if (Box.empty())
|
|
return bounds;
|
|
auto const centre{Box.centre()};
|
|
bounds.min = {Box.min.x, Box.min.y, Box.min.z};
|
|
bounds.max = {Box.max.x, Box.max.y, Box.max.z};
|
|
bounds.sphere = {centre.x, centre.y, centre.z, Radius};
|
|
return bounds;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
std::array<std::int16_t, 4> encode_qtangent(tangent_frame const &Frame) {
|
|
auto const normal{glm::dot(Frame.normal, Frame.normal) > minimum_length ? glm::normalize(Frame.normal) : glm::vec3{0.f, 0.f, 1.f}};
|
|
auto tangent{Frame.tangent - normal * glm::dot(normal, Frame.tangent)};
|
|
tangent = glm::dot(tangent, tangent) > minimum_length ? glm::normalize(tangent) : perpendicular(normal);
|
|
auto const bitangent{glm::cross(normal, tangent)};
|
|
auto rotation{glm::normalize(glm::quat_cast(glm::mat3{tangent, bitangent, normal}))};
|
|
if (rotation.w < 0.f)
|
|
rotation = -rotation;
|
|
// w keeps its sign through the packing, the sign of the bitangent rides on it
|
|
constexpr float bias{1.f / snorm16_scale};
|
|
if (rotation.w < bias) {
|
|
auto const scale{std::sqrt(1.f - bias * bias) / std::max(glm::length(glm::vec3{rotation.x, rotation.y, rotation.z}), minimum_length)};
|
|
rotation = glm::quat{bias, rotation.x * scale, rotation.y * scale, rotation.z * scale};
|
|
}
|
|
if (Frame.handedness < 0.f)
|
|
rotation = -rotation;
|
|
return {pack_snorm16(rotation.x), pack_snorm16(rotation.y), pack_snorm16(rotation.z), pack_snorm16(rotation.w)};
|
|
}
|
|
|
|
packed_rotation encode_rotation(std::array<float, 4> const &Quaternion) {
|
|
auto quaternion{Quaternion};
|
|
auto const length{std::sqrt(quaternion[0] * quaternion[0] + quaternion[1] * quaternion[1] + quaternion[2] * quaternion[2] + quaternion[3] * quaternion[3])};
|
|
if (false == std::isfinite(length) || length <= 0.f)
|
|
return {};
|
|
std::size_t largest{0};
|
|
for (std::size_t idx = 0; idx < 4; ++idx) {
|
|
quaternion[idx] /= length;
|
|
if (std::abs(quaternion[idx]) > std::abs(quaternion[largest]))
|
|
largest = idx;
|
|
}
|
|
auto const sign{quaternion[largest] < 0.f ? -1.f : 1.f};
|
|
packed_rotation packed;
|
|
packed.largest = static_cast<std::uint16_t>(largest);
|
|
std::size_t slot{0};
|
|
for (std::size_t idx = 0; idx < 4; ++idx) {
|
|
if (idx == largest)
|
|
continue;
|
|
// the other components lie within +-1/sqrt(2)
|
|
auto const scaled{std::clamp(sign * quaternion[idx] * std::numbers::sqrt2_v<float>, -1.f, 1.f)};
|
|
packed.components[slot] = static_cast<std::int16_t>(std::lround(scaled * 32767.f));
|
|
++slot;
|
|
}
|
|
return packed;
|
|
}
|
|
|
|
std::array<float, 4> decode_rotation(packed_rotation const &Packed) {
|
|
std::array<float, 4> quaternion{0.f, 0.f, 0.f, 1.f};
|
|
auto const largest{static_cast<std::size_t>(std::min<std::uint16_t>(Packed.largest, 3))};
|
|
auto sum{0.f};
|
|
std::size_t slot{0};
|
|
for (std::size_t idx = 0; idx < 4; ++idx) {
|
|
if (idx == largest)
|
|
continue;
|
|
quaternion[idx] = static_cast<float>(Packed.components[slot]) / 32767.f / std::numbers::sqrt2_v<float>;
|
|
++slot;
|
|
sum += quaternion[idx] * quaternion[idx];
|
|
}
|
|
quaternion[largest] = std::sqrt(std::max(0.f, 1.f - sum));
|
|
return quaternion;
|
|
}
|
|
|
|
tangent_frame decode_qtangent(std::array<std::int16_t, 4> const &Packed) {
|
|
// the first and the third column of the rotation matrix of the quaternion, which 2 / |q|^2 makes unit without a square root:
|
|
// what glm::mat3_cast(glm::normalize(q)) gives, for the two columns needed, at a part of the cost (this runs for every vertex)
|
|
auto const x{Packed[0] / snorm16_scale};
|
|
auto const y{Packed[1] / snorm16_scale};
|
|
auto const z{Packed[2] / snorm16_scale};
|
|
auto const w{Packed[3] / snorm16_scale};
|
|
tangent_frame frame;
|
|
frame.handedness = w < 0.f ? -1.f : 1.f;
|
|
auto const norm{x * x + y * y + z * z + w * w};
|
|
if (norm < 1e-12f)
|
|
return frame;
|
|
auto const s{2.f / norm};
|
|
frame.tangent = {1.f - s * (y * y + z * z), s * (x * y + w * z), s * (x * z - w * y)};
|
|
frame.normal = {s * (x * z + w * y), s * (y * z - w * x), 1.f - s * (x * x + y * y)};
|
|
return frame;
|
|
}
|
|
|
|
glm::mat4 local_transform(model const &Model, std::uint32_t const Node) {
|
|
return node_transform(Model, Node, matrix_lookup(Model));
|
|
}
|
|
|
|
std::vector<glm::mat4> local_transforms(model const &Model) {
|
|
auto const matrices{matrix_lookup(Model)};
|
|
std::vector<glm::mat4> transforms(Model.nodes.size());
|
|
for (std::uint32_t idx = 0; idx < Model.nodes.size(); ++idx)
|
|
transforms[idx] = node_transform(Model, idx, matrices);
|
|
return transforms;
|
|
}
|
|
|
|
std::vector<glm::mat4> model_transforms(model const &Model) {
|
|
auto const matrices{matrix_lookup(Model)};
|
|
std::vector<glm::mat4> transforms(Model.nodes.size());
|
|
for (std::uint32_t idx = 0; idx < Model.nodes.size(); ++idx) {
|
|
auto const local{node_transform(Model, idx, matrices)};
|
|
auto const parent{Model.nodes[idx].parent};
|
|
transforms[idx] = (parent >= 0 && parent < static_cast<std::int64_t>(idx)) ? transforms[parent] * local : local;
|
|
}
|
|
return transforms;
|
|
}
|
|
|
|
bool set_transform(node_record &Node, glm::mat4 const &Matrix, float const Tolerance) {
|
|
glm::vec3 scale{glm::length(glm::vec3{Matrix[0]}), glm::length(glm::vec3{Matrix[1]}), glm::length(glm::vec3{Matrix[2]})};
|
|
glm::mat3 rotation{1.f};
|
|
if (scale.x > minimum_length && scale.y > minimum_length && scale.z > minimum_length) {
|
|
rotation = glm::mat3{glm::vec3{Matrix[0]} / scale.x, glm::vec3{Matrix[1]} / scale.y, glm::vec3{Matrix[2]} / scale.z};
|
|
// a mirror goes into the scale, the rotation stays proper
|
|
if (glm::determinant(rotation) < 0.f) {
|
|
scale.x = -scale.x;
|
|
rotation[0] = -rotation[0];
|
|
}
|
|
}
|
|
auto const quaternion{glm::normalize(glm::quat_cast(rotation))};
|
|
Node.translation = {Matrix[3].x, Matrix[3].y, Matrix[3].z};
|
|
Node.rotation = {quaternion.x, quaternion.y, quaternion.z, quaternion.w};
|
|
Node.scale = {scale.x, scale.y, scale.z};
|
|
auto const composed{compose(Node)};
|
|
for (int column = 0; column < 4; ++column) {
|
|
for (int row = 0; row < 4; ++row) {
|
|
auto const original{Matrix[column][row]};
|
|
if (std::abs(composed[column][row] - original) > Tolerance * std::max(1.f, std::abs(original)))
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void build_name_index(model &Model) {
|
|
Model.name_index.clear();
|
|
for (std::uint32_t idx = 0; idx < Model.nodes.size(); ++idx) {
|
|
if (auto const name{Model.nodes[idx].name}; name != no_index && name < Model.strings.size())
|
|
Model.name_index.push_back({hash_name(Model.strings[name]), idx, 0});
|
|
}
|
|
std::ranges::sort(Model.name_index, [](name_index_record const &Left, name_index_record const &Right) { return Left.hash != Right.hash ? Left.hash < Right.hash : Left.node < Right.node; });
|
|
}
|
|
|
|
std::vector<std::uint32_t> find_nodes(model const &Model, std::string_view const Name) {
|
|
auto const key{lowercase(Name)};
|
|
std::vector<std::uint32_t> found;
|
|
auto const matches{[&Model, &key](std::uint32_t const Node) { return lowercase(Model.string(Model.nodes[Node].name)) == key; }};
|
|
if (Model.name_index.empty()) {
|
|
for (std::uint32_t idx = 0; idx < Model.nodes.size(); ++idx) {
|
|
if (Model.nodes[idx].name != no_index && matches(idx))
|
|
found.push_back(idx);
|
|
}
|
|
return found;
|
|
}
|
|
auto const hash{hash_name(Name)};
|
|
auto const range{std::ranges::equal_range(Model.name_index, hash, {}, &name_index_record::hash)};
|
|
for (auto const &entry : range) {
|
|
if (matches(entry.node))
|
|
found.push_back(entry.node);
|
|
}
|
|
return found;
|
|
}
|
|
|
|
void compute_bounds(model &Model) {
|
|
std::vector<box> boxes(Model.nodes.size());
|
|
std::vector<float> radii(Model.nodes.size(), 0.f);
|
|
for (auto &primitive : Model.primitives) {
|
|
if (primitive.node >= Model.nodes.size() || primitive.vertex_count == 0)
|
|
continue;
|
|
box own;
|
|
primitive.sphere = sphere_of(Model, primitive.base_vertex, primitive.vertex_count, own);
|
|
auto &nodebox{boxes[primitive.node]};
|
|
nodebox.add(own.min);
|
|
nodebox.add(own.max);
|
|
}
|
|
// the radius of the node around the centre of its box, from all its vertices
|
|
for (auto const &primitive : Model.primitives) {
|
|
if (primitive.node >= Model.nodes.size() || primitive.vertex_count == 0)
|
|
continue;
|
|
auto const centre{boxes[primitive.node].centre()};
|
|
auto &radius{radii[primitive.node]};
|
|
for (auto idx = std::size_t{primitive.base_vertex}; idx < std::size_t{primitive.base_vertex} + primitive.vertex_count; ++idx)
|
|
radius = std::max(radius, glm::length(to_vec3(Model.positions[idx]) - centre));
|
|
}
|
|
Model.bounds.clear();
|
|
Model.bounds.reserve(Model.nodes.size() + 1);
|
|
auto const transforms{model_transforms(Model)};
|
|
box whole;
|
|
for (std::size_t idx = 0; idx < Model.nodes.size(); ++idx) {
|
|
Model.bounds.push_back(to_bounds(boxes[idx], radii[idx]));
|
|
if (boxes[idx].empty())
|
|
continue;
|
|
for (int corner = 0; corner < 8; ++corner) {
|
|
glm::vec3 const point{(corner & 1) ? boxes[idx].max.x : boxes[idx].min.x, (corner & 2) ? boxes[idx].max.y : boxes[idx].min.y, (corner & 4) ? boxes[idx].max.z : boxes[idx].min.z};
|
|
whole.add(glm::vec3{transforms[idx] * glm::vec4{point, 1.f}});
|
|
}
|
|
}
|
|
Model.bounds.push_back(to_bounds(whole, whole.empty() ? 0.f : glm::length(whole.max - whole.centre())));
|
|
}
|
|
|
|
namespace {
|
|
|
|
// a node of the model after one put in at At moves one place on
|
|
void shift_node(std::uint32_t &Node, std::uint32_t const At) {
|
|
if (Node != no_index && Node >= At)
|
|
++Node;
|
|
}
|
|
|
|
template <typename Type_> bool read_at(std::span<std::byte const> const Data, std::size_t const Offset, Type_ &Value) {
|
|
if (Offset + sizeof(Type_) > Data.size())
|
|
return false;
|
|
std::memcpy(&Value, Data.data() + Offset, sizeof(Type_));
|
|
return true;
|
|
}
|
|
|
|
template <typename Type_> void write_at(std::span<std::byte> const Data, std::size_t const Offset, Type_ const &Value) {
|
|
std::memcpy(Data.data() + Offset, &Value, sizeof(Type_));
|
|
}
|
|
|
|
// Count node indices from Offset of the data
|
|
void shift_node_list(std::span<std::byte> const Data, std::size_t const Offset, std::size_t const Count, std::uint32_t const At) {
|
|
for (std::size_t idx = 0; idx < Count; ++idx) {
|
|
auto const offset{Offset + idx * sizeof(std::uint32_t)};
|
|
std::uint32_t node{0};
|
|
if (false == read_at(Data, offset, node))
|
|
return;
|
|
shift_node(node, At);
|
|
write_at(Data, offset, node);
|
|
}
|
|
}
|
|
|
|
void shift_properties(std::span<std::byte> const Data, std::uint32_t const At) {
|
|
std::uint32_t count{0};
|
|
if (false == read_at(Data, 0, count))
|
|
return;
|
|
for (std::uint32_t idx = 0; idx < count; ++idx) {
|
|
auto const offset{sizeof(std::uint32_t) + idx * sizeof(payload::property)};
|
|
payload::property property;
|
|
if (false == read_at(Data, offset, property))
|
|
return;
|
|
if (property.type != payload::value_type::node)
|
|
continue;
|
|
shift_node(property.value[0], At);
|
|
write_at(Data, offset, property);
|
|
}
|
|
}
|
|
|
|
void shift_spring(std::span<std::byte> const Data, std::uint32_t const At) {
|
|
payload::spring spring;
|
|
if (false == read_at(Data, 0, spring))
|
|
return;
|
|
shift_node(spring.anchor_a, At);
|
|
shift_node(spring.anchor_b, At);
|
|
write_at(Data, 0, spring);
|
|
}
|
|
|
|
void shift_chain(std::span<std::byte> const Data, std::uint32_t const At) {
|
|
if (payload::chain chain; read_at(Data, 0, chain))
|
|
shift_node_list(Data, sizeof(chain), chain.joint_count, At);
|
|
}
|
|
|
|
void shift_variants(std::span<std::byte> const Data, std::uint32_t const At) {
|
|
payload::variants variants;
|
|
if (false == read_at(Data, 0, variants))
|
|
return;
|
|
std::size_t listsize{0};
|
|
for (std::uint32_t idx = 0; idx < variants.state_count; ++idx) {
|
|
if (payload::variant_state state; read_at(Data, sizeof(variants) + idx * sizeof(state), state))
|
|
listsize = std::max<std::size_t>(listsize, std::size_t{state.node_first} + state.node_count);
|
|
}
|
|
shift_node_list(Data, sizeof(variants) + variants.state_count * sizeof(payload::variant_state), listsize, At);
|
|
}
|
|
|
|
void shift_light_slot(std::span<std::byte> const Data, std::uint32_t const At) {
|
|
if (payload::light_slot slot; read_at(Data, 0, slot))
|
|
shift_node_list(Data, sizeof(slot), std::size_t{slot.on_count} + slot.off_count, At);
|
|
}
|
|
|
|
// the nodes in the data of the component
|
|
void shift_payload(model &Model, component_record const &Record, std::uint32_t const At) {
|
|
if (std::size_t{Record.data_offset} + Record.data_size > Model.component_data.size())
|
|
return;
|
|
std::span<std::byte> const data{Model.component_data.data() + Record.data_offset, Record.data_size};
|
|
switch (Record.type) {
|
|
case component::properties: shift_properties(data, At); break;
|
|
case component::spring: shift_spring(data, At); break;
|
|
case component::chain: shift_chain(data, At); break;
|
|
case component::variants: shift_variants(data, At); break;
|
|
case component::light_slot: shift_light_slot(data, At); break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
// the subtrees which end at At and hold Parent take the new node in; the others after it move on
|
|
void shift_subtrees(model &Model, std::int32_t const Parent, std::uint32_t const At) {
|
|
std::vector<bool> holding(Model.nodes.size(), false);
|
|
for (auto node{Parent}; node >= 0 && node < static_cast<std::int32_t>(Model.nodes.size()); node = Model.nodes[node].parent)
|
|
holding[node] = true;
|
|
for (std::uint32_t idx = 0; idx < Model.nodes.size(); ++idx) {
|
|
auto &node{Model.nodes[idx]};
|
|
if (holding[idx] || node.subtree_end > At)
|
|
++node.subtree_end;
|
|
if (node.parent >= static_cast<std::int32_t>(At))
|
|
++node.parent;
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
std::uint32_t insert_node(model &Model, std::int32_t const Parent, node_record Node) {
|
|
auto const valid_parent{Parent >= 0 && Parent < static_cast<std::int32_t>(Model.nodes.size())};
|
|
auto const at{valid_parent ? Model.nodes[Parent].subtree_end : static_cast<std::uint32_t>(Model.nodes.size())};
|
|
shift_subtrees(Model, valid_parent ? Parent : -1, at);
|
|
for (auto &transform : Model.transforms)
|
|
shift_node(transform.node, at);
|
|
for (auto &primitive : Model.primitives)
|
|
shift_node(primitive.node, at);
|
|
for (auto &skin : Model.skins) {
|
|
if (skin.root >= static_cast<std::int32_t>(at))
|
|
++skin.root;
|
|
}
|
|
for (auto &joint : Model.skin_joints)
|
|
shift_node(joint.node, at);
|
|
for (auto &track : Model.clip_tracks)
|
|
shift_node(track.node, at);
|
|
for (auto &record : Model.components) {
|
|
if (record.kind == target_kind::node)
|
|
shift_node(record.target, at);
|
|
shift_payload(Model, record, at);
|
|
}
|
|
Node.parent = valid_parent ? Parent : -1;
|
|
Node.subtree_end = at + 1;
|
|
Model.nodes.insert(Model.nodes.begin() + at, Node);
|
|
if (false == Model.name_index.empty())
|
|
build_name_index(Model);
|
|
if (false == Model.bounds.empty())
|
|
compute_bounds(Model);
|
|
return at;
|
|
}
|
|
|
|
std::uint32_t add_component(model &Model, std::uint32_t const Type, target_kind const Kind, std::uint32_t const Target, std::span<std::byte const> const Data) {
|
|
// the data of each component starts at a multiple of 4
|
|
Model.component_data.resize((Model.component_data.size() + 3) & ~std::size_t{3});
|
|
component_record record;
|
|
record.type = Type;
|
|
record.kind = Kind;
|
|
record.target = Target;
|
|
record.data_offset = static_cast<std::uint32_t>(Model.component_data.size());
|
|
record.data_size = static_cast<std::uint32_t>(Data.size());
|
|
Model.component_data.insert(Model.component_data.end(), Data.begin(), Data.end());
|
|
auto const index{static_cast<std::uint32_t>(Model.components.size())};
|
|
Model.components.push_back(record);
|
|
auto const list = [index](std::uint32_t &First, std::uint32_t &Count) {
|
|
if (Count == 0) {
|
|
First = index;
|
|
Count = 1;
|
|
}
|
|
};
|
|
if (Kind == target_kind::node && Target < Model.nodes.size())
|
|
list(Model.nodes[Target].component_first, Model.nodes[Target].component_count);
|
|
if (Kind == target_kind::vertex_group && Target < Model.vertex_groups.size())
|
|
list(Model.vertex_groups[Target].component_first, Model.vertex_groups[Target].component_count);
|
|
return index;
|
|
}
|
|
|
|
|
|
} // namespace eu07m
|