Blender V5.0
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.h"
41#include "BLI_listbase.h"
42
44
45#include "MEM_guardedalloc.h"
46
47namespace Freestyle {
48
49class NodeGroup;
50
63
65 public:
67 BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph);
68 virtual ~BlenderFileLoader();
69
71 NodeGroup *Load();
72
75 {
76 return _numFacesRead;
77 }
78
79#if 0
81 inline real minEdgeSize()
82 {
83 return _minEdgeSize;
84 }
85#endif
86
88 inline void setRenderMonitor(RenderMonitor *iRenderMonitor)
89 {
90 _pRenderMonitor = iRenderMonitor;
91 }
92
93 protected:
94 void insertShapeNode(Object *ob, Mesh *mesh, int id);
95 int testDegenerateTriangle(float v1[3], float v2[3], float v3[3]);
96 int countClippedFaces(float v1[3], float v2[3], float v3[3], int clip[3]);
97 void clipLine(float v1[3], float v2[3], float c[3], float z);
98 void clipTriangle(int numTris,
99 float triCoords[][3],
100 float v1[3],
101 float v2[3],
102 float v3[3],
103 float triNormals[][3],
104 float n1[3],
105 float n2[3],
106 float n3[3],
107 bool edgeMarks[5],
108 bool em1,
109 bool em2,
110 bool em3,
111 const int clip[3]);
112 void addTriangle(struct LoaderState *ls,
113 float v1[3],
114 float v2[3],
115 float v3[3],
116 float n1[3],
117 float n2[3],
118 float n3[3],
119 bool fm,
120 bool em1,
121 bool em2,
122 bool em3);
123
124 protected:
125 struct detri_t {
126 uint viA, viB, viP; // 0 <= viA, viB, viP < viSize
129 };
131 Depsgraph *_depsgraph;
134#if 0
135 real _minEdgeSize;
136#endif
137 bool _smooth; /* if true, face smoothness is taken into account */
140
142
143 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderFileLoader")
144};
145
146} /* namespace Freestyle */
A class to hold a bounding box.
General operations, lookup, etc. for materials.
unsigned int uint
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 Guarded memory(de)allocation.
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.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
void setRenderMonitor(RenderMonitor *iRenderMonitor)
BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
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 insertShapeNode(Object *ob, Mesh *mesh, int id)
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])
int countClippedFaces(float v1[3], float v2[3], float v3[3], int clip[3])
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
inherits from class Rep
Definition AppCanvas.cpp:20
static uint c
Definition RandGen.cpp:87
double real
Definition Precision.h:14
IndexedFaceSet::FaceEdgeMark * pm