From 1dc1a87fba520bb45c1ce8165e8ea2c83c0a308d Mon Sep 17 00:00:00 2001 From: Bryan Galdrikian Date: Mon, 22 Jan 2018 14:04:16 -0800 Subject: Changes for 1.1.2 release candidate See README.md, docs/release_notes.txt --- .../source/NvBlastExtAuthoringCutoutImpl.h | 129 +++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 sdk/extensions/authoring/source/NvBlastExtAuthoringCutoutImpl.h (limited to 'sdk/extensions/authoring/source/NvBlastExtAuthoringCutoutImpl.h') diff --git a/sdk/extensions/authoring/source/NvBlastExtAuthoringCutoutImpl.h b/sdk/extensions/authoring/source/NvBlastExtAuthoringCutoutImpl.h new file mode 100644 index 0000000..6824291 --- /dev/null +++ b/sdk/extensions/authoring/source/NvBlastExtAuthoringCutoutImpl.h @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + + +#ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H +#define NVBLASTAUTHORINGFCUTOUTIMPL_H + +#include "NvBlastExtAuthoringCutout.h" +#include +#include "PxMat44.h" // TODO Should replace? + +namespace Nv +{ +namespace Blast +{ + +struct PolyVert +{ + uint16_t index; + uint16_t flags; +}; + +struct ConvexLoop +{ + std::vector polyVerts; +}; + +struct Cutout +{ + std::vector vertices; + std::vector convexLoops; +}; + +struct POINT2D +{ + POINT2D() {} + POINT2D(int32_t _x, int32_t _y) : x(_x), y(_y) {} + + int32_t x; + int32_t y; + + bool operator==(const POINT2D& other) const + { + return x == other.x && y == other.y; + } + bool operator<(const POINT2D& other) const + { + if (x == other.x) return y < other.y; + return x < other.x; + } +}; + +void convertTracesToIncremental(std::vector< std::vector* >& traces); + +struct CutoutSetImpl : public CutoutSet +{ + CutoutSetImpl() : periodic(false), dimensions(0.0f) + { + } + + uint32_t getCutoutCount() const + { + return (uint32_t)cutouts.size(); + } + + uint32_t getCutoutVertexCount(uint32_t cutoutIndex) const + { + return (uint32_t)cutouts[cutoutIndex].vertices.size(); + } + uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const + { + return (uint32_t)cutouts[cutoutIndex].convexLoops.size(); + } + + const physx::PxVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t vertexIndex) const + { + return cutouts[cutoutIndex].vertices[vertexIndex]; + } + + uint32_t getCutoutLoopSize(uint32_t cutoutIndex, uint32_t loopIndex) const + { + return (uint32_t)cutouts[cutoutIndex].convexLoops[loopIndex].polyVerts.size(); + } + + uint32_t getCutoutLoopVertexIndex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const + { + return cutouts[cutoutIndex].convexLoops[loopIndex].polyVerts[vertexNum].index; + } + uint32_t getCutoutLoopVertexFlags(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const + { + return cutouts[cutoutIndex].convexLoops[loopIndex].polyVerts[vertexNum].flags; + } + bool isPeriodic() const + { + return periodic; + } + const physx::PxVec2& getDimensions() const + { + return dimensions; + } + + //void serialize(physx::PxFileBuf& stream) const; + //void deserialize(physx::PxFileBuf& stream); + + void release() + { + delete this; + } + + std::vector cutouts; + bool periodic; + physx::PxVec2 dimensions; +}; + +void createCutoutSet(Nv::Blast::CutoutSetImpl& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth, uint32_t bufferHeight, + float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps); + + +} // namespace Blast +} // namespace Nv + +#endif // ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H -- cgit v1.2.3