Blender V5.3
BlenderFileLoader.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include <float.h>
12#include <string.h>
13
14#include "../geometry/BBox.h"
15#include "../geometry/Geom.h"
24
25#include "MEM_guardedalloc.h"
26
27#include "DNA_material_types.h"
28#include "DNA_mesh_types.h"
29#include "DNA_modifier_types.h"
30#include "DNA_object_types.h"
31#include "DNA_scene_types.h"
32
33#include "render_types.h"
34
35#include "BKE_lib_id.hh"
36#include "BKE_material.hh"
37#include "BKE_mesh.h"
38#include "BKE_scene.hh"
39
40#include "BLI_iterator.hh"
41#include "BLI_listbase.hh"
42
44
45#include "MEM_guardedalloc.h"
46
47namespace Freestyle {
48
49class NodeGroup;
50
52 float *pv;
53 float *pn;
55 uint *pvi;
56 uint *pni;
57 uint *pmi;
60 float minBBox[3];
61 float maxBBox[3];
62};
63
65 public:
68 blender::ViewLayer *view_layer,
69 blender::Depsgraph *depsgraph);
70 virtual ~BlenderFileLoader();
71
73 NodeGroup *Load();
74
76 inline uint numFacesRead()
77 {
78 return _numFacesRead;
79 }
80
81#if 0
83 inline real minEdgeSize()
84 {
85 return _minEdgeSize;
86 }
87#endif
88
90 inline void setRenderMonitor(RenderMonitor *iRenderMonitor)
91 {
92 _pRenderMonitor = iRenderMonitor;
93 }
94
95 protected:
96 void insertShapeNode(blender::Object *ob, blender::Mesh *mesh, int id);
97 int testDegenerateTriangle(float v1[3], float v2[3], float v3[3]);
98 int countClippedFaces(float v1[3], float v2[3], float v3[3], int clip[3]);
99 void clipLine(float v1[3], float v2[3], float c[3], float z);
100 void clipTriangle(int numTris,
101 float triCoords[][3],
102 float v1[3],
103 float v2[3],
104 float v3[3],
105 float triNormals[][3],
106 float n1[3],
107 float n2[3],
108 float n3[3],
109 bool edgeMarks[5],
110 bool em1,
111 bool em2,
112 bool em3,
113 const int clip[3]);
114 void addTriangle(struct LoaderState *ls,
115 float v1[3],
116 float v2[3],
117 float v3[3],
118 float n1[3],
119 float n2[3],
120 float n3[3],
121 bool fm,
122 bool em1,
123 bool em2,
124 bool em3);
125
126 protected:
127 struct detri_t {
128 uint viA, viB, viP; // 0 <= viA, viB, viP < viSize
130 uint n;
131 };
133 blender::Depsgraph *_depsgraph;
136#if 0
137 real _minEdgeSize;
138#endif
139 bool _smooth; /* if true, face smoothness is taken into account */
142
144
145 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderFileLoader")
146};
147
148} /* namespace Freestyle */
A class to hold a bounding box.
General operations, lookup, etc. for materials.
Object is a sort of wrapper for general info.
Configuration definitions.
Class to define a cleaner of geometry providing a set of useful tools.
Various tools for geometry.
Vectors and Matrices (useful type definitions).
A Set of indexed faces to represent a surface object.
Read Blender memory allocation and freeing.
Class to represent a group node. This node can contains several children.
Class to build a shape node. It contains a Rep, which is the shape geometry.
Class to represent a transform node. A Transform node contains one or several children,...
Classes defining the basic "Iterator" design pattern.
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
void setRenderMonitor(RenderMonitor *iRenderMonitor)
void insertShapeNode(blender::Object *ob, blender::Mesh *mesh, int id)
void clipLine(float v1[3], float v2[3], float c[3], float z)
void addTriangle(struct LoaderState *ls, float v1[3], float v2[3], float v3[3], float n1[3], float n2[3], float n3[3], bool fm, bool em1, bool em2, bool em3)
int testDegenerateTriangle(float v1[3], float v2[3], float v3[3])
void clipTriangle(int numTris, float triCoords[][3], float v1[3], float v2[3], float v3[3], float triNormals[][3], float n1[3], float n2[3], float n3[3], bool edgeMarks[5], bool em1, bool em2, bool em3, const int clip[3])
blender::Depsgraph * _depsgraph
int countClippedFaces(float v1[3], float v2[3], float v3[3], int clip[3])
BlenderFileLoader(blender::Render *re, blender::ViewLayer *view_layer, blender::Depsgraph *depsgraph)
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
inherits from class Rep
Definition AppCanvas.cpp:20
double real
Definition Precision.h:14
IndexedFaceSet::FaceEdgeMark * pm