Cleanup: Various clang-tidy warnings in intern
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
#ifndef __ATOMIC_OPS_H__
|
||||
#define __ATOMIC_OPS_H__
|
||||
|
||||
#include "intern/atomic_ops_utils.h"
|
||||
#include "intern/atomic_ops_utils.h" /* IWYU pragma: export */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Function prototypes. */
|
||||
@@ -139,12 +139,12 @@ ATOMIC_INLINE float atomic_add_and_fetch_fl(float *p, const float x);
|
||||
/* Note that we are using _unix flavor as fallback here
|
||||
* (it will raise precompiler errors as needed). */
|
||||
#if defined(_MSC_VER)
|
||||
# include "intern/atomic_ops_msvc.h"
|
||||
# include "intern/atomic_ops_msvc.h" /* IWYU pragma: export */
|
||||
#else
|
||||
# include "intern/atomic_ops_unix.h"
|
||||
# include "intern/atomic_ops_unix.h" /* IWYU pragma: export */
|
||||
#endif
|
||||
|
||||
/* Include 'fake' atomic extensions, built over real atomic primitives. */
|
||||
#include "intern/atomic_ops_ext.h"
|
||||
#include "intern/atomic_ops_ext.h" /* IWYU pragma: export */
|
||||
|
||||
#endif /* __ATOMIC_OPS_H__ */
|
||||
|
||||
@@ -256,9 +256,7 @@ static const char *clg_severity_as_text(enum CLG_Severity severity)
|
||||
if (ok) {
|
||||
return clg_severity_str[severity];
|
||||
}
|
||||
else {
|
||||
return "INVALID_SEVERITY";
|
||||
}
|
||||
return "INVALID_SEVERITY";
|
||||
}
|
||||
|
||||
static enum eCLogColor clg_severity_to_color(enum CLG_Severity severity)
|
||||
|
||||
@@ -25,7 +25,7 @@ CCL_NAMESPACE_END
|
||||
|
||||
/* specializations of TopologyRefinerFactory for ccl::Mesh */
|
||||
|
||||
namespace OpenSubdiv::v3_6_0::Far {
|
||||
namespace OpenSubdiv::OPENSUBDIV_VERSION::Far {
|
||||
template<>
|
||||
bool TopologyRefinerFactory<ccl::Mesh>::resizeComponentTopology(TopologyRefiner &refiner,
|
||||
const ccl::Mesh &mesh)
|
||||
@@ -134,7 +134,7 @@ void TopologyRefinerFactory<ccl::Mesh>::reportInvalidTopology(TopologyError /*er
|
||||
const ccl::Mesh & /*mesh*/)
|
||||
{
|
||||
}
|
||||
} // namespace OpenSubdiv::v3_6_0::Far
|
||||
} // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#ifndef __DUALCON_H__
|
||||
#define __DUALCON_H__
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -17,28 +17,28 @@
|
||||
*/
|
||||
|
||||
// 3d point with integer coordinates
|
||||
typedef struct {
|
||||
struct Point3i {
|
||||
int x, y, z;
|
||||
} Point3i;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct BoundingBox {
|
||||
Point3i begin;
|
||||
Point3i end;
|
||||
} BoundingBox;
|
||||
};
|
||||
|
||||
// triangle that points to three vertices
|
||||
typedef struct {
|
||||
struct Triangle {
|
||||
float vt[3][3];
|
||||
} Triangle;
|
||||
};
|
||||
|
||||
// 3d point with float coordinates
|
||||
typedef struct {
|
||||
struct Point3f {
|
||||
float x, y, z;
|
||||
} Point3f;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct BoundingBoxf {
|
||||
Point3f begin;
|
||||
Point3f end;
|
||||
} BoundingBoxf;
|
||||
};
|
||||
|
||||
#endif /* __GEOCOMMON_H__ */
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
#ifndef __MEMORYALLOCATOR_H__
|
||||
#define __MEMORYALLOCATOR_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#define HEAP_BASE 16
|
||||
#define UCHAR unsigned char
|
||||
@@ -22,7 +24,7 @@
|
||||
*/
|
||||
class VirtualMemoryAllocator {
|
||||
public:
|
||||
virtual ~VirtualMemoryAllocator() {}
|
||||
virtual ~VirtualMemoryAllocator() = default;
|
||||
|
||||
virtual void *allocate() = 0;
|
||||
virtual void deallocate(void *obj) = 0;
|
||||
@@ -120,7 +122,7 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
void destroy()
|
||||
void destroy() override
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < datablocknum; i++) {
|
||||
@@ -136,7 +138,7 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
|
||||
/**
|
||||
* Allocation method
|
||||
*/
|
||||
void *allocate()
|
||||
void *allocate() override
|
||||
{
|
||||
if (available == 0) {
|
||||
allocateDataBlock();
|
||||
@@ -150,7 +152,7 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
|
||||
/**
|
||||
* De-allocation method
|
||||
*/
|
||||
void deallocate(void *obj)
|
||||
void deallocate(void *obj) override
|
||||
{
|
||||
if (available == stacksize) {
|
||||
allocateStackBlock();
|
||||
@@ -165,7 +167,7 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
|
||||
/**
|
||||
* Print information
|
||||
*/
|
||||
void printInfo()
|
||||
void printInfo() override
|
||||
{
|
||||
printf("Bytes: %d Used: %d Allocated: %d Maxfree: %d\n",
|
||||
getBytes(),
|
||||
@@ -177,17 +179,17 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
|
||||
/**
|
||||
* Query methods
|
||||
*/
|
||||
int getAllocated()
|
||||
int getAllocated() override
|
||||
{
|
||||
return HEAP_UNIT * datablocknum - available;
|
||||
};
|
||||
|
||||
int getAll()
|
||||
int getAll() override
|
||||
{
|
||||
return HEAP_UNIT * datablocknum;
|
||||
};
|
||||
|
||||
int getBytes()
|
||||
int getBytes() override
|
||||
{
|
||||
return N;
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
class ModelReader {
|
||||
public:
|
||||
/// Constructor
|
||||
ModelReader(){};
|
||||
ModelReader() = default;
|
||||
|
||||
/// Get next triangle
|
||||
virtual Triangle *getNextTriangle() = 0;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "Projections.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
const int vertmap[8][3] = {
|
||||
{0, 0, 0},
|
||||
@@ -180,12 +180,8 @@ CubeTriangleIsect::CubeTriangleIsect(int64_t cube[2][3],
|
||||
for (i = 1; i < 8; i++) {
|
||||
int64_t proj = (vertmap[i][0] * cube_proj.edges[0] + vertmap[i][1] * cube_proj.edges[1] +
|
||||
vertmap[i][2] * cube_proj.edges[2]);
|
||||
if (proj > max) {
|
||||
max = proj;
|
||||
}
|
||||
if (proj < min) {
|
||||
min = proj;
|
||||
}
|
||||
max = std::max(proj, max);
|
||||
min = std::min(proj, min);
|
||||
}
|
||||
cube_proj.min = min;
|
||||
cube_proj.max = max;
|
||||
@@ -201,13 +197,8 @@ CubeTriangleIsect::CubeTriangleIsect(int64_t cube[2][3],
|
||||
inherit->tri_proj[axis][0] = vts[0];
|
||||
inherit->tri_proj[axis][1] = vts[0];
|
||||
for (i = 1; i < 3; i++) {
|
||||
if (vts[i] < inherit->tri_proj[axis][0]) {
|
||||
inherit->tri_proj[axis][0] = vts[i];
|
||||
}
|
||||
|
||||
if (vts[i] > inherit->tri_proj[axis][1]) {
|
||||
inherit->tri_proj[axis][1] = vts[i];
|
||||
}
|
||||
inherit->tri_proj[axis][0] = std::min(vts[i], inherit->tri_proj[axis][0]);
|
||||
inherit->tri_proj[axis][1] = std::max(vts[i], inherit->tri_proj[axis][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,7 +262,7 @@ unsigned char CubeTriangleIsect::getBoxMask()
|
||||
/**
|
||||
* Shifting a cube to a new origin
|
||||
*/
|
||||
void CubeTriangleIsect::shift(int off[3])
|
||||
void CubeTriangleIsect::shift(const int off[3])
|
||||
{
|
||||
for (int i = 0; i < NUM_AXES; i++) {
|
||||
cubeProj[i].origin += (off[0] * cubeProj[i].edges[0] + off[1] * cubeProj[i].edges[1] +
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#ifndef __PROJECTIONS_H__
|
||||
#define __PROJECTIONS_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#define CONTAINS_INDEX
|
||||
#define GRID_DIMENSION 20
|
||||
@@ -16,7 +17,7 @@
|
||||
# define LONG __int64
|
||||
# define int64_t __int64
|
||||
#else
|
||||
# include <stdint.h>
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -76,8 +77,7 @@ class CubeTriangleIsect {
|
||||
/// Projections of the cube vertices
|
||||
CubeProjection cubeProj[NUM_AXES];
|
||||
|
||||
public:
|
||||
CubeTriangleIsect() {}
|
||||
CubeTriangleIsect() = default;
|
||||
|
||||
/**
|
||||
* Construction from a cube (axes aligned) and triangle
|
||||
@@ -95,7 +95,7 @@ class CubeTriangleIsect {
|
||||
/**
|
||||
* Shifting a cube to a new origin
|
||||
*/
|
||||
void shift(int off[3]);
|
||||
void shift(const int off[3]);
|
||||
|
||||
/**
|
||||
* Method to test intersection of the triangle and the cube
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef __QUEUE_H__
|
||||
#define __QUEUE_H__
|
||||
|
||||
#include "MemoryAllocator.h"
|
||||
|
||||
struct gridQueueEle {
|
||||
int x, y, z;
|
||||
UCHAR dir;
|
||||
@@ -19,8 +21,8 @@ class GridQueue {
|
||||
public:
|
||||
GridQueue()
|
||||
{
|
||||
head = NULL;
|
||||
tail = NULL;
|
||||
head = nullptr;
|
||||
tail = nullptr;
|
||||
numEles = 0;
|
||||
}
|
||||
|
||||
@@ -34,15 +36,15 @@ class GridQueue {
|
||||
return numEles;
|
||||
}
|
||||
|
||||
void pushQueue(int st[3], int dir)
|
||||
void pushQueue(const int st[3], int dir)
|
||||
{
|
||||
gridQueueEle *ele = new gridQueueEle;
|
||||
ele->x = st[0];
|
||||
ele->y = st[1];
|
||||
ele->z = st[2];
|
||||
ele->dir = (UCHAR)dir;
|
||||
ele->next = NULL;
|
||||
if (head == NULL) {
|
||||
ele->next = nullptr;
|
||||
if (head == nullptr) {
|
||||
head = ele;
|
||||
}
|
||||
else {
|
||||
@@ -54,7 +56,7 @@ class GridQueue {
|
||||
|
||||
int popQueue(int st[3], int &dir)
|
||||
{
|
||||
if (head == NULL) {
|
||||
if (head == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,8 +69,8 @@ class GridQueue {
|
||||
head = head->next;
|
||||
delete temp;
|
||||
|
||||
if (head == NULL) {
|
||||
tail = NULL;
|
||||
if (head == nullptr) {
|
||||
tail = nullptr;
|
||||
}
|
||||
numEles--;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef __CUBES_H__
|
||||
#define __CUBES_H__
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "marching_cubes_table.h"
|
||||
|
||||
/* simple wrapper for auto-generated marching cubes data */
|
||||
|
||||
@@ -5,14 +5,11 @@
|
||||
#include "ModelReader.h"
|
||||
#include "dualcon.h"
|
||||
#include "octree.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include <cstdio>
|
||||
#include <float.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define isnan(n) _isnan(n)
|
||||
#endif
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
static void veccopy(float dst[3], const float src[3])
|
||||
{
|
||||
@@ -42,7 +39,7 @@ class DualConInputReader : public ModelReader {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset()
|
||||
void reset() override
|
||||
{
|
||||
curtri = 0;
|
||||
maxsize = 0;
|
||||
@@ -54,9 +51,7 @@ class DualConInputReader : public ModelReader {
|
||||
/* initialize maxsize */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float d = max[i] - min[i];
|
||||
if (d > maxsize) {
|
||||
maxsize = d;
|
||||
}
|
||||
maxsize = std::max(d, maxsize);
|
||||
}
|
||||
|
||||
/* redo the bounds */
|
||||
@@ -71,10 +66,10 @@ class DualConInputReader : public ModelReader {
|
||||
maxsize *= 1 / scale;
|
||||
}
|
||||
|
||||
Triangle *getNextTriangle()
|
||||
Triangle *getNextTriangle() override
|
||||
{
|
||||
if (curtri == input_mesh->tottri) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Triangle *t = new Triangle();
|
||||
@@ -89,7 +84,7 @@ class DualConInputReader : public ModelReader {
|
||||
/* remove triangle if it contains invalid coords */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const float *co = t->vt[i];
|
||||
if (isnan(co[0]) || isnan(co[1]) || isnan(co[2])) {
|
||||
if (std::isnan(co[0]) || std::isnan(co[1]) || std::isnan(co[2])) {
|
||||
delete t;
|
||||
return getNextTriangle();
|
||||
}
|
||||
@@ -98,7 +93,7 @@ class DualConInputReader : public ModelReader {
|
||||
return t;
|
||||
}
|
||||
|
||||
int getNextTriangle(int t[3])
|
||||
int getNextTriangle(int t[3]) override
|
||||
{
|
||||
if (curtri == input_mesh->tottri) {
|
||||
return 0;
|
||||
@@ -114,31 +109,31 @@ class DualConInputReader : public ModelReader {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getNumTriangles()
|
||||
int getNumTriangles() override
|
||||
{
|
||||
return tottri;
|
||||
}
|
||||
|
||||
int getNumVertices()
|
||||
int getNumVertices() override
|
||||
{
|
||||
return input_mesh->totco;
|
||||
}
|
||||
|
||||
float getBoundingBox(float origin[3])
|
||||
float getBoundingBox(float origin[3]) override
|
||||
{
|
||||
veccopy(origin, min);
|
||||
return maxsize;
|
||||
}
|
||||
|
||||
/* output */
|
||||
void getNextVertex(float /*v*/[3])
|
||||
void getNextVertex(float /*v*/[3]) override
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
/* stubs */
|
||||
void printInfo() {}
|
||||
int getMemory()
|
||||
void printInfo() override {}
|
||||
int getMemory() override
|
||||
{
|
||||
return sizeof(DualConInputReader);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#ifndef __MANIFOLD_TABLE_H__
|
||||
#define __MANIFOLD_TABLE_H__
|
||||
|
||||
typedef struct {
|
||||
struct ManifoldIndices {
|
||||
int comps;
|
||||
int pairs[12][2];
|
||||
} ManifoldIndices;
|
||||
};
|
||||
|
||||
extern const ManifoldIndices manifold_table[256];
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "octree.h"
|
||||
#include "Queue.h"
|
||||
|
||||
#include <Eigen/Dense>
|
||||
#include <limits>
|
||||
#include <time.h>
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
/**
|
||||
* Implementations of Octree member functions.
|
||||
@@ -266,7 +266,7 @@ void Octree::addAllTriangles()
|
||||
|
||||
srand(0);
|
||||
|
||||
while ((trian = reader->getNextTriangle()) != NULL) {
|
||||
while ((trian = reader->getNextTriangle()) != nullptr) {
|
||||
// Drop triangles
|
||||
{
|
||||
addTriangle(trian, count);
|
||||
@@ -473,10 +473,10 @@ void Octree::trace()
|
||||
totRingLengths = 0;
|
||||
maxRingLength = 0;
|
||||
|
||||
PathList *chdpath = NULL;
|
||||
PathList *chdpath = nullptr;
|
||||
root = trace(root, st, dimen, maxDepth, chdpath);
|
||||
|
||||
if (chdpath != NULL) {
|
||||
if (chdpath != nullptr) {
|
||||
dc_printf("there are incomplete rings.\n");
|
||||
printPaths(chdpath);
|
||||
}
|
||||
@@ -500,8 +500,8 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
nst[i][j] = st[j] + len * vertmap[i][j];
|
||||
}
|
||||
|
||||
if (chd[i] == NULL || newnode->internal.is_child_leaf(i)) {
|
||||
chdpaths[i] = NULL;
|
||||
if (chd[i] == nullptr || newnode->internal.is_child_leaf(i)) {
|
||||
chdpaths[i] = nullptr;
|
||||
}
|
||||
else {
|
||||
trace(chd[i], nst[i], len, depth - 1, chdpaths[i]);
|
||||
@@ -526,7 +526,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
nstf[j] = nst[c[j]];
|
||||
}
|
||||
|
||||
conn[i] = NULL;
|
||||
conn[i] = nullptr;
|
||||
|
||||
findPaths((Node **)nf, lf, df, nstf, depth - 1, cellProcFaceMask[i][2], conn[i]);
|
||||
|
||||
@@ -538,7 +538,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
}
|
||||
|
||||
// Connect paths
|
||||
PathList *rings = NULL;
|
||||
PathList *rings = nullptr;
|
||||
combinePaths(chdpaths[0], chdpaths[1], conn[8], rings);
|
||||
combinePaths(chdpaths[2], chdpaths[3], conn[9], rings);
|
||||
combinePaths(chdpaths[4], chdpaths[5], conn[10], rings);
|
||||
@@ -546,13 +546,13 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
|
||||
combinePaths(chdpaths[0], chdpaths[2], conn[4], rings);
|
||||
combinePaths(chdpaths[4], chdpaths[6], conn[5], rings);
|
||||
combinePaths(chdpaths[0], NULL, conn[6], rings);
|
||||
combinePaths(chdpaths[4], NULL, conn[7], rings);
|
||||
combinePaths(chdpaths[0], nullptr, conn[6], rings);
|
||||
combinePaths(chdpaths[4], nullptr, conn[7], rings);
|
||||
|
||||
combinePaths(chdpaths[0], chdpaths[4], conn[0], rings);
|
||||
combinePaths(chdpaths[0], NULL, conn[1], rings);
|
||||
combinePaths(chdpaths[0], NULL, conn[2], rings);
|
||||
combinePaths(chdpaths[0], NULL, conn[3], rings);
|
||||
combinePaths(chdpaths[0], nullptr, conn[1], rings);
|
||||
combinePaths(chdpaths[0], nullptr, conn[2], rings);
|
||||
combinePaths(chdpaths[0], nullptr, conn[3], rings);
|
||||
|
||||
// By now, only chdpaths[0] and rings have contents
|
||||
|
||||
@@ -565,9 +565,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
while (trings) {
|
||||
numRings++;
|
||||
totRingLengths += trings->length;
|
||||
if (trings->length > maxRingLength) {
|
||||
maxRingLength = trings->length;
|
||||
}
|
||||
maxRingLength = std::max(trings->length, maxRingLength);
|
||||
trings = trings->next;
|
||||
}
|
||||
|
||||
@@ -580,8 +578,13 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
|
||||
return newnode;
|
||||
}
|
||||
|
||||
void Octree::findPaths(
|
||||
Node *node[2], int leaf[2], int depth[2], int *st[2], int maxdep, int dir, PathList *&paths)
|
||||
void Octree::findPaths(Node *node[2],
|
||||
const int leaf[2],
|
||||
const int depth[2],
|
||||
int *st[2],
|
||||
int maxdep,
|
||||
int dir,
|
||||
PathList *&paths)
|
||||
{
|
||||
if (!(node[0] && node[1])) {
|
||||
return;
|
||||
@@ -651,7 +654,7 @@ void Octree::findPaths(
|
||||
ele2->pos[2] = st[1][2];
|
||||
|
||||
ele1->next = ele2;
|
||||
ele2->next = NULL;
|
||||
ele2->next = nullptr;
|
||||
|
||||
PathList *lst = new PathList;
|
||||
lst->head = ele1;
|
||||
@@ -668,7 +671,7 @@ void Octree::findPaths(
|
||||
void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, PathList *&rings)
|
||||
{
|
||||
// Make new list of paths
|
||||
PathList *nlist = NULL;
|
||||
PathList *nlist = nullptr;
|
||||
|
||||
// Search for each connectors in paths
|
||||
PathList *tpaths = paths;
|
||||
@@ -677,13 +680,15 @@ void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, Pa
|
||||
PathList *singlist = tpaths;
|
||||
PathList *templist;
|
||||
tpaths = tpaths->next;
|
||||
singlist->next = NULL;
|
||||
singlist->next = nullptr;
|
||||
|
||||
// Look for hookup in list1
|
||||
tlist = list1;
|
||||
pre = NULL;
|
||||
pre = nullptr;
|
||||
while (tlist) {
|
||||
if ((templist = combineSinglePath(list1, pre, tlist, singlist, NULL, singlist)) != NULL) {
|
||||
if ((templist = combineSinglePath(list1, pre, tlist, singlist, nullptr, singlist)) !=
|
||||
nullptr)
|
||||
{
|
||||
singlist = templist;
|
||||
continue;
|
||||
}
|
||||
@@ -693,9 +698,11 @@ void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, Pa
|
||||
|
||||
// Look for hookup in list2
|
||||
tlist = list2;
|
||||
pre = NULL;
|
||||
pre = nullptr;
|
||||
while (tlist) {
|
||||
if ((templist = combineSinglePath(list2, pre, tlist, singlist, NULL, singlist)) != NULL) {
|
||||
if ((templist = combineSinglePath(list2, pre, tlist, singlist, nullptr, singlist)) !=
|
||||
nullptr)
|
||||
{
|
||||
singlist = templist;
|
||||
continue;
|
||||
}
|
||||
@@ -705,9 +712,11 @@ void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, Pa
|
||||
|
||||
// Look for hookup in nlist
|
||||
tlist = nlist;
|
||||
pre = NULL;
|
||||
pre = nullptr;
|
||||
while (tlist) {
|
||||
if ((templist = combineSinglePath(nlist, pre, tlist, singlist, NULL, singlist)) != NULL) {
|
||||
if ((templist = combineSinglePath(nlist, pre, tlist, singlist, nullptr, singlist)) !=
|
||||
nullptr)
|
||||
{
|
||||
singlist = templist;
|
||||
continue;
|
||||
}
|
||||
@@ -734,8 +743,8 @@ void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, Pa
|
||||
|
||||
// Append list2 and nlist to the end of list1
|
||||
tlist = list1;
|
||||
if (tlist != NULL) {
|
||||
while (tlist->next != NULL) {
|
||||
if (tlist != nullptr) {
|
||||
while (tlist->next != nullptr) {
|
||||
tlist = tlist->next;
|
||||
}
|
||||
tlist->next = list2;
|
||||
@@ -745,8 +754,8 @@ void Octree::combinePaths(PathList *&list1, PathList *list2, PathList *paths, Pa
|
||||
list1 = list2;
|
||||
}
|
||||
|
||||
if (tlist != NULL) {
|
||||
while (tlist->next != NULL) {
|
||||
if (tlist != nullptr) {
|
||||
while (tlist->next != nullptr) {
|
||||
tlist = tlist->next;
|
||||
}
|
||||
tlist->next = nlist;
|
||||
@@ -770,8 +779,8 @@ PathList *Octree::combineSinglePath(PathList *&head1,
|
||||
// Reverse list1
|
||||
PathElement *prev = list1->head;
|
||||
PathElement *next = prev->next;
|
||||
prev->next = NULL;
|
||||
while (next != NULL) {
|
||||
prev->next = nullptr;
|
||||
while (next != nullptr) {
|
||||
PathElement *tnext = next->next;
|
||||
next->next = prev;
|
||||
|
||||
@@ -786,8 +795,8 @@ PathList *Octree::combineSinglePath(PathList *&head1,
|
||||
// Reverse list2
|
||||
PathElement *prev = list2->head;
|
||||
PathElement *next = prev->next;
|
||||
prev->next = NULL;
|
||||
while (next != NULL) {
|
||||
prev->next = nullptr;
|
||||
while (next != nullptr) {
|
||||
PathElement *tnext = next->next;
|
||||
next->next = prev;
|
||||
|
||||
@@ -811,14 +820,14 @@ PathList *Octree::combineSinglePath(PathList *&head1,
|
||||
nlist->length = list1->length + list2->length - 1;
|
||||
nlist->head = list2->head;
|
||||
nlist->tail = list1->tail;
|
||||
nlist->next = NULL;
|
||||
nlist->next = nullptr;
|
||||
|
||||
deletePath(head1, pre1, list1);
|
||||
deletePath(head2, pre2, list2);
|
||||
|
||||
return nlist;
|
||||
}
|
||||
else if (isEqual(list1->tail, list2->head)) {
|
||||
if (isEqual(list1->tail, list2->head)) {
|
||||
// Easy case
|
||||
PathElement *temp = list2->head->next;
|
||||
delete list2->head;
|
||||
@@ -828,7 +837,7 @@ PathList *Octree::combineSinglePath(PathList *&head1,
|
||||
nlist->length = list1->length + list2->length - 1;
|
||||
nlist->head = list1->head;
|
||||
nlist->tail = list2->tail;
|
||||
nlist->next = NULL;
|
||||
nlist->next = nullptr;
|
||||
|
||||
deletePath(head1, pre1, list1);
|
||||
deletePath(head2, pre2, list2);
|
||||
@@ -836,7 +845,7 @@ PathList *Octree::combineSinglePath(PathList *&head1,
|
||||
return nlist;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Octree::deletePath(PathList *&head, PathList *pre, PathList *&curr)
|
||||
@@ -845,7 +854,7 @@ void Octree::deletePath(PathList *&head, PathList *pre, PathList *&curr)
|
||||
curr = temp->next;
|
||||
delete temp;
|
||||
|
||||
if (pre == NULL) {
|
||||
if (pre == nullptr) {
|
||||
head = curr;
|
||||
}
|
||||
else {
|
||||
@@ -855,7 +864,7 @@ void Octree::deletePath(PathList *&head, PathList *pre, PathList *&curr)
|
||||
|
||||
void Octree::printElement(PathElement *ele)
|
||||
{
|
||||
if (ele != NULL) {
|
||||
if (ele != nullptr) {
|
||||
dc_printf("(%d %d %d)", ele->pos[0], ele->pos[1], ele->pos[2]);
|
||||
}
|
||||
}
|
||||
@@ -906,7 +915,7 @@ void Octree::printPath(PathElement *path)
|
||||
void Octree::printPaths(PathList *path)
|
||||
{
|
||||
PathList *iter = path;
|
||||
while (iter != NULL) {
|
||||
while (iter != nullptr) {
|
||||
dc_printf("Path %d:\n", i);
|
||||
printPath(iter);
|
||||
iter = iter->next;
|
||||
@@ -924,7 +933,7 @@ Node *Octree::patch(Node *newnode, int st[3], int len, PathList *rings)
|
||||
PathList* tlist = rings;
|
||||
PathList* ttlist;
|
||||
PathElement* telem, * ttelem;
|
||||
while(tlist!= NULL) {
|
||||
while(tlist!= nullptr) {
|
||||
// printPath(tlist);
|
||||
numRings ++;
|
||||
totRingLengths += tlist->length;
|
||||
@@ -963,7 +972,7 @@ Node *Octree::patch(Node *newnode, int st[3], int len, PathList *rings)
|
||||
len >>= 1;
|
||||
int count = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (zlists[i] != NULL) {
|
||||
if (zlists[i] != nullptr) {
|
||||
int nori[3] = {
|
||||
st[0] + len * vertmap[i][0], st[1] + len * vertmap[i][1], st[2] + len * vertmap[i][2]};
|
||||
patch(newnode->internal.get_child(count), nori, len, zlists[i]);
|
||||
@@ -992,10 +1001,10 @@ Node *Octree::patchSplit(Node *newnode,
|
||||
printPaths(rings);
|
||||
#endif
|
||||
|
||||
nrings1 = NULL;
|
||||
nrings2 = NULL;
|
||||
nrings1 = nullptr;
|
||||
nrings2 = nullptr;
|
||||
PathList *tmp;
|
||||
while (rings != NULL) {
|
||||
while (rings != nullptr) {
|
||||
// Process this ring
|
||||
newnode = patchSplitSingle(newnode, st, len, rings->head, dir, nrings1, nrings2);
|
||||
|
||||
@@ -1029,19 +1038,18 @@ Node *Octree::patchSplitSingle(Node *newnode,
|
||||
printPath(head);
|
||||
#endif
|
||||
|
||||
if (head == NULL) {
|
||||
if (head == nullptr) {
|
||||
#ifdef IN_DEBUG_MODE
|
||||
dc_printf("Return from PATCHSPLITSINGLE with head==NULL.\n");
|
||||
dc_printf("Return from PATCHSPLITSINGLE with head==nullptr.\n");
|
||||
#endif
|
||||
return newnode;
|
||||
}
|
||||
else {
|
||||
// printPath(head);
|
||||
}
|
||||
|
||||
// printPath(head);
|
||||
|
||||
// Walk along the ring to find pair of intersections
|
||||
PathElement *pre1 = NULL;
|
||||
PathElement *pre2 = NULL;
|
||||
PathElement *pre1 = nullptr;
|
||||
PathElement *pre2 = nullptr;
|
||||
int side = findPair(head, st[dir] + len / 2, dir, pre1, pre2);
|
||||
|
||||
#if 0
|
||||
@@ -1084,7 +1092,7 @@ Node *Octree::patchSplitSingle(Node *newnode,
|
||||
if (isEqual(pre1, pre1->next)) {
|
||||
if (pre1 == pre1->next) {
|
||||
delete pre1;
|
||||
pre1 = NULL;
|
||||
pre1 = nullptr;
|
||||
}
|
||||
else {
|
||||
PathElement *temp = pre1->next;
|
||||
@@ -1095,7 +1103,7 @@ Node *Octree::patchSplitSingle(Node *newnode,
|
||||
if (isEqual(pre2, pre2->next)) {
|
||||
if (pre2 == pre2->next) {
|
||||
delete pre2;
|
||||
pre2 = NULL;
|
||||
pre2 = nullptr;
|
||||
}
|
||||
else {
|
||||
PathElement *temp = pre2->next;
|
||||
@@ -1183,10 +1191,10 @@ Node *Octree::connectFace(
|
||||
|
||||
PathElement *curEleN = f1;
|
||||
PathElement *curEleP = f2->next;
|
||||
Node *nodeN = NULL, *nodeP = NULL;
|
||||
Node *nodeN = nullptr, *nodeP = nullptr;
|
||||
LeafNode *curN = locateLeaf(&newnode->internal, len, f1->pos);
|
||||
LeafNode *curP = locateLeaf(&newnode->internal, len, f2->next->pos);
|
||||
if (curN == NULL || curP == NULL) {
|
||||
if (curN == nullptr || curP == nullptr) {
|
||||
exit(0);
|
||||
}
|
||||
int stN[3], stP[3];
|
||||
@@ -1412,7 +1420,7 @@ LeafNode *Octree::patchAdjacent(InternalNode *node,
|
||||
}
|
||||
|
||||
Node *Octree::locateCell(InternalNode *node,
|
||||
int st[3],
|
||||
const int st[3],
|
||||
int len,
|
||||
int ori[3],
|
||||
int dir,
|
||||
@@ -1498,7 +1506,7 @@ Node *Octree::locateCell(InternalNode *node,
|
||||
void Octree::checkElement(PathElement * /*ele*/)
|
||||
{
|
||||
#if 0
|
||||
if (ele != NULL && locateLeafCheck(ele->pos) != ele->node) {
|
||||
if (ele != nullptr && locateLeafCheck(ele->pos) != ele->node) {
|
||||
dc_printf("Screwed! at pos: %d %d %d\n",
|
||||
ele->pos[0] >> minshift,
|
||||
ele->pos[1] >> minshift,
|
||||
@@ -1522,7 +1530,7 @@ void Octree::checkPath(PathElement *path)
|
||||
void Octree::testFacePoint(PathElement *e1, PathElement *e2)
|
||||
{
|
||||
int i;
|
||||
PathElement *e = NULL;
|
||||
PathElement *e = nullptr;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (e1->pos[i] != e2->pos[i]) {
|
||||
if (e1->pos[i] < e2->pos[i]) {
|
||||
@@ -1708,7 +1716,7 @@ int Octree::isEqual(PathElement *e1, PathElement *e2)
|
||||
|
||||
void Octree::compressRing(PathElement *&ring)
|
||||
{
|
||||
if (ring == NULL) {
|
||||
if (ring == nullptr) {
|
||||
return;
|
||||
}
|
||||
#ifdef IN_DEBUG_MODE
|
||||
@@ -1728,20 +1736,18 @@ void Octree::compressRing(PathElement *&ring)
|
||||
// The ring has shrinked to a point
|
||||
delete pre;
|
||||
delete cur;
|
||||
anchor = NULL;
|
||||
anchor = nullptr;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
prepre->next = cur->next;
|
||||
delete pre;
|
||||
delete cur;
|
||||
pre = prepre->next;
|
||||
cur = pre->next;
|
||||
anchor = prepre;
|
||||
}
|
||||
prepre->next = cur->next;
|
||||
delete pre;
|
||||
delete cur;
|
||||
pre = prepre->next;
|
||||
cur = pre->next;
|
||||
anchor = prepre;
|
||||
}
|
||||
|
||||
if (anchor == NULL) {
|
||||
if (anchor == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1787,7 +1793,7 @@ void Octree::buildSigns()
|
||||
|
||||
void Octree::buildSigns(unsigned char table[], Node *node, int isLeaf, int sg, int rvalue[8])
|
||||
{
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
rvalue[i] = sg;
|
||||
}
|
||||
@@ -1864,7 +1870,7 @@ void Octree::clearProcessBits(Node *node, int height)
|
||||
}
|
||||
}
|
||||
|
||||
int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int threshold)
|
||||
int Octree::floodFill(LeafNode *leaf, const int st[3], int len, int /*height*/, int threshold)
|
||||
{
|
||||
int i, j;
|
||||
int maxtotal = 0;
|
||||
@@ -1980,9 +1986,7 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
|
||||
|
||||
if (threshold == 0) {
|
||||
// Measuring stage
|
||||
if (total > maxtotal) {
|
||||
maxtotal = total;
|
||||
}
|
||||
maxtotal = std::max(total, maxtotal);
|
||||
dc_printf(".\n");
|
||||
delete queue;
|
||||
continue;
|
||||
@@ -2112,9 +2116,7 @@ int Octree::floodFill(Node *node, int st[3], int len, int height, int threshold)
|
||||
nst[2] = st[2] + vertmap[i][2] * len;
|
||||
|
||||
int d = floodFill(node->internal.get_child(count), nst, len, height - 1, threshold);
|
||||
if (d > maxtotal) {
|
||||
maxtotal = d;
|
||||
}
|
||||
maxtotal = std::max(d, maxtotal);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -2442,13 +2444,11 @@ void Octree::processEdgeWrite(Node *node[4], int /*depth*/[4], int /*maxdep*/, i
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxdep, int dir)
|
||||
void Octree::edgeProcContour(Node *node[4], const int leaf[4], int depth[4], int maxdep, int dir)
|
||||
{
|
||||
if (!(node[0] && node[1] && node[2] && node[3])) {
|
||||
return;
|
||||
@@ -2463,7 +2463,7 @@ void Octree::edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxde
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
|
||||
node[j]->internal.get_child(node[j]->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2495,7 +2495,8 @@ void Octree::edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxde
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxdep, int dir)
|
||||
void Octree::faceProcContour(
|
||||
Node *node[2], const int leaf[2], const int depth[2], int maxdep, int dir)
|
||||
{
|
||||
if (!(node[0] && node[1])) {
|
||||
return;
|
||||
@@ -2509,7 +2510,7 @@ void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxde
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
|
||||
node[j]->internal.get_child(node[j]->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2567,7 +2568,7 @@ void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxde
|
||||
|
||||
void Octree::cellProcContour(Node *node, int leaf, int depth)
|
||||
{
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2579,7 +2580,7 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[i] = ((!leaf) && node->internal.has_child(i)) ?
|
||||
node->internal.get_child(node->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
|
||||
// 8 Cell calls
|
||||
@@ -2623,7 +2624,7 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::processEdgeParity(LeafNode *node[4], int /*depth*/[4], int /*maxdep*/, int dir)
|
||||
void Octree::processEdgeParity(LeafNode *node[4], const int /*depth*/[4], int /*maxdep*/, int dir)
|
||||
{
|
||||
int con = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -2644,7 +2645,8 @@ void Octree::processEdgeParity(LeafNode *node[4], int /*depth*/[4], int /*maxdep
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep, int dir)
|
||||
void Octree::edgeProcParity(
|
||||
Node *node[4], const int leaf[4], const int depth[4], int maxdep, int dir)
|
||||
{
|
||||
if (!(node[0] && node[1] && node[2] && node[3])) {
|
||||
return;
|
||||
@@ -2659,7 +2661,7 @@ void Octree::edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
|
||||
node[j]->internal.get_child(node[j]->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2693,7 +2695,8 @@ void Octree::edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep, int dir)
|
||||
void Octree::faceProcParity(
|
||||
Node *node[2], const int leaf[2], const int depth[2], int maxdep, int dir)
|
||||
{
|
||||
if (!(node[0] && node[1])) {
|
||||
return;
|
||||
@@ -2707,7 +2710,7 @@ void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
|
||||
node[j]->internal.get_child(node[j]->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2765,7 +2768,7 @@ void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep
|
||||
|
||||
void Octree::cellProcParity(Node *node, int leaf, int depth)
|
||||
{
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2777,7 +2780,7 @@ void Octree::cellProcParity(Node *node, int leaf, int depth)
|
||||
for (i = 0; i < 8; i++) {
|
||||
chd[i] = ((!leaf) && node->internal.has_child(i)) ?
|
||||
node->internal.get_child(node->internal.get_child_count(i)) :
|
||||
NULL;
|
||||
nullptr;
|
||||
}
|
||||
|
||||
// 8 Cell calls
|
||||
|
||||
@@ -9,14 +9,12 @@
|
||||
#include "MemoryAllocator.h"
|
||||
#include "ModelReader.h"
|
||||
#include "Projections.h"
|
||||
#include "Queue.h"
|
||||
#include "cubes.h"
|
||||
#include "dualcon.h"
|
||||
#include "manifold_table.h"
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* Main class and structures for scan-convertion, sign-generation,
|
||||
@@ -107,7 +105,7 @@ struct InternalNode {
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
children[i] = NULL;
|
||||
children[i] = nullptr;
|
||||
leaf[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -255,7 +253,6 @@ class Octree {
|
||||
|
||||
DualConMode mode;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Construtor
|
||||
*/
|
||||
@@ -264,10 +261,10 @@ class Octree {
|
||||
DualConAddVert add_vert_func,
|
||||
DualConAddQuad add_quad_func,
|
||||
DualConFlags flags,
|
||||
DualConMode mode,
|
||||
DualConMode dualcon_mode,
|
||||
int depth,
|
||||
float threshold,
|
||||
float hermite_num);
|
||||
float sharpness);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -308,10 +305,10 @@ class Octree {
|
||||
void resetMinimalEdges();
|
||||
|
||||
void cellProcParity(Node *node, int leaf, int depth);
|
||||
void faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep, int dir);
|
||||
void edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep, int dir);
|
||||
void faceProcParity(Node *node[2], const int leaf[2], const int depth[2], int maxdep, int dir);
|
||||
void edgeProcParity(Node *node[4], const int leaf[4], const int depth[4], int maxdep, int dir);
|
||||
|
||||
void processEdgeParity(LeafNode *node[4], int depths[4], int maxdep, int dir);
|
||||
void processEdgeParity(LeafNode *node[4], const int depths[4], int maxdep, int dir);
|
||||
|
||||
/**
|
||||
* Add triangles to the tree
|
||||
@@ -341,8 +338,13 @@ class Octree {
|
||||
/**
|
||||
* Look for path on the face and add to paths
|
||||
*/
|
||||
void findPaths(
|
||||
Node *node[2], int leaf[2], int depth[2], int *st[2], int maxdep, int dir, PathList *&paths);
|
||||
void findPaths(Node *node[2],
|
||||
const int leaf[2],
|
||||
const int depth[2],
|
||||
int *st[2],
|
||||
int maxdep,
|
||||
int dir,
|
||||
PathList *&paths);
|
||||
/**
|
||||
* Combine two list1 and list2 into list1 using connecting paths list3,
|
||||
* while closed paths are appended to rings
|
||||
@@ -378,7 +380,7 @@ class Octree {
|
||||
PathList *&nrings2);
|
||||
Node *connectFace(Node *node, int st[3], int len, int dir, PathElement *f1, PathElement *f2);
|
||||
Node *locateCell(InternalNode *node,
|
||||
int st[3],
|
||||
const int st[3],
|
||||
int len,
|
||||
int ori[3],
|
||||
int dir,
|
||||
@@ -428,7 +430,7 @@ class Octree {
|
||||
/************************************************************************/
|
||||
void floodFill();
|
||||
void clearProcessBits(Node *node, int height);
|
||||
int floodFill(LeafNode *leaf, int st[3], int len, int height, int threshold);
|
||||
int floodFill(LeafNode *leaf, const int st[3], int len, int height, int threshold);
|
||||
int floodFill(Node *node, int st[3], int len, int height, int threshold);
|
||||
|
||||
/**
|
||||
@@ -444,8 +446,8 @@ class Octree {
|
||||
* op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY
|
||||
*/
|
||||
void cellProcContour(Node *node, int leaf, int depth);
|
||||
void faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxdep, int dir);
|
||||
void edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxdep, int dir);
|
||||
void faceProcContour(Node *node[2], const int leaf[2], const int depth[2], int maxdep, int dir);
|
||||
void edgeProcContour(Node *node[4], const int leaf[4], int depth[4], int maxdep, int dir);
|
||||
void processEdgeWrite(Node *node[4], int depths[4], int maxdep, int dir);
|
||||
|
||||
/* output callbacks/data */
|
||||
@@ -454,7 +456,6 @@ class Octree {
|
||||
DualConAddQuad add_quad;
|
||||
void *output_mesh;
|
||||
|
||||
private:
|
||||
/************ Operators for all nodes ************/
|
||||
|
||||
/** Lookup table */
|
||||
@@ -491,16 +492,11 @@ class Octree {
|
||||
if (height == 0) {
|
||||
return getSign(&node->leaf, index);
|
||||
}
|
||||
else {
|
||||
if (node->internal.has_child(index)) {
|
||||
return getSign(
|
||||
node->internal.get_child(node->internal.get_child_count(index)), height - 1, index);
|
||||
}
|
||||
else {
|
||||
return getSign(
|
||||
node->internal.get_child(0), height - 1, 7 - node->internal.get_child_index(0));
|
||||
}
|
||||
if (node->internal.has_child(index)) {
|
||||
return getSign(
|
||||
node->internal.get_child(node->internal.get_child_count(index)), height - 1, index);
|
||||
}
|
||||
return getSign(node->internal.get_child(0), height - 1, 7 - node->internal.get_child_index(0));
|
||||
}
|
||||
|
||||
/************ Operators for leaf nodes ************/
|
||||
@@ -508,7 +504,7 @@ class Octree {
|
||||
void printInfo(int st[3])
|
||||
{
|
||||
printf("INFO AT: %d %d %d\n", st[0] >> minshift, st[1] >> minshift, st[2] >> minshift);
|
||||
LeafNode *leaf = (LeafNode *)locateLeafCheck(st);
|
||||
LeafNode *leaf = locateLeafCheck(st);
|
||||
if (leaf) {
|
||||
printInfo(leaf);
|
||||
}
|
||||
@@ -563,7 +559,7 @@ class Octree {
|
||||
return leaf->signs;
|
||||
}
|
||||
|
||||
void setInProcessAll(int st[3], int dir)
|
||||
void setInProcessAll(const int st[3], int dir)
|
||||
{
|
||||
int nst[3], eind;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -579,7 +575,7 @@ class Octree {
|
||||
}
|
||||
}
|
||||
|
||||
void flipParityAll(int st[3], int dir)
|
||||
void flipParityAll(const int st[3], int dir)
|
||||
{
|
||||
int nst[3], eind;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -615,7 +611,7 @@ class Octree {
|
||||
}
|
||||
|
||||
/** Generate signs at the corners from the edge parity */
|
||||
void generateSigns(LeafNode *leaf, unsigned char table[], int start)
|
||||
void generateSigns(LeafNode *leaf, const unsigned char table[], int start)
|
||||
{
|
||||
leaf->signs = table[leaf->edge_parity];
|
||||
|
||||
@@ -721,7 +717,7 @@ class Octree {
|
||||
}
|
||||
}
|
||||
|
||||
removeLeaf(num - 1, (LeafNode *)leaf);
|
||||
removeLeaf(num - 1, leaf);
|
||||
leaf = nleaf;
|
||||
}
|
||||
}
|
||||
@@ -776,9 +772,7 @@ class Octree {
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Retrieve number of edges intersected */
|
||||
@@ -819,7 +813,7 @@ class Octree {
|
||||
}
|
||||
|
||||
/** Set multiple edge intersections */
|
||||
void setEdgeOffsets(LeafNode *leaf, float pt[3], int len)
|
||||
void setEdgeOffsets(LeafNode *leaf, const float pt[3], int len)
|
||||
{
|
||||
float *pts = leaf->edge_intersections;
|
||||
for (int i = 0; i < len; i++) {
|
||||
@@ -917,7 +911,7 @@ class Octree {
|
||||
|
||||
/** Retrieve complete edge intersection */
|
||||
void getEdgeIntersectionByIndex(
|
||||
const LeafNode *leaf, int index, int st[3], int len, float pt[3], float nm[3]) const
|
||||
const LeafNode *leaf, int index, const int st[3], int len, float pt[3], float nm[3]) const
|
||||
{
|
||||
int count = getEdgeCount(leaf, index);
|
||||
const float *pts = leaf->edge_intersections;
|
||||
@@ -1041,7 +1035,7 @@ class Octree {
|
||||
// int nstt[3] = {0, 0, 0};
|
||||
// nstt[i] += 1;
|
||||
const LeafNode *node = locateLeafCheck(nst);
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1076,7 +1070,7 @@ class Octree {
|
||||
// int nstt[3] = {1, 1, 1};
|
||||
// nstt[i] -= 1;
|
||||
const LeafNode *node = locateLeafCheck(nst);
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1117,7 +1111,7 @@ class Octree {
|
||||
// int nstt[3] = {0, 0, 0};
|
||||
// nstt[i] += 1;
|
||||
LeafNode *node = locateLeafCheck(nst);
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1146,7 +1140,7 @@ class Octree {
|
||||
// int nstt[3] = {1, 1, 1};
|
||||
// nstt[i] -= 1;
|
||||
LeafNode *node = locateLeafCheck(nst);
|
||||
if (node == NULL) {
|
||||
if (node == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1179,9 +1173,9 @@ class Octree {
|
||||
* Locate a leaf
|
||||
* WARNING: assuming this leaf already exists!
|
||||
*/
|
||||
LeafNode *locateLeaf(int st[3])
|
||||
LeafNode *locateLeaf(const int st[3])
|
||||
{
|
||||
Node *node = (Node *)root;
|
||||
Node *node = root;
|
||||
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
|
||||
int index = (((st[0] >> i) & 1) << 2) | (((st[1] >> i) & 1) << 1) | (((st[2] >> i) & 1));
|
||||
node = node->internal.get_child(node->internal.get_child_count(index));
|
||||
@@ -1190,7 +1184,7 @@ class Octree {
|
||||
return &node->leaf;
|
||||
}
|
||||
|
||||
const LeafNode *locateLeaf(int st[3]) const
|
||||
const LeafNode *locateLeaf(const int st[3]) const
|
||||
{
|
||||
const Node *node = root;
|
||||
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
|
||||
@@ -1201,7 +1195,7 @@ class Octree {
|
||||
return &node->leaf;
|
||||
}
|
||||
|
||||
LeafNode *locateLeaf(InternalNode *parent, int len, int st[3])
|
||||
LeafNode *locateLeaf(InternalNode *parent, int len, const int st[3])
|
||||
{
|
||||
Node *node = (Node *)parent;
|
||||
int index;
|
||||
@@ -1213,13 +1207,13 @@ class Octree {
|
||||
return &node->leaf;
|
||||
}
|
||||
|
||||
LeafNode *locateLeafCheck(int st[3])
|
||||
LeafNode *locateLeafCheck(const int st[3])
|
||||
{
|
||||
Node *node = (Node *)root;
|
||||
Node *node = root;
|
||||
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
|
||||
int index = (((st[0] >> i) & 1) << 2) | (((st[1] >> i) & 1) << 1) | (((st[2] >> i) & 1));
|
||||
if (!node->internal.has_child(index)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
node = node->internal.get_child(node->internal.get_child_count(index));
|
||||
}
|
||||
@@ -1227,13 +1221,13 @@ class Octree {
|
||||
return &node->leaf;
|
||||
}
|
||||
|
||||
const LeafNode *locateLeafCheck(int st[3]) const
|
||||
const LeafNode *locateLeafCheck(const int st[3]) const
|
||||
{
|
||||
const Node *node = root;
|
||||
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
|
||||
int index = (((st[0] >> i) & 1) << 2) | (((st[1] >> i) & 1) << 1) | (((st[2] >> i) & 1));
|
||||
if (!node->internal.has_child(index)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
node = node->internal.get_child(node->internal.get_child_count(index));
|
||||
}
|
||||
@@ -1241,10 +1235,10 @@ class Octree {
|
||||
return &node->leaf;
|
||||
}
|
||||
|
||||
InternalNode *locateParent(int len, int st[3], int &count)
|
||||
InternalNode *locateParent(int len, const int st[3], int &count)
|
||||
{
|
||||
InternalNode *node = (InternalNode *)root;
|
||||
InternalNode *pre = NULL;
|
||||
InternalNode *pre = nullptr;
|
||||
int index = 0;
|
||||
for (int i = dimen / 2; i >= len; i >>= 1) {
|
||||
index = (((st[0] & i) ? 4 : 0) | ((st[1] & i) ? 2 : 0) | ((st[2] & i) ? 1 : 0));
|
||||
@@ -1256,10 +1250,10 @@ class Octree {
|
||||
return pre;
|
||||
}
|
||||
|
||||
InternalNode *locateParent(InternalNode *parent, int len, int st[3], int &count)
|
||||
InternalNode *locateParent(InternalNode *parent, int len, const int st[3], int &count)
|
||||
{
|
||||
InternalNode *node = parent;
|
||||
InternalNode *pre = NULL;
|
||||
InternalNode *pre = nullptr;
|
||||
int index = 0;
|
||||
for (int i = len / 2; i >= mindimen; i >>= 1) {
|
||||
index = (((st[0] & i) ? 4 : 0) | ((st[1] & i) ? 2 : 0) | ((st[2] & i) ? 1 : 0));
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
/* Eigen data structures */
|
||||
|
||||
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> EigenSparseMatrix;
|
||||
typedef Eigen::SparseLU<EigenSparseMatrix> EigenSparseLU;
|
||||
typedef Eigen::VectorXd EigenVectorX;
|
||||
typedef Eigen::Triplet<double> EigenTriplet;
|
||||
using EigenSparseMatrix = Eigen::SparseMatrix<double, Eigen::ColMajor>;
|
||||
using EigenSparseLU = Eigen::SparseLU<EigenSparseMatrix>;
|
||||
using EigenVectorX = Eigen::VectorXd;
|
||||
using EigenTriplet = Eigen::Triplet<double>;
|
||||
|
||||
/* Linear Solver data structure */
|
||||
|
||||
@@ -63,7 +63,7 @@ struct LinearSolver {
|
||||
state = STATE_VARIABLES_CONSTRUCT;
|
||||
m = 0;
|
||||
n = 0;
|
||||
sparseLU = NULL;
|
||||
sparseLU = nullptr;
|
||||
num_variables = num_variables_;
|
||||
num_rhs = num_rhs_;
|
||||
num_rows = num_rows_;
|
||||
@@ -99,14 +99,16 @@ struct LinearSolver {
|
||||
bool least_squares;
|
||||
};
|
||||
|
||||
LinearSolver *EIG_linear_solver_new(int num_rows, int num_columns, int num_rhs)
|
||||
LinearSolver *EIG_linear_solver_new(int num_rows, int num_columns, int num_right_hand_sides)
|
||||
{
|
||||
return new LinearSolver(num_rows, num_columns, num_rhs, false);
|
||||
return new LinearSolver(num_rows, num_columns, num_right_hand_sides, false);
|
||||
}
|
||||
|
||||
LinearSolver *EIG_linear_least_squares_solver_new(int num_rows, int num_columns, int num_rhs)
|
||||
LinearSolver *EIG_linear_least_squares_solver_new(int num_rows,
|
||||
int num_columns,
|
||||
int num_right_hand_sides)
|
||||
{
|
||||
return new LinearSolver(num_rows, num_columns, num_rhs, true);
|
||||
return new LinearSolver(num_rows, num_columns, num_right_hand_sides, true);
|
||||
}
|
||||
|
||||
void EIG_linear_solver_delete(LinearSolver *solver)
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Solvers for Ax = b and AtAx = Atb */
|
||||
|
||||
typedef struct LinearSolver LinearSolver;
|
||||
struct LinearSolver;
|
||||
|
||||
LinearSolver *EIG_linear_solver_new(int num_rows, int num_columns, int num_right_hand_sides);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
|
||||
bool invertible = true;
|
||||
M.computeInverseWithCheck(R, invertible, 0.0f);
|
||||
if (!invertible) {
|
||||
R = R.Zero();
|
||||
R = Matrix4f::Zero();
|
||||
}
|
||||
memcpy(inverse, R.data(), sizeof(float) * 4 * 4);
|
||||
return invertible;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "GHOST_Types.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -21,7 +19,7 @@ extern "C" {
|
||||
* \param event: The event received.
|
||||
* \param user_data: The callback's user data, supplied to #GHOST_CreateSystem.
|
||||
*/
|
||||
typedef bool (*GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDataPtr user_data);
|
||||
using GHOST_EventCallbackProcPtr = bool (*)(GHOST_EventHandle event, GHOST_TUserDataPtr user_data);
|
||||
|
||||
/**
|
||||
* Creates the one and only system.
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "GHOST_Types.h"
|
||||
|
||||
#ifdef WITH_VULKAN_BACKEND
|
||||
# include <functional>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Interface for GHOST context.
|
||||
*
|
||||
@@ -25,7 +27,7 @@ class GHOST_IContext {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_IContext() {}
|
||||
virtual ~GHOST_IContext() = default;
|
||||
|
||||
/**
|
||||
* Activates the drawing context.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "GHOST_Types.h"
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
class GHOST_IWindow;
|
||||
|
||||
@@ -29,7 +29,7 @@ class GHOST_IEvent {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_IEvent() {}
|
||||
virtual ~GHOST_IEvent() = default;
|
||||
|
||||
/**
|
||||
* Returns the event type.
|
||||
|
||||
@@ -24,7 +24,7 @@ class GHOST_IEventConsumer {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_IEventConsumer() {}
|
||||
virtual ~GHOST_IEventConsumer() = default;
|
||||
|
||||
/**
|
||||
* This method is called by the system when it has events to dispatch.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "GHOST_IContext.hh"
|
||||
#include "GHOST_ITimerTask.hh"
|
||||
@@ -161,7 +161,7 @@ class GHOST_ISystem {
|
||||
* Destructor.
|
||||
* Protected default constructor to force use of static dispose member.
|
||||
*/
|
||||
virtual ~GHOST_ISystem() {}
|
||||
virtual ~GHOST_ISystem() = default;
|
||||
|
||||
public:
|
||||
/***************************************************************************************
|
||||
@@ -486,7 +486,7 @@ class GHOST_ISystem {
|
||||
/**
|
||||
* Returns GHOST_kSuccess if the clipboard contains an image.
|
||||
*/
|
||||
virtual GHOST_TSuccess hasClipboardImage(void) const = 0;
|
||||
virtual GHOST_TSuccess hasClipboardImage() const = 0;
|
||||
|
||||
/**
|
||||
* Get image data from the Clipboard
|
||||
|
||||
@@ -41,7 +41,7 @@ class GHOST_ISystemPaths {
|
||||
* Destructor.
|
||||
* Protected default constructor to force use of static dispose member.
|
||||
*/
|
||||
virtual ~GHOST_ISystemPaths() {}
|
||||
virtual ~GHOST_ISystemPaths() = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ class GHOST_ITimerTask {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_ITimerTask() {}
|
||||
virtual ~GHOST_ITimerTask() = default;
|
||||
|
||||
/**
|
||||
* Returns the timer callback.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "GHOST_Rect.hh"
|
||||
#include "GHOST_Types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
class GHOST_IContext;
|
||||
@@ -36,7 +36,7 @@ class GHOST_IWindow {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_IWindow() {}
|
||||
virtual ~GHOST_IWindow() = default;
|
||||
|
||||
/**
|
||||
* Returns indication as to whether the window is valid.
|
||||
|
||||
@@ -34,7 +34,7 @@ class GHOST_Rect {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_Rect() {}
|
||||
virtual ~GHOST_Rect() = default;
|
||||
|
||||
/**
|
||||
* Access to rectangle width.
|
||||
|
||||
@@ -75,4 +75,4 @@ void GHOST_Buttons::clear()
|
||||
m_Button7 = false;
|
||||
}
|
||||
|
||||
GHOST_Buttons::~GHOST_Buttons() {}
|
||||
GHOST_Buttons::~GHOST_Buttons() = default;
|
||||
|
||||
@@ -46,11 +46,9 @@ void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug)
|
||||
system->initDebug(debug);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
||||
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle /*systemhandle*/)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||
|
||||
return system->disposeSystem();
|
||||
return GHOST_ISystem::disposeSystem();
|
||||
}
|
||||
|
||||
#if !(defined(WIN32) || defined(__APPLE__))
|
||||
@@ -771,7 +769,7 @@ GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
|
||||
void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||
return system->setMultitouchGestures(use);
|
||||
system->setMultitouchGestures(use);
|
||||
}
|
||||
|
||||
void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
|
||||
@@ -947,7 +945,7 @@ void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn)
|
||||
void GHOST_UseWindowFocus(bool use_focus)
|
||||
{
|
||||
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||
return system->useWindowFocus(use_focus);
|
||||
system->useWindowFocus(use_focus);
|
||||
}
|
||||
|
||||
void GHOST_SetAutoFocus(bool auto_focus)
|
||||
|
||||
@@ -29,14 +29,14 @@ class GHOST_CallbackEventConsumer : public GHOST_IEventConsumer {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_CallbackEventConsumer() {}
|
||||
~GHOST_CallbackEventConsumer() override = default;
|
||||
|
||||
/**
|
||||
* This method is called by an event producer when an event is available.
|
||||
* \param event: The event that can be handled or ignored.
|
||||
* \return Indication as to whether the event was handled.
|
||||
*/
|
||||
bool processEvent(const GHOST_IEvent *event);
|
||||
bool processEvent(const GHOST_IEvent *event) override;
|
||||
|
||||
protected:
|
||||
/** The call-back routine invoked. */
|
||||
|
||||
@@ -25,25 +25,25 @@ class GHOST_Context : public GHOST_IContext {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_Context() {}
|
||||
~GHOST_Context() override = default;
|
||||
|
||||
/**
|
||||
* Swaps front and back buffers of a window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
virtual GHOST_TSuccess swapBuffers() override = 0;
|
||||
GHOST_TSuccess swapBuffers() override = 0;
|
||||
|
||||
/**
|
||||
* Activates the drawing context of this window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
virtual GHOST_TSuccess activateDrawingContext() override = 0;
|
||||
GHOST_TSuccess activateDrawingContext() override = 0;
|
||||
|
||||
/**
|
||||
* Release the drawing context of the calling thread.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
virtual GHOST_TSuccess releaseDrawingContext() override = 0;
|
||||
GHOST_TSuccess releaseDrawingContext() override = 0;
|
||||
|
||||
/**
|
||||
* Call immediately after new to initialize. If this fails then immediately delete the object.
|
||||
@@ -82,7 +82,7 @@ class GHOST_Context : public GHOST_IContext {
|
||||
* \param intervalOut: Variable to store the swap interval if it can be read.
|
||||
* \return Whether the swap interval can be read.
|
||||
*/
|
||||
virtual GHOST_TSuccess getSwapInterval(int &)
|
||||
virtual GHOST_TSuccess getSwapInterval(int & /*interval*/)
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class GHOST_Context : public GHOST_IContext {
|
||||
* ie quad buffered stereo. This is not always possible, depends on
|
||||
* the graphics h/w
|
||||
*/
|
||||
inline bool isStereoVisual() const
|
||||
bool isStereoVisual() const
|
||||
{
|
||||
return m_stereoVisual;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ class GHOST_Context : public GHOST_IContext {
|
||||
/**
|
||||
* Returns if the context is rendered upside down compared to OpenGL.
|
||||
*/
|
||||
virtual inline bool isUpsideDown() const
|
||||
virtual bool isUpsideDown() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class GHOST_Context : public GHOST_IContext {
|
||||
* Gets the OpenGL frame-buffer associated with the OpenGL context
|
||||
* \return The ID of an OpenGL frame-buffer object.
|
||||
*/
|
||||
virtual unsigned int getDefaultFramebuffer() override
|
||||
unsigned int getDefaultFramebuffer() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,38 +22,38 @@ class GHOST_ContextD3D : public GHOST_Context {
|
||||
|
||||
public:
|
||||
GHOST_ContextD3D(bool stereoVisual, HWND hWnd);
|
||||
~GHOST_ContextD3D();
|
||||
~GHOST_ContextD3D() override;
|
||||
|
||||
/**
|
||||
* Swaps front and back buffers of a window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess swapBuffers();
|
||||
GHOST_TSuccess swapBuffers() override;
|
||||
|
||||
/**
|
||||
* Activates the drawing context of this window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess activateDrawingContext();
|
||||
GHOST_TSuccess activateDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Release the drawing context of the calling thread.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess releaseDrawingContext();
|
||||
GHOST_TSuccess releaseDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Call immediately after new to initialize. If this fails then immediately delete the object.
|
||||
* \return Indication as to whether initialization has succeeded.
|
||||
*/
|
||||
GHOST_TSuccess initializeDrawingContext();
|
||||
GHOST_TSuccess initializeDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Updates the drawing context of this window. Needed
|
||||
* whenever the window is changed.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess updateDrawingContext()
|
||||
GHOST_TSuccess updateDrawingContext() override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -62,14 +62,14 @@ class GHOST_ContextD3D : public GHOST_Context {
|
||||
* Checks if it is OK for a remove the native display
|
||||
* \return Indication as to whether removal has succeeded.
|
||||
*/
|
||||
GHOST_TSuccess releaseNativeHandles();
|
||||
GHOST_TSuccess releaseNativeHandles() override;
|
||||
|
||||
/**
|
||||
* Sets the swap interval for #swapBuffers.
|
||||
* \param interval: The swap interval to use.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess setSwapInterval(int /*interval*/)
|
||||
GHOST_TSuccess setSwapInterval(int /*interval*/) override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class GHOST_ContextD3D : public GHOST_Context {
|
||||
* \param intervalOut: Variable to store the swap interval if it can be read.
|
||||
* \return Whether the swap interval can be read.
|
||||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &)
|
||||
GHOST_TSuccess getSwapInterval(int & /*unused*/) override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class GHOST_ContextD3D : public GHOST_Context {
|
||||
* Gets the OpenGL frame-buffer associated with the OpenGL context
|
||||
* \return The ID of an OpenGL frame-buffer object.
|
||||
*/
|
||||
unsigned int getDefaultFramebuffer()
|
||||
unsigned int getDefaultFramebuffer() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class GHOST_ContextD3D : public GHOST_Context {
|
||||
unsigned int height);
|
||||
ID3D11Texture2D *getSharedTexture2D(class GHOST_SharedOpenGLResource *shared_res);
|
||||
|
||||
bool isUpsideDown() const
|
||||
bool isUpsideDown() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
class GHOST_ContextNone : public GHOST_Context {
|
||||
public:
|
||||
GHOST_ContextNone(bool stereoVisual) : GHOST_Context(stereoVisual), m_swapInterval(1) {}
|
||||
GHOST_ContextNone(bool stereoVisual) : GHOST_Context(stereoVisual) {}
|
||||
|
||||
/**
|
||||
* Dummy function
|
||||
@@ -66,5 +66,5 @@ class GHOST_ContextNone : public GHOST_Context {
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut) override;
|
||||
|
||||
private:
|
||||
int m_swapInterval;
|
||||
int m_swapInterval = 1;
|
||||
};
|
||||
|
||||
@@ -10,10 +10,7 @@
|
||||
|
||||
#include "GHOST_ContextSDL.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
SDL_GLContext GHOST_ContextSDL::s_sharedContext = nullptr;
|
||||
|
||||
@@ -605,7 +605,7 @@ GHOST_TSuccess GHOST_ContextVK::swapBuffers()
|
||||
}
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
else if (result != VK_SUCCESS) {
|
||||
if (result != VK_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"Error: Failed to present swap chain image : %s\n",
|
||||
vulkan_error_as_string(result));
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
# define GHOST_OPENGL_VK_RESET_NOTIFICATION_STRATEGY 0
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
enum GHOST_TVulkanPlatformType {
|
||||
GHOST_kVulkanPlatformHeadless = 0,
|
||||
#ifdef WITH_GHOST_X11
|
||||
GHOST_kVulkanPlatformX11 = 1,
|
||||
@@ -52,7 +52,7 @@ typedef enum {
|
||||
#ifdef WITH_GHOST_WAYLAND
|
||||
GHOST_kVulkanPlatformWayland = 2,
|
||||
#endif
|
||||
} GHOST_TVulkanPlatformType;
|
||||
};
|
||||
|
||||
struct GHOST_ContextVK_WindowInfo {
|
||||
int size[2];
|
||||
@@ -87,7 +87,7 @@ class GHOST_ContextVK : public GHOST_Context {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_ContextVK();
|
||||
~GHOST_ContextVK() override;
|
||||
|
||||
/**
|
||||
* Swaps front and back buffers of a window.
|
||||
|
||||
@@ -39,52 +39,52 @@ class GHOST_ContextWGL : public GHOST_Context {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_ContextWGL();
|
||||
~GHOST_ContextWGL() override;
|
||||
|
||||
/**
|
||||
* Swaps front and back buffers of a window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess swapBuffers();
|
||||
GHOST_TSuccess swapBuffers() override;
|
||||
|
||||
/**
|
||||
* Activates the drawing context of this window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess activateDrawingContext();
|
||||
GHOST_TSuccess activateDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Release the drawing context of the calling thread.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess releaseDrawingContext();
|
||||
GHOST_TSuccess releaseDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Call immediately after new to initialize. If this fails then immediately delete the object.
|
||||
* \return Indication as to whether initialization has succeeded.
|
||||
*/
|
||||
GHOST_TSuccess initializeDrawingContext();
|
||||
GHOST_TSuccess initializeDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Removes references to native handles from this context and then returns
|
||||
* \return GHOST_kSuccess if it is OK for the parent to release the handles and
|
||||
* GHOST_kFailure if releasing the handles will interfere with sharing
|
||||
*/
|
||||
GHOST_TSuccess releaseNativeHandles();
|
||||
GHOST_TSuccess releaseNativeHandles() override;
|
||||
|
||||
/**
|
||||
* Sets the swap interval for #swapBuffers.
|
||||
* \param interval: The swap interval to use.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
GHOST_TSuccess setSwapInterval(int interval);
|
||||
GHOST_TSuccess setSwapInterval(int interval) override;
|
||||
|
||||
/**
|
||||
* Gets the current swap interval for #swapBuffers.
|
||||
* \param intervalOut: Variable to store the swap interval if it can be read.
|
||||
* \return Whether the swap interval can be read.
|
||||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut);
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut) override;
|
||||
|
||||
private:
|
||||
int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <cstdio> /* For `printf()`. */
|
||||
#include <iostream>
|
||||
#include <stdio.h> /* For `printf()`. */
|
||||
|
||||
#if defined(WITH_GHOST_DEBUG)
|
||||
# define GHOST_PRINT(x) \
|
||||
@@ -51,7 +51,7 @@
|
||||
#endif /* `!defined(WITH_GHOST_DEBUG)` */
|
||||
|
||||
#ifdef WITH_ASSERT_ABORT
|
||||
# include <stdlib.h> //for abort()
|
||||
# include <cstdlib> //for abort()
|
||||
# define GHOST_ASSERT(x, info) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
GHOST_DisplayManager::GHOST_DisplayManager() : m_settingsInitialized(false) {}
|
||||
|
||||
GHOST_DisplayManager::~GHOST_DisplayManager() {}
|
||||
GHOST_DisplayManager::~GHOST_DisplayManager() = default;
|
||||
|
||||
GHOST_TSuccess GHOST_DisplayManager::initialize()
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ class GHOST_DisplayManager {
|
||||
const GHOST_DisplaySetting &setting);
|
||||
|
||||
protected:
|
||||
typedef std::vector<GHOST_DisplaySetting> GHOST_DisplaySettings;
|
||||
using GHOST_DisplaySettings = std::vector<GHOST_DisplaySetting>;
|
||||
|
||||
/**
|
||||
* Finds the best display settings match.
|
||||
|
||||
@@ -30,7 +30,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
||||
* \param numDisplays: The number of displays on this system.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const override;
|
||||
|
||||
/**
|
||||
* Returns the number of display settings for this display device.
|
||||
@@ -38,7 +38,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
||||
* \param numSetting: The number of settings of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const override;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
@@ -49,7 +49,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
||||
*/
|
||||
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||
int32_t index,
|
||||
GHOST_DisplaySetting &setting) const;
|
||||
GHOST_DisplaySetting &setting) const override;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
@@ -57,7 +57,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
||||
* \param setting: The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display,
|
||||
GHOST_DisplaySetting &setting) const override;
|
||||
|
||||
/**
|
||||
* Changes the current setting for this display device.
|
||||
@@ -65,7 +66,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
||||
* \param setting: The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display,
|
||||
const GHOST_DisplaySetting &setting) override;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
||||
* \param numDisplays: The number of displays on this system.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const override;
|
||||
|
||||
/**
|
||||
* Returns the number of display settings for this display device.
|
||||
@@ -36,7 +36,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
||||
* \param numSetting: The number of settings of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const override;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
@@ -47,7 +47,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
||||
*/
|
||||
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||
int32_t index,
|
||||
GHOST_DisplaySetting &setting) const;
|
||||
GHOST_DisplaySetting &setting) const override;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
@@ -55,7 +55,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
||||
* \param setting: The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display,
|
||||
GHOST_DisplaySetting &setting) const override;
|
||||
|
||||
/**
|
||||
* Changes the current setting for this display device.
|
||||
@@ -63,7 +64,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
||||
* \param setting: The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display,
|
||||
const GHOST_DisplaySetting &setting) override;
|
||||
|
||||
private:
|
||||
GHOST_SystemX11 *m_system;
|
||||
|
||||
@@ -23,7 +23,7 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
* \param window: The generating window (or nullptr if system event).
|
||||
*/
|
||||
GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
|
||||
: m_type(type), m_time(msec), m_window(window), m_data(nullptr)
|
||||
: m_type(type), m_time(msec), m_window(window)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
* Returns the event type.
|
||||
* \return The event type.
|
||||
*/
|
||||
GHOST_TEventType getType() const
|
||||
GHOST_TEventType getType() const override
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
* Returns the time this event was generated.
|
||||
* \return The event generation time.
|
||||
*/
|
||||
uint64_t getTime() const
|
||||
uint64_t getTime() const override
|
||||
{
|
||||
return m_time;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
* or nullptr if it is a 'system' event.
|
||||
* \return The generating window.
|
||||
*/
|
||||
GHOST_IWindow *getWindow() const
|
||||
GHOST_IWindow *getWindow() const override
|
||||
{
|
||||
return m_window;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
* Returns the event data.
|
||||
* \return The event data.
|
||||
*/
|
||||
GHOST_TEventDataPtr getData() const
|
||||
GHOST_TEventDataPtr getData() const override
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
@@ -72,5 +72,5 @@ class GHOST_Event : public GHOST_IEvent {
|
||||
/** Pointer to the generating window. */
|
||||
GHOST_IWindow *m_window;
|
||||
/** Pointer to the event data. */
|
||||
GHOST_TEventDataPtr m_data;
|
||||
GHOST_TEventDataPtr m_data = nullptr;
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
|
||||
m_data = &m_dragnDropEventData;
|
||||
}
|
||||
|
||||
~GHOST_EventDragnDrop()
|
||||
~GHOST_EventDragnDrop() override
|
||||
{
|
||||
/* Free the dropped object data. */
|
||||
if (m_dragnDropEventData.data == nullptr) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "GHOST_Event.hh"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "GHOST_Debug.hh"
|
||||
#include <algorithm>
|
||||
|
||||
GHOST_EventManager::GHOST_EventManager() {}
|
||||
GHOST_EventManager::GHOST_EventManager() = default;
|
||||
|
||||
GHOST_EventManager::~GHOST_EventManager()
|
||||
{
|
||||
|
||||
@@ -108,14 +108,14 @@ class GHOST_EventManager {
|
||||
void disposeEvents();
|
||||
|
||||
/** A stack with events. */
|
||||
typedef std::deque<const GHOST_IEvent *> TEventStack;
|
||||
using TEventStack = std::deque<const GHOST_IEvent *>;
|
||||
|
||||
/** The event stack. */
|
||||
std::deque<const GHOST_IEvent *> m_events;
|
||||
std::deque<const GHOST_IEvent *> m_handled_events;
|
||||
|
||||
/** A vector with event consumers. */
|
||||
typedef std::vector<GHOST_IEventConsumer *> TConsumerVector;
|
||||
using TConsumerVector = std::vector<GHOST_IEventConsumer *>;
|
||||
|
||||
/** The list with event consumers. */
|
||||
TConsumerVector m_consumers;
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
/* For now only used with NDOF. */
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
static const char *getButtonActionString(const GHOST_TButtonAction action)
|
||||
|
||||
@@ -22,7 +22,7 @@ class GHOST_EventPrinter : public GHOST_IEventConsumer {
|
||||
* \param event: The event that can be handled or not.
|
||||
* \return Indication as to whether the event was handled.
|
||||
*/
|
||||
bool processEvent(const GHOST_IEvent *event);
|
||||
bool processEvent(const GHOST_IEvent *event) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ class GHOST_EventString : public GHOST_Event {
|
||||
m_data = data_ptr;
|
||||
}
|
||||
|
||||
~GHOST_EventString()
|
||||
~GHOST_EventString() override
|
||||
{
|
||||
if (m_data) {
|
||||
free((void *)m_data);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* Copyright (C) 2001 NaN Technologies B.V.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#include "GHOST_ISystem.hh"
|
||||
|
||||
@@ -18,7 +18,7 @@ GHOST_ModifierKeys::GHOST_ModifierKeys()
|
||||
clear();
|
||||
}
|
||||
|
||||
GHOST_ModifierKeys::~GHOST_ModifierKeys() {}
|
||||
GHOST_ModifierKeys::~GHOST_ModifierKeys() = default;
|
||||
|
||||
GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKey mask)
|
||||
{
|
||||
|
||||
@@ -600,8 +600,9 @@ void GHOST_NDOFManager::updateButtonsArray(NDOF_Button_Array buttons,
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!found) {
|
||||
updateButton(cached_button, false, time);
|
||||
}
|
||||
}
|
||||
|
||||
/* Find pressed buttons */
|
||||
@@ -614,8 +615,9 @@ void GHOST_NDOFManager::updateButtonsArray(NDOF_Button_Array buttons,
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!found) {
|
||||
updateButton(button, true, time);
|
||||
}
|
||||
}
|
||||
cache = buttons;
|
||||
}
|
||||
@@ -632,10 +634,8 @@ static CLG_LogRef LOG_NDOF_MOTION = {"ghost.ndof.motion"};
|
||||
|
||||
void GHOST_NDOFManager::setDeadZone(float dz)
|
||||
{
|
||||
if (dz < 0.0f) {
|
||||
/* Negative values don't make sense, so clamp at zero. */
|
||||
dz = 0.0f;
|
||||
}
|
||||
/* Negative values don't make sense, so clamp at zero. */
|
||||
dz = std::max(dz, 0.0f);
|
||||
motion_dead_zone_ = dz;
|
||||
|
||||
/* Warn the rogue user/developer about high dead-zone, but allow it. */
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
typedef enum {
|
||||
enum NDOF_DeviceT {
|
||||
NDOF_UnknownDevice = 0,
|
||||
|
||||
/* Current devices. */
|
||||
@@ -31,16 +31,16 @@ typedef enum {
|
||||
NDOF_Spaceball5000,
|
||||
NDOF_SpaceTraveler
|
||||
|
||||
} NDOF_DeviceT;
|
||||
};
|
||||
|
||||
typedef std::array<GHOST_NDOF_ButtonT, 6> NDOF_Button_Array;
|
||||
using NDOF_Button_Array = std::array<GHOST_NDOF_ButtonT, 6>;
|
||||
|
||||
typedef enum { ShortButton, LongButton } NDOF_Button_Type;
|
||||
enum NDOF_Button_Type { ShortButton, LongButton };
|
||||
|
||||
class GHOST_NDOFManager {
|
||||
public:
|
||||
GHOST_NDOFManager(GHOST_System &);
|
||||
virtual ~GHOST_NDOFManager() {}
|
||||
virtual ~GHOST_NDOFManager() = default;
|
||||
|
||||
/**
|
||||
* Whether multi-axis functionality is available (via the OS or driver)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
class GHOST_NDOFManagerUnix : public GHOST_NDOFManager {
|
||||
public:
|
||||
GHOST_NDOFManagerUnix(GHOST_System &);
|
||||
~GHOST_NDOFManagerUnix();
|
||||
bool available();
|
||||
~GHOST_NDOFManagerUnix() override;
|
||||
bool available() override;
|
||||
bool processEvents();
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
class GHOST_NDOFManagerWin32 : public GHOST_NDOFManager {
|
||||
public:
|
||||
GHOST_NDOFManagerWin32(GHOST_System &);
|
||||
bool available();
|
||||
bool available() override;
|
||||
};
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
* \ingroup GHOST
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "GHOST_ISystemPaths.hh"
|
||||
#include "GHOST_Path-api.hh"
|
||||
#include "GHOST_ISystemPaths.hh"
|
||||
#include "GHOST_Types.h"
|
||||
#include "intern/GHOST_Debug.hh"
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
#include "GHOST_System.hh"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdio> /* Just for #printf. */
|
||||
|
||||
#include "GHOST_DisplayManager.hh"
|
||||
#include "GHOST_EventManager.hh"
|
||||
#include "GHOST_TimerManager.hh"
|
||||
@@ -44,7 +41,7 @@ GHOST_System::~GHOST_System()
|
||||
exit();
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_System::hasClipboardImage(void) const
|
||||
GHOST_TSuccess GHOST_System::hasClipboardImage() const
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -343,7 +340,7 @@ GHOST_TTabletAPI GHOST_System::getTabletAPI()
|
||||
return m_tabletAPI;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_System::getPixelAtCursor(float[3] /*r_color*/) const
|
||||
GHOST_TSuccess GHOST_System::getPixelAtCursor(float /*r_color*/[3]) const
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* Destructor.
|
||||
* Protected default constructor to force use of static dispose member.
|
||||
*/
|
||||
virtual ~GHOST_System();
|
||||
~GHOST_System() override;
|
||||
|
||||
public:
|
||||
/***************************************************************************************
|
||||
@@ -69,14 +69,14 @@ class GHOST_System : public GHOST_ISystem {
|
||||
GHOST_ITimerTask *installTimer(uint64_t delay,
|
||||
uint64_t interval,
|
||||
GHOST_TimerProcPtr timerProc,
|
||||
GHOST_TUserDataPtr userData = nullptr);
|
||||
GHOST_TUserDataPtr userData = nullptr) override;
|
||||
|
||||
/**
|
||||
* Removes a timer.
|
||||
* \param timerTask: Timer task to be removed.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask);
|
||||
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask) override;
|
||||
|
||||
/***************************************************************************************
|
||||
* Display/window management functionality
|
||||
@@ -87,21 +87,21 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param window: Pointer to the window to be disposed.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess disposeWindow(GHOST_IWindow *window);
|
||||
GHOST_TSuccess disposeWindow(GHOST_IWindow *window) override;
|
||||
|
||||
/**
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
virtual GHOST_IContext *createOffscreenContext(GHOST_GPUSettings gpuSettings) = 0;
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GPUSettings gpuSettings) override = 0;
|
||||
|
||||
/**
|
||||
* Returns whether a window is valid.
|
||||
* \param window: Pointer to the window to be checked.
|
||||
* \return Indication of validity.
|
||||
*/
|
||||
bool validWindow(GHOST_IWindow *window);
|
||||
bool validWindow(GHOST_IWindow *window) override;
|
||||
|
||||
/**
|
||||
* Begins full screen mode.
|
||||
@@ -113,7 +113,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
*/
|
||||
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting,
|
||||
GHOST_IWindow **window,
|
||||
const bool stereoVisual);
|
||||
const bool stereoVisual) override;
|
||||
|
||||
/**
|
||||
* Updates the resolution while in full-screen mode.
|
||||
@@ -122,38 +122,39 @@ class GHOST_System : public GHOST_ISystem {
|
||||
*
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window);
|
||||
GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting &setting,
|
||||
GHOST_IWindow **window) override;
|
||||
|
||||
/**
|
||||
* Ends full screen mode.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess endFullScreen();
|
||||
GHOST_TSuccess endFullScreen() override;
|
||||
|
||||
/**
|
||||
* Returns current full screen mode status.
|
||||
* \return The current status.
|
||||
*/
|
||||
bool getFullScreen();
|
||||
bool getFullScreen() override;
|
||||
|
||||
/**
|
||||
* Native pixel size support (MacBook 'retina').
|
||||
* \return The pixel size in float.
|
||||
*/
|
||||
bool useNativePixel();
|
||||
bool useNativePixel() override;
|
||||
bool m_nativePixel;
|
||||
|
||||
/**
|
||||
* Focus window after opening, or put them in the background.
|
||||
*/
|
||||
void useWindowFocus(const bool use_focus);
|
||||
void useWindowFocus(const bool use_focus) override;
|
||||
|
||||
bool m_windowFocus;
|
||||
|
||||
/**
|
||||
* Focus and raise windows on mouse hover.
|
||||
*/
|
||||
void setAutoFocus(const bool auto_focus);
|
||||
void setAutoFocus(const bool auto_focus) override;
|
||||
bool m_autoFocus;
|
||||
|
||||
/**
|
||||
@@ -162,7 +163,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param y: The y-coordinate of the cursor.
|
||||
* \return The window under the cursor or nullptr if none.
|
||||
*/
|
||||
GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y);
|
||||
GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y) override;
|
||||
|
||||
/***************************************************************************************
|
||||
* Event management functionality
|
||||
@@ -178,21 +179,21 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* Dispatches all the events on the stack.
|
||||
* The event stack will be empty afterwards.
|
||||
*/
|
||||
void dispatchEvents();
|
||||
void dispatchEvents() override;
|
||||
|
||||
/**
|
||||
* Adds the given event consumer to our list.
|
||||
* \param consumer: The event consumer to add.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer);
|
||||
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer) override;
|
||||
|
||||
/**
|
||||
* Remove the given event consumer to our list.
|
||||
* \param consumer: The event consumer to remove.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer);
|
||||
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer) override;
|
||||
|
||||
/***************************************************************************************
|
||||
* Cursor management functionality
|
||||
@@ -204,8 +205,10 @@ class GHOST_System : public GHOST_ISystem {
|
||||
|
||||
GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window,
|
||||
int32_t &x,
|
||||
int32_t &y) const;
|
||||
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y);
|
||||
int32_t &y) const override;
|
||||
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window,
|
||||
int32_t x,
|
||||
int32_t y) override;
|
||||
|
||||
/**
|
||||
* Inherited from GHOST_ISystem but left pure virtual
|
||||
@@ -225,7 +228,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param isDown: The state of a modifier key (true == pressed).
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const;
|
||||
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const override;
|
||||
|
||||
/**
|
||||
* Returns the state of a mouse button (outside the message queue).
|
||||
@@ -233,19 +236,19 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param isDown: Button state.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const;
|
||||
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const override;
|
||||
|
||||
/**
|
||||
* Enable multi-touch gestures if supported.
|
||||
* \param use: Enable or disable.
|
||||
*/
|
||||
void setMultitouchGestures(const bool use);
|
||||
void setMultitouchGestures(const bool use) override;
|
||||
|
||||
/**
|
||||
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
|
||||
* \param api: Enum indicating which API to use.
|
||||
*/
|
||||
virtual void setTabletAPI(GHOST_TTabletAPI api);
|
||||
void setTabletAPI(GHOST_TTabletAPI api) override;
|
||||
GHOST_TTabletAPI getTabletAPI();
|
||||
|
||||
/**
|
||||
@@ -253,7 +256,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param r_color: returned sRGB float colors
|
||||
* \return Success value (true == successful and supported by platform)
|
||||
*/
|
||||
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const;
|
||||
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
/***************************************************************************************
|
||||
@@ -264,7 +267,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* Sets 3D mouse dead-zone
|
||||
* \param deadzone: Dead-zone of the 3D mouse (both for rotation and pan) relative to full range.
|
||||
*/
|
||||
void setNDOFDeadZone(float deadzone);
|
||||
void setNDOFDeadZone(float deadzone) override;
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
@@ -320,19 +323,19 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param selection: Only used on X11.
|
||||
* \return Returns the clipboard data
|
||||
*/
|
||||
virtual char *getClipboard(bool selection) const = 0;
|
||||
char *getClipboard(bool selection) const override = 0;
|
||||
|
||||
/**
|
||||
* Put data to the Clipboard
|
||||
* \param buffer: The buffer to copy to the clipboard.
|
||||
* \param selection: The clipboard to copy too only used on X11.
|
||||
*/
|
||||
virtual void putClipboard(const char *buffer, bool selection) const = 0;
|
||||
void putClipboard(const char *buffer, bool selection) const override = 0;
|
||||
|
||||
/**
|
||||
* Returns GHOST_kSuccess if the clipboard contains an image.
|
||||
*/
|
||||
GHOST_TSuccess hasClipboardImage() const;
|
||||
GHOST_TSuccess hasClipboardImage() const override;
|
||||
|
||||
/**
|
||||
* Get image data from the Clipboard
|
||||
@@ -340,7 +343,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param r_height: the returned image height in pixels.
|
||||
* \return pointer uint array in RGBA byte order. Caller must free.
|
||||
*/
|
||||
uint *getClipboardImage(int *r_width, int *r_height) const;
|
||||
uint *getClipboardImage(int *r_width, int *r_height) const override;
|
||||
|
||||
/**
|
||||
* Put image data to the Clipboard
|
||||
@@ -348,7 +351,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param width: the image width in pixels.
|
||||
* \param height: the image height in pixels.
|
||||
*/
|
||||
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const;
|
||||
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
|
||||
|
||||
/**
|
||||
* Show a system message box
|
||||
@@ -359,12 +362,12 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* \param link: An optional hyperlink.
|
||||
* \param dialog_options: Options how to display the message.
|
||||
*/
|
||||
virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
|
||||
const char * /*message*/,
|
||||
const char * /*help_label*/,
|
||||
const char * /*continue_label*/,
|
||||
const char * /*link*/,
|
||||
GHOST_DialogOptions /*dialog_options*/) const
|
||||
GHOST_TSuccess showMessageBox(const char * /*title*/,
|
||||
const char * /*message*/,
|
||||
const char * /*help_label*/,
|
||||
const char * /*continue_label*/,
|
||||
const char * /*link*/,
|
||||
GHOST_DialogOptions /*dialog_options*/) const override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
};
|
||||
@@ -377,25 +380,25 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* Specify whether debug messages are to be shown.
|
||||
* \param debug: Flag for systems to debug.
|
||||
*/
|
||||
virtual void initDebug(GHOST_Debug debug);
|
||||
void initDebug(GHOST_Debug debug) override;
|
||||
|
||||
/**
|
||||
* Check whether debug messages are to be shown.
|
||||
*/
|
||||
virtual bool isDebugEnabled();
|
||||
bool isDebugEnabled() override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initialize the system.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess init();
|
||||
GHOST_TSuccess init() override;
|
||||
|
||||
/**
|
||||
* Shut the system down.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess exit();
|
||||
GHOST_TSuccess exit() override;
|
||||
|
||||
/**
|
||||
* Creates a full-screen window.
|
||||
|
||||
@@ -37,7 +37,7 @@ class GHOST_SystemHeadless : public GHOST_System {
|
||||
}
|
||||
bool setConsoleWindowState(GHOST_TConsoleWindowState /*action*/) override
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys & /*keys*/) const override
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
|
||||
* Destructor.
|
||||
* Protected default constructor to force use of static dispose member.
|
||||
*/
|
||||
virtual ~GHOST_SystemPaths() {}
|
||||
~GHOST_SystemPaths() override = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -30,23 +30,23 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
|
||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||
* \return Unsigned char string pointing to system directory (eg `/usr/share/blender/`).
|
||||
*/
|
||||
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
|
||||
const char *getSystemDir(int version, const char *versionstr) const override = 0;
|
||||
|
||||
/**
|
||||
* Determine the base directory in which user configuration is stored, including versioning.
|
||||
* If needed, it will create the base directory.
|
||||
* \return Unsigned char string pointing to user directory (eg `~/.blender/`).
|
||||
*/
|
||||
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
|
||||
const char *getUserDir(int version, const char *versionstr) const override = 0;
|
||||
|
||||
/**
|
||||
* Determine the directory of the current binary.
|
||||
* \return Unsigned char string pointing to the binary directory.
|
||||
*/
|
||||
virtual const char *getBinaryDir() const = 0;
|
||||
const char *getBinaryDir() const override = 0;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
virtual void addToSystemRecentFiles(const char *filepath) const = 0;
|
||||
void addToSystemRecentFiles(const char *filepath) const override = 0;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ static const char *home_dir_get()
|
||||
|
||||
const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionstr) const
|
||||
{
|
||||
static string user_path = "";
|
||||
static string user_path;
|
||||
static int last_version = 0;
|
||||
|
||||
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
|
||||
@@ -103,7 +103,7 @@ const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionst
|
||||
const char *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
|
||||
{
|
||||
const char *type_str;
|
||||
static string path = "";
|
||||
static string path;
|
||||
|
||||
switch (type) {
|
||||
case GHOST_kUserSpecialDirDesktop:
|
||||
|
||||
@@ -22,36 +22,36 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_SystemPathsUnix();
|
||||
~GHOST_SystemPathsUnix() override;
|
||||
|
||||
/**
|
||||
* Determine the base directory in which shared resources are located. It will first try to use
|
||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||
* \return Unsigned char string pointing to system directory (eg `/usr/share/blender/`).
|
||||
*/
|
||||
const char *getSystemDir(int version, const char *versionstr) const;
|
||||
const char *getSystemDir(int version, const char *versionstr) const override;
|
||||
|
||||
/**
|
||||
* Determine the base directory in which user configuration is stored, including versioning.
|
||||
* If needed, it will create the base directory.
|
||||
* \return Unsigned char string pointing to user directory (eg `~/.config/.blender/`).
|
||||
*/
|
||||
const char *getUserDir(int version, const char *versionstr) const;
|
||||
const char *getUserDir(int version, const char *versionstr) const override;
|
||||
|
||||
/**
|
||||
* Determine a special ("well known") and easy to reach user directory.
|
||||
* \return Unsigned char string pointing to user directory (eg `~/Documents/`).
|
||||
*/
|
||||
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
|
||||
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const override;
|
||||
|
||||
/**
|
||||
* Determine the directory of the current binary.
|
||||
* \return Unsigned char string pointing to the binary directory.
|
||||
*/
|
||||
const char *getBinaryDir() const;
|
||||
const char *getBinaryDir() const override;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char *filepath) const;
|
||||
void addToSystemRecentFiles(const char *filepath) const override;
|
||||
};
|
||||
|
||||
@@ -31,36 +31,36 @@ class GHOST_SystemPathsWin32 : public GHOST_SystemPaths {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_SystemPathsWin32();
|
||||
~GHOST_SystemPathsWin32() override;
|
||||
|
||||
/**
|
||||
* Determine the base directory in which shared resources are located. It will first try to use
|
||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||
* \return Unsigned char string pointing to system directory (eg `/usr/share/`).
|
||||
*/
|
||||
const char *getSystemDir(int version, const char *versionstr) const;
|
||||
const char *getSystemDir(int version, const char *versionstr) const override;
|
||||
|
||||
/**
|
||||
* Determine the base directory in which user configuration is stored, including versioning.
|
||||
* If needed, it will create the base directory.
|
||||
* \return Unsigned char string pointing to user directory (eg `~/`).
|
||||
*/
|
||||
const char *getUserDir(int version, const char *versionstr) const;
|
||||
const char *getUserDir(int version, const char *versionstr) const override;
|
||||
|
||||
/**
|
||||
* Determine a special ("well known") and easy to reach user directory.
|
||||
* \return Unsigned char string pointing to user directory (eg `~/Documents/`).
|
||||
*/
|
||||
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
|
||||
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const override;
|
||||
|
||||
/**
|
||||
* Determine the directory of the current binary.
|
||||
* \return Unsigned char string pointing to the binary directory.
|
||||
*/
|
||||
const char *getBinaryDir() const;
|
||||
const char *getBinaryDir() const override;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char *filepath) const;
|
||||
void addToSystemRecentFiles(const char *filepath) const override;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~GHOST_SystemWin32();
|
||||
~GHOST_SystemWin32() override;
|
||||
|
||||
/***************************************************************************************
|
||||
** Time(r) functionality
|
||||
@@ -66,7 +66,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* This overloaded method uses the high frequency timer if available.
|
||||
* \return The number of milliseconds.
|
||||
*/
|
||||
uint64_t getMilliSeconds() const;
|
||||
uint64_t getMilliSeconds() const override;
|
||||
|
||||
/***************************************************************************************
|
||||
** Display/window management functionality
|
||||
@@ -76,19 +76,19 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* Returns the number of displays on this system.
|
||||
* \return The number of displays.
|
||||
*/
|
||||
uint8_t getNumDisplays() const;
|
||||
uint8_t getNumDisplays() const override;
|
||||
|
||||
/**
|
||||
* Returns the dimensions of the main display on this system.
|
||||
* \return The dimension of the main display.
|
||||
*/
|
||||
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
|
||||
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override;
|
||||
|
||||
/**
|
||||
* Returns the dimensions of all displays on this system.
|
||||
* \return The dimension of the main display.
|
||||
*/
|
||||
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
|
||||
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
|
||||
|
||||
/**
|
||||
* Create a new window.
|
||||
@@ -115,21 +115,21 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
GHOST_GPUSettings gpuSettings,
|
||||
const bool exclusive = false,
|
||||
const bool is_dialog = false,
|
||||
const GHOST_IWindow *parentWindow = 0);
|
||||
const GHOST_IWindow *parentWindow = nullptr) override;
|
||||
|
||||
/**
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the window, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GPUSettings gpuSettings);
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GPUSettings gpuSettings) override;
|
||||
|
||||
/**
|
||||
* Dispose of a context.
|
||||
* \param context: Pointer to the context to be disposed.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess disposeContext(GHOST_IContext *context);
|
||||
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;
|
||||
|
||||
/**
|
||||
* Create a new off-screen DirectX context.
|
||||
@@ -152,7 +152,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* Get the Window under the mouse cursor. Location obtained from the OS.
|
||||
* \return The window under the cursor or nullptr if none.
|
||||
*/
|
||||
GHOST_IWindow *getWindowUnderCursor(int32_t /*x*/, int32_t /*y*/);
|
||||
GHOST_IWindow *getWindowUnderCursor(int32_t /*x*/, int32_t /*y*/) override;
|
||||
|
||||
/***************************************************************************************
|
||||
** Event management functionality
|
||||
@@ -163,7 +163,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param waitForEvent: Flag to wait for an event (or return immediately).
|
||||
* \return Indication of the presence of events.
|
||||
*/
|
||||
bool processEvents(bool waitForEvent);
|
||||
bool processEvents(bool waitForEvent) override;
|
||||
|
||||
/***************************************************************************************
|
||||
** Cursor management functionality
|
||||
@@ -175,7 +175,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param y: The y-coordinate of the cursor.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
|
||||
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override;
|
||||
|
||||
/**
|
||||
* Updates the location of the cursor (location in screen coordinates).
|
||||
@@ -183,14 +183,14 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param y: The y-coordinate of the cursor.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
|
||||
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override;
|
||||
|
||||
/**
|
||||
* Get the color of the pixel at the current mouse cursor location
|
||||
* \param r_color: returned sRGB float colors
|
||||
* \return Success value (true == successful and supported by platform)
|
||||
*/
|
||||
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const;
|
||||
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
|
||||
|
||||
/***************************************************************************************
|
||||
** Access to mouse button and keyboard states.
|
||||
@@ -201,35 +201,35 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param keys: The state of all modifier keys (true == pressed).
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;
|
||||
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override;
|
||||
|
||||
/**
|
||||
* Returns the state of the mouse buttons (outside the message queue).
|
||||
* \param buttons: The state of the buttons.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const;
|
||||
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override;
|
||||
|
||||
GHOST_TCapabilityFlag getCapabilities() const;
|
||||
GHOST_TCapabilityFlag getCapabilities() const override;
|
||||
|
||||
/**
|
||||
* Returns unsigned char from CUT_BUFFER0
|
||||
* \param selection: Used by X11 only.
|
||||
* \return Returns the Clipboard.
|
||||
*/
|
||||
char *getClipboard(bool selection) const;
|
||||
char *getClipboard(bool selection) const override;
|
||||
|
||||
/**
|
||||
* Puts buffer to system clipboard.
|
||||
* \param selection: Used by X11 only.
|
||||
* \return No return.
|
||||
*/
|
||||
void putClipboard(const char *buffer, bool selection) const;
|
||||
void putClipboard(const char *buffer, bool selection) const override;
|
||||
|
||||
/**
|
||||
* Returns GHOST_kSuccess if the clipboard contains an image.
|
||||
*/
|
||||
GHOST_TSuccess hasClipboardImage() const;
|
||||
GHOST_TSuccess hasClipboardImage() const override;
|
||||
|
||||
/**
|
||||
* Get image data from the Clipboard
|
||||
@@ -237,7 +237,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param r_height: the returned image height in pixels.
|
||||
* \return pointer uint array in RGBA byte order. Caller must free.
|
||||
*/
|
||||
uint *getClipboardImage(int *r_width, int *r_height) const;
|
||||
uint *getClipboardImage(int *r_width, int *r_height) const override;
|
||||
|
||||
/**
|
||||
* Put image data to the Clipboard
|
||||
@@ -245,7 +245,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param width: the image width in pixels.
|
||||
* \param height: the image height in pixels.
|
||||
*/
|
||||
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const;
|
||||
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
|
||||
|
||||
/**
|
||||
* Show a system message box
|
||||
@@ -261,7 +261,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
const char *help_label,
|
||||
const char *continue_label,
|
||||
const char *link,
|
||||
GHOST_DialogOptions dialog_options) const;
|
||||
GHOST_DialogOptions dialog_options) const override;
|
||||
|
||||
/**
|
||||
* Creates a drag & drop event and pushes it immediately onto the event queue.
|
||||
@@ -307,13 +307,13 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* For now, it just registers the window class (WNDCLASS).
|
||||
* \return A success value.
|
||||
*/
|
||||
GHOST_TSuccess init();
|
||||
GHOST_TSuccess init() override;
|
||||
|
||||
/**
|
||||
* Closes the system down.
|
||||
* \return A success value.
|
||||
*/
|
||||
GHOST_TSuccess exit();
|
||||
GHOST_TSuccess exit() override;
|
||||
|
||||
/**
|
||||
* Converts raw WIN32 key codes from the `wndproc` to GHOST keys.
|
||||
@@ -463,7 +463,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
* \param action: console state
|
||||
* \return current status (1 -visible, 0 - hidden)
|
||||
*/
|
||||
bool setConsoleWindowState(GHOST_TConsoleWindowState action);
|
||||
bool setConsoleWindowState(GHOST_TConsoleWindowState action) override;
|
||||
|
||||
/** State variable set at initialization. */
|
||||
bool m_hasPerformanceCounter;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "GHOST_TimerTask.hh"
|
||||
|
||||
GHOST_TimerManager::GHOST_TimerManager() {}
|
||||
GHOST_TimerManager::GHOST_TimerManager() = default;
|
||||
|
||||
GHOST_TimerManager::~GHOST_TimerManager()
|
||||
{
|
||||
@@ -71,10 +71,7 @@ uint64_t GHOST_TimerManager::nextFireTime()
|
||||
|
||||
for (iter = m_timers.begin(); iter != m_timers.end(); ++iter) {
|
||||
const uint64_t next = (*iter)->getNext();
|
||||
|
||||
if (next < smallest) {
|
||||
smallest = next;
|
||||
}
|
||||
smallest = std::min(next, smallest);
|
||||
}
|
||||
|
||||
return smallest;
|
||||
|
||||
@@ -31,8 +31,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
m_interval(interval),
|
||||
m_next(start),
|
||||
m_timerProc(timerProc),
|
||||
m_userData(userData),
|
||||
m_auxData(0)
|
||||
m_userData(userData)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the timer start time.
|
||||
* \return The timer start time.
|
||||
*/
|
||||
inline uint64_t getStart() const
|
||||
uint64_t getStart() const
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
@@ -58,7 +57,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the timer interval.
|
||||
* \return The timer interval.
|
||||
*/
|
||||
inline uint64_t getInterval() const
|
||||
uint64_t getInterval() const
|
||||
{
|
||||
return m_interval;
|
||||
}
|
||||
@@ -76,7 +75,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the time the timerProc will be called.
|
||||
* \return The time the timerProc will be called.
|
||||
*/
|
||||
inline uint64_t getNext() const
|
||||
uint64_t getNext() const
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
@@ -94,7 +93,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the timer callback.
|
||||
* \return the timer callback.
|
||||
*/
|
||||
inline GHOST_TimerProcPtr getTimerProc() const
|
||||
GHOST_TimerProcPtr getTimerProc() const override
|
||||
{
|
||||
return m_timerProc;
|
||||
}
|
||||
@@ -103,7 +102,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Changes the timer callback.
|
||||
* \param timerProc: The timer callback.
|
||||
*/
|
||||
inline void setTimerProc(const GHOST_TimerProcPtr timerProc)
|
||||
void setTimerProc(const GHOST_TimerProcPtr timerProc) override
|
||||
{
|
||||
m_timerProc = timerProc;
|
||||
}
|
||||
@@ -112,7 +111,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the timer user data.
|
||||
* \return The timer user data.
|
||||
*/
|
||||
inline GHOST_TUserDataPtr getUserData() const
|
||||
GHOST_TUserDataPtr getUserData() const override
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
@@ -121,7 +120,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Changes the time user data.
|
||||
* \param userData: The timer user data.
|
||||
*/
|
||||
void setUserData(const GHOST_TUserDataPtr userData)
|
||||
void setUserData(const GHOST_TUserDataPtr userData) override
|
||||
{
|
||||
m_userData = userData;
|
||||
}
|
||||
@@ -130,7 +129,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
* Returns the auxiliary storage room.
|
||||
* \return The auxiliary storage room.
|
||||
*/
|
||||
inline uint32_t getAuxData() const
|
||||
uint32_t getAuxData() const
|
||||
{
|
||||
return m_auxData;
|
||||
}
|
||||
@@ -161,5 +160,5 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
|
||||
GHOST_TUserDataPtr m_userData;
|
||||
|
||||
/** Auxiliary storage room. */
|
||||
uint32_t m_auxData;
|
||||
uint32_t m_auxData = 0;
|
||||
};
|
||||
|
||||
@@ -67,13 +67,13 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Destructor.
|
||||
* Closes the window and disposes resources allocated.
|
||||
*/
|
||||
virtual ~GHOST_Window();
|
||||
~GHOST_Window() override;
|
||||
|
||||
/**
|
||||
* Returns indication as to whether the window is valid.
|
||||
* \return The validity of the window.
|
||||
*/
|
||||
virtual bool getValid() const override
|
||||
bool getValid() const override
|
||||
{
|
||||
return m_context != nullptr;
|
||||
}
|
||||
@@ -82,9 +82,9 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Returns the associated OS object/handle
|
||||
* \return The associated OS object/handle
|
||||
*/
|
||||
virtual void *getOSWindow() const override;
|
||||
void *getOSWindow() const override;
|
||||
|
||||
virtual GHOST_TSuccess setPath(const char * /*filepath*/) override
|
||||
GHOST_TSuccess setPath(const char * /*filepath*/) override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
*/
|
||||
inline GHOST_TStandardCursor getCursorShape() const override;
|
||||
|
||||
inline bool isDialog() const override
|
||||
bool isDialog() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Sets the progress bar value displayed in the window/application icon
|
||||
* \param progress: The progress percentage (0.0 to 1.0).
|
||||
*/
|
||||
virtual GHOST_TSuccess setProgressBar(float /*progress*/) override
|
||||
GHOST_TSuccess setProgressBar(float /*progress*/) override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
/**
|
||||
* Hides the progress bar in the icon
|
||||
*/
|
||||
virtual GHOST_TSuccess endProgressBar() override
|
||||
GHOST_TSuccess endProgressBar() override
|
||||
{
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -215,13 +215,13 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* \param isUnsavedChanges: Unsaved changes or not.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override;
|
||||
GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override;
|
||||
|
||||
/**
|
||||
* Gets the window "modified" status, indicating unsaved changes
|
||||
* \return True if there are unsaved changes
|
||||
*/
|
||||
virtual bool getModifiedState() override;
|
||||
bool getModifiedState() override;
|
||||
|
||||
/**
|
||||
* Returns the type of drawing context used in this window.
|
||||
@@ -242,19 +242,19 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Returns the drawing context used in this window.
|
||||
* \return The current drawing context.
|
||||
*/
|
||||
virtual GHOST_IContext *getDrawingContext() override;
|
||||
GHOST_IContext *getDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Swaps front and back buffers of a window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
virtual GHOST_TSuccess swapBuffers() override;
|
||||
GHOST_TSuccess swapBuffers() override;
|
||||
|
||||
/**
|
||||
* Activates the drawing context of this window.
|
||||
* \return A boolean success indicator.
|
||||
*/
|
||||
virtual GHOST_TSuccess activateDrawingContext() override;
|
||||
GHOST_TSuccess activateDrawingContext() override;
|
||||
|
||||
/**
|
||||
* Updates the drawing context of this window. Needed
|
||||
@@ -273,7 +273,7 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Gets the OpenGL frame-buffer associated with the window's contents.
|
||||
* \return The ID of an OpenGL frame-buffer object.
|
||||
*/
|
||||
virtual unsigned int getDefaultFramebuffer() override;
|
||||
unsigned int getDefaultFramebuffer() override;
|
||||
|
||||
#ifdef WITH_VULKAN_BACKEND
|
||||
virtual GHOST_TSuccess getVulkanSwapChainFormat(
|
||||
@@ -284,7 +284,7 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Returns the window user data.
|
||||
* \return The window user data.
|
||||
*/
|
||||
inline GHOST_TUserDataPtr getUserData() const override
|
||||
GHOST_TUserDataPtr getUserData() const override
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
@@ -310,19 +310,19 @@ class GHOST_Window : public GHOST_IWindow {
|
||||
* Returns the recommended DPI for this window.
|
||||
* \return The recommended DPI for this window.
|
||||
*/
|
||||
virtual inline uint16_t getDPIHint() override
|
||||
uint16_t getDPIHint() override
|
||||
{
|
||||
return 96;
|
||||
}
|
||||
|
||||
#ifdef WITH_INPUT_IME
|
||||
virtual void beginIME(
|
||||
void beginIME(
|
||||
int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
|
||||
{
|
||||
/* do nothing temporarily if not in windows */
|
||||
}
|
||||
|
||||
virtual void endIME() override
|
||||
void endIME() override
|
||||
{
|
||||
/* do nothing temporarily if not in windows */
|
||||
}
|
||||
|
||||
@@ -20,10 +20,8 @@ GHOST_WindowManager::GHOST_WindowManager()
|
||||
{
|
||||
}
|
||||
|
||||
GHOST_WindowManager::~GHOST_WindowManager()
|
||||
{
|
||||
/* m_windows is freed by GHOST_System::disposeWindow */
|
||||
}
|
||||
/* m_windows is freed by GHOST_System::disposeWindow */
|
||||
GHOST_WindowManager::~GHOST_WindowManager() = default;
|
||||
|
||||
GHOST_TSuccess GHOST_WindowManager::addWindow(GHOST_IWindow *window)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "GHOST_IWindow.hh"
|
||||
#include "GHOST_Rect.hh"
|
||||
|
||||
/**
|
||||
* Manages system windows (platform independent implementation).
|
||||
|
||||
8
intern/mantaflow/extern/manta_fluid_API.h
vendored
8
intern/mantaflow/extern/manta_fluid_API.h
vendored
@@ -9,6 +9,8 @@
|
||||
#ifndef MANTA_API_H
|
||||
#define MANTA_API_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -119,7 +121,7 @@ float *manta_smoke_get_fuel(struct MANTA *smoke);
|
||||
float *manta_smoke_get_react(struct MANTA *smoke);
|
||||
float *manta_smoke_get_heat(struct MANTA *smoke);
|
||||
float *manta_smoke_get_flame(struct MANTA *smoke);
|
||||
float *manta_smoke_get_shadow(struct MANTA *fluid);
|
||||
float *manta_smoke_get_shadow(struct MANTA *smoke);
|
||||
float *manta_smoke_get_color_r(struct MANTA *smoke);
|
||||
float *manta_smoke_get_color_g(struct MANTA *smoke);
|
||||
float *manta_smoke_get_color_b(struct MANTA *smoke);
|
||||
@@ -154,8 +156,8 @@ void manta_noise_get_res(struct MANTA *smoke, int *res);
|
||||
int manta_noise_get_cells(struct MANTA *smoke);
|
||||
|
||||
/* Liquid functions */
|
||||
bool manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_liquid_ensure_sndparts(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_liquid_export_script(struct MANTA *liquid, struct FluidModifierData *fmd);
|
||||
bool manta_liquid_ensure_sndparts(struct MANTA *liquid, struct FluidModifierData *fmd);
|
||||
|
||||
/* Liquid accessors */
|
||||
int manta_liquid_get_particle_res_x(struct MANTA *liquid);
|
||||
|
||||
2
intern/mantaflow/extern/manta_python_API.h
vendored
2
intern/mantaflow/extern/manta_python_API.h
vendored
@@ -9,7 +9,7 @@
|
||||
#ifndef MANTA_PYTHON_API_H
|
||||
#define MANTA_PYTHON_API_H
|
||||
|
||||
#include "Python.h"
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -8,16 +8,17 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <zlib.h>
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include <manta.h>
|
||||
|
||||
#include "MANTA_main.h"
|
||||
#include "Python.h"
|
||||
#include "fluid_script.h"
|
||||
#include "liquid_script.h"
|
||||
#include "manta.h"
|
||||
#include "smoke_script.h"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
@@ -26,9 +27,6 @@
|
||||
|
||||
#include "DNA_fluid_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
@@ -562,7 +560,7 @@ MANTA::~MANTA()
|
||||
}
|
||||
|
||||
/* Destruction string for Python. */
|
||||
string tmpString = "";
|
||||
string tmpString;
|
||||
vector<string> pythonCommands;
|
||||
bool result = false;
|
||||
|
||||
@@ -778,7 +776,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd)
|
||||
FluidDomainSettings *fds = fmd->domain;
|
||||
bool is2D = (fds->solver_res == 2);
|
||||
|
||||
string borderCollisions = "";
|
||||
string borderCollisions;
|
||||
if ((fds->border_collisions & FLUID_DOMAIN_BORDER_LEFT) == 0) {
|
||||
borderCollisions += "x";
|
||||
}
|
||||
@@ -798,7 +796,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd)
|
||||
borderCollisions += "Z";
|
||||
}
|
||||
|
||||
string particleTypesStr = "";
|
||||
string particleTypesStr;
|
||||
if (fds->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) {
|
||||
particleTypesStr += "PtypeSpray";
|
||||
}
|
||||
@@ -1158,7 +1156,7 @@ string MANTA::parseLine(const string &line)
|
||||
if (line.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
string res = "";
|
||||
string res;
|
||||
int currPos = 0, start_del = 0, end_del = -1;
|
||||
bool readingVar = false;
|
||||
const char delimiter = '$';
|
||||
@@ -1187,7 +1185,7 @@ string MANTA::parseScript(const string &setup_string, FluidModifierData *fmd)
|
||||
|
||||
istringstream f(setup_string);
|
||||
ostringstream res;
|
||||
string line = "";
|
||||
string line;
|
||||
|
||||
/* Update RNA map if modifier data is handed over. */
|
||||
if (fmd) {
|
||||
@@ -1202,7 +1200,7 @@ string MANTA::parseScript(const string &setup_string, FluidModifierData *fmd)
|
||||
/** Dirty hack: Needed to format paths from python code that is run via #PyRun_String. */
|
||||
static string escapePath(string const &s)
|
||||
{
|
||||
string result = "";
|
||||
string result;
|
||||
for (char c : s) {
|
||||
if (c == '\\') {
|
||||
result += "\\\\";
|
||||
|
||||
@@ -26,23 +26,23 @@ struct MANTA {
|
||||
virtual ~MANTA();
|
||||
|
||||
/* Mirroring Mantaflow structures for particle data (pVel also used for mesh vert vels). */
|
||||
typedef struct PData {
|
||||
struct pData {
|
||||
float pos[3];
|
||||
int flag;
|
||||
} pData;
|
||||
typedef struct PVel {
|
||||
};
|
||||
struct pVel {
|
||||
float pos[3];
|
||||
} pVel;
|
||||
};
|
||||
|
||||
/* Mirroring Mantaflow structures for meshes. */
|
||||
typedef struct Node {
|
||||
struct Node {
|
||||
int flags;
|
||||
float pos[3], normal[3];
|
||||
} Node;
|
||||
typedef struct Triangle {
|
||||
};
|
||||
struct Triangle {
|
||||
int c[3];
|
||||
int flags;
|
||||
} Triangle;
|
||||
};
|
||||
|
||||
/* Grid initialization functions. */
|
||||
bool initHeat(struct FluidModifierData *fmd = nullptr);
|
||||
@@ -101,303 +101,303 @@ struct MANTA {
|
||||
bool hasParticles(FluidModifierData *fmd, int framenr);
|
||||
bool hasGuiding(FluidModifierData *fmd, int framenr, bool sourceDomain);
|
||||
|
||||
inline size_t getTotalCells()
|
||||
size_t getTotalCells()
|
||||
{
|
||||
return mTotalCells;
|
||||
}
|
||||
inline size_t getTotalCellsHigh()
|
||||
size_t getTotalCellsHigh()
|
||||
{
|
||||
return mTotalCellsHigh;
|
||||
}
|
||||
inline bool usingNoise()
|
||||
bool usingNoise()
|
||||
{
|
||||
return mUsingNoise;
|
||||
}
|
||||
inline int getResX()
|
||||
int getResX()
|
||||
{
|
||||
return mResX;
|
||||
}
|
||||
inline int getResY()
|
||||
int getResY()
|
||||
{
|
||||
return mResY;
|
||||
}
|
||||
inline int getResZ()
|
||||
int getResZ()
|
||||
{
|
||||
return mResZ;
|
||||
}
|
||||
inline int getParticleResX()
|
||||
int getParticleResX()
|
||||
{
|
||||
return mResXParticle;
|
||||
}
|
||||
inline int getParticleResY()
|
||||
int getParticleResY()
|
||||
{
|
||||
return mResYParticle;
|
||||
}
|
||||
inline int getParticleResZ()
|
||||
int getParticleResZ()
|
||||
{
|
||||
return mResZParticle;
|
||||
}
|
||||
inline int getMeshResX()
|
||||
int getMeshResX()
|
||||
{
|
||||
return mResXMesh;
|
||||
}
|
||||
inline int getMeshResY()
|
||||
int getMeshResY()
|
||||
{
|
||||
return mResYMesh;
|
||||
}
|
||||
inline int getMeshResZ()
|
||||
int getMeshResZ()
|
||||
{
|
||||
return mResZMesh;
|
||||
}
|
||||
inline int getResXHigh()
|
||||
int getResXHigh()
|
||||
{
|
||||
return mResXNoise;
|
||||
}
|
||||
inline int getResYHigh()
|
||||
int getResYHigh()
|
||||
{
|
||||
return mResYNoise;
|
||||
}
|
||||
inline int getResZHigh()
|
||||
int getResZHigh()
|
||||
{
|
||||
return mResZNoise;
|
||||
}
|
||||
inline int getMeshUpres()
|
||||
int getMeshUpres()
|
||||
{
|
||||
return mUpresMesh;
|
||||
}
|
||||
inline int getParticleUpres()
|
||||
int getParticleUpres()
|
||||
{
|
||||
return mUpresParticle;
|
||||
}
|
||||
|
||||
/* Smoke getters. */
|
||||
inline float *getDensity()
|
||||
float *getDensity()
|
||||
{
|
||||
return mDensity;
|
||||
}
|
||||
inline float *getHeat()
|
||||
float *getHeat()
|
||||
{
|
||||
return mHeat;
|
||||
}
|
||||
inline float *getVelocityX()
|
||||
float *getVelocityX()
|
||||
{
|
||||
return mVelocityX;
|
||||
}
|
||||
inline float *getVelocityY()
|
||||
float *getVelocityY()
|
||||
{
|
||||
return mVelocityY;
|
||||
}
|
||||
inline float *getVelocityZ()
|
||||
float *getVelocityZ()
|
||||
{
|
||||
return mVelocityZ;
|
||||
}
|
||||
inline float *getObVelocityX()
|
||||
float *getObVelocityX()
|
||||
{
|
||||
return mObVelocityX;
|
||||
}
|
||||
inline float *getObVelocityY()
|
||||
float *getObVelocityY()
|
||||
{
|
||||
return mObVelocityY;
|
||||
}
|
||||
inline float *getObVelocityZ()
|
||||
float *getObVelocityZ()
|
||||
{
|
||||
return mObVelocityZ;
|
||||
}
|
||||
inline float *getGuideVelocityX()
|
||||
float *getGuideVelocityX()
|
||||
{
|
||||
return mGuideVelocityX;
|
||||
}
|
||||
inline float *getGuideVelocityY()
|
||||
float *getGuideVelocityY()
|
||||
{
|
||||
return mGuideVelocityY;
|
||||
}
|
||||
inline float *getGuideVelocityZ()
|
||||
float *getGuideVelocityZ()
|
||||
{
|
||||
return mGuideVelocityZ;
|
||||
}
|
||||
inline float *getInVelocityX()
|
||||
float *getInVelocityX()
|
||||
{
|
||||
return mInVelocityX;
|
||||
}
|
||||
inline float *getInVelocityY()
|
||||
float *getInVelocityY()
|
||||
{
|
||||
return mInVelocityY;
|
||||
}
|
||||
inline float *getInVelocityZ()
|
||||
float *getInVelocityZ()
|
||||
{
|
||||
return mInVelocityZ;
|
||||
}
|
||||
inline float *getForceX()
|
||||
float *getForceX()
|
||||
{
|
||||
return mForceX;
|
||||
}
|
||||
inline float *getForceY()
|
||||
float *getForceY()
|
||||
{
|
||||
return mForceY;
|
||||
}
|
||||
inline float *getForceZ()
|
||||
float *getForceZ()
|
||||
{
|
||||
return mForceZ;
|
||||
}
|
||||
inline int *getFlags()
|
||||
int *getFlags()
|
||||
{
|
||||
return mFlags;
|
||||
}
|
||||
inline float *getNumObstacle()
|
||||
float *getNumObstacle()
|
||||
{
|
||||
return mNumObstacle;
|
||||
}
|
||||
inline float *getNumGuide()
|
||||
float *getNumGuide()
|
||||
{
|
||||
return mNumGuide;
|
||||
}
|
||||
inline float *getFlame()
|
||||
float *getFlame()
|
||||
{
|
||||
return mFlame;
|
||||
}
|
||||
inline float *getFuel()
|
||||
float *getFuel()
|
||||
{
|
||||
return mFuel;
|
||||
}
|
||||
inline float *getReact()
|
||||
float *getReact()
|
||||
{
|
||||
return mReact;
|
||||
}
|
||||
inline float *getColorR()
|
||||
float *getColorR()
|
||||
{
|
||||
return mColorR;
|
||||
}
|
||||
inline float *getColorG()
|
||||
float *getColorG()
|
||||
{
|
||||
return mColorG;
|
||||
}
|
||||
inline float *getColorB()
|
||||
float *getColorB()
|
||||
{
|
||||
return mColorB;
|
||||
}
|
||||
inline float *getShadow()
|
||||
float *getShadow()
|
||||
{
|
||||
return mShadow;
|
||||
}
|
||||
inline float *getDensityIn()
|
||||
float *getDensityIn()
|
||||
{
|
||||
return mDensityIn;
|
||||
}
|
||||
inline float *getHeatIn()
|
||||
float *getHeatIn()
|
||||
{
|
||||
return mHeatIn;
|
||||
}
|
||||
inline float *getColorRIn()
|
||||
float *getColorRIn()
|
||||
{
|
||||
return mColorRIn;
|
||||
}
|
||||
inline float *getColorGIn()
|
||||
float *getColorGIn()
|
||||
{
|
||||
return mColorGIn;
|
||||
}
|
||||
inline float *getColorBIn()
|
||||
float *getColorBIn()
|
||||
{
|
||||
return mColorBIn;
|
||||
}
|
||||
inline float *getFuelIn()
|
||||
float *getFuelIn()
|
||||
{
|
||||
return mFuelIn;
|
||||
}
|
||||
inline float *getReactIn()
|
||||
float *getReactIn()
|
||||
{
|
||||
return mReactIn;
|
||||
}
|
||||
inline float *getEmissionIn()
|
||||
float *getEmissionIn()
|
||||
{
|
||||
return mEmissionIn;
|
||||
}
|
||||
|
||||
inline float *getDensityHigh()
|
||||
float *getDensityHigh()
|
||||
{
|
||||
return mDensityHigh;
|
||||
}
|
||||
inline float *getFlameHigh()
|
||||
float *getFlameHigh()
|
||||
{
|
||||
return mFlameHigh;
|
||||
}
|
||||
inline float *getFuelHigh()
|
||||
float *getFuelHigh()
|
||||
{
|
||||
return mFuelHigh;
|
||||
}
|
||||
inline float *getReactHigh()
|
||||
float *getReactHigh()
|
||||
{
|
||||
return mReactHigh;
|
||||
}
|
||||
inline float *getColorRHigh()
|
||||
float *getColorRHigh()
|
||||
{
|
||||
return mColorRHigh;
|
||||
}
|
||||
inline float *getColorGHigh()
|
||||
float *getColorGHigh()
|
||||
{
|
||||
return mColorGHigh;
|
||||
}
|
||||
inline float *getColorBHigh()
|
||||
float *getColorBHigh()
|
||||
{
|
||||
return mColorBHigh;
|
||||
}
|
||||
inline float *getTextureU()
|
||||
float *getTextureU()
|
||||
{
|
||||
return mTextureU;
|
||||
}
|
||||
inline float *getTextureV()
|
||||
float *getTextureV()
|
||||
{
|
||||
return mTextureV;
|
||||
}
|
||||
inline float *getTextureW()
|
||||
float *getTextureW()
|
||||
{
|
||||
return mTextureW;
|
||||
}
|
||||
inline float *getTextureU2()
|
||||
float *getTextureU2()
|
||||
{
|
||||
return mTextureU2;
|
||||
}
|
||||
inline float *getTextureV2()
|
||||
float *getTextureV2()
|
||||
{
|
||||
return mTextureV2;
|
||||
}
|
||||
inline float *getTextureW2()
|
||||
float *getTextureW2()
|
||||
{
|
||||
return mTextureW2;
|
||||
}
|
||||
|
||||
inline float *getPhiIn()
|
||||
float *getPhiIn()
|
||||
{
|
||||
return mPhiIn;
|
||||
}
|
||||
inline float *getPhiStaticIn()
|
||||
float *getPhiStaticIn()
|
||||
{
|
||||
return mPhiStaticIn;
|
||||
}
|
||||
inline float *getPhiObsIn()
|
||||
float *getPhiObsIn()
|
||||
{
|
||||
return mPhiObsIn;
|
||||
}
|
||||
inline float *getPhiObsStaticIn()
|
||||
float *getPhiObsStaticIn()
|
||||
{
|
||||
return mPhiObsStaticIn;
|
||||
}
|
||||
inline float *getPhiGuideIn()
|
||||
float *getPhiGuideIn()
|
||||
{
|
||||
return mPhiGuideIn;
|
||||
}
|
||||
inline float *getPhiOutIn()
|
||||
float *getPhiOutIn()
|
||||
{
|
||||
return mPhiOutIn;
|
||||
}
|
||||
inline float *getPhiOutStaticIn()
|
||||
float *getPhiOutStaticIn()
|
||||
{
|
||||
return mPhiOutStaticIn;
|
||||
}
|
||||
inline float *getPhi()
|
||||
float *getPhi()
|
||||
{
|
||||
return mPhi;
|
||||
}
|
||||
inline float *getPressure()
|
||||
float *getPressure()
|
||||
{
|
||||
return mPressure;
|
||||
}
|
||||
@@ -406,20 +406,20 @@ struct MANTA {
|
||||
static int with_debug; /* On or off (1 or 0), also sets manta debug level. */
|
||||
|
||||
/* Mesh getters. */
|
||||
inline int getNumVertices()
|
||||
int getNumVertices()
|
||||
{
|
||||
return (mMeshNodes && !mMeshNodes->empty()) ? mMeshNodes->size() : 0;
|
||||
}
|
||||
inline int getNumNormals()
|
||||
int getNumNormals()
|
||||
{
|
||||
return (mMeshNodes && !mMeshNodes->empty()) ? mMeshNodes->size() : 0;
|
||||
}
|
||||
inline int getNumTriangles()
|
||||
int getNumTriangles()
|
||||
{
|
||||
return (mMeshTriangles && !mMeshTriangles->empty()) ? mMeshTriangles->size() : 0;
|
||||
}
|
||||
|
||||
inline float getVertexXAt(int i)
|
||||
float getVertexXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -428,7 +428,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getVertexYAt(int i)
|
||||
float getVertexYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -437,7 +437,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getVertexZAt(int i)
|
||||
float getVertexZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -447,7 +447,7 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float getNormalXAt(int i)
|
||||
float getNormalXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -456,7 +456,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getNormalYAt(int i)
|
||||
float getNormalYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -465,7 +465,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getNormalZAt(int i)
|
||||
float getNormalZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshNodes && !mMeshNodes->empty()) {
|
||||
@@ -475,7 +475,7 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline int getTriangleXAt(int i)
|
||||
int getTriangleXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshTriangles && !mMeshTriangles->empty()) {
|
||||
@@ -484,7 +484,7 @@ struct MANTA {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
inline int getTriangleYAt(int i)
|
||||
int getTriangleYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshTriangles && !mMeshTriangles->empty()) {
|
||||
@@ -493,7 +493,7 @@ struct MANTA {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
inline int getTriangleZAt(int i)
|
||||
int getTriangleZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshTriangles && !mMeshTriangles->empty()) {
|
||||
@@ -503,7 +503,7 @@ struct MANTA {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float getVertVelXAt(int i)
|
||||
float getVertVelXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshVelocities && !mMeshVelocities->empty()) {
|
||||
@@ -512,7 +512,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getVertVelYAt(int i)
|
||||
float getVertVelYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshVelocities && !mMeshVelocities->empty()) {
|
||||
@@ -521,7 +521,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getVertVelZAt(int i)
|
||||
float getVertVelZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mMeshVelocities && !mMeshVelocities->empty()) {
|
||||
@@ -532,7 +532,7 @@ struct MANTA {
|
||||
}
|
||||
|
||||
// Particle getters
|
||||
inline int getFlipParticleFlagAt(int i)
|
||||
int getFlipParticleFlagAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleData && !mFlipParticleData->empty()) {
|
||||
@@ -541,7 +541,7 @@ struct MANTA {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
inline int getSndParticleFlagAt(int i)
|
||||
int getSndParticleFlagAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleData && !mParticleData->empty()) {
|
||||
@@ -551,7 +551,7 @@ struct MANTA {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float getFlipParticlePositionXAt(int i)
|
||||
float getFlipParticlePositionXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleData && !mFlipParticleData->empty()) {
|
||||
@@ -560,7 +560,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getFlipParticlePositionYAt(int i)
|
||||
float getFlipParticlePositionYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleData && !mFlipParticleData->empty()) {
|
||||
@@ -569,7 +569,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getFlipParticlePositionZAt(int i)
|
||||
float getFlipParticlePositionZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleData && !mFlipParticleData->empty()) {
|
||||
@@ -579,7 +579,7 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float getSndParticlePositionXAt(int i)
|
||||
float getSndParticlePositionXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleData && !mParticleData->empty()) {
|
||||
@@ -588,7 +588,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getSndParticlePositionYAt(int i)
|
||||
float getSndParticlePositionYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleData && !mParticleData->empty()) {
|
||||
@@ -597,7 +597,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getSndParticlePositionZAt(int i)
|
||||
float getSndParticlePositionZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleData && !mParticleData->empty()) {
|
||||
@@ -607,7 +607,7 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float getFlipParticleVelocityXAt(int i)
|
||||
float getFlipParticleVelocityXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleVelocity && !mFlipParticleVelocity->empty()) {
|
||||
@@ -616,7 +616,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getFlipParticleVelocityYAt(int i)
|
||||
float getFlipParticleVelocityYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleVelocity && !mFlipParticleVelocity->empty()) {
|
||||
@@ -625,7 +625,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getFlipParticleVelocityZAt(int i)
|
||||
float getFlipParticleVelocityZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mFlipParticleVelocity && !mFlipParticleVelocity->empty()) {
|
||||
@@ -635,7 +635,7 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float getSndParticleVelocityXAt(int i)
|
||||
float getSndParticleVelocityXAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleVelocity && !mParticleVelocity->empty()) {
|
||||
@@ -644,7 +644,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getSndParticleVelocityYAt(int i)
|
||||
float getSndParticleVelocityYAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleVelocity && !mParticleVelocity->empty()) {
|
||||
@@ -653,7 +653,7 @@ struct MANTA {
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
inline float getSndParticleVelocityZAt(int i)
|
||||
float getSndParticleVelocityZAt(int i)
|
||||
{
|
||||
assert(i >= 0);
|
||||
if (mParticleVelocity && !mParticleVelocity->empty()) {
|
||||
@@ -663,52 +663,52 @@ struct MANTA {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float *getFlipParticleData()
|
||||
float *getFlipParticleData()
|
||||
{
|
||||
return (mFlipParticleData && !mFlipParticleData->empty()) ?
|
||||
(float *)&mFlipParticleData->front() :
|
||||
nullptr;
|
||||
}
|
||||
inline float *getSndParticleData()
|
||||
float *getSndParticleData()
|
||||
{
|
||||
return (mParticleData && !mParticleData->empty()) ? (float *)&mParticleData->front() : nullptr;
|
||||
}
|
||||
|
||||
inline float *getFlipParticleVelocity()
|
||||
float *getFlipParticleVelocity()
|
||||
{
|
||||
return (mFlipParticleVelocity && !mFlipParticleVelocity->empty()) ?
|
||||
(float *)&mFlipParticleVelocity->front() :
|
||||
nullptr;
|
||||
}
|
||||
inline float *getSndParticleVelocity()
|
||||
float *getSndParticleVelocity()
|
||||
{
|
||||
return (mParticleVelocity && !mParticleVelocity->empty()) ?
|
||||
(float *)&mParticleVelocity->front() :
|
||||
nullptr;
|
||||
}
|
||||
inline float *getSndParticleLife()
|
||||
float *getSndParticleLife()
|
||||
{
|
||||
return (mParticleLife && !mParticleLife->empty()) ? (float *)&mParticleLife->front() : nullptr;
|
||||
}
|
||||
|
||||
inline int getNumFlipParticles()
|
||||
int getNumFlipParticles()
|
||||
{
|
||||
return (mFlipParticleData && !mFlipParticleData->empty()) ? mFlipParticleData->size() : 0;
|
||||
}
|
||||
inline int getNumSndParticles()
|
||||
int getNumSndParticles()
|
||||
{
|
||||
return (mParticleData && !mParticleData->empty()) ? mParticleData->size() : 0;
|
||||
}
|
||||
|
||||
inline bool usingFlipFromFile()
|
||||
bool usingFlipFromFile()
|
||||
{
|
||||
return mFlipFromFile;
|
||||
}
|
||||
inline bool usingMeshFromFile()
|
||||
bool usingMeshFromFile()
|
||||
{
|
||||
return mMeshFromFile;
|
||||
}
|
||||
inline bool usingParticleFromFile()
|
||||
bool usingParticleFromFile()
|
||||
{
|
||||
return mParticlesFromFile;
|
||||
}
|
||||
@@ -853,12 +853,12 @@ struct MANTA {
|
||||
vector<pVel> *mParticleVelocity;
|
||||
vector<float> *mParticleLife;
|
||||
|
||||
void initializeRNAMap(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
bool initDomain(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
bool initNoise(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
bool initMesh(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
bool initSmoke(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
bool initSmokeNoise(struct FluidModifierData *doRnaRefresh = nullptr);
|
||||
void initializeRNAMap(struct FluidModifierData *fmd = nullptr);
|
||||
bool initDomain(struct FluidModifierData *fmd = nullptr);
|
||||
bool initNoise(struct FluidModifierData *fmd = nullptr);
|
||||
bool initMesh(struct FluidModifierData *fmd = nullptr);
|
||||
bool initSmoke(struct FluidModifierData *fmd = nullptr);
|
||||
bool initSmokeNoise(struct FluidModifierData *fmd = nullptr);
|
||||
void initializeMantaflow();
|
||||
void terminateMantaflow();
|
||||
bool runPythonString(vector<string> commands);
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
* \ingroup intern_mantaflow
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "MANTA_main.h"
|
||||
#include "manta_fluid_API.h"
|
||||
#include "MANTA_main.h"
|
||||
|
||||
/* Fluid functions */
|
||||
MANTA *manta_init(int *res, struct FluidModifierData *fmd)
|
||||
@@ -303,8 +301,13 @@ bool manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd)
|
||||
return smoke->exportSmokeScript(fmd);
|
||||
}
|
||||
|
||||
static void get_rgba(
|
||||
float *r, float *g, float *b, float *a, int total_cells, float *data, int sequential)
|
||||
static void get_rgba(const float *r,
|
||||
const float *g,
|
||||
const float *b,
|
||||
const float *a,
|
||||
int total_cells,
|
||||
float *data,
|
||||
int sequential)
|
||||
{
|
||||
int i;
|
||||
/* Use offsets to map RGB grids to correct location in data grid. */
|
||||
@@ -347,7 +350,10 @@ void manta_noise_get_rgba(MANTA *smoke, float *data, int sequential)
|
||||
sequential);
|
||||
}
|
||||
|
||||
static void get_rgba_fixed_color(float color[3], int total_cells, float *data, int sequential)
|
||||
static void get_rgba_fixed_color(const float color[3],
|
||||
int total_cells,
|
||||
float *data,
|
||||
int sequential)
|
||||
{
|
||||
int i;
|
||||
int m = 4, i_g = 1, i_b = 2, i_a = 3;
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
#define __MEM_ALLOCATOR_H__
|
||||
|
||||
#include "guardedalloc/MEM_guardedalloc.h"
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
template<typename _Tp> struct MEM_Allocator {
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp *pointer;
|
||||
typedef const _Tp *const_pointer;
|
||||
typedef _Tp &reference;
|
||||
typedef const _Tp &const_reference;
|
||||
typedef _Tp value_type;
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = _Tp *;
|
||||
using const_pointer = const _Tp *;
|
||||
using reference = _Tp &;
|
||||
using const_reference = const _Tp &;
|
||||
using value_type = _Tp;
|
||||
|
||||
template<typename _Tp1> struct rebind {
|
||||
typedef MEM_Allocator<_Tp1> other;
|
||||
using other = MEM_Allocator<_Tp1>;
|
||||
};
|
||||
|
||||
MEM_Allocator() throw() {}
|
||||
MEM_Allocator(const MEM_Allocator &) throw() {}
|
||||
MEM_Allocator() noexcept = default;
|
||||
MEM_Allocator(const MEM_Allocator & /*other*/) noexcept = default;
|
||||
|
||||
template<typename _Tp1> MEM_Allocator(const MEM_Allocator<_Tp1>) throw() {}
|
||||
template<typename _Tp1> MEM_Allocator(const MEM_Allocator<_Tp1> /*other*/) noexcept {}
|
||||
|
||||
~MEM_Allocator() throw() {}
|
||||
~MEM_Allocator() noexcept = default;
|
||||
|
||||
pointer address(reference __x) const
|
||||
{
|
||||
@@ -44,7 +44,7 @@ template<typename _Tp> struct MEM_Allocator {
|
||||
|
||||
/* NOTE: `__n` is permitted to be 0.
|
||||
* The C++ standard says nothing about what the return value is when `__n == 0`. */
|
||||
_Tp *allocate(size_type __n, const void * = 0)
|
||||
_Tp *allocate(size_type __n, const void * /*unused*/ = nullptr)
|
||||
{
|
||||
_Tp *__ret = NULL;
|
||||
if (__n) {
|
||||
@@ -54,12 +54,12 @@ template<typename _Tp> struct MEM_Allocator {
|
||||
}
|
||||
|
||||
// __p is not permitted to be a null pointer.
|
||||
void deallocate(pointer __p, size_type)
|
||||
void deallocate(pointer __p, size_type /*unused*/)
|
||||
{
|
||||
MEM_freeN(__p);
|
||||
}
|
||||
|
||||
size_type max_size() const throw()
|
||||
size_type max_size() const noexcept
|
||||
{
|
||||
return size_t(-1) / sizeof(_Tp);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
*/
|
||||
|
||||
#include "MEM_Allocator.h"
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
template<class T> class MEM_CacheLimiter;
|
||||
@@ -60,7 +58,7 @@ bool MEM_CacheLimiter_is_disabled(void);
|
||||
template<class T> class MEM_CacheLimiterHandle {
|
||||
public:
|
||||
explicit MEM_CacheLimiterHandle(T *data_, MEM_CacheLimiter<T> *parent_)
|
||||
: data(data_), refcount(0), parent(parent_)
|
||||
: data(data_), parent(parent_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -119,16 +117,16 @@ template<class T> class MEM_CacheLimiterHandle {
|
||||
friend class MEM_CacheLimiter<T>;
|
||||
|
||||
T *data;
|
||||
int refcount;
|
||||
int refcount = 0;
|
||||
int pos;
|
||||
MEM_CacheLimiter<T> *parent;
|
||||
};
|
||||
|
||||
template<class T> class MEM_CacheLimiter {
|
||||
public:
|
||||
typedef size_t (*MEM_CacheLimiter_DataSize_Func)(void *data);
|
||||
typedef int (*MEM_CacheLimiter_ItemPriority_Func)(void *item, int default_priority);
|
||||
typedef bool (*MEM_CacheLimiter_ItemDestroyable_Func)(void *item);
|
||||
using MEM_CacheLimiter_DataSize_Func = size_t (*)(void *);
|
||||
using MEM_CacheLimiter_ItemPriority_Func = int (*)(void *, int);
|
||||
using MEM_CacheLimiter_ItemDestroyable_Func = bool (*)(void *);
|
||||
|
||||
MEM_CacheLimiter(MEM_CacheLimiter_DataSize_Func data_size_func) : data_size_func(data_size_func)
|
||||
{
|
||||
@@ -224,7 +222,7 @@ template<class T> class MEM_CacheLimiter {
|
||||
* doesn't make much sense because we'll iterate it all to get
|
||||
* least priority element anyway.
|
||||
*/
|
||||
if (item_priority_func == NULL) {
|
||||
if (item_priority_func == nullptr) {
|
||||
queue[handle->pos] = queue.back();
|
||||
queue[handle->pos]->pos = handle->pos;
|
||||
queue.pop_back();
|
||||
@@ -244,9 +242,9 @@ template<class T> class MEM_CacheLimiter {
|
||||
}
|
||||
|
||||
private:
|
||||
typedef MEM_CacheLimiterHandle<T> *MEM_CacheElementPtr;
|
||||
typedef std::vector<MEM_CacheElementPtr, MEM_Allocator<MEM_CacheElementPtr>> MEM_CacheQueue;
|
||||
typedef typename MEM_CacheQueue::iterator iterator;
|
||||
using MEM_CacheElementPtr = MEM_CacheLimiterHandle<T> *;
|
||||
using MEM_CacheQueue = std::vector<MEM_CacheElementPtr, MEM_Allocator<MEM_CacheElementPtr>>;
|
||||
using iterator = typename MEM_CacheQueue::iterator;
|
||||
|
||||
/* Check whether element can be destroyed when enforcing cache limits */
|
||||
bool can_destroy_element(MEM_CacheElementPtr &elem)
|
||||
@@ -263,7 +261,7 @@ template<class T> class MEM_CacheLimiter {
|
||||
return true;
|
||||
}
|
||||
|
||||
MEM_CacheElementPtr get_least_priority_destroyable_element(void)
|
||||
MEM_CacheElementPtr get_least_priority_destroyable_element()
|
||||
{
|
||||
if (queue.empty()) {
|
||||
return NULL;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef __MEM_CACHELIMITERC_API_H__
|
||||
#define __MEM_CACHELIMITERC_API_H__
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -18,20 +18,20 @@ extern "C" {
|
||||
struct MEM_CacheLimiter_s;
|
||||
struct MEM_CacheLimiterHandle_s;
|
||||
|
||||
typedef struct MEM_CacheLimiter_s MEM_CacheLimiterC;
|
||||
typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
|
||||
using MEM_CacheLimiterC = struct MEM_CacheLimiter_s;
|
||||
using MEM_CacheLimiterHandleC = struct MEM_CacheLimiterHandle_s;
|
||||
|
||||
/* function used to remove data from memory */
|
||||
typedef void (*MEM_CacheLimiter_Destruct_Func)(void *);
|
||||
using MEM_CacheLimiter_Destruct_Func = void (*)(void *);
|
||||
|
||||
/* function used to measure stored data element size */
|
||||
typedef size_t (*MEM_CacheLimiter_DataSize_Func)(void *);
|
||||
using MEM_CacheLimiter_DataSize_Func = size_t (*)(void *);
|
||||
|
||||
/* function used to measure priority of item when freeing memory */
|
||||
typedef int (*MEM_CacheLimiter_ItemPriority_Func)(void *, int);
|
||||
using MEM_CacheLimiter_ItemPriority_Func = int (*)(void *, int);
|
||||
|
||||
/* function to check whether item could be destroyed */
|
||||
typedef bool (*MEM_CacheLimiter_ItemDestroyable_Func)(void *);
|
||||
using MEM_CacheLimiter_ItemDestroyable_Func = bool (*)(void *);
|
||||
|
||||
#ifndef __MEM_CACHELIMITER_H__
|
||||
void MEM_CacheLimiter_set_maximum(size_t m);
|
||||
|
||||
@@ -27,7 +27,7 @@ class MEM_RefCounted {
|
||||
/**
|
||||
* Constructs a shared object.
|
||||
*/
|
||||
MEM_RefCounted() : m_refCount(1) {}
|
||||
MEM_RefCounted() = default;
|
||||
|
||||
/**
|
||||
* Returns the reference count of this object.
|
||||
@@ -53,11 +53,10 @@ class MEM_RefCounted {
|
||||
* Destructs a shared object.
|
||||
* The destructor is protected to force the use of incRef and decRef.
|
||||
*/
|
||||
virtual ~MEM_RefCounted() {}
|
||||
virtual ~MEM_RefCounted() = default;
|
||||
|
||||
protected:
|
||||
/** The reference count. */
|
||||
int m_refCount;
|
||||
int m_refCount = 1;
|
||||
};
|
||||
|
||||
inline int MEM_RefCounted::getRef() const
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#define __MEM_REFCOUNTEDC_API_H__
|
||||
|
||||
/** A pointer to a private object. */
|
||||
typedef struct MEM_TOpaqueObject *MEM_TObjectPtr;
|
||||
using MEM_TObjectPtr = struct MEM_TOpaqueObject *;
|
||||
/** A pointer to a shared object. */
|
||||
typedef MEM_TObjectPtr MEM_TRefCountedObjectPtr;
|
||||
using MEM_TRefCountedObjectPtr = MEM_TObjectPtr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
|
||||
#include "MEM_CacheLimiter.h"
|
||||
#include "MEM_CacheLimiterC-Api.h"
|
||||
@@ -42,10 +43,10 @@ bool MEM_CacheLimiter_is_disabled(void)
|
||||
class MEM_CacheLimiterHandleCClass;
|
||||
class MEM_CacheLimiterCClass;
|
||||
|
||||
typedef MEM_CacheLimiterHandle<MEM_CacheLimiterHandleCClass> handle_t;
|
||||
typedef MEM_CacheLimiter<MEM_CacheLimiterHandleCClass> cache_t;
|
||||
typedef std::list<MEM_CacheLimiterHandleCClass *, MEM_Allocator<MEM_CacheLimiterHandleCClass *>>
|
||||
list_t;
|
||||
using handle_t = MEM_CacheLimiterHandle<MEM_CacheLimiterHandleCClass>;
|
||||
using cache_t = MEM_CacheLimiter<MEM_CacheLimiterHandleCClass>;
|
||||
using list_t =
|
||||
std::list<MEM_CacheLimiterHandleCClass *, MEM_Allocator<MEM_CacheLimiterHandleCClass *>>;
|
||||
|
||||
class MEM_CacheLimiterCClass {
|
||||
public:
|
||||
@@ -130,7 +131,7 @@ MEM_CacheLimiterCClass::~MEM_CacheLimiterCClass()
|
||||
{
|
||||
// should not happen, but don't leak memory in this case...
|
||||
for (list_t::iterator it = cclass_list.begin(); it != cclass_list.end(); it++) {
|
||||
(*it)->set_data(NULL);
|
||||
(*it)->set_data(nullptr);
|
||||
|
||||
delete *it;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,14 @@
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace mikk {
|
||||
|
||||
struct AtomicHashSetLinearProbeFcn {
|
||||
inline size_t operator()(size_t idx, size_t /* numProbes */, size_t capacity) const
|
||||
size_t operator()(size_t idx, size_t /* numProbes */, size_t capacity) const
|
||||
{
|
||||
idx += 1; // linear probing
|
||||
|
||||
@@ -42,7 +44,7 @@ struct AtomicHashSetLinearProbeFcn {
|
||||
};
|
||||
|
||||
struct AtomicHashSetQuadraticProbeFcn {
|
||||
inline size_t operator()(size_t idx, size_t numProbes, size_t capacity) const
|
||||
size_t operator()(size_t idx, size_t numProbes, size_t capacity) const
|
||||
{
|
||||
idx += numProbes; // quadratic probing
|
||||
|
||||
@@ -57,9 +59,8 @@ template<class KeyT,
|
||||
class KeyEqual = std::equal_to<KeyT>,
|
||||
class ProbeFcn = AtomicHashSetLinearProbeFcn>
|
||||
class AtomicHashSet {
|
||||
static_assert((std::is_convertible<KeyT, int32_t>::value ||
|
||||
std::is_convertible<KeyT, int64_t>::value ||
|
||||
std::is_convertible<KeyT, const void *>::value),
|
||||
static_assert((std::is_convertible_v<KeyT, int32_t> || std::is_convertible_v<KeyT, int64_t> ||
|
||||
std::is_convertible_v<KeyT, const void *>),
|
||||
"You are trying to use AtomicHashSet with disallowed key "
|
||||
"types. You must use atomically compare-and-swappable integer "
|
||||
"keys, or a different container class.");
|
||||
@@ -74,18 +75,18 @@ class AtomicHashSet {
|
||||
private:
|
||||
size_t kAnchorMask_;
|
||||
/* When using a single thread, we can avoid overhead by not bothering with atomic cells. */
|
||||
typedef typename std::conditional<isAtomic, std::atomic<KeyT>, KeyT>::type cell_type;
|
||||
using cell_type = std::conditional_t<isAtomic, std::atomic<KeyT>, KeyT>;
|
||||
std::vector<cell_type> cells_;
|
||||
|
||||
public:
|
||||
struct Config {
|
||||
KeyT emptyKey;
|
||||
double maxLoadFactor;
|
||||
double growthFactor;
|
||||
size_t capacity; // if positive, overrides maxLoadFactor
|
||||
KeyT emptyKey = (KeyT)-1;
|
||||
double maxLoadFactor = 0.8;
|
||||
double growthFactor = -1;
|
||||
size_t capacity = 0; // if positive, overrides maxLoadFactor
|
||||
|
||||
// Cannot have constexpr ctor because some compilers rightly complain.
|
||||
Config() : emptyKey((KeyT)-1), maxLoadFactor(0.8), growthFactor(-1), capacity(0) {}
|
||||
Config() = default;
|
||||
};
|
||||
|
||||
/* Instead of a mess of arguments, we take a max size and a Config struct to
|
||||
@@ -172,7 +173,7 @@ class AtomicHashSet {
|
||||
}
|
||||
|
||||
private:
|
||||
inline size_t keyToAnchorIdx(const KeyT k) const
|
||||
size_t keyToAnchorIdx(const KeyT k) const
|
||||
{
|
||||
const size_t hashVal = hasher_(k);
|
||||
const size_t probe = hashVal & kAnchorMask_;
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#ifndef M_PI_F
|
||||
# define M_PI_F (3.1415926535897932f) /* pi */
|
||||
@@ -105,18 +107,19 @@ static uint hash_float3x3(const float3 &x, const float3 &y, const float3 &z)
|
||||
template<typename T, typename KeyGetter>
|
||||
void radixsort(std::vector<T> &data, std::vector<T> &data2, KeyGetter getKey)
|
||||
{
|
||||
typedef decltype(getKey(data[0])) key_t;
|
||||
using key_t = decltype(getKey(data[0]));
|
||||
constexpr size_t datasize = sizeof(key_t);
|
||||
static_assert(datasize % 2 == 0);
|
||||
static_assert(std::is_integral<key_t>::value);
|
||||
static_assert(std::is_integral_v<key_t>);
|
||||
|
||||
uint bins[datasize][257] = {{0}};
|
||||
|
||||
/* Count number of elements per bin. */
|
||||
for (const T &item : data) {
|
||||
key_t key = getKey(item);
|
||||
for (uint pass = 0; pass < datasize; pass++)
|
||||
for (uint pass = 0; pass < datasize; pass++) {
|
||||
bins[pass][((key >> (8 * pass)) & 0xff) + 1]++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute prefix sum to find position of each bin in the sorted array. */
|
||||
|
||||
@@ -321,7 +321,7 @@ template<typename Mesh> class Mikktspace {
|
||||
|
||||
struct VertexHash {
|
||||
Mikktspace<Mesh> *mikk;
|
||||
inline uint operator()(const uint &k) const
|
||||
uint operator()(const uint &k) const
|
||||
{
|
||||
return hash_float3x3(mikk->getPosition(k), mikk->getNormal(k), mikk->getTexCoord(k));
|
||||
}
|
||||
@@ -329,7 +329,7 @@ template<typename Mesh> class Mikktspace {
|
||||
|
||||
struct VertexEqual {
|
||||
Mikktspace<Mesh> *mikk;
|
||||
inline bool operator()(const uint &kA, const uint &kB) const
|
||||
bool operator()(const uint &kA, const uint &kB) const
|
||||
{
|
||||
return mikk->getTexCoord(kA) == mikk->getTexCoord(kB) &&
|
||||
mikk->getNormal(kA) == mikk->getNormal(kB) &&
|
||||
@@ -620,8 +620,9 @@ template<typename Mesh> class Mikktspace {
|
||||
unpack_index(tB, iB, b.data);
|
||||
Mikktspace<Mesh>::Triangle &triB = mikk->triangles[tB];
|
||||
|
||||
if (b.key != a.key)
|
||||
if (b.key != a.key) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (triB.neighbor[iB] != UNSET_ENTRY) {
|
||||
continue;
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "ocio_impl.h"
|
||||
@@ -40,9 +38,8 @@ struct OCIO_PackedImageDescription {
|
||||
};
|
||||
|
||||
struct FallbackTransform {
|
||||
FallbackTransform() : type(TRANSFORM_UNKNOWN), scale(1.0f), exponent(1.0f) {}
|
||||
|
||||
virtual ~FallbackTransform() {}
|
||||
FallbackTransform() = default;
|
||||
virtual ~FallbackTransform() = default;
|
||||
|
||||
void applyRGB(float *pixel)
|
||||
{
|
||||
@@ -83,11 +80,11 @@ struct FallbackTransform {
|
||||
return false;
|
||||
}
|
||||
|
||||
TransformType type;
|
||||
TransformType type = TRANSFORM_UNKNOWN;
|
||||
/* Scale transform. */
|
||||
float scale;
|
||||
float scale = 1.0f;
|
||||
/* Exponent transform. */
|
||||
float exponent;
|
||||
float exponent = 1.0f;
|
||||
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("FallbackTransform");
|
||||
};
|
||||
@@ -124,7 +121,7 @@ void FallbackImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr * /*config*/) {}
|
||||
|
||||
OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromEnv()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromFile(const char * /*filename*/)
|
||||
@@ -145,11 +142,11 @@ const char *FallbackImpl::configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *
|
||||
if (index == 0) {
|
||||
return "Linear";
|
||||
}
|
||||
else if (index == 1) {
|
||||
if (index == 1) {
|
||||
return "sRGB";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstColorSpaceRcPtr *FallbackImpl::configGetColorSpace(OCIO_ConstConfigRcPtr * /*config*/,
|
||||
@@ -158,32 +155,32 @@ OCIO_ConstColorSpaceRcPtr *FallbackImpl::configGetColorSpace(OCIO_ConstConfigRcP
|
||||
if (strcmp(name, "scene_linear") == 0) {
|
||||
return COLORSPACE_LINEAR;
|
||||
}
|
||||
else if (strcmp(name, "color_picking") == 0) {
|
||||
if (strcmp(name, "color_picking") == 0) {
|
||||
return COLORSPACE_SRGB;
|
||||
}
|
||||
else if (strcmp(name, "texture_paint") == 0) {
|
||||
if (strcmp(name, "texture_paint") == 0) {
|
||||
return COLORSPACE_LINEAR;
|
||||
}
|
||||
else if (strcmp(name, "default_byte") == 0) {
|
||||
if (strcmp(name, "default_byte") == 0) {
|
||||
return COLORSPACE_SRGB;
|
||||
}
|
||||
else if (strcmp(name, "default_float") == 0) {
|
||||
if (strcmp(name, "default_float") == 0) {
|
||||
return COLORSPACE_LINEAR;
|
||||
}
|
||||
else if (strcmp(name, "default_sequencer") == 0) {
|
||||
if (strcmp(name, "default_sequencer") == 0) {
|
||||
return COLORSPACE_SRGB;
|
||||
}
|
||||
else if (strcmp(name, "Linear") == 0) {
|
||||
if (strcmp(name, "Linear") == 0) {
|
||||
return COLORSPACE_LINEAR;
|
||||
}
|
||||
else if (strcmp(name, "sRGB") == 0) {
|
||||
if (strcmp(name, "sRGB") == 0) {
|
||||
return COLORSPACE_SRGB;
|
||||
}
|
||||
else if (strcmp(name, "data") == 0) {
|
||||
if (strcmp(name, "data") == 0) {
|
||||
return COLORSPACE_DATA;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int FallbackImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
|
||||
@@ -193,10 +190,10 @@ int FallbackImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, con
|
||||
if (cs == COLORSPACE_LINEAR) {
|
||||
return 0;
|
||||
}
|
||||
else if (cs == COLORSPACE_SRGB) {
|
||||
if (cs == COLORSPACE_SRGB) {
|
||||
return 1;
|
||||
}
|
||||
else if (cs == COLORSPACE_DATA) {
|
||||
if (cs == COLORSPACE_DATA) {
|
||||
return 2;
|
||||
}
|
||||
return -1;
|
||||
@@ -217,7 +214,7 @@ const char *FallbackImpl::configGetDisplay(OCIO_ConstConfigRcPtr * /*config*/, i
|
||||
if (index == 0) {
|
||||
return "sRGB";
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *FallbackImpl::configGetDefaultView(OCIO_ConstConfigRcPtr * /*config*/,
|
||||
@@ -238,7 +235,7 @@ const char *FallbackImpl::configGetView(OCIO_ConstConfigRcPtr * /*config*/,
|
||||
if (index == 0) {
|
||||
return "Standard";
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *FallbackImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr * /*config*/,
|
||||
@@ -282,12 +279,12 @@ const char *FallbackImpl::configGetLookNameByIndex(OCIO_ConstConfigRcPtr * /*con
|
||||
OCIO_ConstLookRcPtr *FallbackImpl::configGetLook(OCIO_ConstConfigRcPtr * /*config*/,
|
||||
const char * /*name*/)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *FallbackImpl::lookGetProcessSpace(OCIO_ConstLookRcPtr * /*look*/)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FallbackImpl::lookRelease(OCIO_ConstLookRcPtr * /*look*/) {}
|
||||
@@ -458,13 +455,13 @@ const char *FallbackImpl::colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
|
||||
if (cs == COLORSPACE_LINEAR) {
|
||||
return "Linear";
|
||||
}
|
||||
else if (cs == COLORSPACE_SRGB) {
|
||||
if (cs == COLORSPACE_SRGB) {
|
||||
return "sRGB";
|
||||
}
|
||||
else if (cs == COLORSPACE_DATA) {
|
||||
if (cs == COLORSPACE_DATA) {
|
||||
return "data";
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *FallbackImpl::colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr * /*cs*/)
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "ocio_impl.h"
|
||||
|
||||
static IOCIOImpl *impl = NULL;
|
||||
static IOCIOImpl *impl = nullptr;
|
||||
|
||||
void OCIO_init()
|
||||
{
|
||||
@@ -20,7 +18,7 @@ void OCIO_init()
|
||||
void OCIO_exit()
|
||||
{
|
||||
delete impl;
|
||||
impl = NULL;
|
||||
impl = nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstConfigRcPtr *OCIO_getCurrentConfig()
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
#ifndef __OCIO_CAPI_H__
|
||||
#define __OCIO_CAPI_H__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OCIO_GPUShader OCIO_GPUShader;
|
||||
using OCIO_GPUShader = struct OCIO_GPUShader;
|
||||
|
||||
#define OCIO_DECLARE_HANDLE(name) \
|
||||
struct name; \
|
||||
@@ -45,7 +47,7 @@ static const float OCIO_ACES_TO_XYZ[3][3] = {{0.938280f, 0.337369f, 0.001174f},
|
||||
* blender's DNA structure stored in view transform settings
|
||||
* to a generic OpenColorIO C-API.
|
||||
*/
|
||||
typedef struct OCIO_CurveMappingSettings {
|
||||
struct OCIO_CurveMappingSettings {
|
||||
/* This is a LUT which contain values for all 4 curve mapping tables
|
||||
* (combined, R, G and B).
|
||||
*
|
||||
@@ -95,7 +97,7 @@ typedef struct OCIO_CurveMappingSettings {
|
||||
* upload of new settings to GPU is needed.
|
||||
*/
|
||||
size_t cache_id;
|
||||
} OCIO_CurveMappingSettings;
|
||||
};
|
||||
|
||||
void OCIO_init(void);
|
||||
void OCIO_exit(void);
|
||||
@@ -188,7 +190,7 @@ struct OCIO_PackedImageDesc *OCIO_createOCIO_PackedImageDesc(float *data,
|
||||
long xStrideBytes,
|
||||
long yStrideBytes);
|
||||
|
||||
void OCIO_PackedImageDescRelease(struct OCIO_PackedImageDesc *p);
|
||||
void OCIO_PackedImageDescRelease(struct OCIO_PackedImageDesc *id);
|
||||
|
||||
bool OCIO_supportGPUShader(void);
|
||||
bool OCIO_gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
@@ -31,7 +30,7 @@ using namespace OCIO_NAMESPACE;
|
||||
#if !defined(WITH_ASSERT_ABORT)
|
||||
# define OCIO_abort()
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
# include <cstdlib>
|
||||
# define OCIO_abort() abort()
|
||||
#endif
|
||||
|
||||
@@ -55,7 +54,7 @@ static void OCIO_reportException(Exception &exception)
|
||||
OCIO_reportError(exception.what());
|
||||
}
|
||||
|
||||
OCIO_ConstConfigRcPtr *OCIOImpl::getCurrentConfig(void)
|
||||
OCIO_ConstConfigRcPtr *OCIOImpl::getCurrentConfig()
|
||||
{
|
||||
ConstConfigRcPtr *config = MEM_new<ConstConfigRcPtr>(__func__);
|
||||
|
||||
@@ -72,7 +71,7 @@ OCIO_ConstConfigRcPtr *OCIOImpl::getCurrentConfig(void)
|
||||
|
||||
MEM_delete(config);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OCIOImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr *config)
|
||||
@@ -85,7 +84,7 @@ void OCIOImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr *config)
|
||||
}
|
||||
}
|
||||
|
||||
OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromEnv(void)
|
||||
OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromEnv()
|
||||
{
|
||||
ConstConfigRcPtr *config = MEM_new<ConstConfigRcPtr>(__func__);
|
||||
|
||||
@@ -102,7 +101,7 @@ OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromEnv(void)
|
||||
|
||||
MEM_delete(config);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromFile(const char *filename)
|
||||
@@ -122,7 +121,7 @@ OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromFile(const char *filename)
|
||||
|
||||
MEM_delete(config);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OCIOImpl::configRelease(OCIO_ConstConfigRcPtr *config)
|
||||
@@ -151,7 +150,7 @@ const char *OCIOImpl::configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *conf
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstColorSpaceRcPtr *OCIOImpl::configGetColorSpace(OCIO_ConstConfigRcPtr *config,
|
||||
@@ -172,7 +171,7 @@ OCIO_ConstColorSpaceRcPtr *OCIOImpl::configGetColorSpace(OCIO_ConstConfigRcPtr *
|
||||
|
||||
MEM_delete(cs);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int OCIOImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
|
||||
@@ -196,7 +195,7 @@ const char *OCIOImpl::configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config)
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int OCIOImpl::configGetNumDisplays(OCIO_ConstConfigRcPtr *config)
|
||||
@@ -220,7 +219,7 @@ const char *OCIOImpl::configGetDisplay(OCIO_ConstConfigRcPtr *config, int index)
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *OCIOImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display)
|
||||
@@ -232,7 +231,7 @@ const char *OCIOImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *config, const
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int OCIOImpl::configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display)
|
||||
@@ -256,7 +255,7 @@ const char *OCIOImpl::configGetView(OCIO_ConstConfigRcPtr *config, const char *d
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *OCIOImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *config,
|
||||
@@ -275,7 +274,7 @@ const char *OCIOImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *conf
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OCIOImpl::configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb)
|
||||
@@ -372,7 +371,7 @@ const char *OCIOImpl::configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, in
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_ConstLookRcPtr *OCIOImpl::configGetLook(OCIO_ConstConfigRcPtr *config, const char *name)
|
||||
@@ -392,7 +391,7 @@ OCIO_ConstLookRcPtr *OCIOImpl::configGetLook(OCIO_ConstConfigRcPtr *config, cons
|
||||
|
||||
MEM_delete(look);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *OCIOImpl::lookGetProcessSpace(OCIO_ConstLookRcPtr *look)
|
||||
@@ -543,7 +542,7 @@ OCIO_ConstProcessorRcPtr *OCIOImpl::configGetProcessorWithNames(OCIO_ConstConfig
|
||||
|
||||
MEM_delete(processor);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OCIOImpl::processorRelease(OCIO_ConstProcessorRcPtr *processor)
|
||||
@@ -793,7 +792,7 @@ OCIO_ConstProcessorRcPtr *OCIOImpl::createDisplayProcessor(OCIO_ConstConfigRcPtr
|
||||
}
|
||||
|
||||
MEM_delete(p);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OCIO_PackedImageDesc *OCIOImpl::createOCIO_PackedImageDesc(float *data,
|
||||
@@ -821,7 +820,7 @@ OCIO_PackedImageDesc *OCIOImpl::createOCIO_PackedImageDesc(float *data,
|
||||
OCIO_reportException(exception);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OCIOImpl::OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *id)
|
||||
@@ -829,12 +828,12 @@ void OCIOImpl::OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *id)
|
||||
MEM_delete((PackedImageDesc *)id);
|
||||
}
|
||||
|
||||
const char *OCIOImpl::getVersionString(void)
|
||||
const char *OCIOImpl::getVersionString()
|
||||
{
|
||||
return GetVersion();
|
||||
}
|
||||
|
||||
int OCIOImpl::getVersionHex(void)
|
||||
int OCIOImpl::getVersionHex()
|
||||
{
|
||||
return GetVersionHex();
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
class IOCIOImpl {
|
||||
public:
|
||||
virtual ~IOCIOImpl() {}
|
||||
virtual ~IOCIOImpl() = default;
|
||||
|
||||
virtual OCIO_ConstConfigRcPtr *getCurrentConfig(void) = 0;
|
||||
virtual OCIO_ConstConfigRcPtr *getCurrentConfig() = 0;
|
||||
virtual void setCurrentConfig(const OCIO_ConstConfigRcPtr *config) = 0;
|
||||
|
||||
virtual OCIO_ConstConfigRcPtr *configCreateFromEnv(void) = 0;
|
||||
virtual OCIO_ConstConfigRcPtr *configCreateFromEnv() = 0;
|
||||
virtual OCIO_ConstConfigRcPtr *configCreateFromFile(const char *filename) = 0;
|
||||
|
||||
virtual void configRelease(OCIO_ConstConfigRcPtr *config) = 0;
|
||||
@@ -125,79 +125,86 @@ class IOCIOImpl {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void gpuDisplayShaderUnbind(void) {}
|
||||
virtual void gpuCacheFree(void) {}
|
||||
virtual void gpuDisplayShaderUnbind() {}
|
||||
virtual void gpuCacheFree() {}
|
||||
|
||||
virtual const char *getVersionString(void) = 0;
|
||||
virtual int getVersionHex(void) = 0;
|
||||
virtual const char *getVersionString() = 0;
|
||||
virtual int getVersionHex() = 0;
|
||||
};
|
||||
|
||||
class FallbackImpl : public IOCIOImpl {
|
||||
public:
|
||||
FallbackImpl() {}
|
||||
FallbackImpl() = default;
|
||||
|
||||
OCIO_ConstConfigRcPtr *getCurrentConfig(void);
|
||||
void setCurrentConfig(const OCIO_ConstConfigRcPtr *config);
|
||||
OCIO_ConstConfigRcPtr *getCurrentConfig() override;
|
||||
void setCurrentConfig(const OCIO_ConstConfigRcPtr *config) override;
|
||||
|
||||
OCIO_ConstConfigRcPtr *configCreateFromEnv(void);
|
||||
OCIO_ConstConfigRcPtr *configCreateFromFile(const char *filename);
|
||||
OCIO_ConstConfigRcPtr *configCreateFromEnv() override;
|
||||
OCIO_ConstConfigRcPtr *configCreateFromFile(const char *filename) override;
|
||||
|
||||
void configRelease(OCIO_ConstConfigRcPtr *config);
|
||||
void configRelease(OCIO_ConstConfigRcPtr *config) override;
|
||||
|
||||
int configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index);
|
||||
OCIO_ConstColorSpaceRcPtr *configGetColorSpace(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
OCIO_ConstColorSpaceRcPtr *configGetColorSpace(OCIO_ConstConfigRcPtr *config,
|
||||
const char *name) override;
|
||||
int configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name) override;
|
||||
|
||||
int colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
int colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
void colorSpaceIsBuiltin(OCIO_ConstConfigRcPtr *config,
|
||||
OCIO_ConstColorSpaceRcPtr *cs,
|
||||
bool &is_scene_linear,
|
||||
bool &is_srgb);
|
||||
bool &is_srgb) override;
|
||||
|
||||
void colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
void colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
|
||||
const char *configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config);
|
||||
int configGetNumDisplays(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetDisplay(OCIO_ConstConfigRcPtr *config, int index);
|
||||
const char *configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display);
|
||||
int configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display);
|
||||
const char *configGetView(OCIO_ConstConfigRcPtr *config, const char *display, int index);
|
||||
const char *configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config) override;
|
||||
int configGetNumDisplays(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetDisplay(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
const char *configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display) override;
|
||||
int configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display) override;
|
||||
const char *configGetView(OCIO_ConstConfigRcPtr *config,
|
||||
const char *display,
|
||||
int index) override;
|
||||
const char *configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *config,
|
||||
const char *display,
|
||||
const char *view);
|
||||
const char *view) override;
|
||||
|
||||
void configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb);
|
||||
void configGetXYZtoSceneLinear(OCIO_ConstConfigRcPtr *config, float xyz_to_scene_linear[3][3]);
|
||||
void configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb) override;
|
||||
void configGetXYZtoSceneLinear(OCIO_ConstConfigRcPtr *config,
|
||||
float xyz_to_scene_linear[3][3]) override;
|
||||
|
||||
int configGetNumLooks(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index);
|
||||
OCIO_ConstLookRcPtr *configGetLook(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetNumLooks(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
OCIO_ConstLookRcPtr *configGetLook(OCIO_ConstConfigRcPtr *config, const char *name) override;
|
||||
|
||||
const char *lookGetProcessSpace(OCIO_ConstLookRcPtr *look);
|
||||
void lookRelease(OCIO_ConstLookRcPtr *look);
|
||||
const char *lookGetProcessSpace(OCIO_ConstLookRcPtr *look) override;
|
||||
void lookRelease(OCIO_ConstLookRcPtr *look) override;
|
||||
|
||||
OCIO_ConstProcessorRcPtr *configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config,
|
||||
const char *srcName,
|
||||
const char *dstName);
|
||||
void processorRelease(OCIO_ConstProcessorRcPtr *processor);
|
||||
const char *dstName) override;
|
||||
void processorRelease(OCIO_ConstProcessorRcPtr *processor) override;
|
||||
|
||||
OCIO_ConstCPUProcessorRcPtr *processorGetCPUProcessor(OCIO_ConstProcessorRcPtr *processor);
|
||||
bool cpuProcessorIsNoOp(OCIO_ConstCPUProcessorRcPtr *cpu_processor);
|
||||
void cpuProcessorApply(OCIO_ConstCPUProcessorRcPtr *cpu_processor, OCIO_PackedImageDesc *img);
|
||||
OCIO_ConstCPUProcessorRcPtr *processorGetCPUProcessor(
|
||||
OCIO_ConstProcessorRcPtr *processor) override;
|
||||
bool cpuProcessorIsNoOp(OCIO_ConstCPUProcessorRcPtr *cpu_processor) override;
|
||||
void cpuProcessorApply(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
OCIO_PackedImageDesc *img) override;
|
||||
void cpuProcessorApply_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
OCIO_PackedImageDesc *img);
|
||||
void cpuProcessorApplyRGB(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorApplyRGBA(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorApplyRGBA_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorRelease(OCIO_ConstCPUProcessorRcPtr *cpu_processor);
|
||||
OCIO_PackedImageDesc *img) override;
|
||||
void cpuProcessorApplyRGB(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel) override;
|
||||
void cpuProcessorApplyRGBA(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel) override;
|
||||
void cpuProcessorApplyRGBA_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
float *pixel) override;
|
||||
void cpuProcessorRelease(OCIO_ConstCPUProcessorRcPtr *cpu_processor) override;
|
||||
|
||||
const char *colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceGetNumAliases(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetAlias(OCIO_ConstColorSpaceRcPtr *cs, const int index);
|
||||
const char *colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
int colorSpaceGetNumAliases(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetAlias(OCIO_ConstColorSpaceRcPtr *cs, const int index) override;
|
||||
|
||||
OCIO_ConstProcessorRcPtr *createDisplayProcessor(OCIO_ConstConfigRcPtr *config,
|
||||
const char *input,
|
||||
@@ -209,7 +216,7 @@ class FallbackImpl : public IOCIOImpl {
|
||||
const float temperature,
|
||||
const float tint,
|
||||
const bool use_white_balance,
|
||||
const bool inverse);
|
||||
const bool inverse) override;
|
||||
|
||||
OCIO_PackedImageDesc *createOCIO_PackedImageDesc(float *data,
|
||||
long width,
|
||||
@@ -217,81 +224,88 @@ class FallbackImpl : public IOCIOImpl {
|
||||
long numChannels,
|
||||
long chanStrideBytes,
|
||||
long xStrideBytes,
|
||||
long yStrideBytes);
|
||||
long yStrideBytes) override;
|
||||
|
||||
void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *p);
|
||||
void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *id) override;
|
||||
|
||||
const char *getVersionString(void);
|
||||
int getVersionHex(void);
|
||||
const char *getVersionString() override;
|
||||
int getVersionHex() override;
|
||||
};
|
||||
|
||||
#ifdef WITH_OCIO
|
||||
class OCIOImpl : public IOCIOImpl {
|
||||
public:
|
||||
OCIOImpl(){};
|
||||
OCIOImpl() = default;
|
||||
|
||||
OCIO_ConstConfigRcPtr *getCurrentConfig(void);
|
||||
void setCurrentConfig(const OCIO_ConstConfigRcPtr *config);
|
||||
OCIO_ConstConfigRcPtr *getCurrentConfig() override;
|
||||
void setCurrentConfig(const OCIO_ConstConfigRcPtr *config) override;
|
||||
|
||||
OCIO_ConstConfigRcPtr *configCreateFromEnv(void);
|
||||
OCIO_ConstConfigRcPtr *configCreateFromFile(const char *filename);
|
||||
OCIO_ConstConfigRcPtr *configCreateFromEnv() override;
|
||||
OCIO_ConstConfigRcPtr *configCreateFromFile(const char *filename) override;
|
||||
|
||||
void configRelease(OCIO_ConstConfigRcPtr *config);
|
||||
void configRelease(OCIO_ConstConfigRcPtr *config) override;
|
||||
|
||||
int configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index);
|
||||
OCIO_ConstColorSpaceRcPtr *configGetColorSpace(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
OCIO_ConstColorSpaceRcPtr *configGetColorSpace(OCIO_ConstConfigRcPtr *config,
|
||||
const char *name) override;
|
||||
int configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name) override;
|
||||
|
||||
int colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
int colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
void colorSpaceIsBuiltin(OCIO_ConstConfigRcPtr *config,
|
||||
OCIO_ConstColorSpaceRcPtr *cs,
|
||||
bool &is_scene_linear,
|
||||
bool &is_srgb);
|
||||
bool &is_srgb) override;
|
||||
|
||||
void colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
void colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
|
||||
const char *configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config);
|
||||
int configGetNumDisplays(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetDisplay(OCIO_ConstConfigRcPtr *config, int index);
|
||||
const char *configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display);
|
||||
int configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display);
|
||||
const char *configGetView(OCIO_ConstConfigRcPtr *config, const char *display, int index);
|
||||
const char *configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config) override;
|
||||
int configGetNumDisplays(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetDisplay(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
const char *configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display) override;
|
||||
int configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display) override;
|
||||
const char *configGetView(OCIO_ConstConfigRcPtr *config,
|
||||
const char *display,
|
||||
int index) override;
|
||||
const char *configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *config,
|
||||
const char *display,
|
||||
const char *view);
|
||||
const char *view) override;
|
||||
|
||||
void configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb);
|
||||
void configGetXYZtoSceneLinear(OCIO_ConstConfigRcPtr *config, float xyz_to_scene_linear[3][3]);
|
||||
void configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb) override;
|
||||
void configGetXYZtoSceneLinear(OCIO_ConstConfigRcPtr *config,
|
||||
float xyz_to_scene_linear[3][3]) override;
|
||||
|
||||
int configGetNumLooks(OCIO_ConstConfigRcPtr *config);
|
||||
const char *configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index);
|
||||
OCIO_ConstLookRcPtr *configGetLook(OCIO_ConstConfigRcPtr *config, const char *name);
|
||||
int configGetNumLooks(OCIO_ConstConfigRcPtr *config) override;
|
||||
const char *configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index) override;
|
||||
OCIO_ConstLookRcPtr *configGetLook(OCIO_ConstConfigRcPtr *config, const char *name) override;
|
||||
|
||||
const char *lookGetProcessSpace(OCIO_ConstLookRcPtr *look);
|
||||
void lookRelease(OCIO_ConstLookRcPtr *look);
|
||||
const char *lookGetProcessSpace(OCIO_ConstLookRcPtr *look) override;
|
||||
void lookRelease(OCIO_ConstLookRcPtr *look) override;
|
||||
|
||||
OCIO_ConstProcessorRcPtr *configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config,
|
||||
const char *srcName,
|
||||
const char *dstName);
|
||||
void processorRelease(OCIO_ConstProcessorRcPtr *processor);
|
||||
const char *dstName) override;
|
||||
void processorRelease(OCIO_ConstProcessorRcPtr *processor) override;
|
||||
|
||||
OCIO_ConstCPUProcessorRcPtr *processorGetCPUProcessor(OCIO_ConstProcessorRcPtr *processor);
|
||||
bool cpuProcessorIsNoOp(OCIO_ConstCPUProcessorRcPtr *cpu_processor);
|
||||
void cpuProcessorApply(OCIO_ConstCPUProcessorRcPtr *cpu_processor, OCIO_PackedImageDesc *img);
|
||||
OCIO_ConstCPUProcessorRcPtr *processorGetCPUProcessor(
|
||||
OCIO_ConstProcessorRcPtr *processor) override;
|
||||
bool cpuProcessorIsNoOp(OCIO_ConstCPUProcessorRcPtr *cpu_processor) override;
|
||||
void cpuProcessorApply(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
OCIO_PackedImageDesc *img) override;
|
||||
void cpuProcessorApply_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
OCIO_PackedImageDesc *img);
|
||||
void cpuProcessorApplyRGB(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorApplyRGBA(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorApplyRGBA_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel);
|
||||
void cpuProcessorRelease(OCIO_ConstCPUProcessorRcPtr *cpu_processor);
|
||||
OCIO_PackedImageDesc *img) override;
|
||||
void cpuProcessorApplyRGB(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel) override;
|
||||
void cpuProcessorApplyRGBA(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel) override;
|
||||
void cpuProcessorApplyRGBA_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor,
|
||||
float *pixel) override;
|
||||
void cpuProcessorRelease(OCIO_ConstCPUProcessorRcPtr *cpu_processor) override;
|
||||
|
||||
const char *colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
int colorSpaceGetNumAliases(OCIO_ConstColorSpaceRcPtr *cs);
|
||||
const char *colorSpaceGetAlias(OCIO_ConstColorSpaceRcPtr *cs, const int index);
|
||||
const char *colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
int colorSpaceGetNumAliases(OCIO_ConstColorSpaceRcPtr *cs) override;
|
||||
const char *colorSpaceGetAlias(OCIO_ConstColorSpaceRcPtr *cs, const int index) override;
|
||||
|
||||
OCIO_ConstProcessorRcPtr *createDisplayProcessor(OCIO_ConstConfigRcPtr *config,
|
||||
const char *input,
|
||||
@@ -303,7 +317,7 @@ class OCIOImpl : public IOCIOImpl {
|
||||
const float temperature,
|
||||
const float tint,
|
||||
const bool use_white_balance,
|
||||
const bool inverse);
|
||||
const bool inverse) override;
|
||||
|
||||
OCIO_PackedImageDesc *createOCIO_PackedImageDesc(float *data,
|
||||
long width,
|
||||
@@ -311,11 +325,11 @@ class OCIOImpl : public IOCIOImpl {
|
||||
long numChannels,
|
||||
long chanStrideBytes,
|
||||
long xStrideBytes,
|
||||
long yStrideBytes);
|
||||
long yStrideBytes) override;
|
||||
|
||||
void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *p);
|
||||
void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *id) override;
|
||||
|
||||
bool supportGPUShader();
|
||||
bool supportGPUShader() override;
|
||||
bool gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
||||
const char *input,
|
||||
const char *view,
|
||||
@@ -330,12 +344,12 @@ class OCIOImpl : public IOCIOImpl {
|
||||
const bool use_predivide,
|
||||
const bool use_overlay,
|
||||
const bool use_hdr,
|
||||
const bool use_white_balance);
|
||||
void gpuDisplayShaderUnbind(void);
|
||||
void gpuCacheFree(void);
|
||||
const bool use_white_balance) override;
|
||||
void gpuDisplayShaderUnbind() override;
|
||||
void gpuCacheFree() override;
|
||||
|
||||
const char *getVersionString(void);
|
||||
int getVersionHex(void);
|
||||
const char *getVersionString() override;
|
||||
int getVersionHex() override;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later AND BSD-3-Clause */
|
||||
|
||||
#include <limits>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -27,12 +26,9 @@
|
||||
|
||||
using namespace OCIO_NAMESPACE;
|
||||
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_math_color.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "ocio_impl.h"
|
||||
#include "ocio_shader_shared.hh"
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
# include <iso646.h>
|
||||
#endif
|
||||
|
||||
#include "internal/base/util.h"
|
||||
|
||||
void openSubdiv_init() {}
|
||||
|
||||
void openSubdiv_cleanup() {}
|
||||
|
||||
@@ -32,7 +32,7 @@ OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type)
|
||||
OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFromCAPI(
|
||||
OpenSubdiv_FVarLinearInterpolation linear_interpolation)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
switch (linear_interpolation) {
|
||||
case OSD_FVAR_LINEAR_INTERPOLATION_NONE:
|
||||
return Options::FVAR_LINEAR_NONE;
|
||||
@@ -54,7 +54,7 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFrom
|
||||
OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
|
||||
OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
switch (linear_interpolation) {
|
||||
case Options::FVAR_LINEAR_NONE:
|
||||
return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
|
||||
|
||||
@@ -170,7 +170,7 @@ template<typename EVAL_VERTEX_BUFFER,
|
||||
typename DEVICE_CONTEXT = void>
|
||||
class FaceVaryingVolatileEval {
|
||||
public:
|
||||
typedef OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR> EvaluatorCache;
|
||||
using EvaluatorCache = OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR>;
|
||||
|
||||
FaceVaryingVolatileEval(int face_varying_channel,
|
||||
const StencilTable *face_varying_stencils,
|
||||
@@ -309,13 +309,12 @@ template<typename SRC_VERTEX_BUFFER,
|
||||
typename DEVICE_CONTEXT = void>
|
||||
class VolatileEvalOutput : public EvalOutputAPI::EvalOutput {
|
||||
public:
|
||||
typedef OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR> EvaluatorCache;
|
||||
typedef FaceVaryingVolatileEval<EVAL_VERTEX_BUFFER,
|
||||
STENCIL_TABLE,
|
||||
PATCH_TABLE,
|
||||
EVALUATOR,
|
||||
DEVICE_CONTEXT>
|
||||
FaceVaryingEval;
|
||||
using EvaluatorCache = OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR>;
|
||||
using FaceVaryingEval = FaceVaryingVolatileEval<EVAL_VERTEX_BUFFER,
|
||||
STENCIL_TABLE,
|
||||
PATCH_TABLE,
|
||||
EVALUATOR,
|
||||
DEVICE_CONTEXT>;
|
||||
|
||||
VolatileEvalOutput(const StencilTable *vertex_stencils,
|
||||
const StencilTable *varying_stencils,
|
||||
|
||||
@@ -32,7 +32,7 @@ class CpuEvalOutput : public VolatileEvalOutput<CpuVertexBuffer,
|
||||
const std::vector<const StencilTable *> &all_face_varying_stencils,
|
||||
const int face_varying_width,
|
||||
const PatchTable *patch_table,
|
||||
EvaluatorCache *evaluator_cache = NULL)
|
||||
EvaluatorCache *evaluator_cache = nullptr)
|
||||
: VolatileEvalOutput<CpuVertexBuffer,
|
||||
CpuVertexBuffer,
|
||||
StencilTable,
|
||||
|
||||
@@ -21,7 +21,7 @@ static void buildPatchArraysBufferFromVector(const PatchArrayVector &patch_array
|
||||
patch_arrays_buffer->device_alloc(patch_arrays_buffer, patch_arrays.size());
|
||||
patch_arrays_buffer->bind_gpu(patch_arrays_buffer);
|
||||
patch_arrays_buffer->device_update(
|
||||
patch_arrays_buffer, 0, patch_array_byte_site, &patch_arrays[0]);
|
||||
patch_arrays_buffer, 0, patch_array_byte_site, patch_arrays.data());
|
||||
}
|
||||
|
||||
GpuEvalOutput::GpuEvalOutput(const StencilTable *vertex_stencils,
|
||||
|
||||
@@ -28,7 +28,7 @@ class GpuEvalOutput : public VolatileEvalOutput<GLVertexBuffer,
|
||||
const std::vector<const StencilTable *> &all_face_varying_stencils,
|
||||
const int face_varying_width,
|
||||
const PatchTable *patch_table,
|
||||
EvaluatorCache *evaluator_cache = NULL);
|
||||
EvaluatorCache *evaluator_cache = nullptr);
|
||||
|
||||
void fillPatchArraysBuffer(OpenSubdiv_Buffer *patch_arrays_buffer) override;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "internal/evaluator/eval_output_gpu.h"
|
||||
|
||||
OpenSubdiv_EvaluatorCacheImpl::OpenSubdiv_EvaluatorCacheImpl() {}
|
||||
OpenSubdiv_EvaluatorCacheImpl::OpenSubdiv_EvaluatorCacheImpl() = default;
|
||||
|
||||
OpenSubdiv_EvaluatorCacheImpl::~OpenSubdiv_EvaluatorCacheImpl()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache *evaluator_cache)
|
||||
MEM_delete(evaluator_cache);
|
||||
}
|
||||
|
||||
const char *openSubdiv_getGLSLPatchBasisSource(void)
|
||||
const char *openSubdiv_getGLSLPatchBasisSource()
|
||||
{
|
||||
/* Using a global string to avoid dealing with memory allocation/ownership. */
|
||||
static std::string patch_basis_source;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* Author: Sergey Sharybin. */
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <iso646.h>
|
||||
@@ -18,8 +17,6 @@
|
||||
#include <opensubdiv/osd/types.h>
|
||||
#include <opensubdiv/version.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "internal/evaluator/eval_output_cpu.h"
|
||||
#include "internal/evaluator/eval_output_gpu.h"
|
||||
#include "internal/evaluator/evaluator_cache_impl.h"
|
||||
@@ -43,7 +40,10 @@ namespace blender::opensubdiv {
|
||||
template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
public:
|
||||
StackOrHeapArray()
|
||||
: num_elements_(0), heap_elements_(NULL), num_heap_elements_(0), effective_elements_(NULL)
|
||||
: num_elements_(0),
|
||||
heap_elements_(nullptr),
|
||||
num_heap_elements_(0),
|
||||
effective_elements_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
return;
|
||||
}
|
||||
// Simple case: no previously allocated buffer, can simply do one allocation.
|
||||
if (effective_elements_ == NULL) {
|
||||
if (effective_elements_ == nullptr) {
|
||||
effective_elements_ = allocate(num_elements);
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
};
|
||||
|
||||
// 32 is a number of inner vertices along the patch size at subdivision level 6.
|
||||
typedef StackOrHeapArray<PatchCoord, 32 * 32> StackOrHeapPatchCoordArray;
|
||||
using StackOrHeapPatchCoordArray = StackOrHeapArray<PatchCoord, 32 * 32>;
|
||||
|
||||
static void convertPatchCoordsToArray(const OpenSubdiv_PatchCoord *patch_coords,
|
||||
const int num_patch_coords,
|
||||
@@ -259,7 +259,7 @@ void EvalOutputAPI::evaluateLimit(const int ptex_face_index,
|
||||
assert(face_v <= 1.0f);
|
||||
const PatchTable::PatchHandle *handle = patch_map_->FindPatch(ptex_face_index, face_u, face_v);
|
||||
PatchCoord patch_coord(*handle, face_u, face_v);
|
||||
if (dPdu != NULL || dPdv != NULL) {
|
||||
if (dPdu != nullptr || dPdv != nullptr) {
|
||||
implementation_->evalPatchesWithDerivatives(&patch_coord, 1, P, dPdu, dPdv);
|
||||
}
|
||||
else {
|
||||
@@ -318,7 +318,7 @@ void EvalOutputAPI::evaluatePatchesLimit(const OpenSubdiv_PatchCoord *patch_coor
|
||||
{
|
||||
StackOrHeapPatchCoordArray patch_coords_array;
|
||||
convertPatchCoordsToArray(patch_coords, num_patch_coords, patch_map_, &patch_coords_array);
|
||||
if (dPdu != NULL || dPdv != NULL) {
|
||||
if (dPdu != nullptr || dPdv != nullptr) {
|
||||
implementation_->evalPatchesWithDerivatives(
|
||||
patch_coords_array.data(), num_patch_coords, P, dPdu, dPdv);
|
||||
}
|
||||
@@ -342,12 +342,12 @@ void EvalOutputAPI::getPatchMap(OpenSubdiv_Buffer *patch_map_handles,
|
||||
const std::vector<PatchTable::PatchHandle> &handles = patch_map_->getHandles();
|
||||
PatchTable::PatchHandle *buffer_handles = static_cast<PatchTable::PatchHandle *>(
|
||||
patch_map_handles->alloc(patch_map_handles, handles.size()));
|
||||
memcpy(buffer_handles, &handles[0], sizeof(PatchTable::PatchHandle) * handles.size());
|
||||
memcpy(buffer_handles, handles.data(), sizeof(PatchTable::PatchHandle) * handles.size());
|
||||
|
||||
const std::vector<PatchMap::QuadNode> &quadtree = patch_map_->nodes();
|
||||
PatchMap::QuadNode *buffer_nodes = static_cast<PatchMap::QuadNode *>(
|
||||
patch_map_quadtree->alloc(patch_map_quadtree, quadtree.size()));
|
||||
memcpy(buffer_nodes, &quadtree[0], sizeof(PatchMap::QuadNode) * quadtree.size());
|
||||
memcpy(buffer_nodes, quadtree.data(), sizeof(PatchMap::QuadNode) * quadtree.size());
|
||||
}
|
||||
|
||||
void EvalOutputAPI::fillPatchArraysBuffer(OpenSubdiv_Buffer *patch_arrays_buffer)
|
||||
@@ -407,7 +407,7 @@ bool EvalOutputAPI::hasVertexData() const
|
||||
} // namespace blender::opensubdiv
|
||||
|
||||
OpenSubdiv_Evaluator::OpenSubdiv_Evaluator()
|
||||
: eval_output(NULL), patch_map(NULL), patch_table(NULL)
|
||||
: eval_output(nullptr), patch_map(nullptr), patch_table(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -424,9 +424,9 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
OpenSubdiv_EvaluatorCache *evaluator_cache_descr)
|
||||
{
|
||||
TopologyRefiner *refiner = topology_refiner->topology_refiner;
|
||||
if (refiner == NULL) {
|
||||
if (refiner == nullptr) {
|
||||
// Happens on bad topology.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// TODO(sergey): Base this on actual topology.
|
||||
const bool has_varying_data = false;
|
||||
@@ -471,7 +471,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
//
|
||||
// TODO(sergey): Seems currently varying stencils are always required in
|
||||
// OpenSubdiv itself.
|
||||
const StencilTable *varying_stencils = NULL;
|
||||
const StencilTable *varying_stencils = nullptr;
|
||||
if (has_varying_data) {
|
||||
StencilTableFactory::Options varying_stencil_options;
|
||||
varying_stencil_options.generateOffsets = stencil_generate_offsets;
|
||||
@@ -503,7 +503,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
// Append local points stencils.
|
||||
// Point stencils.
|
||||
const StencilTable *local_point_stencil_table = patch_table->GetLocalPointStencilTable();
|
||||
if (local_point_stencil_table != NULL) {
|
||||
if (local_point_stencil_table != nullptr) {
|
||||
const StencilTable *table = StencilTableFactory::AppendLocalPointStencilTable(
|
||||
*refiner, vertex_stencils, local_point_stencil_table);
|
||||
delete_stencil_table(vertex_stencils);
|
||||
@@ -513,7 +513,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
if (has_varying_data) {
|
||||
const StencilTable *local_point_varying_stencil_table =
|
||||
patch_table->GetLocalPointVaryingStencilTable();
|
||||
if (local_point_varying_stencil_table != NULL) {
|
||||
if (local_point_varying_stencil_table != nullptr) {
|
||||
const StencilTable *table = StencilTableFactory::AppendLocalPointStencilTable(
|
||||
*refiner, varying_stencils, local_point_varying_stencil_table);
|
||||
delete_stencil_table(varying_stencils);
|
||||
@@ -528,7 +528,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
all_face_varying_stencils[face_varying_channel],
|
||||
patch_table->GetLocalPointFaceVaryingStencilTable(face_varying_channel),
|
||||
face_varying_channel);
|
||||
if (table != NULL) {
|
||||
if (table != nullptr) {
|
||||
delete_stencil_table(all_face_varying_stencils[face_varying_channel]);
|
||||
all_face_varying_stencils[face_varying_channel] = table;
|
||||
}
|
||||
|
||||
@@ -190,12 +190,12 @@ static GLuint compileKernel(BufferDescriptor const &srcDesc,
|
||||
|
||||
std::string defineStr = defines.str();
|
||||
|
||||
const char *shaderSources[4] = {"#version 430\n", 0, 0, 0};
|
||||
const char *shaderSources[4] = {"#version 430\n", nullptr, nullptr, nullptr};
|
||||
|
||||
shaderSources[1] = defineStr.c_str();
|
||||
shaderSources[2] = patchBasisShaderSource.c_str();
|
||||
shaderSources[3] = datatoc_glsl_compute_kernel_glsl;
|
||||
glShaderSource(shader, 4, shaderSources, NULL);
|
||||
glShaderSource(shader, 4, shaderSources, nullptr);
|
||||
glCompileShader(shader);
|
||||
glAttachShader(program, shader);
|
||||
|
||||
@@ -205,10 +205,10 @@ static GLuint compileKernel(BufferDescriptor const &srcDesc,
|
||||
|
||||
if (linked == GL_FALSE) {
|
||||
char buffer[1024];
|
||||
glGetShaderInfoLog(shader, 1024, NULL, buffer);
|
||||
glGetShaderInfoLog(shader, 1024, nullptr, buffer);
|
||||
OpenSubdiv::Far::Error(OpenSubdiv::Far::FAR_RUNTIME_ERROR, buffer);
|
||||
|
||||
glGetProgramInfoLog(program, 1024, NULL, buffer);
|
||||
glGetProgramInfoLog(program, 1024, nullptr, buffer);
|
||||
OpenSubdiv::Far::Error(OpenSubdiv::Far::FAR_RUNTIME_ERROR, buffer);
|
||||
|
||||
glDeleteProgram(program);
|
||||
@@ -524,7 +524,7 @@ bool GLComputeEvaluator::EvalPatches(GLuint srcBuffer,
|
||||
int patchArraySize = sizeof(PatchArray);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, _patchArraysSSBO);
|
||||
glBufferData(
|
||||
GL_SHADER_STORAGE_BUFFER, patchArrays.size() * patchArraySize, NULL, GL_STATIC_DRAW);
|
||||
GL_SHADER_STORAGE_BUFFER, patchArrays.size() * patchArraySize, nullptr, GL_STATIC_DRAW);
|
||||
for (int i = 0; i < (int)patchArrays.size(); ++i) {
|
||||
glBufferSubData(
|
||||
GL_SHADER_STORAGE_BUFFER, i * patchArraySize, sizeof(PatchArray), &patchArrays[i]);
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
#include <opensubdiv/osd/types.h>
|
||||
#include <opensubdiv/version.h>
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
namespace Far {
|
||||
namespace OpenSubdiv::OPENSUBDIV_VERSION::Far {
|
||||
class LimitStencilTable;
|
||||
class StencilTable;
|
||||
} // namespace Far
|
||||
} // namespace OPENSUBDIV_VERSION
|
||||
} // namespace OpenSubdiv
|
||||
} // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
|
||||
// namespace OPENSUBDIV_VERSION
|
||||
|
||||
namespace blender::opensubdiv {
|
||||
|
||||
@@ -30,13 +27,13 @@ namespace blender::opensubdiv {
|
||||
class GLStencilTableSSBO {
|
||||
public:
|
||||
static GLStencilTableSSBO *Create(OpenSubdiv::Far::StencilTable const *stencilTable,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // unused
|
||||
return new GLStencilTableSSBO(stencilTable);
|
||||
}
|
||||
static GLStencilTableSSBO *Create(OpenSubdiv::Far::LimitStencilTable const *limitStencilTable,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // unused
|
||||
return new GLStencilTableSSBO(limitStencilTable);
|
||||
@@ -105,12 +102,12 @@ class GLStencilTableSSBO {
|
||||
|
||||
class GLComputeEvaluator {
|
||||
public:
|
||||
typedef bool Instantiatable;
|
||||
using Instantiatable = bool;
|
||||
static GLComputeEvaluator *Create(OpenSubdiv::Osd::BufferDescriptor const &srcDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvDesc,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
return Create(srcDesc,
|
||||
dstDesc,
|
||||
@@ -129,7 +126,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duuDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duvDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvvDesc,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // not used
|
||||
GLComputeEvaluator *instance = new GLComputeEvaluator();
|
||||
@@ -137,7 +134,7 @@ class GLComputeEvaluator {
|
||||
return instance;
|
||||
}
|
||||
delete instance;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// Constructor.
|
||||
@@ -186,26 +183,25 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dstDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic static stencil function. This function has a same
|
||||
@@ -258,7 +254,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
@@ -272,25 +268,24 @@ class GLComputeEvaluator {
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic static stencil function. This function has a same
|
||||
@@ -367,7 +362,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvvDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
@@ -387,31 +382,30 @@ class GLComputeEvaluator {
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic stencil function.
|
||||
@@ -786,28 +780,26 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -870,9 +862,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -886,27 +877,26 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -993,9 +983,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1015,33 +1004,32 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1336,28 +1324,26 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1472,9 +1458,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1488,27 +1473,26 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1663,9 +1647,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1685,33 +1668,32 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1859,9 +1841,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1872,27 +1853,26 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -2013,9 +1993,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -2030,28 +2009,27 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -2212,9 +2190,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -2235,34 +2212,33 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
|
||||
@@ -64,12 +64,11 @@ inline PatchMap::QuadNode *PatchMap::assignLeafOrChildNode(QuadNode *node,
|
||||
if (node->children[quadrant].isSet) {
|
||||
return &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
else {
|
||||
int newChildNodeIndex = (int)_quadtree.size();
|
||||
_quadtree.push_back(QuadNode());
|
||||
node->SetChild(quadrant, newChildNodeIndex, false);
|
||||
return &_quadtree[newChildNodeIndex];
|
||||
}
|
||||
|
||||
int newChildNodeIndex = (int)_quadtree.size();
|
||||
_quadtree.emplace_back();
|
||||
node->SetChild(quadrant, newChildNodeIndex, false);
|
||||
return &_quadtree[newChildNodeIndex];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -97,8 +96,8 @@ void PatchMap::initializeHandles(PatchTable const &patchTable)
|
||||
_minPatchFace = (int)patchTable.GetPatchParamTable()[0].GetFaceId();
|
||||
_maxPatchFace = _minPatchFace;
|
||||
|
||||
int numArrays = (int)patchTable.GetNumPatchArrays();
|
||||
int numPatches = (int)patchTable.GetNumPatchesTotal();
|
||||
int numArrays = patchTable.GetNumPatchArrays();
|
||||
int numPatches = patchTable.GetNumPatchesTotal();
|
||||
|
||||
_handles.resize(numPatches);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class PatchMap {
|
||||
Child children[4];
|
||||
};
|
||||
|
||||
typedef OpenSubdiv::Far::PatchTable::PatchHandle Handle;
|
||||
using Handle = OpenSubdiv::Far::PatchTable::PatchHandle;
|
||||
|
||||
/// \brief Constructor
|
||||
///
|
||||
@@ -104,7 +104,7 @@ class PatchMap {
|
||||
void initializeHandles(OpenSubdiv::Far::PatchTable const &patchTable);
|
||||
void initializeQuadtree(OpenSubdiv::Far::PatchTable const &patchTable);
|
||||
|
||||
typedef std::vector<QuadNode> QuadTree;
|
||||
using QuadTree = std::vector<QuadNode>;
|
||||
|
||||
// Internal methods supporting quadtree construction and queries
|
||||
void assignRootNode(QuadNode *node, int index);
|
||||
@@ -114,7 +114,6 @@ class PatchMap {
|
||||
template<class T>
|
||||
static int transformUVToTriQuadrant(T const &median, T &u, T &v, bool &rotated);
|
||||
|
||||
private:
|
||||
bool _patchesAreTriangular; // tri and quad assembly and search requirements differ
|
||||
|
||||
int _minPatchFace; // minimum patch face index supported by the map
|
||||
@@ -180,23 +179,22 @@ int inline PatchMap::transformUVToTriQuadrant(T const &median, T &u, T &v, bool
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (u < median) {
|
||||
v -= median;
|
||||
return 1;
|
||||
}
|
||||
if (v < median) {
|
||||
u -= median;
|
||||
return 2;
|
||||
}
|
||||
u -= median;
|
||||
|
||||
if (u < median) {
|
||||
v -= median;
|
||||
if ((u + v) < median) {
|
||||
rotated = false;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
if (v < median) {
|
||||
u -= median;
|
||||
return 2;
|
||||
}
|
||||
u -= median;
|
||||
v -= median;
|
||||
if ((u + v) < median) {
|
||||
rotated = false;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Returns a handle to the sub-patch of the face at the given (u,v).
|
||||
@@ -209,13 +207,13 @@ inline PatchMap::Handle const *PatchMap::FindPatch(int faceid, double u, double
|
||||
// have all or no quadrants set):
|
||||
//
|
||||
if ((faceid < _minPatchFace) || (faceid > _maxPatchFace)) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QuadNode const *node = &_quadtree[faceid - _minPatchFace];
|
||||
|
||||
if (!node->children[0].isSet) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -237,12 +235,10 @@ inline PatchMap::Handle const *PatchMap::FindPatch(int faceid, double u, double
|
||||
if (node->children[quadrant].isLeaf) {
|
||||
return &_handles[node->children[quadrant].index];
|
||||
}
|
||||
else {
|
||||
node = &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
node = &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace blender::opensubdiv
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace blender::opensubdiv {
|
||||
|
||||
MeshTopology::MeshTopology() : num_vertices_(0), num_edges_(0), num_faces_(0) {}
|
||||
|
||||
MeshTopology::~MeshTopology() {}
|
||||
MeshTopology::~MeshTopology() = default;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Vertices.
|
||||
|
||||
@@ -24,11 +24,9 @@ struct TopologyRefinerData {
|
||||
blender::opensubdiv::MeshTopology *base_mesh_topology;
|
||||
};
|
||||
|
||||
typedef OpenSubdiv::Far::TopologyRefinerFactory<TopologyRefinerData> TopologyRefinerFactoryType;
|
||||
using TopologyRefinerFactoryType = OpenSubdiv::Far::TopologyRefinerFactory<TopologyRefinerData>;
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
namespace Far {
|
||||
namespace OpenSubdiv::OPENSUBDIV_VERSION::Far {
|
||||
|
||||
template<>
|
||||
inline bool TopologyRefinerFactory<TopologyRefinerData>::resizeComponentTopology(
|
||||
@@ -139,15 +137,15 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTopology
|
||||
IndexArray dst_vertex_faces = getBaseVertexFaces(refiner, vertex_index);
|
||||
const int num_vertex_faces = converter->getNumVertexFaces(converter, vertex_index);
|
||||
vertex_faces.resize(num_vertex_faces);
|
||||
converter->getVertexFaces(converter, vertex_index, &vertex_faces[0]);
|
||||
converter->getVertexFaces(converter, vertex_index, vertex_faces.data());
|
||||
|
||||
// Vertex-edges.
|
||||
IndexArray dst_vertex_edges = getBaseVertexEdges(refiner, vertex_index);
|
||||
const int num_vertex_edges = converter->getNumVertexEdges(converter, vertex_index);
|
||||
vertex_edges.resize(num_vertex_edges);
|
||||
converter->getVertexEdges(converter, vertex_index, &vertex_edges[0]);
|
||||
memcpy(&dst_vertex_edges[0], &vertex_edges[0], sizeof(int) * num_vertex_edges);
|
||||
memcpy(&dst_vertex_faces[0], &vertex_faces[0], sizeof(int) * num_vertex_faces);
|
||||
converter->getVertexEdges(converter, vertex_index, vertex_edges.data());
|
||||
memcpy(&dst_vertex_edges[0], vertex_edges.data(), sizeof(int) * num_vertex_edges);
|
||||
memcpy(&dst_vertex_faces[0], vertex_faces.data(), sizeof(int) * num_vertex_faces);
|
||||
}
|
||||
|
||||
// Edge relations.
|
||||
@@ -184,7 +182,7 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
MeshTopology *base_mesh_topology = cb_data.base_mesh_topology;
|
||||
|
||||
const bool full_topology_specified = converter->specifiesFullTopology(converter);
|
||||
if (full_topology_specified || converter->getEdgeVertices != NULL) {
|
||||
if (full_topology_specified || converter->getEdgeVertices != nullptr) {
|
||||
const int num_edges = converter->getNumEdges(converter);
|
||||
for (int edge_index = 0; edge_index < num_edges; ++edge_index) {
|
||||
const float sharpness = converter->getEdgeSharpness(converter, edge_index);
|
||||
@@ -228,7 +226,7 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
|
||||
// Get sharpness provided by the converter.
|
||||
float sharpness = 0.0f;
|
||||
if (converter->getVertexSharpness != NULL) {
|
||||
if (converter->getVertexSharpness != nullptr) {
|
||||
sharpness = converter->getVertexSharpness(converter, vertex_index);
|
||||
base_mesh_topology->setVertexSharpness(vertex_index, sharpness);
|
||||
}
|
||||
@@ -256,11 +254,11 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignFaceVaryingTopolo
|
||||
TopologyRefiner &refiner, const TopologyRefinerData &cb_data)
|
||||
{
|
||||
const OpenSubdiv_Converter *converter = cb_data.converter;
|
||||
if (converter->getNumUVLayers == NULL) {
|
||||
assert(converter->precalcUVLayer == NULL);
|
||||
assert(converter->getNumUVCoordinates == NULL);
|
||||
assert(converter->getFaceCornerUVIndex == NULL);
|
||||
assert(converter->finishUVLayer == NULL);
|
||||
if (converter->getNumUVLayers == nullptr) {
|
||||
assert(converter->precalcUVLayer == nullptr);
|
||||
assert(converter->getNumUVCoordinates == nullptr);
|
||||
assert(converter->getFaceCornerUVIndex == nullptr);
|
||||
assert(converter->finishUVLayer == nullptr);
|
||||
return true;
|
||||
}
|
||||
const int num_layers = converter->getNumUVLayers(converter);
|
||||
@@ -295,9 +293,7 @@ inline void TopologyRefinerFactory<TopologyRefinerData>::reportInvalidTopology(
|
||||
printf("OpenSubdiv Error: %s\n", msg);
|
||||
}
|
||||
|
||||
} /* namespace Far */
|
||||
} /* namespace OPENSUBDIV_VERSION */
|
||||
} /* namespace OpenSubdiv */
|
||||
} // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
|
||||
|
||||
namespace blender::opensubdiv {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static bool checkSchemeTypeMatches(const TopologyRefinerImpl *topology_refiner_i
|
||||
static bool checkOptionsMatches(const TopologyRefinerImpl *topology_refiner_impl,
|
||||
const OpenSubdiv_Converter *converter)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
const Options options = getOSDTopologyRefiner(topology_refiner_impl)->GetSchemeOptions();
|
||||
const Options::FVarLinearInterpolation fvar_interpolation = options.GetFVarLinearInterpolation();
|
||||
const Options::FVarLinearInterpolation converter_fvar_interpolation =
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
// Global initialization/deinitialization.
|
||||
//
|
||||
// Supposed to be called from main thread.
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint> // for bool
|
||||
|
||||
#include "BLI_offset_indices.hh"
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <opensubdiv/far/patchMap.h>
|
||||
#include <opensubdiv/far/patchTable.h>
|
||||
|
||||
#include "internal/base/memory.h"
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
struct OpenSubdiv_Buffer;
|
||||
@@ -104,15 +102,15 @@ class EvalOutputAPI {
|
||||
float dPdv[3]);
|
||||
|
||||
// Evaluate varying data at a given bilinear coordinate of given ptex face.
|
||||
void evaluateVertexData(const int ptes_face_index, float face_u, float face_v, float data[]);
|
||||
void evaluateVertexData(const int ptex_face_index, float face_u, float face_v, float data[]);
|
||||
|
||||
// Evaluate varying data at a given bilinear coordinate of given ptex face.
|
||||
void evaluateVarying(const int ptes_face_index, float face_u, float face_v, float varying[3]);
|
||||
void evaluateVarying(const int ptex_face_index, float face_u, float face_v, float varying[3]);
|
||||
|
||||
// Evaluate facee-varying data at a given bilinear coordinate of given
|
||||
// ptex face.
|
||||
void evaluateFaceVarying(const int face_varying_channel,
|
||||
const int ptes_face_index,
|
||||
const int ptex_face_index,
|
||||
float face_u,
|
||||
float face_v,
|
||||
float face_varying[2]);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <opensubdiv/far/topologyRefiner.h>
|
||||
|
||||
#include "internal/base/memory.h"
|
||||
#include "internal/topology/mesh_topology.h"
|
||||
|
||||
// Those settings don't really belong to OpenSubdiv's topology refiner, but
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
OpenSubdiv_EvaluatorCache *openSubdiv_createEvaluatorCache(eOpenSubdivEvaluator /*evaluator_type*/)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache * /*evaluator_cache*/) {}
|
||||
|
||||
const char *openSubdiv_getGLSLPatchBasisSource()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "field-math.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "optimizer.hpp"
|
||||
#include "parametrizer.hpp"
|
||||
#include "quadriflow_capi.hpp"
|
||||
@@ -20,7 +17,7 @@ struct ObjVertex {
|
||||
uint32_t n = (uint32_t)-1;
|
||||
uint32_t uv = (uint32_t)-1;
|
||||
|
||||
ObjVertex() {}
|
||||
ObjVertex() = default;
|
||||
|
||||
ObjVertex(uint32_t pi)
|
||||
{
|
||||
@@ -43,7 +40,7 @@ struct ObjVertexHash {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_map<ObjVertex, uint32_t, ObjVertexHash> VertexMap;
|
||||
using VertexMap = std::unordered_map<ObjVertex, uint32_t, ObjVertexHash>;
|
||||
|
||||
static int check_if_canceled(float progress,
|
||||
void (*update_cb)(void *, float progress, int *cancel),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct QuadriflowRemeshData {
|
||||
struct QuadriflowRemeshData {
|
||||
const float *verts;
|
||||
const int *faces;
|
||||
int totfaces;
|
||||
@@ -27,7 +27,7 @@ typedef struct QuadriflowRemeshData {
|
||||
bool minimum_cost_flow;
|
||||
bool aggresive_sat;
|
||||
int rng_seed;
|
||||
} QuadriflowRemeshData;
|
||||
};
|
||||
|
||||
void QFLOW_quadriflow_remesh(QuadriflowRemeshData *qrd,
|
||||
void (*update_cb)(void *, float progress, int *cancel),
|
||||
|
||||
@@ -86,10 +86,10 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename);
|
||||
/* Setup ---------------------------- */
|
||||
|
||||
/* Add RigidBody to dynamics world */
|
||||
void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_groups);
|
||||
void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_groups);
|
||||
|
||||
/* Remove RigidBody from dynamics world */
|
||||
void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *body);
|
||||
void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *object);
|
||||
|
||||
/* Collision detection */
|
||||
|
||||
@@ -108,93 +108,93 @@ void RB_world_convex_sweep_test(rbDynamicsWorld *world,
|
||||
rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4]);
|
||||
|
||||
/* Delete the given RigidBody instance */
|
||||
void RB_body_delete(rbRigidBody *body);
|
||||
void RB_body_delete(rbRigidBody *object);
|
||||
|
||||
/* Settings ------------------------- */
|
||||
|
||||
/* 'Type' */
|
||||
void RB_body_set_type(rbRigidBody *body, int type, float mass);
|
||||
void RB_body_set_type(rbRigidBody *object, int type, float mass);
|
||||
|
||||
/* ............ */
|
||||
|
||||
/* Collision Shape */
|
||||
void RB_body_set_collision_shape(rbRigidBody *body, rbCollisionShape *shape);
|
||||
void RB_body_set_collision_shape(rbRigidBody *object, rbCollisionShape *shape);
|
||||
|
||||
/* ............ */
|
||||
|
||||
/* Mass */
|
||||
float RB_body_get_mass(rbRigidBody *body);
|
||||
void RB_body_set_mass(rbRigidBody *body, float value);
|
||||
float RB_body_get_mass(rbRigidBody *object);
|
||||
void RB_body_set_mass(rbRigidBody *object, float value);
|
||||
|
||||
/* Friction */
|
||||
float RB_body_get_friction(rbRigidBody *body);
|
||||
void RB_body_set_friction(rbRigidBody *body, float value);
|
||||
float RB_body_get_friction(rbRigidBody *object);
|
||||
void RB_body_set_friction(rbRigidBody *object, float value);
|
||||
|
||||
/* Restitution */
|
||||
float RB_body_get_restitution(rbRigidBody *body);
|
||||
void RB_body_set_restitution(rbRigidBody *body, float value);
|
||||
float RB_body_get_restitution(rbRigidBody *object);
|
||||
void RB_body_set_restitution(rbRigidBody *object, float value);
|
||||
|
||||
/* Damping */
|
||||
float RB_body_get_linear_damping(rbRigidBody *body);
|
||||
void RB_body_set_linear_damping(rbRigidBody *body, float value);
|
||||
float RB_body_get_linear_damping(rbRigidBody *object);
|
||||
void RB_body_set_linear_damping(rbRigidBody *object, float value);
|
||||
|
||||
float RB_body_get_angular_damping(rbRigidBody *body);
|
||||
void RB_body_set_angular_damping(rbRigidBody *body, float value);
|
||||
float RB_body_get_angular_damping(rbRigidBody *object);
|
||||
void RB_body_set_angular_damping(rbRigidBody *object, float value);
|
||||
|
||||
void RB_body_set_damping(rbRigidBody *object, float linear, float angular);
|
||||
|
||||
/* Sleeping Thresholds */
|
||||
float RB_body_get_linear_sleep_thresh(rbRigidBody *body);
|
||||
void RB_body_set_linear_sleep_thresh(rbRigidBody *body, float value);
|
||||
float RB_body_get_linear_sleep_thresh(rbRigidBody *object);
|
||||
void RB_body_set_linear_sleep_thresh(rbRigidBody *object, float value);
|
||||
|
||||
float RB_body_get_angular_sleep_thresh(rbRigidBody *body);
|
||||
void RB_body_set_angular_sleep_thresh(rbRigidBody *body, float value);
|
||||
float RB_body_get_angular_sleep_thresh(rbRigidBody *object);
|
||||
void RB_body_set_angular_sleep_thresh(rbRigidBody *object, float value);
|
||||
|
||||
void RB_body_set_sleep_thresh(rbRigidBody *body, float linear, float angular);
|
||||
void RB_body_set_sleep_thresh(rbRigidBody *object, float linear, float angular);
|
||||
|
||||
/* Linear Velocity */
|
||||
void RB_body_get_linear_velocity(rbRigidBody *body, float v_out[3]);
|
||||
void RB_body_set_linear_velocity(rbRigidBody *body, const float v_in[3]);
|
||||
void RB_body_get_linear_velocity(rbRigidBody *object, float v_out[3]);
|
||||
void RB_body_set_linear_velocity(rbRigidBody *object, const float v_in[3]);
|
||||
|
||||
/* Angular Velocity */
|
||||
void RB_body_get_angular_velocity(rbRigidBody *body, float v_out[3]);
|
||||
void RB_body_set_angular_velocity(rbRigidBody *body, const float v_in[3]);
|
||||
void RB_body_get_angular_velocity(rbRigidBody *object, float v_out[3]);
|
||||
void RB_body_set_angular_velocity(rbRigidBody *object, const float v_in[3]);
|
||||
|
||||
/* Linear/Angular Factor, used to lock translation/rotation axes */
|
||||
void RB_body_set_linear_factor(rbRigidBody *object, float x, float y, float z);
|
||||
void RB_body_set_angular_factor(rbRigidBody *object, float x, float y, float z);
|
||||
|
||||
/* Kinematic State */
|
||||
void RB_body_set_kinematic_state(rbRigidBody *body, int kinematic);
|
||||
void RB_body_set_kinematic_state(rbRigidBody *object, int kinematic);
|
||||
|
||||
/* RigidBody Interface - Rigid Body Activation States */
|
||||
int RB_body_get_activation_state(rbRigidBody *body);
|
||||
void RB_body_set_activation_state(rbRigidBody *body, int use_deactivation);
|
||||
void RB_body_activate(rbRigidBody *body);
|
||||
void RB_body_deactivate(rbRigidBody *body);
|
||||
int RB_body_get_activation_state(rbRigidBody *object);
|
||||
void RB_body_set_activation_state(rbRigidBody *object, int use_deactivation);
|
||||
void RB_body_activate(rbRigidBody *object);
|
||||
void RB_body_deactivate(rbRigidBody *object);
|
||||
|
||||
/* Simulation ----------------------- */
|
||||
|
||||
/* Get current transform matrix of RigidBody to use in Blender (OpenGL format) */
|
||||
void RB_body_get_transform_matrix(rbRigidBody *body, float m_out[4][4]);
|
||||
void RB_body_get_transform_matrix(rbRigidBody *object, float m_out[4][4]);
|
||||
|
||||
/* Set RigidBody's location and rotation */
|
||||
void RB_body_set_loc_rot(rbRigidBody *body, const float loc[3], const float rot[4]);
|
||||
void RB_body_set_loc_rot(rbRigidBody *object, const float loc[3], const float rot[4]);
|
||||
/* Set RigidBody's local scaling */
|
||||
void RB_body_set_scale(rbRigidBody *body, const float scale[3]);
|
||||
void RB_body_set_scale(rbRigidBody *object, const float scale[3]);
|
||||
|
||||
/* ............ */
|
||||
|
||||
/* Get RigidBody's position as a vector */
|
||||
void RB_body_get_position(rbRigidBody *body, float v_out[3]);
|
||||
void RB_body_get_position(rbRigidBody *object, float v_out[3]);
|
||||
/* Get RigidBody's orientation as a quaternion */
|
||||
void RB_body_get_orientation(rbRigidBody *body, float v_out[4]);
|
||||
void RB_body_get_orientation(rbRigidBody *object, float v_out[4]);
|
||||
/* Get RigidBody's local scale as a vector */
|
||||
void RB_body_get_scale(rbRigidBody *object, float v_out[3]);
|
||||
|
||||
/* ............ */
|
||||
|
||||
void RB_body_apply_central_force(rbRigidBody *body, const float v_in[3]);
|
||||
void RB_body_apply_central_force(rbRigidBody *object, const float v_in[3]);
|
||||
|
||||
/* ********************************** */
|
||||
/* Collision Shape Methods */
|
||||
@@ -228,7 +228,7 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh);
|
||||
/* Compound Shape ---------------- */
|
||||
|
||||
rbCollisionShape *RB_shape_new_compound(void);
|
||||
void RB_compound_add_child_shape(rbCollisionShape *collisionShape,
|
||||
void RB_compound_add_child_shape(rbCollisionShape *parentShape,
|
||||
rbCollisionShape *shape,
|
||||
const float loc[3],
|
||||
const float rot[4]);
|
||||
|
||||
@@ -35,22 +35,22 @@
|
||||
* -- Joshua Leung, June 2010
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
|
||||
#include "RBI_api.h"
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include <btBulletDynamicsCommon.h>
|
||||
|
||||
#include "LinearMath/btConvexHullComputer.h"
|
||||
#include "LinearMath/btMatrix3x3.h"
|
||||
#include "LinearMath/btScalar.h"
|
||||
#include "LinearMath/btTransform.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include <LinearMath/btConvexHullComputer.h>
|
||||
#include <LinearMath/btMatrix3x3.h>
|
||||
#include <LinearMath/btScalar.h>
|
||||
#include <LinearMath/btTransform.h>
|
||||
#include <LinearMath/btVector3.h>
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
|
||||
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
|
||||
#include "BulletCollision/Gimpact/btGImpactShape.h"
|
||||
#include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
|
||||
#include <BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h>
|
||||
#include <BulletCollision/Gimpact/btGImpactShape.h>
|
||||
|
||||
struct rbDynamicsWorld {
|
||||
btDiscreteDynamicsWorld *dynamicsWorld;
|
||||
@@ -88,7 +88,7 @@ struct rbCollisionShape {
|
||||
};
|
||||
|
||||
struct rbFilterCallback : public btOverlapFilterCallback {
|
||||
virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
|
||||
bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const override
|
||||
{
|
||||
rbRigidBody *rb0 = (rbRigidBody *)((btRigidBody *)proxy0->m_clientObject)->getUserPointer();
|
||||
rbRigidBody *rb1 = (rbRigidBody *)((btRigidBody *)proxy1->m_clientObject)->getUserPointer();
|
||||
@@ -663,9 +663,9 @@ rbCollisionShape *RB_shape_new_box(float x, float y, float z)
|
||||
{
|
||||
rbCollisionShape *shape = new rbCollisionShape;
|
||||
shape->cshape = new btBoxShape(btVector3(x, y, z));
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -673,9 +673,9 @@ rbCollisionShape *RB_shape_new_sphere(float radius)
|
||||
{
|
||||
rbCollisionShape *shape = new rbCollisionShape;
|
||||
shape->cshape = new btSphereShape(radius);
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -683,9 +683,9 @@ rbCollisionShape *RB_shape_new_capsule(float radius, float height)
|
||||
{
|
||||
rbCollisionShape *shape = new rbCollisionShape;
|
||||
shape->cshape = new btCapsuleShapeZ(radius, height);
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -693,9 +693,9 @@ rbCollisionShape *RB_shape_new_cone(float radius, float height)
|
||||
{
|
||||
rbCollisionShape *shape = new rbCollisionShape;
|
||||
shape->cshape = new btConeShapeZ(radius, height);
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -703,9 +703,9 @@ rbCollisionShape *RB_shape_new_cylinder(float radius, float height)
|
||||
{
|
||||
rbCollisionShape *shape = new rbCollisionShape;
|
||||
shape->cshape = new btCylinderShapeZ(btVector3(radius, radius, height));
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -727,9 +727,9 @@ rbCollisionShape *RB_shape_new_convex_hull(
|
||||
hull_computer.vertices.size());
|
||||
|
||||
shape->cshape = hull_shape;
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ rbCollisionShape *RB_shape_new_trimesh(rbMeshData *mesh)
|
||||
shape->cshape = new btScaledBvhTriangleMeshShape(unscaledShape, btVector3(1.0f, 1.0f, 1.0f));
|
||||
shape->mesh = mesh;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ void RB_shape_trimesh_update(rbCollisionShape *shape,
|
||||
const float min[3],
|
||||
const float max[3])
|
||||
{
|
||||
if (shape->mesh == NULL || num_verts != shape->mesh->num_vertices) {
|
||||
if (shape->mesh == nullptr || num_verts != shape->mesh->num_vertices) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh)
|
||||
shape->cshape = gimpactShape;
|
||||
shape->mesh = mesh;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -850,9 +850,9 @@ rbCollisionShape *RB_shape_new_compound()
|
||||
btCompoundShape *compoundShape = new btCompoundShape();
|
||||
|
||||
shape->cshape = compoundShape;
|
||||
shape->mesh = NULL;
|
||||
shape->mesh = nullptr;
|
||||
shape->compoundChilds = 0;
|
||||
shape->compoundChildShapes = NULL;
|
||||
shape->compoundChildShapes = nullptr;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ void RB_shape_delete(rbCollisionShape *shape)
|
||||
for (int i = 0; i < shape->compoundChilds; i++) {
|
||||
RB_shape_delete(shape->compoundChildShapes[i]);
|
||||
}
|
||||
if (shape->compoundChildShapes != NULL) {
|
||||
if (shape->compoundChildShapes != nullptr) {
|
||||
free(shape->compoundChildShapes);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
// minimal float3 + util_math.h implementation for nishita sky model
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#ifndef M_PI_F
|
||||
# define M_PI_F (3.1415926535897932f) /* pi */
|
||||
|
||||
@@ -78,10 +78,9 @@ All instructions on how to use this code are in the accompanying header file.
|
||||
#include "sky_model.h"
|
||||
#include "sky_model_data.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
// Some macro definitions that occur elsewhere in ART, and that have to be
|
||||
// replicated to make this a stand-alone module.
|
||||
@@ -107,12 +106,12 @@ All instructions on how to use this code are in the accompanying header file.
|
||||
#endif
|
||||
|
||||
/* Not defined on all platforms (macOS & WIN32). */
|
||||
typedef unsigned int uint;
|
||||
using uint = unsigned int;
|
||||
|
||||
// internal definitions
|
||||
|
||||
typedef const double *ArHosekSkyModel_Dataset;
|
||||
typedef const double *ArHosekSkyModel_Radiance_Dataset;
|
||||
using ArHosekSkyModel_Dataset = const double *;
|
||||
using ArHosekSkyModel_Radiance_Dataset = const double *;
|
||||
|
||||
// internal functions
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using namespace Eigen;
|
||||
|
||||
namespace slim {
|
||||
|
||||
void correct_map_surface_area_if_necessary(SLIMData &slimData);
|
||||
void correct_mesh_surface_area_if_necessary(SLIMData &slimData);
|
||||
void correct_map_surface_area_if_necessary(SLIMData &slim_data);
|
||||
void correct_mesh_surface_area_if_necessary(SLIMData &slim_data);
|
||||
|
||||
} // namespace slim
|
||||
|
||||
@@ -41,7 +41,7 @@ static inline void doublearea_sort3(const Eigen::PlainObjectBase<DerivedX> &X,
|
||||
{
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
typedef typename Eigen::PlainObjectBase<DerivedY>::Scalar YScalar;
|
||||
using YScalar = typename Eigen::PlainObjectBase<DerivedY>::Scalar;
|
||||
Y = X.template cast<YScalar>();
|
||||
/* Get number of columns (or rows). */
|
||||
int num_outer = (dim == 1 ? X.cols() : X.rows());
|
||||
@@ -49,7 +49,7 @@ static inline void doublearea_sort3(const Eigen::PlainObjectBase<DerivedX> &X,
|
||||
int num_inner = (dim == 1 ? X.rows() : X.cols());
|
||||
assert(num_inner == 3);
|
||||
(void)num_inner;
|
||||
typedef typename Eigen::PlainObjectBase<DerivedIX>::Scalar Index;
|
||||
using Index = typename Eigen::PlainObjectBase<DerivedIX>::Scalar;
|
||||
IX.resize(X.rows(), X.cols());
|
||||
if (dim == 1) {
|
||||
IX.row(0).setConstant(0); /* = Eigen::PlainObjectBase<DerivedIX>::Zero(1,IX.cols());. */
|
||||
@@ -165,7 +165,7 @@ inline void doublearea(const Eigen::PlainObjectBase<Derivedl> &ul,
|
||||
{
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
typedef typename Derivedl::Index Index;
|
||||
using Index = typename Derivedl::Index;
|
||||
/* Only support triangles. */
|
||||
assert(ul.cols() == 3);
|
||||
/* Number of triangles. */
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "flip_avoiding_line_search.h"
|
||||
|
||||
#include <Eigen/Dense>
|
||||
#include <vector>
|
||||
|
||||
namespace slim {
|
||||
|
||||
@@ -95,13 +94,9 @@ static inline double get_smallest_pos_quad_zero(double a, double b, double c)
|
||||
if (t2 > 0) {
|
||||
return t2;
|
||||
}
|
||||
else {
|
||||
return t1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return INFINITY;
|
||||
return t1;
|
||||
}
|
||||
return INFINITY;
|
||||
}
|
||||
|
||||
static inline double get_min_pos_root_2D(const Eigen::MatrixXd &uv,
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
|
||||
#include "geometry_data_retrieval.h"
|
||||
|
||||
#include "slim.h"
|
||||
#include "slim_matrix_transfer.h"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "area_compensation.h"
|
||||
#include "geometry_data_retrieval.h"
|
||||
#include "least_squares_relocator.h"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "slim.h"
|
||||
#include "slim_matrix_transfer.h"
|
||||
|
||||
#include "area_compensation.h"
|
||||
#include "least_squares_relocator.h"
|
||||
#include "uv_initializer.h"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
|
||||
@@ -8,13 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "slim.h"
|
||||
#include "slim_matrix_transfer.h"
|
||||
#include "uv_initializer.h"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
@@ -33,20 +30,20 @@ struct GeometryData {
|
||||
double weight_influence = 0.0;
|
||||
|
||||
/* All the following maps have to be declared as last members. */
|
||||
Map<MatrixXd> vertex_positions3d = Map<MatrixXd>(NULL, 0, 0);
|
||||
Map<MatrixXd> uv_positions2d = Map<MatrixXd>(NULL, 0, 0);
|
||||
Map<MatrixXd> vertex_positions3d = Map<MatrixXd>(nullptr, 0, 0);
|
||||
Map<MatrixXd> uv_positions2d = Map<MatrixXd>(nullptr, 0, 0);
|
||||
MatrixXd positions_of_pinned_vertices2d;
|
||||
Map<Matrix<double, Dynamic, Dynamic, RowMajor>> positions_of_explicitly_pinned_vertices2d =
|
||||
Map<Matrix<double, Dynamic, Dynamic, RowMajor>>(NULL, 0, 0);
|
||||
Map<Matrix<double, Dynamic, Dynamic, RowMajor>>(nullptr, 0, 0);
|
||||
|
||||
Map<MatrixXi> faces_by_vertexindices = Map<MatrixXi>(NULL, 0, 0);
|
||||
Map<MatrixXi> edges_by_vertexindices = Map<MatrixXi>(NULL, 0, 0);
|
||||
Map<MatrixXi> faces_by_vertexindices = Map<MatrixXi>(nullptr, 0, 0);
|
||||
Map<MatrixXi> edges_by_vertexindices = Map<MatrixXi>(nullptr, 0, 0);
|
||||
VectorXi pinned_vertex_indices;
|
||||
Map<VectorXi> explicitly_pinned_vertex_indices = Map<VectorXi>(NULL, 0);
|
||||
Map<VectorXi> explicitly_pinned_vertex_indices = Map<VectorXi>(nullptr, 0);
|
||||
|
||||
Map<VectorXd> edge_lengths = Map<VectorXd>(NULL, 0);
|
||||
Map<VectorXi> boundary_vertex_indices = Map<VectorXi>(NULL, 0);
|
||||
Map<VectorXf> weights_per_vertex = Map<VectorXf>(NULL, 0);
|
||||
Map<VectorXd> edge_lengths = Map<VectorXd>(nullptr, 0);
|
||||
Map<VectorXi> boundary_vertex_indices = Map<VectorXi>(nullptr, 0);
|
||||
Map<VectorXf> weights_per_vertex = Map<VectorXf>(nullptr, 0);
|
||||
|
||||
GeometryData(const MatrixTransfer &mt, MatrixTransferChart &chart);
|
||||
GeometryData(const GeometryData &) = delete;
|
||||
|
||||
@@ -10,10 +10,8 @@
|
||||
|
||||
#include "slim.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace slim {
|
||||
|
||||
void transform_initialization_if_necessary(SLIMData &slimData);
|
||||
void transform_initialization_if_necessary(SLIMData &slim_data);
|
||||
|
||||
}
|
||||
|
||||
@@ -113,48 +113,65 @@ static inline void grad(const Eigen::PlainObjectBase<DerivedV> &V,
|
||||
/* Row indices. */
|
||||
for (int r = 0; r < 3; r++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int i = r * F.rows(); i < (r + 1) * F.rows(); i++)
|
||||
for (int i = r * F.rows(); i < (r + 1) * F.rows(); i++) {
|
||||
rs.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Column indices. */
|
||||
for (int r = 0; r < 3; r++) {
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
cs.push_back(F(i, 1));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
cs.push_back(F(i, 0));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
cs.push_back(F(i, 2));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
cs.push_back(F(i, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/* Values. */
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp13(i, 0));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp13(i, 0));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp21(i, 0));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp21(i, 0));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp13(i, 1));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp13(i, 1));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp21(i, 1));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp21(i, 1));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp13(i, 2));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp13(i, 2));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(eperp21(i, 2));
|
||||
for (int i = 0; i < F.rows(); i++)
|
||||
}
|
||||
for (int i = 0; i < F.rows(); i++) {
|
||||
vs.push_back(-eperp21(i, 2));
|
||||
}
|
||||
|
||||
/* Create sparse gradient operator matrix.. */
|
||||
G.resize(3 * F.rows(), V.rows());
|
||||
@@ -278,8 +295,8 @@ static inline void update_weights_and_closest_rotations(SLIMData &s, Eigen::Matr
|
||||
double exp_f = s.exp_factor;
|
||||
|
||||
for (int i = 0; i < s.Ji.rows(); ++i) {
|
||||
typedef Eigen::Matrix<double, 2, 2> Mat2;
|
||||
typedef Eigen::Matrix<double, 2, 1> Vec2;
|
||||
using Mat2 = Eigen::Matrix<double, 2, 2>;
|
||||
using Vec2 = Eigen::Matrix<double, 2, 1>;
|
||||
Mat2 ji, ri, ti, ui, vi;
|
||||
Vec2 sing;
|
||||
Vec2 closest_sing_vec;
|
||||
@@ -358,10 +375,12 @@ static inline void update_weights_and_closest_rotations(SLIMData &s, Eigen::Matr
|
||||
}
|
||||
}
|
||||
|
||||
if (std::abs(s1 - 1) < eps)
|
||||
if (std::abs(s1 - 1) < eps) {
|
||||
m_sing_new(0) = 1;
|
||||
if (std::abs(s2 - 1) < eps)
|
||||
}
|
||||
if (std::abs(s2 - 1) < eps) {
|
||||
m_sing_new(1) = 1;
|
||||
}
|
||||
mat_W = ui * m_sing_new.asDiagonal() * ui.transpose();
|
||||
|
||||
s.W_11(i) = mat_W(0, 0);
|
||||
@@ -430,9 +449,11 @@ static inline void pre_calc(SLIMData &s)
|
||||
|
||||
/* Flattened weight matrix. */
|
||||
s.WGL_M.resize(s.dim * s.dim * s.f_n);
|
||||
for (int i = 0; i < s.dim * s.dim; i++)
|
||||
for (int j = 0; j < s.f_n; j++)
|
||||
for (int i = 0; i < s.dim * s.dim; i++) {
|
||||
for (int j = 0; j < s.f_n; j++) {
|
||||
s.WGL_M(i * s.f_n + j) = s.M(j);
|
||||
}
|
||||
}
|
||||
|
||||
s.first_solve = true;
|
||||
s.has_pre_calc = true;
|
||||
@@ -458,12 +479,11 @@ static inline void buildA(SLIMData &s, Eigen::SparseMatrix<double> &A)
|
||||
double val = it.value();
|
||||
double weight = s.weightPerFaceMap(dx_r);
|
||||
|
||||
IJV.push_back(Eigen::Triplet<double>(dx_r, dx_c, weight * val * s.W_11(dx_r)));
|
||||
IJV.push_back(Eigen::Triplet<double>(dx_r, s.v_n + dx_c, weight * val * s.W_12(dx_r)));
|
||||
IJV.emplace_back(dx_r, dx_c, weight * val * s.W_11(dx_r));
|
||||
IJV.emplace_back(dx_r, s.v_n + dx_c, weight * val * s.W_12(dx_r));
|
||||
|
||||
IJV.push_back(Eigen::Triplet<double>(2 * s.f_n + dx_r, dx_c, weight * val * s.W_21(dx_r)));
|
||||
IJV.push_back(
|
||||
Eigen::Triplet<double>(2 * s.f_n + dx_r, s.v_n + dx_c, weight * val * s.W_22(dx_r)));
|
||||
IJV.emplace_back(2 * s.f_n + dx_r, dx_c, weight * val * s.W_21(dx_r));
|
||||
IJV.emplace_back(2 * s.f_n + dx_r, s.v_n + dx_c, weight * val * s.W_22(dx_r));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,13 +494,11 @@ static inline void buildA(SLIMData &s, Eigen::SparseMatrix<double> &A)
|
||||
double val = it.value();
|
||||
double weight = s.weightPerFaceMap(dy_r);
|
||||
|
||||
IJV.push_back(Eigen::Triplet<double>(s.f_n + dy_r, dy_c, weight * val * s.W_11(dy_r)));
|
||||
IJV.push_back(
|
||||
Eigen::Triplet<double>(s.f_n + dy_r, s.v_n + dy_c, weight * val * s.W_12(dy_r)));
|
||||
IJV.emplace_back(s.f_n + dy_r, dy_c, weight * val * s.W_11(dy_r));
|
||||
IJV.emplace_back(s.f_n + dy_r, s.v_n + dy_c, weight * val * s.W_12(dy_r));
|
||||
|
||||
IJV.push_back(Eigen::Triplet<double>(3 * s.f_n + dy_r, dy_c, weight * val * s.W_21(dy_r)));
|
||||
IJV.push_back(
|
||||
Eigen::Triplet<double>(3 * s.f_n + dy_r, s.v_n + dy_c, weight * val * s.W_22(dy_r)));
|
||||
IJV.emplace_back(3 * s.f_n + dy_r, dy_c, weight * val * s.W_21(dy_r));
|
||||
IJV.emplace_back(3 * s.f_n + dy_r, s.v_n + dy_c, weight * val * s.W_22(dy_r));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,9 +524,11 @@ static inline void buildRhs(SLIMData &s, const Eigen::SparseMatrix<double> &At)
|
||||
}
|
||||
|
||||
Eigen::VectorXd uv_flat(s.dim * s.v_n);
|
||||
for (int i = 0; i < s.dim; i++)
|
||||
for (int j = 0; j < s.v_n; j++)
|
||||
for (int i = 0; i < s.dim; i++) {
|
||||
for (int j = 0; j < s.v_n; j++) {
|
||||
uv_flat(s.v_n * i + j) = s.V_o(j, i);
|
||||
}
|
||||
}
|
||||
|
||||
s.rhs = (At * s.WGL_M.asDiagonal() * f_rhs + s.proximal_p * uv_flat);
|
||||
}
|
||||
@@ -565,8 +585,8 @@ static inline double compute_energy_with_jacobians(SLIMData &s,
|
||||
ji(1, 0) = Ji(i, 2);
|
||||
ji(1, 1) = Ji(i, 3);
|
||||
|
||||
typedef Eigen::Matrix<double, 2, 2> Mat2;
|
||||
typedef Eigen::Matrix<double, 2, 1> Vec2;
|
||||
using Mat2 = Eigen::Matrix<double, 2, 2>;
|
||||
using Vec2 = Eigen::Matrix<double, 2, 1>;
|
||||
Mat2 ri, ti, ui, vi;
|
||||
Vec2 sing;
|
||||
polar_svd(ji, ri, ti, ui, sing, vi);
|
||||
@@ -753,12 +773,15 @@ static inline void solve_weighted_arap(SLIMData &s, Eigen::MatrixXd &uv)
|
||||
SimplicialLDLT<Eigen::SparseMatrix<double>> solver;
|
||||
Uc = solver.compute(L).solve(s.rhs);
|
||||
|
||||
for (int i = 0; i < Uc.size(); i++)
|
||||
if (!std::isfinite(Uc(i)))
|
||||
for (int i = 0; i < Uc.size(); i++) {
|
||||
if (!std::isfinite(Uc(i))) {
|
||||
throw SlimFailedException();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < s.dim; i++)
|
||||
for (int i = 0; i < s.dim; i++) {
|
||||
uv.col(i) = Uc.block(i * s.v_n, 0, s.v_n, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::MatrixXd slim_solve(SLIMData &data, int iter_num)
|
||||
|
||||
@@ -6,16 +6,12 @@
|
||||
* \ingroup intern_slim
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "slim.h"
|
||||
#include "slim_matrix_transfer.h"
|
||||
|
||||
#include "area_compensation.h"
|
||||
#include "doublearea.h"
|
||||
#include "geometry_data_retrieval.h"
|
||||
#include "least_squares_relocator.h"
|
||||
#include "slim.h"
|
||||
#include "uv_initializer.h"
|
||||
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Sparse>
|
||||
@@ -54,9 +50,9 @@ static void adjust_pins(SLIMData &slim_data, const PinnedVertexData &pinned_vert
|
||||
return;
|
||||
}
|
||||
|
||||
auto &pinned_vertex_indices = pinned_vertex_data.pinned_vertex_indices;
|
||||
auto &pinned_vertex_positions_2D = pinned_vertex_data.pinned_vertex_positions_2D;
|
||||
auto &selected_pins = pinned_vertex_data.selected_pins;
|
||||
const auto &pinned_vertex_indices = pinned_vertex_data.pinned_vertex_indices;
|
||||
const auto &pinned_vertex_positions_2D = pinned_vertex_data.pinned_vertex_positions_2D;
|
||||
const auto &selected_pins = pinned_vertex_data.selected_pins;
|
||||
|
||||
int n_pins = pinned_vertex_indices.size();
|
||||
int n_selected_pins = selected_pins.size();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "uv_initializer.h"
|
||||
#include "cotmatrix.h"
|
||||
|
||||
#include <Eigen/SparseLU>
|
||||
|
||||
@@ -23,8 +22,7 @@ static void find_vertex_to_opposite_angles_correspondence(
|
||||
const Eigen::MatrixXd &v,
|
||||
Eigen::SparseMatrix<double> &vertex_to_face_indices)
|
||||
{
|
||||
|
||||
typedef Eigen::Triplet<double> t;
|
||||
using t = Eigen::Triplet<double>;
|
||||
std::vector<t> coefficients;
|
||||
|
||||
for (int i = 0; i < f.rows(); i++) {
|
||||
@@ -40,14 +38,14 @@ static void find_vertex_to_opposite_angles_correspondence(
|
||||
double angle3 = compute_angle(v.row(vertex_index1) - v.row(vertex_index3),
|
||||
v.row(vertex_index2) - v.row(vertex_index3));
|
||||
|
||||
coefficients.push_back(t(vertex_index1, 2 * vertex_index2, angle3));
|
||||
coefficients.push_back(t(vertex_index1, 2 * vertex_index3 + 1, angle2));
|
||||
coefficients.emplace_back(vertex_index1, 2 * vertex_index2, angle3);
|
||||
coefficients.emplace_back(vertex_index1, 2 * vertex_index3 + 1, angle2);
|
||||
|
||||
coefficients.push_back(t(vertex_index2, 2 * vertex_index1 + 1, angle3));
|
||||
coefficients.push_back(t(vertex_index2, 2 * vertex_index3, angle1));
|
||||
coefficients.emplace_back(vertex_index2, 2 * vertex_index1 + 1, angle3);
|
||||
coefficients.emplace_back(vertex_index2, 2 * vertex_index3, angle1);
|
||||
|
||||
coefficients.push_back(t(vertex_index3, 2 * vertex_index1, angle2));
|
||||
coefficients.push_back(t(vertex_index3, 2 * vertex_index2 + 1, angle1));
|
||||
coefficients.emplace_back(vertex_index3, 2 * vertex_index1, angle2);
|
||||
coefficients.emplace_back(vertex_index3, 2 * vertex_index2 + 1, angle1);
|
||||
}
|
||||
|
||||
vertex_to_face_indices.setFromTriplets(coefficients.begin(), coefficients.end());
|
||||
@@ -59,7 +57,7 @@ static void find_vertex_to_its_angles_correspondence(
|
||||
Eigen::SparseMatrix<double> &vertex_to_face_indices)
|
||||
{
|
||||
|
||||
typedef Eigen::Triplet<double> t;
|
||||
using t = Eigen::Triplet<double>;
|
||||
std::vector<t> coefficients;
|
||||
|
||||
for (int i = 0; i < f.rows(); i++) {
|
||||
@@ -75,14 +73,14 @@ static void find_vertex_to_its_angles_correspondence(
|
||||
double angle3 = compute_angle(v.row(vertex_index1) - v.row(vertex_index3),
|
||||
v.row(vertex_index2) - v.row(vertex_index3));
|
||||
|
||||
coefficients.push_back(t(vertex_index1, 2 * vertex_index2, angle1));
|
||||
coefficients.push_back(t(vertex_index1, 2 * vertex_index3 + 1, angle1));
|
||||
coefficients.emplace_back(vertex_index1, 2 * vertex_index2, angle1);
|
||||
coefficients.emplace_back(vertex_index1, 2 * vertex_index3 + 1, angle1);
|
||||
|
||||
coefficients.push_back(t(vertex_index2, 2 * vertex_index1 + 1, angle2));
|
||||
coefficients.push_back(t(vertex_index2, 2 * vertex_index3, angle2));
|
||||
coefficients.emplace_back(vertex_index2, 2 * vertex_index1 + 1, angle2);
|
||||
coefficients.emplace_back(vertex_index2, 2 * vertex_index3, angle2);
|
||||
|
||||
coefficients.push_back(t(vertex_index3, 2 * vertex_index1, angle3));
|
||||
coefficients.push_back(t(vertex_index3, 2 * vertex_index2 + 1, angle3));
|
||||
coefficients.emplace_back(vertex_index3, 2 * vertex_index1, angle3);
|
||||
coefficients.emplace_back(vertex_index3, 2 * vertex_index2 + 1, angle3);
|
||||
}
|
||||
|
||||
vertex_to_face_indices.setFromTriplets(coefficients.begin(), coefficients.end());
|
||||
@@ -158,18 +156,18 @@ void convex_border_parameterization(const Eigen::MatrixXi &f,
|
||||
break;
|
||||
}
|
||||
|
||||
int_triplet_vector.push_back(Eigen::Triplet<double>(rowindex, rowindex, edge_weight));
|
||||
int_triplet_vector.emplace_back(rowindex, rowindex, edge_weight);
|
||||
|
||||
if (second_vertex >= n_knowns) {
|
||||
/* Also an unknown point in the interior. */
|
||||
columnindex = second_vertex - n_knowns;
|
||||
|
||||
int_triplet_vector.push_back(Eigen::Triplet<double>(rowindex, columnindex, -edge_weight));
|
||||
int_triplet_vector.emplace_back(rowindex, columnindex, -edge_weight);
|
||||
}
|
||||
else {
|
||||
/* Known point on the border. */
|
||||
columnindex = second_vertex;
|
||||
bnd_triplet_vector.push_back(Eigen::Triplet<double>(rowindex, columnindex, edge_weight));
|
||||
bnd_triplet_vector.emplace_back(rowindex, columnindex, edge_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Sparse>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace slim {
|
||||
|
||||
struct SLIMData;
|
||||
|
||||
typedef std::unique_ptr<SLIMData> SLIMDataPtr;
|
||||
using SLIMDataPtr = std::unique_ptr<SLIMData>;
|
||||
|
||||
/**
|
||||
* MatrixTransferChart holds all information and data matrices to be
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
#include "utf_winfunc.hh"
|
||||
#include "utfconv.hh"
|
||||
#include <cwchar>
|
||||
#include <io.h>
|
||||
#include <wchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
FILE *ufopen(const char *filename, const char *mode)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
FILE *f = nullptr;
|
||||
UTF16_ENCODE(filename);
|
||||
UTF16_ENCODE(mode);
|
||||
|
||||
@@ -108,7 +108,7 @@ int umkdir(const char *pathname)
|
||||
|
||||
char *u_alloc_getenv(const char *varname)
|
||||
{
|
||||
char *r = 0;
|
||||
char *r = nullptr;
|
||||
wchar_t *str;
|
||||
UTF16_ENCODE(varname);
|
||||
if (varname_16) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# error "This file can only compile on windows"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
FILE *ufopen(const char *filename, const char *mode);
|
||||
int uopen(const char *filename, int oflag, int pmode);
|
||||
|
||||
@@ -280,9 +280,9 @@ static void utf_8_cut_end(char *inout8, size_t maxcutpoint)
|
||||
char *alloc_utf_8_from_16(const wchar_t *in16, size_t add)
|
||||
{
|
||||
size_t bsize = count_utf_8_from_16(in16);
|
||||
char *out8 = NULL;
|
||||
char *out8 = nullptr;
|
||||
if (!bsize) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
out8 = (char *)malloc(sizeof(char) * (bsize + add));
|
||||
conv_utf_16_to_8(in16, out8, bsize);
|
||||
@@ -292,9 +292,9 @@ char *alloc_utf_8_from_16(const wchar_t *in16, size_t add)
|
||||
wchar_t *alloc_utf16_from_8(const char *in8, size_t add)
|
||||
{
|
||||
size_t bsize = count_utf_16_from_8(in8);
|
||||
wchar_t *out16 = NULL;
|
||||
wchar_t *out16 = nullptr;
|
||||
if (!bsize) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
out16 = (wchar_t *)malloc(sizeof(wchar_t) * (bsize + add));
|
||||
conv_utf_8_to_16(in8, out16, bsize);
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#ifndef __UTFCONV_H__
|
||||
#define __UTFCONV_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cwchar>
|
||||
|
||||
/**
|
||||
* Counts how many bytes is required for future utf-8 string using utf-16
|
||||
|
||||
Reference in New Issue
Block a user