[Bf-blender-cvs] [31bfa17a1f2] master: Cleanup: delete unused ViewMapIO files in Freestyle
Yuki Hashimoto
noreply at git.blender.org
Wed Mar 23 20:06:28 CET 2022
Commit: 31bfa17a1f2b45401f265573c0a77a7366a9ed90
Author: Yuki Hashimoto
Date: Wed Mar 23 17:46:20 2022 +0100
Branches: master
https://developer.blender.org/rB31bfa17a1f2b45401f265573c0a77a7366a9ed90
Cleanup: delete unused ViewMapIO files in Freestyle
ViewMapIO.h is only included in Controller.cpp init_options().
However, g_models_path and g_flags set here are never used elsewhere.
Therefore, ViewMapIO files can be deleted without affecting anything.
Differential Revision: https://developer.blender.org/D14423
===================================================================
M source/blender/freestyle/CMakeLists.txt
M source/blender/freestyle/intern/application/Controller.cpp
D source/blender/freestyle/intern/view_map/ViewMapIO.cpp
D source/blender/freestyle/intern/view_map/ViewMapIO.h
===================================================================
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index 2a5a2d0d957..c2fad9fef3a 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -508,8 +508,6 @@ set(SRC
intern/view_map/ViewMapAdvancedIterators.h
intern/view_map/ViewMapBuilder.cpp
intern/view_map/ViewMapBuilder.h
- intern/view_map/ViewMapIO.cpp
- intern/view_map/ViewMapIO.h
intern/view_map/ViewMapIterators.h
intern/view_map/ViewMapTesselator.cpp
intern/view_map/ViewMapTesselator.h
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 024bc80f3fa..cc815b5317f 100644
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -36,7 +36,6 @@ extern "C" {
#include "../view_map/SteerableViewMap.h"
#include "../view_map/ViewMap.h"
-#include "../view_map/ViewMapIO.h"
#include "../view_map/ViewMapTesselator.h"
#include "../winged_edge/Curvature.h"
@@ -1099,13 +1098,10 @@ void Controller::init_options()
Config::Path *cpath = Config::Path::getInstance();
// Directories
- ViewMapIO::Options::setModelsPath(cpath->getModelsPath());
TextureManager::Options::setPatternsPath(cpath->getPatternsPath());
TextureManager::Options::setBrushesPath(cpath->getModelsPath());
// ViewMap Format
- ViewMapIO::Options::rmFlags(ViewMapIO::Options::FLOAT_VECTORS);
- ViewMapIO::Options::rmFlags(ViewMapIO::Options::NO_OCCLUDERS);
setComputeSteerableViewMapFlag(false);
// Visibility
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
deleted file mode 100644
index 47d9e61ba2f..00000000000
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
+++ /dev/null
@@ -1,1294 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-/** \file
- * \ingroup freestyle
- * \brief Functions to manage I/O for the view map
- */
-
-#include <climits>
-
-#include "ViewMapIO.h"
-
-#ifdef IRIX
-# define WRITE(n) Internal::write<sizeof((n))>(out, (const char *)(&(n)))
-# define READ(n) Internal::read<sizeof((n))>(in, (char *)(&(n)))
-#else
-# define WRITE(n) out.write((const char *)(&(n)), sizeof((n)))
-# define READ(n) in.read((char *)(&(n)), sizeof((n)))
-#endif
-
-#define WRITE_IF_NON_NULL(ptr) \
- if (ptr) { \
- WRITE((ptr)->userdata); \
- } \
- else { \
- WRITE(ZERO); \
- } \
- (void)0
-
-#define READ_IF_NON_NULL(ptr, array) \
- READ(tmp); \
- if (tmp) { \
- (ptr) = (array)[tmp]; \
- } \
- else { \
- (ptr) = NULL; \
- } \
- (void)0
-
-namespace Freestyle::ViewMapIO {
-
-namespace Internal {
-
-static ViewMap *g_vm;
-
-//////////////////// 'load' Functions ////////////////////
-
-inline int load(istream &in, Vec3r &v)
-{
- if (Options::getFlags() & Options::FLOAT_VECTORS) {
- float tmp;
- READ(tmp);
- v[0] = tmp;
- READ(tmp);
- v[1] = tmp;
- READ(tmp);
- v[2] = tmp;
- }
- else {
- Vec3r::value_type tmp;
- READ(tmp);
- v[0] = tmp;
- READ(tmp);
- v[1] = tmp;
- READ(tmp);
- v[2] = tmp;
- }
- return 0;
-}
-
-inline int load(istream &in, Polygon3r &p)
-{
- unsigned tmp;
-
- // Id
- READ(tmp);
- p.setId(tmp);
-
- // vertices (List)
- vector<Vec3r> tmp_vec;
- Vec3r v;
- READ(tmp);
- for (unsigned int i = 0; i < tmp; i++) {
- load(in, v);
- tmp_vec.push_back(v);
- }
- p.setVertices(tmp_vec);
-
- // min & max
- // Already computed (in the SetVertices() method)
-
- return 0;
-}
-
-inline int load(istream &in, FrsMaterial &m)
-{
- float tmp_array[4];
- int i;
-
- // Diffuse
- for (i = 0; i < 4; i++) {
- READ(tmp_array[i]);
- }
- m.setDiffuse(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
-
- // Specular
- for (i = 0; i < 4; i++) {
- READ(tmp_array[i]);
- }
- m.setSpecular(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
-
- // Ambient
- for (i = 0; i < 4; i++) {
- READ(tmp_array[i]);
- }
- m.setAmbient(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
-
- // Emission
- for (i = 0; i < 4; i++) {
- READ(tmp_array[i]);
- }
- m.setEmission(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
-
- // Shininess
- READ(tmp_array[0]);
- m.setShininess(tmp_array[0]);
-
- return 0;
-}
-
-static int load(istream &in, ViewShape *vs)
-{
- if (!vs || !vs->sshape()) {
- return 1;
- }
-
- // SShape
-
- // -> Id
- Id::id_type id1, id2;
- READ(id1);
- READ(id2);
- vs->sshape()->setId(Id(id1, id2));
-
- // -> Importance
- float importance;
- READ(importance);
- vs->sshape()->setImportance(importance);
-
- // -> BBox
- // Not necessary (only used during view map computatiom)
-
- unsigned i, size, tmp;
-
- // -> Material
- READ(size);
- vector<FrsMaterial> frs_materials;
- FrsMaterial m;
- for (i = 0; i < size; ++i) {
- load(in, m);
- frs_materials.push_back(m);
- }
- vs->sshape()->setFrsMaterials(frs_materials);
-
- // -> VerticesList (List)
- READ(size);
- for (i = 0; i < size; i++) {
- SVertex *sv;
- READ_IF_NON_NULL(sv, g_vm->SVertices());
- vs->sshape()->AddNewVertex(sv);
- }
-
- // -> Chains (List)
- READ(size);
- for (i = 0; i < size; i++) {
- FEdge *fe;
- READ_IF_NON_NULL(fe, g_vm->FEdges());
- vs->sshape()->AddChain(fe);
- }
-
- // -> EdgesList (List)
- READ(size);
- for (i = 0; i < size; i++) {
- FEdge *fe;
- READ_IF_NON_NULL(fe, g_vm->FEdges());
- vs->sshape()->AddEdge(fe);
- }
-
- // ViewEdges (List)
- READ(size);
- for (i = 0; i < size; i++) {
- ViewEdge *ve;
- READ_IF_NON_NULL(ve, g_vm->ViewEdges());
- vs->AddEdge(ve);
- }
-
- // ViewVertices (List)
- READ(size);
- for (i = 0; i < size; i++) {
- ViewVertex *vv;
- READ_IF_NON_NULL(vv, g_vm->ViewVertices());
- vs->AddVertex(vv);
- }
-
- return 0;
-}
-
-static int load(istream &in, FEdge *fe)
-{
- if (!fe) {
- return 1;
- }
-
- bool b;
-
- FEdgeSmooth *fesmooth = nullptr;
- FEdgeSharp *fesharp = nullptr;
- if (fe->isSmooth()) {
- fesmooth = dynamic_cast<FEdgeSmooth *>(fe);
- }
- else {
- fesharp = dynamic_cast<FEdgeSharp *>(fe);
- }
-
- // Id
- Id::id_type id1, id2;
- READ(id1);
- READ(id2);
- fe->setId(Id(id1, id2));
-
- // Nature
- Nature::EdgeNature nature;
- READ(nature);
- fe->setNature(nature);
-
-#if 0 // hasVisibilityPoint
- bool b;
- READ(b);
- fe->setHasVisibilityPoint(b);
-#endif
-
- Vec3r v;
- unsigned int matindex;
-
-#if 0
- // VisibilityPointA
- load(in, v);
- fe->setVisibilityPointA(v);
-
- // VisibilityPointB
- load(in, v);
- fe->setVisibilityPointB(v);
-#endif
-
- if (fe->isSmooth()) {
- // Normal
- load(in, v);
- fesmooth->setNormal(v);
-
- // Material
- READ(matindex);
- fesmooth->setFrsMaterialIndex(matindex);
- }
- else {
- // aNormal
- load(in, v);
- fesharp->setNormalA(v);
-
- // bNormal
- load(in, v);
- fesharp->setNormalB(v);
-
- // Materials
- READ(matindex);
- fesharp->setaFrsMaterialIndex(matindex);
- READ(matindex);
- fesharp->setbFrsMaterialIndex(matindex);
- }
-
- unsigned tmp;
-
- // VertexA
- SVertex *sva;
- READ_IF_NON_NULL(sva, g_vm->SVertices());
- fe->setVertexA(sva);
-
- // VertexB
- SVertex *svb;
- READ_IF_NON_NULL(svb, g_vm->SVertices());
- fe->setVertexB(svb);
-
- // NextEdge
- FEdge *nfe;
- READ_IF_NON_NULL(nfe, g_vm->FEdges());
- fe->setNextEdge(nfe);
-
- // PreviousEdge
- FEdge *pfe;
- READ_IF_NON_NULL(pfe, g_vm->FEdges());
- fe->setPreviousEdge(pfe);
-
- // ViewEdge
- ViewEdge *ve;
- READ_IF_NON_NULL(ve, g_vm->ViewEdges());
- fe->setViewEdge(ve);
-
- // Face
- // Not necessary (only used during view map computatiom)
-
- Polygon3r p;
-
- // aFace
- load(in, p);
- fe->setaFace(p);
-
- // occludeeEmpty
- READ(b);
- fe->setOccludeeEmpty(b);
-
- // occludeeIntersection
- load(in, v);
- fe->setOccludeeIntersection(v);
-
- return 0;
-}
-
-static int load(istream &in, SVertex *sv)
-{
- if (!sv) {
- return 1;
- }
-
- // Id
- Id::id_type id1, id2;
- READ(id1);
- READ(id2);
- sv->setId(Id(id1, id2));
-
- Vec3r v;
-
- // Point3D
- load(in, v);
- sv->setPoint3D(v);
-
- // Point2D
- load(in, v);
- sv->setPoint2D(v);
-
- unsigned tmp;
-
- // Shape
- ViewShape *vs;
- READ_IF_NON_NULL(vs, g_vm->ViewShapes());
- sv->setShape(vs->sshape());
-
- // pViewVertex
- ViewVertex *vv;
- READ_IF_NON_NULL(vv, g_vm->ViewVertices());
- sv->setViewVertex(vv);
-
- unsigned i, size;
-
- // Normals (List)
- READ(size);
- for (i = 0; i < size; i++) {
- load(in, v);
- sv->AddNormal(v);
- }
-
- // FEdges (List)
- READ(size);
- FEdge *fe;
- for (i = 0; i < size; i++) {
- READ_IF_NON_NULL(fe, g_vm->FEdges());
- sv->AddFEdge(fe);
- }
-
- return 0;
-}
-
-static int load(istream &in, ViewEdge *ve)
-{
- if (!ve) {
- return 1;
- }
-
- unsigned tmp;
-
- // Id
- Id::id_type id1, id2;
- READ(id1);
- READ(id2);
- ve->setId(Id(id1, id2));
-
- // Nature
- Nature::EdgeNature nature;
- READ(nature);
- ve->setNature(nature);
-
- // QI
- READ(tmp);
- ve->setQI(tmp);
-
- // Shape
- ViewShape *vs;
- READ_IF_NON_NULL(vs, g_vm->ViewShapes());
- ve->setShape(vs);
-
- // aShape
- ViewShape *avs;
- READ_IF_NON_NULL(avs, g_vm->ViewShapes());
- ve->setaShape(avs);
-
- // FEdgeA
- FEdge *fea;
- READ_IF_NON_NULL(fea, g_vm->FEdges());
- ve->setFEdgeA(fea);
-
- // FEdgeB
- FEdge *feb;
- READ_IF_NON_NULL(feb, g_vm->FEdges());
- ve->setFEdgeB(feb);
-
- // A
- ViewVertex *vva;
- READ_IF_NON_NULL(vva, g_vm->ViewVertices());
- ve->setA(vva);
-
- // B
- ViewVertex *vvb;
- READ_IF_NON_NULL(vvb, g_vm->ViewVertices());
- ve->setB(vvb);
-
- // Occluders (List)
- if (!(Options::getFlags() & Options::NO_OCCLUDERS)) {
- unsigned size;
- READ(size);
- ViewShape *vso;
- for (unsigned int i = 0; i < size; i++) {
- READ_IF_NON_NULL(vso, g_vm->ViewShapes());
- ve->AddOccluder(vso);
- }
- }
-
- return 0;
-}
-
-static int load(istream &in, ViewVertex *vv)
-{
- if (!vv) {
- return 1;
- }
-
- unsigned tmp;
- bool b;
-
- // Nature
- Nature::VertexNature nature;
- READ
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list