Blender V4.3
ply_file_buffer_binary.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
12
13namespace blender::io::ply {
14void FileBufferBinary::write_vertex(float x, float y, float z)
15{
16 float3 vector(x, y, z);
17 char *bits = reinterpret_cast<char *>(&vector);
18 Span<char> span(bits, sizeof(float3));
19
20 write_bytes(span);
21}
22
23void FileBufferBinary::write_UV(float u, float v)
24{
25 float2 vector(u, v);
26 char *bits = reinterpret_cast<char *>(&vector);
27 Span<char> span(bits, sizeof(float2));
28
29 write_bytes(span);
30}
31
33{
34 char *bits = reinterpret_cast<char *>(&v);
35 Span<char> span(bits, sizeof(float));
36
37 write_bytes(span);
38}
39
40void FileBufferBinary::write_vertex_normal(float nx, float ny, float nz)
41{
42 float3 vector(nx, ny, nz);
43 char *bits = reinterpret_cast<char *>(&vector);
44 Span<char> span(bits, sizeof(float3));
45
46 write_bytes(span);
47}
48
50{
51 uchar4 vector(r, g, b, a);
52 char *bits = reinterpret_cast<char *>(&vector);
53 Span<char> span(bits, sizeof(uchar4));
54
55 write_bytes(span);
56}
57
59{
60 /* In binary, there is no end to a vertex. */
61}
62
63void FileBufferBinary::write_face(char size, Span<uint32_t> const &vertex_indices)
64{
65 write_bytes(Span<char>({size}));
66
67 write_bytes(vertex_indices.cast<char>());
68}
69
70void FileBufferBinary::write_edge(int first, int second)
71{
72 int2 vector(first, second);
73 char *bits = reinterpret_cast<char *>(&vector);
74 Span<char> span(bits, sizeof(int2));
75
76 write_bytes(span);
77}
78} // namespace blender::io::ply
unsigned char uchar
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 vector
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
Span< NewT > constexpr cast() const
Definition BLI_span.hh:419
void write_vertex_normal(float nx, float ny, float nz) override
void write_vertex_color(uchar r, uchar g, uchar b, uchar a) override
void write_UV(float u, float v) override
void write_face(char size, Span< uint32_t > const &vertex_indices) override
void write_vertex(float x, float y, float z) override
void write_edge(int first, int second) override
void write_bytes(Span< char > bytes)
local_group_size(16, 16) .push_constant(Type b