Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions include/polyscope/camera_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@ namespace polyscope {
// Forward declare structure
class CameraView;

/*
// Forward declare quantity types (currently there are none)
template <> // Specialize the quantity type
struct QuantityTypeHelper<CameraView> {
typedef CameraViewQuantity type;
};
*/

struct CameraViewPickResult {
// currently nothing, just following the same pattern as other structures
};

class CameraView : public QuantityStructure<CameraView> {
class CameraView : public Structure {
public:
// === Member functions ===

Expand Down
4 changes: 2 additions & 2 deletions include/polyscope/color_bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class ColorBar {
Quantity& parent;
std::pair<double, double> colormapRange; // in DATA values, not [0,1]

void exportColorbarToSVG(const std::string& filename);
void exportColorbarToSVG(const std::string& filename);

// Getters and setters

void setOnscreenColorbarEnabled(bool newEnabled);
bool getOnscreenColorbarEnabled();

// Location in screen coords. (-1,-1), means "place automatically" (default)
void setOnscreenColorbarLocation(glm::vec2 newScreenCoords);
glm::vec2 getOnscreenColorbarLocation();
Expand Down
2 changes: 1 addition & 1 deletion include/polyscope/color_image_quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ColorImageQuantity : public ImageQuantity {

// == Setters and getters

ColorImageQuantity* setEnabled(bool newEnabled) override;
void setEnabled(bool newEnabled) override;

ColorImageQuantity* setIsPremultiplied(bool val);
bool getIsPremultiplied();
Expand Down
7 changes: 1 addition & 6 deletions include/polyscope/curve_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@ class CurveNetworkNodeVectorQuantity;
class CurveNetworkEdgeVectorQuantity;


template <> // Specialize the quantity type
struct QuantityTypeHelper<CurveNetwork> {
typedef CurveNetworkQuantity type;
};

struct CurveNetworkPickResult {
CurveNetworkElement elementType; // which kind of element did we click
int64_t index; // index of the clicked element
float tEdge = -1; // if the pick is an edge, the t-value in [0,1] along the edge
};

class CurveNetwork : public QuantityStructure<CurveNetwork> {
class CurveNetwork : public Structure {
public:
// === Member functions ===

Expand Down
6 changes: 3 additions & 3 deletions include/polyscope/curve_network_quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

namespace polyscope {

// Forward declare
class CurveNetwork;

// Extend Quantity<CurveNetwork>
class CurveNetworkQuantity : public QuantityS<CurveNetwork> {
class CurveNetworkQuantity : public Quantity {
public:
CurveNetworkQuantity(std::string name, CurveNetwork& parentStructure, bool dominates = false);
virtual ~CurveNetworkQuantity() {};

CurveNetwork& parent; // shadows and hides the generic member in Quantity

// Build GUI info an element
virtual void buildNodeInfoGUI(size_t vInd);
virtual void buildEdgeInfoGUI(size_t fInd);
Expand Down
2 changes: 0 additions & 2 deletions include/polyscope/floating_quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class FloatingQuantity : public Quantity {
virtual ~FloatingQuantity() {};

virtual void buildUI() override;

virtual FloatingQuantity* setEnabled(bool newEnabled) = 0;
};


Expand Down
2 changes: 1 addition & 1 deletion include/polyscope/floating_quantity_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ScalarImageQuantity;
class ColorImageQuantity;


class FloatingQuantityStructure : public QuantityStructure<FloatingQuantityStructure> {
class FloatingQuantityStructure : public Structure {
public:
// === Member functions ===

Expand Down
32 changes: 15 additions & 17 deletions include/polyscope/implicit_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct ImplicitRenderOpts {

// Populate the custom-filled entries of opts according to the policy above.
template <class S>
void resolveImplicitRenderOpts(QuantityStructure<S>* parent, ImplicitRenderOpts& opts);
void resolveImplicitRenderOpts(S* parent, ImplicitRenderOpts& opts);

// === Depth/geometry/shape only render functions

Expand All @@ -102,15 +102,13 @@ void resolveImplicitRenderOpts(QuantityStructure<S>* parent, ImplicitRenderOpts&
// handles more general implicit functions. See the options struct for other options.

template <class Func, class S>
DepthRenderImageQuantity* renderImplicitSurface(QuantityStructure<S>* parent, std::string name, Func&& func,
ImplicitRenderMode mode,
DepthRenderImageQuantity* renderImplicitSurface(S* parent, std::string name, Func&& func, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func>
DepthRenderImageQuantity* renderImplicitSurface(std::string name, Func&& func, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func, class S>
DepthRenderImageQuantity* renderImplicitSurfaceBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ImplicitRenderMode mode,
DepthRenderImageQuantity* renderImplicitSurfaceBatch(S* parent, std::string name, Func&& func, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func>
DepthRenderImageQuantity* renderImplicitSurfaceBatch(std::string name, Func&& func, ImplicitRenderMode mode,
Expand All @@ -121,16 +119,16 @@ DepthRenderImageQuantity* renderImplicitSurfaceBatch(std::string name, Func&& fu
// Like the implicit surface renderers above, but additionally take a color

template <class Func, class FuncColor, class S>
ColorRenderImageQuantity* renderImplicitSurfaceColor(QuantityStructure<S>* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ColorRenderImageQuantity* renderImplicitSurfaceColor(S* parent, std::string name, Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func, class FuncColor>
ColorRenderImageQuantity* renderImplicitSurfaceColor(std::string name, Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());

template <class Func, class FuncColor, class S>
ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func, class FuncColor>
Expand All @@ -143,17 +141,17 @@ ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(std::string name, Func
// Like the implicit surface renderers above, but additionally take a scalar and colormap it, etc

template <class Func, class FuncScalar, class S>
ScalarRenderImageQuantity* renderImplicitSurfaceScalar(QuantityStructure<S>* parent, std::string name, Func&& func,
FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts(),
DataType dataType = DataType::STANDARD);
ScalarRenderImageQuantity*
renderImplicitSurfaceScalar(S* parent, std::string name, Func&& func, FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts(), DataType dataType = DataType::STANDARD);

template <class Func, class FuncScalar>
ScalarRenderImageQuantity*
renderImplicitSurfaceScalar(std::string name, Func&& func, FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts(), DataType dataType = DataType::STANDARD);

template <class Func, class FuncScalar, class S>
ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(S* parent, std::string name, Func&& func,
FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts(),
DataType dataType = DataType::STANDARD);
Expand All @@ -169,7 +167,7 @@ ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(std::string name, Fu
// Whereas the other functions shade based on normals, this one just renders surface depth and color directly.

template <class Func, class FuncColor, class S>
RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(QuantityStructure<S>* parent, std::string name, Func&& func,
RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func, class FuncColor>
Expand All @@ -178,9 +176,9 @@ RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(std::string name, Fun
ImplicitRenderOpts opts = ImplicitRenderOpts());

template <class Func, class FuncColor, class S>
RawColorRenderImageQuantity*
renderImplicitSurfaceRawColorBatch(QuantityStructure<S>* parent, std::string name, Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode, ImplicitRenderOpts opts = ImplicitRenderOpts());
RawColorRenderImageQuantity* renderImplicitSurfaceRawColorBatch(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts = ImplicitRenderOpts());
template <class Func, class FuncColor>
RawColorRenderImageQuantity* renderImplicitSurfaceRawColorBatch(std::string name, Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode,
Expand Down
29 changes: 14 additions & 15 deletions include/polyscope/implicit_helpers.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace polyscope {

template <class S>
void resolveImplicitRenderOpts(QuantityStructure<S>* parent, ImplicitRenderOpts& opts) {
void resolveImplicitRenderOpts(S* parent, ImplicitRenderOpts& opts) {

// see comment in the ImplicitRenderOpts struct for the logic that this function implements

Expand Down Expand Up @@ -249,8 +249,8 @@ DepthRenderImageQuantity* renderImplicitSurfaceBatch(std::string name, Func&& fu
}

template <class Func, class S>
DepthRenderImageQuantity* renderImplicitSurface(QuantityStructure<S>* parent, std::string name, Func&& func,
ImplicitRenderMode mode, ImplicitRenderOpts opts) {
DepthRenderImageQuantity* renderImplicitSurface(S* parent, std::string name, Func&& func, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {

// Bootstrap on the batch version
auto batchFunc = [&](const float* pos_ptr, float* result_ptr, size_t size) {
Expand All @@ -269,8 +269,8 @@ DepthRenderImageQuantity* renderImplicitSurface(QuantityStructure<S>* parent, st


template <class Func, class S>
DepthRenderImageQuantity* renderImplicitSurfaceBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ImplicitRenderMode mode, ImplicitRenderOpts opts) {
DepthRenderImageQuantity* renderImplicitSurfaceBatch(S* parent, std::string name, Func&& func, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {

resolveImplicitRenderOpts(parent, opts);

Expand Down Expand Up @@ -307,9 +307,8 @@ ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(std::string name, Func


template <class Func, class FuncColor, class S>
ColorRenderImageQuantity* renderImplicitSurfaceColor(QuantityStructure<S>* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {
ColorRenderImageQuantity* renderImplicitSurfaceColor(S* parent, std::string name, Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode, ImplicitRenderOpts opts) {

// Bootstrap on the batch version
auto batchFunc = [&](const float* pos_ptr, float* result_ptr, size_t size) {
Expand Down Expand Up @@ -344,7 +343,7 @@ ColorRenderImageQuantity* renderImplicitSurfaceColor(QuantityStructure<S>* paren


template <class Func, class FuncColor, class S>
ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ColorRenderImageQuantity* renderImplicitSurfaceColorBatch(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {

Expand Down Expand Up @@ -399,7 +398,7 @@ ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(std::string name, Fu
}

template <class Func, class FuncScalar, class S>
ScalarRenderImageQuantity* renderImplicitSurfaceScalar(QuantityStructure<S>* parent, std::string name, Func&& func,
ScalarRenderImageQuantity* renderImplicitSurfaceScalar(S* parent, std::string name, Func&& func,
FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts, DataType dataType) {

Expand Down Expand Up @@ -430,7 +429,7 @@ ScalarRenderImageQuantity* renderImplicitSurfaceScalar(QuantityStructure<S>* par
}

template <class Func, class FuncScalar, class S>
ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(QuantityStructure<S>* parent, std::string name, Func&& func,
ScalarRenderImageQuantity* renderImplicitSurfaceScalarBatch(S* parent, std::string name, Func&& func,
FuncScalar&& funcScalar, ImplicitRenderMode mode,
ImplicitRenderOpts opts, DataType dataType) {

Expand Down Expand Up @@ -483,7 +482,7 @@ RawColorRenderImageQuantity* renderImplicitSurfaceRawColorBatch(std::string name


template <class Func, class FuncColor, class S>
RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(QuantityStructure<S>* parent, std::string name, Func&& func,
RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {

Expand Down Expand Up @@ -520,9 +519,9 @@ RawColorRenderImageQuantity* renderImplicitSurfaceRawColor(QuantityStructure<S>*


template <class Func, class FuncColor, class S>
RawColorRenderImageQuantity* renderImplicitSurfaceRawColorBatch(QuantityStructure<S>* parent, std::string name,
Func&& func, FuncColor&& funcColor,
ImplicitRenderMode mode, ImplicitRenderOpts opts) {
RawColorRenderImageQuantity* renderImplicitSurfaceRawColorBatch(S* parent, std::string name, Func&& func,
FuncColor&& funcColor, ImplicitRenderMode mode,
ImplicitRenderOpts opts) {

resolveImplicitRenderOpts(parent, opts);

Expand Down
9 changes: 2 additions & 7 deletions include/polyscope/point_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "polyscope/color_management.h"
#include "polyscope/persistent_value.h"
#include "polyscope/pick.h"
#include "polyscope/point_cloud_quantity.h"
#include "polyscope/polyscope.h"
#include "polyscope/render/engine.h"
#include "polyscope/render/managed_buffer.h"
Expand All @@ -16,6 +15,7 @@

#include "polyscope/point_cloud_color_quantity.h"
#include "polyscope/point_cloud_parameterization_quantity.h"
#include "polyscope/point_cloud_quantity.h"
#include "polyscope/point_cloud_scalar_quantity.h"
#include "polyscope/point_cloud_vector_quantity.h"

Expand All @@ -33,16 +33,11 @@ class PointCloudParameterizationQuantity;
class PointCloudVectorQuantity;


template <> // Specialize the quantity type
struct QuantityTypeHelper<PointCloud> {
typedef PointCloudQuantity type;
};

struct PointCloudPickResult {
int64_t index;
};

class PointCloud : public QuantityStructure<PointCloud> {
class PointCloud : public Structure {
public:
// === Member functions ===

Expand Down
6 changes: 3 additions & 3 deletions include/polyscope/point_cloud_quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

namespace polyscope {

// Forward delcare point cloud
class PointCloud;

// Extend Quantity<PointCloud> to add a few extra functions
class PointCloudQuantity : public QuantityS<PointCloud> {
class PointCloudQuantity : public Quantity {
public:
PointCloudQuantity(std::string name, PointCloud& parentStructure, bool dominates = false);
virtual ~PointCloudQuantity() {};

PointCloud& parent; // shadows and hides the generic member in Quantity

// Build GUI info about a point
virtual void buildInfoGUI(size_t pointInd);
};
Expand Down
2 changes: 1 addition & 1 deletion include/polyscope/polyscope.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extern std::function<void()>& userCallback;
// == Other callback functions

// invoked when files are dropped onto the window, nothing by default
extern std::function<void(const std::vector<std::string>&)> filesDroppedCallback;
extern std::function<void(const std::vector<std::string>&)> filesDroppedCallback;

// === Implementation details

Expand Down
Loading