├── README.md
├── build
├── BMesh
│ ├── BMesh.vcxproj
│ └── BMesh.vcxproj.filters
├── BaseLib
│ ├── BaseLib.vcxproj
│ └── BaseLib.vcxproj.filters
├── Boolean
│ ├── Boolean.vcxproj
│ └── Boolean.vcxproj.filters
├── Sculpt
│ ├── Sculpt.vcxproj
│ ├── Sculpt.vcxproj.filters
│ └── Sculpt.vcxproj.user
├── VBvh
│ ├── VBvh.vcxproj
│ └── VBvh.vcxproj.filters
├── VKernel
│ ├── VKernel.vcxproj
│ ├── VKernel.vcxproj.filters
│ └── VKernel.vcxproj.user
├── VbsQt
│ ├── VbsQt.vcxproj
│ ├── VbsQt.vcxproj.filters
│ └── VbsQt.vcxproj.user
├── render
│ ├── render.vcxproj
│ ├── render.vcxproj.filters
│ └── render.vcxproj.user
├── vsculpt
│ ├── vsculpt.vcxproj
│ ├── vsculpt.vcxproj.filters
│ └── vsculpt.vcxproj.user
├── vsculpt_qt5.sln
└── vsculpt_qt5.v12.suo
├── inc
├── BMesh
│ ├── BMCompilerTypeCheck.h
│ ├── BMCustomData.h
│ ├── BMUtilDefine.h
│ ├── BMesh.h
│ ├── BMeshClass.h
│ ├── BMeshCore.h
│ ├── BMeshInline.h
│ ├── BMeshIterators.h
│ ├── BMeshPolygon.h
│ ├── BMeshQueries.h
│ ├── BMeshStructure.h
│ ├── BMeshUtility.h
│ └── Tools
│ │ ├── BMBisectOp.h
│ │ ├── BMeshBisectPlane.h
│ │ ├── BMeshDecimate.h
│ │ ├── BMeshDiffCurvature.h
│ │ ├── BMeshDuplicate.h
│ │ ├── BMeshOp.h
│ │ ├── BMeshRemesh.h
│ │ ├── BMeshSymmetrize.h
│ │ └── BMeshTriangulate.h
├── BaseLib
│ ├── BasePrecompiled.h
│ ├── Box.h
│ ├── BoxEdge.h
│ ├── BoxPlane.h
│ ├── BoxVertex.h
│ ├── CalcPolygonOffset.h
│ ├── ClipPolygon.h
│ ├── DlnEdge.h
│ ├── DlnPoint.h
│ ├── DlnTriangle.h
│ ├── GluTesselator.h
│ ├── GluTesselatorBoundary.h
│ ├── KArray.h
│ ├── KGrid1D.h
│ ├── KLinkList.h
│ ├── KModelMatrix.h
│ ├── KPair.h
│ ├── KSphereOctree.h
│ ├── K_HashTable.h
│ ├── LinearEquation.h
│ ├── MathBase.h
│ ├── MathGeom.h
│ ├── MathUtil.h
│ ├── PlanarContour.h
│ ├── Plane.h
│ ├── Point2Df.h
│ ├── Point3Dd.h
│ ├── Point3DdList.h
│ ├── PointnD.h
│ ├── Quadrangle.h
│ ├── Ray2Dd.h
│ ├── Segment2Df.h
│ ├── SkeletonGenerator.h
│ ├── SseVector3f.h
│ ├── StackWalker.h
│ ├── Timer.h
│ ├── TriTriIsct.h
│ ├── TriangleIndexByZ.h
│ ├── UtilMacro.h
│ ├── VB2DTessellator.h
│ ├── VBGrid2D.h
│ ├── VBOffsetor.h
│ ├── VBQuaternion.h
│ ├── VQuadric.h
│ ├── VertexGrid2D.h
│ ├── aabb2d.h
│ ├── contour2d.h
│ ├── defined.h
│ ├── eigen3.h
│ ├── geometry.h
│ ├── geometry.inl
│ ├── intersectpoint.h
│ ├── line2Dd.h
│ ├── line3D.h
│ ├── matrix3x3d.h
│ ├── matrix4x4d.h
│ ├── misc
│ │ └── TriangleTriangleIntersection.h
│ ├── point2D.h
│ ├── ppl
│ │ ├── agents_extras.h
│ │ ├── barrier.h
│ │ ├── bounded_queue.h
│ │ ├── concrt_extras.h
│ │ ├── concurrent_unordered_map.h
│ │ ├── concurrent_unordered_set.h
│ │ ├── connect.h
│ │ ├── internal_concurrent_hash.h
│ │ ├── internal_split_ordered_list.h
│ │ ├── ppl_extras.h
│ │ ├── ppltasks.h
│ │ └── semaphore.h
│ ├── segment2Dd.h
│ ├── segment3Dd.h
│ ├── triangle3Dd.h
│ └── util.h
├── Boolean
│ ├── accel
│ │ └── aabvh.h
│ ├── bm
│ │ ├── bm_isct.h
│ │ ├── bm_isct_bool_include.h
│ │ ├── bm_isct_boolean.h
│ │ ├── bm_isct_isct_problem.h
│ │ ├── bm_isct_outer_hull_exact.h
│ │ └── bm_isct_tri_problem.h
│ ├── isct
│ │ ├── absext4.h
│ │ ├── empty3d.cpp
│ │ ├── empty3d.h
│ │ ├── ext4.h
│ │ ├── fixext4.h
│ │ ├── fixint.h
│ │ ├── gmpext4.h
│ │ ├── quantization.cpp
│ │ ├── quantization.h
│ │ ├── triangle.c
│ │ ├── triangle.h
│ │ └── unsafeRayTriIsct.h
│ ├── math
│ │ ├── bbox.h
│ │ ├── ray.h
│ │ └── vec.h
│ └── util
│ │ ├── iterPool.h
│ │ ├── log.cpp
│ │ ├── memPool.h
│ │ ├── prelude.h
│ │ ├── shortVec.h
│ │ ├── timer.cpp
│ │ └── unionFind.h
├── Sculpt
│ ├── AnchoredStroke.h
│ ├── AverageBrushDataOp.h
│ ├── BMSplitCollapseOp.h
│ ├── BezierCurve.h
│ ├── NormalUpdateOp.h
│ ├── SUtil.h
│ ├── SculptCommand.h
│ ├── StrokeData.h
│ ├── VSculptConfig.h
│ ├── VSculptLogger.cpp
│ ├── VSculptLogger.h
│ ├── brush
│ │ ├── ClayBrushOp.h
│ │ ├── ClayStripBrushOp.h
│ │ ├── CreaseBrushOp.h
│ │ ├── DrawBrushOp.h
│ │ ├── FillBrushOp.h
│ │ ├── FlattenBrushOp.h
│ │ ├── GrabBrushOp.h
│ │ ├── InflateBrushOp.h
│ │ ├── NudgetBrushOp.h
│ │ ├── PinchBrushOp.h
│ │ ├── RotateBrushOp.h
│ │ ├── SculptStroke.h
│ │ ├── SmoothBrushOp.h
│ │ ├── SnakeHookBrushOp.h
│ │ └── ThumbBrushOp.h
│ ├── commonDefine.h
│ └── transform.h
├── VBvh
│ ├── BMBvhIsect.h
│ ├── BMeshBvh.h
│ ├── BMeshBvhBuilder.h
│ ├── BMeshBvhNodeSplitter.h
│ ├── VBvhBinBuilder.h
│ ├── VBvhDefine.h
│ ├── VBvhIterator.h
│ ├── VBvhMortonBuilder.h
│ ├── VBvhNode.h
│ ├── VBvhOverlap.h
│ ├── VBvhUtil.h
│ ├── VMorton.h
│ ├── VObjectPartition.h
│ ├── VPrimInfor.h
│ ├── VPrimRef.h
│ ├── WorkStack.h
│ ├── common
│ │ ├── default.h
│ │ ├── math
│ │ │ ├── bbox.h
│ │ │ ├── mymath.h
│ │ │ ├── vec2.h
│ │ │ ├── vec3.h
│ │ │ ├── vec3ba.h
│ │ │ ├── vec3fa.h
│ │ │ ├── vec3ia.h
│ │ │ └── vec4.h
│ │ ├── simd
│ │ │ ├── simd.h
│ │ │ ├── sse.h
│ │ │ ├── sse_special.h
│ │ │ ├── sseb.h
│ │ │ ├── ssef.h
│ │ │ └── ssei.h
│ │ └── sys
│ │ │ ├── constants.h
│ │ │ ├── intrinsics.h
│ │ │ ├── platform.h
│ │ │ └── sysinfo.h
│ └── hash
│ │ ├── GridUtil.h
│ │ └── SpacialHash.h
├── VKernel
│ ├── BMeshRemeshOp.h
│ ├── GteWireframeEffect.h
│ ├── VCamera.h
│ ├── VCameraLens.h
│ ├── VContext.h
│ ├── VEffectManager.h
│ ├── VFloorNode.h
│ ├── VKernelCommon.h
│ ├── VLighting.h
│ ├── VManipulatorNode.h
│ ├── VMeshObject.h
│ ├── VMeshObjectRender.h
│ ├── VNode.h
│ ├── VNodeRender.h
│ ├── VObject.h
│ ├── VPVWUpdater.h
│ ├── VScene.h
│ ├── VSceneRenderer.h
│ ├── VSmoothOp.h
│ ├── VTextureLoader.h
│ ├── VTrackBall.h
│ ├── VTransform.h
│ ├── VView3DEditBox.h
│ └── VView3DRegion.h
├── VbsQt
│ └── VbsDef.h
├── render
│ ├── GTEngineDEF.h
│ ├── GTEnginePCH.h
│ ├── GTGraphics.h
│ ├── Graphics
│ │ ├── GL4
│ │ │ ├── GteGL4BlendState.h
│ │ │ ├── GteGL4Buffer.h
│ │ │ ├── GteGL4ConstantBuffer.h
│ │ │ ├── GteGL4DepthStencilState.h
│ │ │ ├── GteGL4DrawTarget.h
│ │ │ ├── GteGL4DrawingState.h
│ │ │ ├── GteGL4Engine.h
│ │ │ ├── GteGL4GraphicsObject.h
│ │ │ ├── GteGL4IndexBuffer.h
│ │ │ ├── GteGL4InputLayout.h
│ │ │ ├── GteGL4InputLayoutManager.h
│ │ │ ├── GteGL4RasterizerState.h
│ │ │ ├── GteGL4Resource.h
│ │ │ ├── GteGL4SamplerState.h
│ │ │ ├── GteGL4Texture.h
│ │ │ ├── GteGL4Texture2.h
│ │ │ ├── GteGL4Texture3.h
│ │ │ ├── GteGL4TextureArray.h
│ │ │ ├── GteGL4TextureCube.h
│ │ │ ├── GteGL4TextureDS.h
│ │ │ ├── GteGL4TextureRT.h
│ │ │ ├── GteGL4TextureSingle.h
│ │ │ ├── GteGL4VertexBuffer.h
│ │ │ ├── GteGLFunction.h
│ │ │ ├── GteGLSLComputeProgram.h
│ │ │ ├── GteGLSLProgramFactory.h
│ │ │ ├── GteGLSLReflection.h
│ │ │ ├── GteGLSLVisualProgram.h
│ │ │ ├── GteOpenGL.h
│ │ │ └── GteOpenGLHelper.h
│ │ ├── GteAmbientLightEffect.h
│ │ ├── GteBlendState.h
│ │ ├── GteBuffer.h
│ │ ├── GteComputeProgram.h
│ │ ├── GteComputeShader.h
│ │ ├── GteConstantBuffer.h
│ │ ├── GteConstantColorEffect.h
│ │ ├── GteDataFormat.h
│ │ ├── GteDepthStencilState.h
│ │ ├── GteDirectionalLightEffect.h
│ │ ├── GteDirectionalLightTextureEffect.h
│ │ ├── GteDrawTarget.h
│ │ ├── GteDrawingState.h
│ │ ├── GteFont.h
│ │ ├── GteFontArialW400H18.h
│ │ ├── GteGEDrawTarget.h
│ │ ├── GteGEInputLayoutManager.h
│ │ ├── GteGEObject.h
│ │ ├── GteGeometryShader.h
│ │ ├── GteGraphicsEngine.h
│ │ ├── GteGraphicsObject.h
│ │ ├── GteIndexBuffer.h
│ │ ├── GteIndexFormat.h
│ │ ├── GteIndirectArgumentsBuffer.h
│ │ ├── GteKeyframeController.h
│ │ ├── GteLightCameraGeometry.h
│ │ ├── GteLighting.h
│ │ ├── GteLightingEffect.h
│ │ ├── GteMaterial.h
│ │ ├── GteMemberLayout.h
│ │ ├── GteMeshFactory.h
│ │ ├── GteOverlayEffect.h
│ │ ├── GtePixelShader.h
│ │ ├── GtePointLightEffect.h
│ │ ├── GtePointLightTextureEffect.h
│ │ ├── GteProgramDefines.h
│ │ ├── GteProgramFactory.h
│ │ ├── GteRasterizerState.h
│ │ ├── GteRawBuffer.h
│ │ ├── GteResource.h
│ │ ├── GteSamplerState.h
│ │ ├── GteShader.h
│ │ ├── GteSpotLightEffect.h
│ │ ├── GteStructuredBuffer.h
│ │ ├── GteTextEffect.h
│ │ ├── GteTexture.h
│ │ ├── GteTexture1.h
│ │ ├── GteTexture1Array.h
│ │ ├── GteTexture2.h
│ │ ├── GteTexture2Array.h
│ │ ├── GteTexture2ColorEffect.h
│ │ ├── GteTexture2Effect.h
│ │ ├── GteTexture3.h
│ │ ├── GteTexture3Effect.h
│ │ ├── GteTextureArray.h
│ │ ├── GteTextureBuffer.h
│ │ ├── GteTextureCube.h
│ │ ├── GteTextureCubeArray.h
│ │ ├── GteTextureDS.h
│ │ ├── GteTextureRT.h
│ │ ├── GteTextureSingle.h
│ │ ├── GteTypedBuffer.h
│ │ ├── GteVertexBuffer.h
│ │ ├── GteVertexColorEffect.h
│ │ ├── GteVertexFormat.h
│ │ ├── GteVertexShader.h
│ │ ├── GteVisualEffect.h
│ │ ├── GteVisualProgram.h
│ │ └── gteCommon.h
│ ├── LowLevel
│ │ ├── GteArray2.h
│ │ ├── GteAtomicMinMax.h
│ │ ├── GteComputeModel.h
│ │ ├── GteMemory.h
│ │ ├── GteMinHeap.h
│ │ ├── GteRangeIteration.h
│ │ ├── GteThreadSafeMap.h
│ │ ├── GteThreadSafeQueue.h
│ │ ├── GteTimer.h
│ │ └── GteWrapper.h
│ └── Mathematics
│ │ └── GteBitHacks.h
└── vsculpt
│ ├── K3DQMLAdapter.h
│ ├── Operator
│ ├── VCommonConfigOp.h
│ ├── VDropMeshOp.h
│ ├── VManipulatorOp.h
│ ├── VMeshBooleanOp.h
│ ├── VMeshDecimateOp.h
│ ├── VMeshRemeshOp.h
│ ├── VMeshSelfIsectOp.h
│ ├── VMeshSmoothOp.h
│ ├── VOpTemplate.h
│ ├── VOperator.h
│ ├── VSculptBrushOp.h
│ ├── VSculptConfigOp.h
│ ├── VView3DEditBoxOp.h
│ └── VViewEditOp.h
│ ├── QtQuickAppViewer.h
│ ├── VCommon.h
│ ├── VEventHandler.h
│ ├── VOperatorQmlAdaptor.h
│ └── VView3DRegionQuickItem.h
├── qml
├── box_view.ply
└── cube.png
├── resource
├── K3DStudio-2.qrc
├── K3DStudio-3.qrc
├── K3DStudio-4.qrc
├── K3DStudio-5.qrc
├── TestForm.ui.qml
├── TestForm.ui.qml.autosave
├── qml.qrc
├── vsculptres.pro
├── vsculptres.pro.user
└── vsculptres.pro.user.ec4a7c4
└── src
├── BMesh
├── BMCustomData.cpp
├── BMeshCore.cpp
├── BMeshIterators.cpp
├── BMeshPolygon.cpp
├── BMeshQueries.cpp
├── BMeshStructure.cpp
├── BMeshUtility.cpp
└── Tools
│ ├── BMBisectOp.cpp
│ ├── BMeshBisectPlane.cpp
│ ├── BMeshDecimate.cpp
│ ├── BMeshDiffCurvature.cpp
│ ├── BMeshRemesh.cpp
│ ├── BMeshSymmetrize.cpp
│ └── BMeshTriangulate.cpp
├── BaseLib
├── BasePrecompiled.cpp
├── Box.cpp
├── BoxEdge.cpp
├── BoxPlane.cpp
├── BoxVertex.cpp
├── CalcPolygonOffset.cpp
├── ClipPolygon.cpp
├── DlnEdge.cpp
├── DlnPoint.cpp
├── DlnTriangle.cpp
├── GluTesselator.cpp
├── GluTesselatorBoundary.cpp
├── KModelMatrix.cpp
├── MathGeom.cpp
├── MathUtil.cpp
├── PlanarContour.cpp
├── Plane.cpp
├── Point2Df.cpp
├── Point3Dd.cpp
├── Quadrangle.cpp
├── Ray2Dd.cpp
├── Segment2Dd.cpp
├── Segment2Df.cpp
├── SkeletonGenerator.cpp
├── StackWalker.cpp
├── Timer.cpp
├── TriTriIsct.cpp
├── VB2DTessellator.cpp
├── VBOffsetor.cpp
├── VBQuaternion.cpp
├── VQuadric.cpp
├── contour2d.cpp
├── eigen3.cpp
├── intersectpoint.cpp
├── line2Dd.cpp
├── line3D.cpp
├── matrix3x3d.cpp
├── matrix4x4d.cpp
├── misc
│ └── TriangleTriangleIntersection.cpp
├── segment3Dd.cpp
├── triangle3Dd.cpp
└── util.cpp
├── Boolean
└── bm
│ ├── bm_isct.cpp
│ ├── bm_isct_bool_include.cpp
│ ├── bm_isct_boolean.cpp
│ ├── bm_isct_isct_problem.cpp
│ ├── bm_isct_outer_hull_exact.cpp
│ └── bm_isct_tri_problem.cpp
├── Sculpt
├── BMSplitCollapseOp.cpp
├── BezierCurve.cpp
├── SUtil.cpp
├── SculptCommand.cpp
├── VSculptConfig.cpp
├── brush
│ └── SculptStroke.cpp
└── transform.cpp
├── VBvh
├── BMBvhIsect.cpp
├── BMeshBvh.cpp
├── BMeshBvhBuilder.cpp
├── BMeshBvhNodeSplitter.cpp
├── VBvhUtil.cpp
├── VObjectPartition.cpp
└── common
│ ├── simd
│ └── sse.cpp
│ └── sys
│ └── sysinfo.cpp
├── VKernel
├── BMeshRemeshOp.cpp
├── GteWireframeEffect.cpp
├── VCamera.cpp
├── VCameraLens.cpp
├── VContext.cpp
├── VEffectManager.cpp
├── VFloorNode.cpp
├── VLighting.cpp
├── VManipulatorNode.cpp
├── VMeshObject.cpp
├── VMeshObjectRender.cpp
├── VNode.cpp
├── VObject.cpp
├── VPVWUpdater.cpp
├── VScene.cpp
├── VSceneRenderer.cpp
├── VSmoothOp.cpp
├── VTextureLoader.cpp
├── VTrackBall.cpp
├── VTransform.cpp
├── VView3DEditBox.cpp
└── VView3DRegion.cpp
├── VbsQt
└── VbsDef.cpp
├── render
├── Graphics
│ ├── GL4
│ │ ├── GteGL4BlendState.cpp
│ │ ├── GteGL4Buffer.cpp
│ │ ├── GteGL4ConstantBuffer.cpp
│ │ ├── GteGL4DepthStencilState.cpp
│ │ ├── GteGL4DrawTarget.cpp
│ │ ├── GteGL4DrawingState.cpp
│ │ ├── GteGL4Engine.cpp
│ │ ├── GteGL4GraphicsObject.cpp
│ │ ├── GteGL4IndexBuffer.cpp
│ │ ├── GteGL4InputLayout.cpp
│ │ ├── GteGL4InputLayoutManager.cpp
│ │ ├── GteGL4RasterizerState.cpp
│ │ ├── GteGL4Resource.cpp
│ │ ├── GteGL4SamplerState.cpp
│ │ ├── GteGL4Texture.cpp
│ │ ├── GteGL4Texture2.cpp
│ │ ├── GteGL4Texture3.cpp
│ │ ├── GteGL4TextureArray.cpp
│ │ ├── GteGL4TextureCube.cpp
│ │ ├── GteGL4TextureDS.cpp
│ │ ├── GteGL4TextureRT.cpp
│ │ ├── GteGL4TextureSingle.cpp
│ │ ├── GteGL4VertexBuffer.cpp
│ │ ├── GteGLFunction.cpp
│ │ ├── GteGLSLComputeProgram.cpp
│ │ ├── GteGLSLProgramFactory.cpp
│ │ ├── GteGLSLReflection.cpp
│ │ ├── GteGLSLVisualProgram.cpp
│ │ ├── GteOpenGL.cpp
│ │ ├── GteOpenGLHelper.cpp
│ │ └── GteWGLExtensions.cpp
│ ├── GteAmbientLightEffect.cpp
│ ├── GteBlendState.cpp
│ ├── GteBuffer.cpp
│ ├── GteComputeProgram.cpp
│ ├── GteComputeShader.cpp
│ ├── GteConstantBuffer.cpp
│ ├── GteConstantColorEffect.cpp
│ ├── GteDataFormat.cpp
│ ├── GteDepthStencilState.cpp
│ ├── GteDirectionalLightEffect.cpp
│ ├── GteDirectionalLightTextureEffect.cpp
│ ├── GteDrawTarget.cpp
│ ├── GteDrawingState.cpp
│ ├── GteFont.cpp
│ ├── GteFontArialW400H18.cpp
│ ├── GteGEDrawTarget.cpp
│ ├── GteGEObject.cpp
│ ├── GteGeometryShader.cpp
│ ├── GteGraphicsEngine.cpp
│ ├── GteGraphicsObject.cpp
│ ├── GteIndexBuffer.cpp
│ ├── GteIndirectArgumentsBuffer.cpp
│ ├── GteKeyframeController.cpp
│ ├── GteLightCameraGeometry.cpp
│ ├── GteLighting.cpp
│ ├── GteLightingEffect.cpp
│ ├── GteMaterial.cpp
│ ├── GteMeshFactory.cpp
│ ├── GteOverlayEffect.cpp
│ ├── GtePixelShader.cpp
│ ├── GtePointLightEffect.cpp
│ ├── GtePointLightTextureEffect.cpp
│ ├── GteProgramDefines.cpp
│ ├── GteProgramFactory.cpp
│ ├── GteRasterizerState.cpp
│ ├── GteRawBuffer.cpp
│ ├── GteResource.cpp
│ ├── GteSamplerState.cpp
│ ├── GteShader.cpp
│ ├── GteSpotLightEffect.cpp
│ ├── GteStructuredBuffer.cpp
│ ├── GteTextEffect.cpp
│ ├── GteTexture.cpp
│ ├── GteTexture1.cpp
│ ├── GteTexture1Array.cpp
│ ├── GteTexture2.cpp
│ ├── GteTexture2Array.cpp
│ ├── GteTexture2ColorEffect.cpp
│ ├── GteTexture2Effect.cpp
│ ├── GteTexture3.cpp
│ ├── GteTexture3Effect.cpp
│ ├── GteTextureArray.cpp
│ ├── GteTextureBuffer.cpp
│ ├── GteTextureCube.cpp
│ ├── GteTextureCubeArray.cpp
│ ├── GteTextureDS.cpp
│ ├── GteTextureRT.cpp
│ ├── GteTextureSingle.cpp
│ ├── GteTypedBuffer.cpp
│ ├── GteVertexBuffer.cpp
│ ├── GteVertexColorEffect.cpp
│ ├── GteVertexFormat.cpp
│ ├── GteVertexShader.cpp
│ ├── GteVisualEffect.cpp
│ └── GteVisualProgram.cpp
├── LowLevel
│ ├── GteTimer.cpp
│ └── GteWrapper.cpp
└── Mathematics
│ └── GteBitHacks.cpp
└── vsculpt
├── K3DQMLAdapter.cpp
├── Operator
├── VCommonConfigOp.cpp
├── VDropMeshOp.cpp
├── VManipulatorOp.cpp
├── VMeshBooleanOp.cpp
├── VMeshDecimateOp.cpp
├── VMeshRemeshOp.cpp
├── VMeshSelfIsectOp.cpp
├── VMeshSmoothOp.cpp
├── VOpTemplate.cpp
├── VOperator.cpp
├── VSculptBrushOp.cpp
├── VSculptConfigOp.cpp
├── VView3DEditBoxOp.cpp
└── VViewEditOp.cpp
├── QtQuickAppViewer.cpp
├── VEventHandler.cpp
├── VOperatorQmlAdaptor.cpp
├── VView3DRegionQuickItem.cpp
└── main.cpp
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # An open-source digital sculpting project
3 |
4 | ## Some cool features.
5 |
6 | ### Multiple Types of Sculpt Brushes
7 | Inflate, Nudget, Draw Pinch, Snake Hook, Clay Strip, Smooth, Crease, Clay, Grab, Flatten, Rotate, Thumb
8 | 
9 |
10 | ### Dynamic Topology
11 | Automatical subdivison of mesh surfaces to support higher level of detail
12 | 
13 |
14 | ### Adaptive Remeshing
15 | Optimize mesh topology for more vertices at high curvature regions and fewer vertices at more flat regions.
16 | 
17 |
18 | ### Mesh Boolean Tools
19 | Calculate Union, Difference or Subtraction of two meshes
20 | 
21 |
22 | ### Meshing of Sphere-based Skeleton Structure for Fash Mesh Creation.
23 | 
24 |
25 | ## Requirements.
26 | - Qt5
27 |
28 | ## Additional resource
29 | - A few more [demo clips](https://www.youtube.com/playlist?list=PLkLcpRjubtMfBnvqnge646SncXCaHWqBJ)
30 |
--------------------------------------------------------------------------------
/build/Sculpt/Sculpt.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | C:\Qt\Qt5.6.0\5.6\msvc2013
6 | PATH=$(QTDIR)\bin%3b$(PATH)
7 |
8 |
9 | C:\Qt\Qt5.6.0\5.6\msvc2013
10 | PATH=$(QTDIR)\bin%3b$(PATH)
11 |
12 |
--------------------------------------------------------------------------------
/build/VKernel/VKernel.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
5 | C:\Qt\Qt5.6.0\5.6\msvc2013
6 |
7 |
8 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
9 | C:\Qt\Qt5.6.0\5.6\msvc2013
10 |
11 |
--------------------------------------------------------------------------------
/build/VbsQt/VbsQt.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
5 | C:\Qt\Qt5.6.0\5.6\msvc2013
6 |
7 |
8 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
9 | C:\Qt\Qt5.6.0\5.6\msvc2013
10 |
11 |
--------------------------------------------------------------------------------
/build/render/render.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | C:\Qt\Qt5.6.0\5.6\msvc2013
6 | PATH=$(QTDIR)\bin%3b$(PATH)
7 |
8 |
9 | C:\Qt\Qt5.6.0\5.6\msvc2013
10 | PATH=$(QTDIR)\bin%3b$(PATH)
11 |
12 |
--------------------------------------------------------------------------------
/build/vsculpt/vsculpt.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
5 | C:\Qt\Qt5.6.0\5.6\msvc2013
6 |
7 |
8 | PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
9 | C:\Qt\Qt5.6.0\5.6\msvc2013
10 |
11 |
--------------------------------------------------------------------------------
/build/vsculpt_qt5.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhha/digital_sculpting/804edb2757143b87f3ffe6585a7b79b804ccdc80/build/vsculpt_qt5.v12.suo
--------------------------------------------------------------------------------
/inc/BMesh/BMesh.h:
--------------------------------------------------------------------------------
1 | #ifndef VMESH_VMESH_H
2 | #define VMESH_VMESH_H
3 | #include "BMeshCore.h"
4 | #include "BMeshClass.h"
5 | #include "BMeshIterators.h"
6 | #include "BMeshQueries.h"
7 | #include "BMeshPolygon.h"
8 | #include "BMeshUtility.h"
9 | #include "BMCustomData.h"
10 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/BMeshPolygon.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_BM_POLYGON_H
2 | #define BMESH_BM_POLYGON_H
3 | #include "BMUtilDefine.h"
4 | #include "BaseLib/UtilMacro.h"
5 | #include "BMeshClass.h"
6 |
7 | VM_BEGIN_NAMESPACE
8 |
9 | void BM_face_as_array_vert_tri(const BMFace *f, BMVert *r_verts[3]) ATTR_NONNULL();
10 | void BM_face_as_array_vert_quad(const BMFace *f, BMVert *r_verts[4]) ATTR_NONNULL();
11 |
12 | void BM_face_as_array_loop_tri(const BMFace *f, BMLoop *r_loops[3]) ATTR_NONNULL();
13 | void BM_face_as_array_loop_quad(const BMFace *f, BMLoop *r_loops[4]) ATTR_NONNULL();
14 | bool BM_face_closest_point(BMFace *f, const Vector3f &p, Vector3f &closest);
15 |
16 | void BM_face_normal_update(BMFace *f);
17 | float BM_face_calc_normal(const BMFace *f, Vector3f &r_no) ATTR_NONNULL();
18 | void BM_face_calc_bounds(const BMFace *f, Vector3f &lower, Vector3f &upper);
19 | float BM_face_calc_area(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
20 | void BM_face_calc_center_mean(const BMFace *f, Vector3f ¢er) ATTR_NONNULL();
21 |
22 | void BM_vert_calc_mean(const BMVert *v, Vector3f &r_mean);
23 | bool BM_vert_calc_normal(const BMVert *v, Vector3f &r_no);
24 | bool BM_vert_calc_normal_ex(const BMVert *v, const char hflag, Vector3f &r_no);
25 | void BM_vert_normal_update(BMVert *v) ATTR_NONNULL();
26 | void BM_vert_normal_update_face(BMVert *v) ATTR_NONNULL();
27 | void BM_vert_normal_update_all(BMVert *v) ATTR_NONNULL();
28 |
29 | /*TODO. Ignore it*/
30 | void BM_vert_default_color_set(BMVert *v);
31 | VM_END_NAMESPACE
32 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/BMeshUtility.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_UTILITY_H
2 | #define BMESH_UTILITY_H
3 | #include "BMUtilDefine.h"
4 | #include "BaseLib/UtilMacro.h"
5 | #include "BMeshClass.h"
6 | #include "BaseLib/VQuadric.h"
7 |
8 | VM_BEGIN_NAMESPACE
9 | void BM_edge_collapse_optimize_co(BMEdge *e, Vector3f &co);
10 | void BM_vert_quadric_calc(BMVert *v, Qdr::Quadric &vquadric);
11 | float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2, const BMVert *v3, const BMVert *v4, const short method);
12 | VM_END_NAMESPACE
13 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMBisectOp.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_BM_BISECT_OP_H
2 | #define BMESH_BM_BISECT_OP_H
3 | #include "BMeshOp.h"
4 | VM_BEGIN_NAMESPACE
5 |
6 | class BMBisectOp : public BMeshOp
7 | {
8 | public:
9 | BMBisectOp();
10 | ~BMBisectOp();
11 | virtual void execute();
12 | private:
13 | Vector3f _plane_co;
14 | Vector3f _plane_no;
15 | };
16 |
17 | VM_END_NAMESPACE
18 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMeshDiffCurvature.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_DIFF_CURVATURE_H
2 | #define BMESH_DIFF_CURVATURE_H
3 |
4 | #include "BMesh/BMesh.h"
5 | #define FIXED_VORONOI_AREA
6 |
7 | VM_BEGIN_NAMESPACE
8 |
9 | class BMeshDiffCurvature
10 | {
11 | public:
12 | BMeshDiffCurvature(BMesh *bm, int ncurvature_off);
13 | ~BMeshDiffCurvature();
14 | void compute();
15 | private:
16 | void init();
17 | void computeVertexArea();
18 | void computeGaussCurvature();
19 | void computeMeanCurvature();
20 | void computeEdgeWeight();
21 | void smoothMeshBegin();
22 | void smoothMeshEnd();
23 | void smoothCurvature();
24 | void outputCurvature();
25 | void checkVertexBoundary();
26 | private:
27 | BMesh *_bmesh;
28 | int _curvature_off;
29 | std::vector _vOrgCoord;
30 |
31 | /*real-time data*/
32 | std::vector _vBoundary;
33 | std::vector _vArea;
34 | std::vector _vGaussCurvature;
35 | std::vector _vMeanCurvature;
36 |
37 | std::vector _eWeight;
38 | std::vector _eLength;
39 | std::vector _eVec;
40 |
41 | std::vector _fInternalAngle;
42 | std::vector _fArea;
43 | };
44 |
45 | VM_END_NAMESPACE
46 |
47 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMeshDuplicate.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_BMESH_DUPLICATE_H
2 | #define BMESH_BMESH_DUPLICATE_H
3 | #include "BMesh/BMesh.h"
4 |
5 | VM_BEGIN_NAMESPACE
6 |
7 | VM_END_NAMESPACE
8 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMeshRemesh.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhha/digital_sculpting/804edb2757143b87f3ffe6585a7b79b804ccdc80/inc/BMesh/Tools/BMeshRemesh.h
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMeshSymmetrize.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_BMESH_SYMMETRIZE_H
2 | #define BMESH_BMESH_SYMMETRIZE_H
3 | #include "BMesh/BMesh.h"
4 | VM_BEGIN_NAMESPACE
5 | class BMeshSymmetrize
6 | {
7 | enum
8 | {
9 | ELEM_CENTER = 1 << 0
10 | };
11 | public:
12 | BMeshSymmetrize(BMesh *bm, Vector3f plane_co, Vector3f plane_no, bool side);
13 | ~BMeshSymmetrize();
14 | void execute();
15 | private:
16 | void clear_flag(BMesh *mesh);
17 | void mirror_clone();
18 | private:
19 | BMesh *_bm;
20 | Vector3f _plane_co;
21 | Vector3f _plane_no;
22 | Vector4f _plane;
23 | bool _side;
24 | };
25 | VM_END_NAMESPACE
26 | #endif
--------------------------------------------------------------------------------
/inc/BMesh/Tools/BMeshTriangulate.h:
--------------------------------------------------------------------------------
1 | #ifndef BMESH_BMESH_TRIANGULATE_H
2 | #define BMESH_BMESH_TRIANGULATE_H
3 | #include "BMesh/BMesh.h"
4 | VM_BEGIN_NAMESPACE
5 | class BMeshTriangulate
6 | {
7 | public:
8 | BMeshTriangulate(BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only);
9 | ~BMeshTriangulate();
10 | void run();
11 | private:
12 | BMesh *_bm;
13 | const int _quad_method;
14 | const int _ngon_method;
15 | const bool _tag_only;
16 | };
17 | VM_END_NAMESPACE
18 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/BasePrecompiled.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Plane.h"
4 | #include "Point2D.h"
5 | #include "Point2Df.h"
6 | #include "Point3Dd.h"
7 | #include "Point3DdList.h"
8 | #include "PointnD.h"
9 | #include "Quadrangle.h"
10 | #include "Ray2Dd.h"
11 | #include "segment2Dd.h"
12 | #include "Segment2Df.h"
13 | #include "segment3Dd.h"
14 | //#include "SseVector3f.h"
15 | #include "Timer.h"
16 | #include "triangle3Dd.h"
17 | #include "util.h"
18 | #include "aabb2d.h"
19 | #include "Box.h"
20 | #include "BoxEdge.h"
21 | #include "BoxPlane.h"
22 | #include "BoxVertex.h"
23 | #include "contour2d.h"
24 | #include "defined.h"
25 | #include "geometry.h"
26 | #include "intersectpoint.h"
27 | #include "KArray.h"
28 | #include "KGrid1D.h"
29 | #include "KLinkList.h"
30 | #include "KSphereOctree.h"
31 | #include "line2Dd.h"
32 |
--------------------------------------------------------------------------------
/inc/BaseLib/Box.h:
--------------------------------------------------------------------------------
1 | #ifndef PARALLELEPIPPED_VERTEX
2 | #define PARALLELEPIPPED_VERTEX
3 |
4 | //#include "Point3Dd.h"
5 | //class Vector3Dd;
6 | class Point3Dd;
7 | class BoxVertex;
8 | class BoxPlane;
9 | class BoxEdge;
10 | class Box {
11 | public:
12 | //Cube();
13 | Box(BoxVertex* minv, BoxVertex* maxv);
14 | //Parallelepiped(ParallelepipedVertex* minv, ParallelepipedVertex* maxv);
15 | ~Box();
16 | public:
17 | Point3Dd* getXVect();
18 | Point3Dd* getYVect();
19 | Point3Dd* getZVect();
20 | BoxPlane** getBoxPlanes();
21 | int getNumberOfPlanes();
22 | BoxVertex** getVertexs();
23 | BoxEdge** getEdges();
24 | private:
25 | //int buildEdges();
26 | //int buildPlane();
27 | int calcBasicParams();
28 | public:
29 | BoxVertex* _vertexes[8];
30 | BoxVertex* _minVertex;
31 | BoxVertex* _maxVertex;
32 | BoxEdge* _edges[12];
33 | BoxPlane* _planes[6];
34 |
35 | double _dx, _dy, _dz;
36 | Point3Dd* _vx, *_vy, *_vz;
37 | };
38 |
39 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/BoxEdge.h:
--------------------------------------------------------------------------------
1 | #ifndef CUBE_EDGE
2 | #define CUBE_EDGE
3 | #include "Point3Dd.h"
4 | #include
5 |
6 | class BoxVertex;
7 | class BoxPlane;
8 | class BoxEdge {
9 | public:
10 | BoxEdge(BoxVertex* v1, BoxVertex* v2);
11 | ~BoxEdge();
12 | public:
13 | //void setPlanes(BoxPlane* plane1, BoxPlane* plane2);
14 | int calcPlanes();
15 | Point3Dd getCenterPoint();
16 | BoxVertex* getVextex(const int& index);
17 | BoxVertex* getOtherVertex(const BoxVertex* vertex);
18 | double module();
19 | BoxVertex* getCommonVertex(BoxEdge* edge);
20 | BoxVertex* getCommonVertex(BoxEdge* edge1, BoxEdge* edge2);
21 | bool isContainVertex(BoxVertex* vertex);
22 | Point3Dd getVector();
23 | std::string getAxisText();
24 | private:
25 | BoxVertex* _vextexes[2];
26 | BoxPlane* _planes[2];
27 | };
28 |
29 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/BoxPlane.h:
--------------------------------------------------------------------------------
1 | #ifndef BOX_PLANE
2 | #define BOX_PLANE
3 |
4 | #include
5 | class Point3Dd;
6 | class BoxEdge;
7 | class BoxVertex;
8 | class BoxPlane{
9 | public:
10 | BoxPlane(BoxVertex* v1, BoxVertex* v2, BoxVertex* v3, BoxVertex* v4);
11 | ~BoxPlane();
12 | //void addBoxEdges(BoxEdge* e);
13 | void setNormal(Point3Dd* normal);
14 | void setEdges(BoxEdge* e1, BoxEdge* e2, BoxEdge* e3, BoxEdge* e4);
15 | bool isContainEdges(BoxEdge* e);
16 | bool isContainVertex(BoxVertex* v);
17 | BoxVertex* getCommonVertex(BoxPlane* plane1, BoxPlane* plane2);
18 | BoxEdge* getCommonEdge(BoxPlane* plane);
19 | BoxEdge** getBoxEdges();
20 | Point3Dd* getNormal();
21 | int getIntersectedEdges(BoxPlane* plane1, BoxPlane* plane2,
22 | BoxEdge*& edge1, BoxEdge*& edge2, BoxEdge*& edge3);
23 | BoxVertex* getVertex(const int& index);
24 | private:
25 | BoxVertex* _vertexes[4];
26 | //std::vector _edges;
27 | BoxEdge* _edges[4];
28 | Point3Dd* _normal;
29 | };
30 |
31 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/BoxVertex.h:
--------------------------------------------------------------------------------
1 | #ifndef CUBE_VERTEX
2 | #define CUBE_VERTEX
3 |
4 | #include "Point3Dd.h"
5 | #include
6 |
7 | class BoxEdge;
8 | class BoxPlane;
9 | class BoxVertex{
10 | public:
11 | //CubeVertex();
12 | BoxVertex(const Point3Dd& p);
13 | BoxVertex(Point3Dd* p);
14 | ~BoxVertex();
15 |
16 | Point3Dd* getPoint();
17 | //void setEdges(BoxEdge* e1, BoxEdge* e2, BoxEdge* e3);
18 | void addBoxEdge(BoxEdge* e);
19 | void addBoxPlan(BoxPlane* e);
20 |
21 | std::vector getPlanes();
22 | std::vector getEdges();
23 | BoxEdge* getOtherEdge(BoxEdge* e1, BoxEdge* e2);
24 | void get3Edges(BoxEdge*& e1, BoxEdge*& e2, BoxEdge*& e3);
25 | private:
26 | Point3Dd* _p;
27 | std::vector _edges;
28 | std::vector _planes;
29 |
30 | };
31 |
32 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/DlnEdge.h:
--------------------------------------------------------------------------------
1 | #ifndef SUPPORTGEN_SKEEDGE_H
2 | #define SUPPORTGEN_SKEEDGE_H
3 |
4 |
5 | namespace BaseType{
6 |
7 | class DlnPoint;
8 | class DlnTriangle;
9 |
10 | class DlnEdge
11 | {
12 | public:
13 | DlnEdge(void);
14 | DlnEdge(DlnPoint* p1, DlnPoint* p2);
15 | ~DlnEdge(void);
16 | bool isChecked();
17 | int setChecked(const bool flag = true);
18 | DlnPoint* getPoint(int i);
19 | int addTriangle(DlnTriangle* trig);
20 | bool isNotBoundaryEdge();
21 | double calc2DSquareLength();
22 | double calc2DLength();
23 | int calc2DMidPoint(double* mid);
24 | int removeTriangle(const DlnTriangle* trig);
25 | DlnTriangle* getOtherTriangle(DlnTriangle* trig);
26 | DlnTriangle* getTriangle(size_t i);
27 | bool addPoint(DlnPoint* p);
28 | bool removePoint(DlnPoint* p);
29 | void removeFromPoint();
30 | private:
31 | bool _isChecked;
32 | DlnPoint* _vps[2];
33 | DlnTriangle* _trigs[2];
34 | };
35 |
36 | } // namespace
37 |
38 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/DlnTriangle.h:
--------------------------------------------------------------------------------
1 | #ifndef SUPPORTGEN_SKETRIANGLE_H
2 | #define SUPPORTGEN_SKETRIANGLE_H
3 |
4 | #include "Point2D.h"
5 |
6 | namespace BaseType{
7 |
8 | class DlnEdge;
9 | class DlnPoint;
10 |
11 | class DlnTriangle
12 | {
13 | public:
14 | DlnTriangle(void);
15 | DlnTriangle(DlnPoint* p0, DlnPoint* p1, DlnPoint* p2);
16 | ~DlnTriangle(void);
17 |
18 | DlnEdge* getEdge(const unsigned i);
19 | bool removeEdge(DlnEdge* e);
20 | bool addEdge(DlnEdge* e);
21 | void removeFromEdge();
22 | void removePoints();
23 | int setEdge(const int i, DlnEdge* ed);
24 | bool isExistEdge(const int &i);
25 | Point2Dd* getCoord(int i);
26 | int calc2DcenterPoint(double* cen);
27 | int checkType();
28 | unsigned getType();
29 | bool isChecked();
30 | int setChecked(bool flag = true);
31 | int filter(const double& aveWidth2);
32 | int getTipVertexCoordOfType1Trig(double* coord);
33 | DlnEdge* getSkeEdgeOfType1Trig();
34 | DlnEdge* getUncheckedSkeEdge();
35 | DlnEdge* getOtherSkeEdge(DlnEdge* ed);
36 | DlnPoint* getOtherPoint(DlnPoint* v0, DlnPoint* v1);
37 | void setEdges(DlnEdge* e0, DlnEdge* e1, DlnEdge* e2);
38 | void setPoints(DlnPoint* p0, DlnPoint* p1, DlnPoint* p2);
39 | void recalcType();
40 | DlnPoint* getPoint(size_t i){ return _points[i]; }
41 | private:
42 | unsigned short _isChecked:1;
43 | unsigned short _skeTrigType:4;
44 | DlnEdge* _edges[3];
45 | DlnPoint* _points[3];
46 |
47 | #ifdef _DEBUG
48 | int SkeTriangle_filter_count;
49 | #endif
50 | };
51 |
52 | }
53 |
54 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/GluTesselatorBoundary.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "Point3Dd.h"
6 |
7 | namespace Tesselator
8 | {
9 |
10 | //typedef std::array Point3d;
11 |
12 | typedef Point3Dd Point3d;
13 | typedef std::vector Polygon3d;
14 | typedef std::vector PolygonList;
15 |
16 | bool boundTesselatePolygon(PolygonList const & polygons, PolygonList & boundaries, int windingRule);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/inc/BaseLib/KPair.h:
--------------------------------------------------------------------------------
1 | #ifndef BASETYPE_KPAIR_H
2 | #define BASETYPE_KPAIR_H
3 |
4 | namespace BaseType{
5 |
6 |
7 |
8 | template
9 | class KPair3{
10 | public:
11 | KPair3():
12 | _value1(0),
13 | _value2(0)
14 | {
15 |
16 | }
17 | KPair3(T key, T1* val1, T2* val2):
18 | _key(key),
19 | _value1(val1),
20 | _value2(val2){
21 |
22 | }
23 | ~KPair3(){}
24 |
25 | public:
26 | T _key;
27 | T1* _value1;
28 | T2* _value2;
29 | };
30 |
31 | template
32 | struct KPairAscendingSort
33 | {
34 |
35 | bool operator()(KPair3 const* s_pair, KPair3 const* e_pair) const
36 | {
37 | if (s_pair->_key < e_pair->_key)
38 | {
39 | return true;
40 | }
41 | return false;
42 | }
43 |
44 | };
45 |
46 | } // namespace
47 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/MathBase.h:
--------------------------------------------------------------------------------
1 | #ifndef BASELIB_MATHBASE_H
2 | #define BASELIB_MATHBASE_H
3 |
4 | #include "BaseLib/UtilMacro.h"
5 |
6 | //#define RAD2DEG(_rad) ((_rad) * (180.0 / M_PI))
7 | //#define DEG2RAD(_deg) ((_deg) * (M_PI / 180.0))
8 |
9 |
10 | #define RAD2DEGF(_rad) ((_rad) * (float)(180.0 / M_PI))
11 | #define DEG2RADF(_deg) ((_deg) * (float)(M_PI / 180.0))
12 |
13 | namespace MathBase
14 | {
15 | MINLINE float saacos(float fac)
16 | {
17 | if (UNLIKELY(fac <= -1.0f)) return (float)M_PI;
18 | else if (UNLIKELY(fac >= 1.0f)) return 0.0f;
19 | else return acosf(fac);
20 | }
21 |
22 | MINLINE float saasin(float fac)
23 | {
24 | if (UNLIKELY(fac <= -1.0f)) return (float)-M_PI / 2.0f;
25 | else if (UNLIKELY(fac >= 1.0f)) return (float)M_PI / 2.0f;
26 | else return asinf(fac);
27 | }
28 |
29 | MINLINE float sasqrt(float fac)
30 | {
31 | if (UNLIKELY(fac <= 0.0f)) return 0.0f;
32 | else return sqrtf(fac);
33 | }
34 |
35 | MINLINE float saacosf(float fac)
36 | {
37 | if (UNLIKELY(fac <= -1.0f)) return (float)M_PI;
38 | else if (UNLIKELY(fac >= 1.0f)) return 0.0f;
39 | else return acosf(fac);
40 | }
41 |
42 | MINLINE float saasinf(float fac)
43 | {
44 | if (UNLIKELY(fac <= -1.0f)) return (float)-M_PI / 2.0f;
45 | else if (UNLIKELY(fac >= 1.0f)) return (float)M_PI / 2.0f;
46 | else return asinf(fac);
47 | }
48 | };
49 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/Plane.h:
--------------------------------------------------------------------------------
1 | #ifndef PLANE_H
2 | #define PLANE_H
3 | #include "point3Dd.h"
4 | #include
5 |
6 | class Segment3Dd;
7 |
8 | class Plane {
9 | public:
10 | Plane(const Point3Dd& p, const Point3Dd& normal);
11 | Plane(){};
12 | public:
13 | int intersectPlane(Point3Dd& lp, Vector3Dd& ld, const Point3Dd& p, const Vector3Dd& n) const;
14 |
15 | public:
16 | Point3Dd _p;
17 | Vector3Dd _normal;
18 | };
19 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/Point2Df.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_POINT2DF_H
2 | #define BASE_POINT2DF_H
3 | #pragma once
4 | //class Point2Df
5 | //{
6 | //public:
7 | // float _v[2];
8 | //public:
9 | // Point2Df(void);
10 | // Point2Df(const float* coord);
11 | // Point2Df(const double* coord);
12 | // Point2Df(const double x, const double y);
13 | // ~Point2Df(void);
14 | //};
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/inc/BaseLib/Point3DdList.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "Point3Dd.h"
6 |
7 | //namespace BaseType
8 | //{
9 | //
10 | //typedef std::vector Polygon;
11 | //
12 | //typedef std::vector PolygonList;
13 | //
14 | //}
15 |
--------------------------------------------------------------------------------
/inc/BaseLib/Quadrangle.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_QUADRANGLE_H
2 | #define BASE_QUADRANGLE_H
3 | #include "Point3Dd.h"
4 | #pragma once
5 |
6 | namespace BaseType{
7 |
8 | class Quadrangle
9 | {
10 | public:
11 | Quadrangle(void);
12 | Quadrangle(const Point3Dd& p1, const Point3Dd& p2, const Point3Dd& p3, const Point3Dd& p4);
13 | ~Quadrangle(void);
14 | private:
15 | Point3Dd _vp[4];
16 | };
17 |
18 | } // namespace
19 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/Ray2Dd.h:
--------------------------------------------------------------------------------
1 | #ifndef RAY2D_H
2 | #define RAY2D_H
3 | #include "Point2D.h"
4 | #include "contour2d.h"
5 | #include
6 | #include "segment2Dd.h"
7 |
8 | class Segment2Dd;
9 |
10 | class Ray2Dd {
11 | public:
12 | Ray2Dd();
13 | Ray2Dd(const Point2Dd& sp, const Point2Dd& vector);
14 | ~Ray2Dd();
15 |
16 | public:
17 | bool checkintersectSegment(const Point2Dd& sp, const Point2Dd& ep);
18 | bool intersectSegment(Point2Dd& ip, const Point2Dd& sp,
19 | const Point2Dd& ep);
20 | bool intersectSegment(ISPoint2D& ip, Segment2Dd* segment);
21 | bool intersectLine(Point2Dd& ip, const Point2Dd& sp,
22 | const Point2Dd& ep);
23 | Point2Dd getOriginalPoint();
24 | Point2Dd getVector();
25 | private:
26 | Point2Dd _sp;
27 | Point2Dd _vector;
28 | };
29 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/Segment2Df.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_SEGMENT2DF_H
2 | #define BASE_SEGMENT2DF_H
3 | #pragma once
4 | #include "Point2D.h"
5 |
6 | class Segment2Df
7 | {
8 | public:
9 | Point2Df* _sp;
10 | Point2Df* _ep;
11 | public:
12 |
13 | Segment2Df(void);
14 | Segment2Df(Point2Df* sp, Point2Df* ep);
15 | ~Segment2Df(void);
16 | };
17 |
18 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/VB2DTessellator.h:
--------------------------------------------------------------------------------
1 | #ifndef BASELIB_TESSELLATOR_H
2 | #define BASELIB_TESSELLATOR_H
3 | #include "KLinkList.h"
4 | #include
5 | #include
6 | #include "Point3Dd.h"
7 | #include "Point2Df.h"
8 | #include "VBGrid2D.h"
9 | namespace BaseType{
10 |
11 | typedef KLinkListEx Point2DfLinkList;
12 | typedef VBGrid2D WPGridLinkPoint2Df;
13 |
14 | class VB2DTessellator
15 | {
16 | private:
17 | unsigned _numberInitContour;
18 | WPGridLinkPoint2Df _grid;
19 | std::vector < Point2DfLinkList*> _contours;
20 | std::deque _indexTrigs;
21 | std::vector _pointCoord;
22 | public:
23 | VB2DTessellator();
24 | ~VB2DTessellator();
25 | void setOrigin(float origin[2]);
26 | void setSize(float size[2]);
27 | void addAContour(const std::vector &contour);
28 | void dumpToCad(Point2DfLinkList *contour, int color = 0);
29 | void dumpToCad(int color = 0);
30 | Point2DfLinkList* findOuterContour();
31 | void calcAngleOfContour(Point2DfLinkList *contour);
32 | void calcAngleOfAllContours();
33 | Point2DfLinkList* findVertexWithSmallestAngle(Point2DfLinkList *contour);
34 | void generateTriangles();
35 | void getData(float **coords, unsigned &coordSize, unsigned **index, unsigned &indexSize);
36 | void getTrianglesIndex(unsigned **index, unsigned &nts);
37 |
38 | Point2DfLinkList* createTriangle(Point2DfLinkList *vmin);
39 | void setPolygonID(Point2DfLinkList *contour, const int id){ contour->setIDForAllLinkList(id); };
40 | };
41 | }// namespace
42 | #endif
43 |
--------------------------------------------------------------------------------
/inc/BaseLib/eigen3.h:
--------------------------------------------------------------------------------
1 |
2 | /* Eigen-decomposition for symmetric 3x3 real matrices.
3 | Public domain, copied from the public domain Java library JAMA. */
4 |
5 | #ifndef BASELIB_EIGEN3_H
6 | #define BASELIB_EIGEN3_H
7 | /* Symmetric matrix A => eigenvectors in columns of V, corresponding
8 | eigenvalues in d. */
9 | namespace BaseType{
10 | void eigen_decomposition(double A[3][3], double V[3][3], double d[3]);
11 |
12 | }// namespace
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/inc/BaseLib/intersectpoint.h:
--------------------------------------------------------------------------------
1 | #ifndef INTERSECSION_POINT_H
2 | #define INTERSECSION_POINT_H
3 | #include "Point2D.h"
4 |
5 | class Segment2Dd;
6 |
7 | class ISPoint2D {
8 | public:
9 | ISPoint2D() {
10 | isDeleted = false;
11 | segment = nullptr;
12 | }
13 | ISPoint2D(const ISPoint2D& p)
14 | : ip (p.ip)
15 | , segment (p.segment)
16 | , isDeleted (p.isDeleted)
17 | {
18 | }
19 | ISPoint2D(Point2Dd ip_, Segment2Dd* seg)
20 | : ip (ip_)
21 | , segment (seg)
22 | , isDeleted (false)
23 | {
24 | }
25 | Point2Dd ip;
26 | Segment2Dd* segment;
27 | bool isDeleted;
28 |
29 | const bool operator<( const ISPoint2D& p ) const {
30 | return ip < p.ip;
31 | }
32 |
33 | //ISPoint2D& operator=( const ISPoint2D& p ) {
34 | // ip = p.ip;
35 | // segment = p.segment;
36 | // isDeleted = p.isDeleted;
37 |
38 | // return *this;
39 | //}
40 |
41 | ISPoint2D& operator=(const ISPoint2D& p) {
42 | ip = p.ip;
43 | segment = p.segment;
44 | isDeleted = p.isDeleted;
45 |
46 | return *this;
47 | }
48 |
49 | //const bool operator>( const ISPoint& p ) const {
50 | // return ip > p.ip;
51 | //}
52 |
53 | };
54 |
55 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/line2Dd.h:
--------------------------------------------------------------------------------
1 | #ifndef LINE2D_H
2 | #define LINE2D_H
3 | #include "Point2D.h"
4 | #include "intersectpoint.h"
5 | #include
6 |
7 | class Segment2Dd;
8 |
9 | class Line2Dd {
10 | public:
11 | Line2Dd(const Point2Dd& p, const Point2Dd& v);
12 |
13 | public:
14 | bool xLineIntersectXSegment(Point2Dd& ip, Segment2Dd* segment);
15 |
16 | bool xLineIntersectSegment( std::vector& ips,
17 | Segment2Dd* segment );
18 | private:
19 | Point2Dd _p;
20 | Point2Dd _v;
21 | };
22 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/line3D.h:
--------------------------------------------------------------------------------
1 | #ifndef LINE3D_H
2 | #define LINE3D_H
3 | #include "point3Dd.h"
4 | #include
5 |
6 | class Segment3Dd;
7 |
8 | class Line3Dd {
9 | public:
10 | Line3Dd(const Point3Dd& p, const Point3Dd& v);
11 |
12 | public:
13 | bool intersectPlanarLine(Point3Dd& ip, const Point3Dd& p, const Vector3Dd& v);
14 | int Line3Dd::intersectPlane( Point3Dd& ip, const Point3Dd& onPoint, const Vector3Dd& normal) const;
15 | private:
16 | Point3Dd _p;
17 | Point3Dd _v;
18 | };
19 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/matrix3x3d.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_MATRIX3X3D_H
2 | #define BASE_MATRIX3X3D_H
3 |
4 | #include "Point3Dd.h"
5 | class Matrix3x3d
6 | {
7 | public:
8 | Matrix3x3d(void);
9 | Matrix3x3d(const Matrix3x3d &m);
10 | ~Matrix3x3d(void);
11 |
12 | void setIdentity();
13 | Matrix3x3d operator*( Matrix3x3d& other) ;
14 | Matrix3x3d calRotateMatrixRevert();
15 | Matrix3x3d calRotateMatrixRevert2();
16 | Matrix3x3d calRotateMatrixRevert(Matrix3x3d& other);
17 | const Point3Dd operator*(const Point3Dd& p) const;
18 | const Matrix3x3d operator*(double d) const;
19 | const Matrix3x3d operator/(double d) const;
20 | void makeRotationAboutAxis(Point3Dd& axis, double angle);
21 | Vector3Dd getRow(unsigned i) const;
22 | Vector3Dd getColumn(unsigned i) const;
23 | void setColumn(unsigned i,const Vector3Dd &v);
24 | void setRow(unsigned i, const Vector3Dd &v);
25 | void unit();
26 | Matrix3x3d inverse() const;
27 |
28 | public:
29 | double _v[3][3];
30 | };
31 |
32 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/matrix4x4d.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_MATRIX4X4D_H
2 | #define BASE_MATRIX4X4D_H
3 | #pragma once
4 | class Matrix4x4d
5 | {
6 | public:
7 | Matrix4x4d(void);
8 | ~Matrix4x4d(void);
9 | public:
10 | double _v[4][4];
11 | };
12 |
13 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/ppl/agents_extras.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhha/digital_sculpting/804edb2757143b87f3ffe6585a7b79b804ccdc80/inc/BaseLib/ppl/agents_extras.h
--------------------------------------------------------------------------------
/inc/BaseLib/ppl/ppl_extras.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhha/digital_sculpting/804edb2757143b87f3ffe6585a7b79b804ccdc80/inc/BaseLib/ppl/ppl_extras.h
--------------------------------------------------------------------------------
/inc/BaseLib/segment3Dd.h:
--------------------------------------------------------------------------------
1 | #ifndef SEGMENT_3D_H
2 | #define SEGMENT_3D_H
3 |
4 | #include "Point3Dd.h"
5 | #include "segment2Dd.h"
6 | #include "triangle3Dd.h"
7 |
8 | class Segment3Dd
9 | {
10 | public:
11 | Segment3Dd();
12 | Segment3Dd( const Point3Dd& firstPoint, const Point3Dd& lastPoint );
13 | Segment3Dd( const Segment3Dd& segment );
14 | ~Segment3Dd();
15 | public:
16 |
17 | const int intersectAxisPlane(double& ip, const double & offsetVal,
18 | const int icoord ) const/* icoord: coord index */;
19 |
20 | const int intersectAxisPlane(Point3Dd& ip, const double &offsetVal,
21 | const int icoord ) const/* icoord: coord index */;
22 | const Point3Dd getFisrtPoint() const;
23 | const Point3Dd getSecondPoint() const;
24 | bool isContainPoint(const Point3Dd& p, const bool& isOnLine = false);
25 | void getArrows(Segment3Dd& lArrow, Segment3Dd& rArrow);
26 |
27 | void get2SupplementSegments(const Segment3Dd& seg,
28 | Segment3Dd& seg1, Segment3Dd& seg2);
29 | const Vector3Dd getVector() const;
30 | private:
31 | Point3Dd _sp;
32 | Point3Dd _ep;
33 |
34 | };
35 |
36 | typedef std::vector Segment3DdListVector;
37 | #endif
--------------------------------------------------------------------------------
/inc/BaseLib/triangle3Dd.h:
--------------------------------------------------------------------------------
1 | #ifndef TRIANGLE_3D_H
2 | #define TRIANGLE_3D_H
3 | #include
4 | #include "Point2D.h"
5 | #include "Point3Dd.h"
6 |
7 |
8 | class Triangle3Dd
9 | {
10 | public:
11 | Triangle3Dd(const Point3Dd* vertexs, const Vector3Dd& normal);
12 | Triangle3Dd(const Point3Dd* vertexs);
13 | Triangle3Dd(const Point3Dd& p1, const Point3Dd& p2, const Point3Dd& p3);
14 | Triangle3Dd(const Point3Dd* p1, const Point3Dd* p2, const Point3Dd* p3, const Point3Dd* norm);
15 | Triangle3Dd();
16 | ~Triangle3Dd();
17 | public:
18 | void set(const Point3Dd& p1, const Point3Dd& p2, const Point3Dd& p3);
19 | int intersectAxisPlane( Point2Dd& ip1, Point2Dd& ip2,
20 | const double & zValue, const int iCoord ) const;
21 | bool isInvertedNormal();
22 | void correctInvertedNormal();
23 | void getVertexts(Point3Dd vertexs[3]);
24 | Point3Dd getVertext(const int i);
25 | Point3Dd* getpVertext(const int i);
26 | Vector3Dd getNormal();
27 | Vector3Dd* getpNormal();
28 | void getZMinMax(double& min, double& max);
29 | int calcNormal();
30 | void offset(const double& d);
31 | void invertNormal();
32 | public:
33 |
34 | #ifdef _DEBUG
35 | int _ired;
36 | #endif
37 |
38 | private:
39 | Point3Dd _vertexs[3];
40 | Vector3Dd _normal;
41 | };
42 |
43 | #endif
--------------------------------------------------------------------------------
/inc/Boolean/bm/bm_isct_bool_include.h:
--------------------------------------------------------------------------------
1 | #ifndef BOOLEAN_BM_ISCT_BOOL_INCLUDE_H
2 | #define BOOLEAN_BM_ISCT_BOOL_INCLUDE_H
3 | #include "BMesh/BMesh.h"
4 | #include "VBvh/BMeshBvh.h"
5 |
6 | namespace bm_isct
7 | {
8 | BMesh *compute_union(VM::BMesh *bm0, VBvh::BMBvh *bvh0, VM::BMesh *bm1, VBvh::BMBvh *bvh1);
9 | BMesh *compute_difference(VM::BMesh *bm0, VBvh::BMBvh *bvh0, VM::BMesh *bm1, VBvh::BMBvh *bvh1);
10 | BMesh *compute_intersection(VM::BMesh *bm0, VBvh::BMBvh *bvh0, VM::BMesh *bm1, VBvh::BMBvh *bvh1);
11 | BMesh *resolve_self_isct(VM::BMesh *bm0);
12 | }
13 | #endif
--------------------------------------------------------------------------------
/inc/Boolean/bm/bm_isct_tri_problem.h:
--------------------------------------------------------------------------------
1 | #ifndef BM_ISECT_TRI_PROBLEM_H
2 | #define BM_ISECT_TRI_PROBLEM_H
3 | #include "bm/bm_isct.h"
4 |
5 | #define REAL double
6 | extern "C" {
7 | #include "triangle.h"
8 | }
9 | namespace bm_isct
10 | {
11 | class IsctProblem;
12 | class TriangleProblem
13 | {
14 | public:
15 | TriangleProblem() {}
16 | ~TriangleProblem() {}
17 |
18 | void init(IsctProblem *iprob, Tptr t);
19 | private:
20 | void addEdge(IsctProblem *iprob, IVptr iv, Tptr tri_key);
21 | void addBoundaryHelper(Eptr edge, IVptr iv);
22 | public:
23 | // specify reference glue point and edge piercing this triangle.
24 | IVptr addInteriorEndpoint(IsctProblem *iprob, Eptr edge, GluePt glue);
25 |
26 | void addInteriorPoint(IsctProblem *iprob, Tptr t0, Tptr t1, GluePt glue);
27 | // specify the other triangle cutting this one, the edge cut,
28 | // and the resulting point of intersection
29 | void addBoundaryEndpoint(IsctProblem *iprob, Tptr tri_key, Eptr edge, IVptr iv);
30 | // run after we've accumulated all the elements
31 | void consolidate(IsctProblem *iprob);
32 | bool isValid() const;
33 | void subdivide(IsctProblem *iprob);
34 | private:
35 | void subdivideEdge(IsctProblem *iprob, GEptr ge, ShortVec &edges);
36 | private:
37 | friend class IsctProblem;
38 |
39 | ShortVec iverts;
40 | ShortVec iedges;
41 | // original triangle elements
42 | OVptr overts[3];
43 | OEptr oedges[3];
44 |
45 | ShortVec gtris;
46 |
47 | Tptr the_tri;
48 | };
49 | }
50 | #endif
--------------------------------------------------------------------------------
/inc/Boolean/isct/quantization.cpp:
--------------------------------------------------------------------------------
1 | // +-------------------------------------------------------------------------
2 | // | quantization.h
3 | // |
4 | // | Author: Gilbert Bernstein
5 | // +-------------------------------------------------------------------------
6 | // | COPYRIGHT:
7 | // | Copyright Gilbert Bernstein 2013
8 | // | See the included COPYRIGHT file for further details.
9 | // |
10 | // | This file is part of the Cork library.
11 | // |
12 | // | Cork is free software: you can redistribute it and/or modify
13 | // | it under the terms of the GNU Lesser General Public License as
14 | // | published by the Free Software Foundation, either version 3 of
15 | // | the License, or (at your option) any later version.
16 | // |
17 | // | Cork is distributed in the hope that it will be useful,
18 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | // | GNU Lesser General Public License for more details.
21 | // |
22 | // | You should have received a copy
23 | // | of the GNU Lesser General Public License
24 | // | along with Cork. If not, see .
25 | // +-------------------------------------------------------------------------
26 | #include "quantization.h"
27 |
28 | namespace Quantization {
29 |
30 | double MAGNIFY = 1.0;
31 | double RESHRINK = 1.0;
32 |
33 | } // end namespace Quantization
34 |
35 |
--------------------------------------------------------------------------------
/inc/Sculpt/AnchoredStroke.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_ANCHORED_STROKE_H
2 | #define SCULPT_ANCHORED_STROKE_H
3 | #include "sculpt/IStroke.h"
4 | class AnchoredStroke : public IStroke
5 | {
6 | public:
7 | AnchoredStroke();
8 | ~AnchoredStroke();
9 | void startStroke(const double& mouseX, const double& mouseY);
10 | void doStroke(const double& mouseX, const double& mouseY);
11 | void endStroke(const double& mouseX, const double& mouseY);
12 | void processStroke();
13 | void saveData();
14 | void restoreData();
15 | private:
16 | size_t _oldFlag;
17 | std::vector _lastNodes;
18 | Point2Dd _pixelCenter;
19 | Point3Dd _initialHitPoint;
20 | double _oldPixelRadius;
21 | bool _firstTime;
22 |
23 | StlVertex** _lastVertArr;
24 | size_t _sizeLastVertArr;
25 | size_t _numLastVerts;
26 | };
27 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/BezierCurve.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_BEZIER_CURVE_H
2 | #define SCULPT_BEZIER_CURVE_H
3 | #include
4 | #include
5 | #include "BaseLib/Point3Dd.h"
6 | #include "VbsQt/VbsDef.h"
7 |
8 | class BezierCurve
9 | {
10 | public:
11 | struct CurvePoint
12 | {
13 | double x;
14 | double y;
15 | };
16 |
17 | BezierCurve(VbsDef::CURVE type = VbsDef::CURVE_SMOOTH);
18 | ~BezierCurve();
19 |
20 | double evaluate(const double par);
21 | void render();
22 | void reset(VbsDef::CURVE type);
23 | void dumpCurve();
24 |
25 | private:
26 | bool setControlPoints(int type);
27 | void makeTable(int resolution);
28 |
29 | private:
30 | int _resolution;
31 | int _totalPoint;
32 | float _step;
33 | VbsDef::CURVE _type;
34 | CurvePoint *_cpoints;
35 | CurvePoint *_table;
36 | };
37 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/SculptCommand.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_COMMAND_H
2 | #define SCULPT_COMMAND_H
3 | #include
4 | #include "VBvh//BMeshBvh.h"
5 | #include "VKernel/VScene.h"
6 | #include "VKernel/VMeshObject.h"
7 | #include "VSculptLogger.h"
8 |
9 | using namespace VBvh;
10 |
11 | class VSculptCommand
12 | {
13 | private:
14 | struct BMFaceLog
15 | {
16 | BMFace *f;
17 | BMVert *verts[3];
18 | };
19 |
20 | struct BMVLog
21 | {
22 | BMVert* v;
23 | Vector3f co;
24 | };
25 |
26 | public:
27 | VSculptCommand(vk::VScene *scene, vk::VMeshObject *obj);
28 | ~VSculptCommand();
29 | protected:
30 | /*method called from system. mutex must be locked here*/
31 | bool doHook();
32 | void undoHook();
33 | void redoHook();
34 | public:
35 | void log_data(const std::vector& nodes);
36 | void log_data(VSculptLogger &&logger);
37 | private:
38 | vk::VScene *_scene;
39 | vk::VMeshObject* _obj;
40 | std::shared_ptr _logger;
41 | };
42 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/StrokeData.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_STROKE_DATA_H
2 | #define SCULPT_STROKE_DATA_H
3 | #include
4 | #include "BezierCurve.h"
5 | #include "VKernel/VMeshObject.h"
6 | #include "Vbvh/BMeshBvh.h"
7 | #include "VKernel/VScene.h"
8 | #include "VKernel/VMeshObject.h"
9 | using namespace VBvh;
10 |
11 | enum SYMNFlag
12 | {
13 | SYMM_X = (1 << 0),
14 | SYMM_Y = (1 << 1),
15 | SYMM_Z = (1 << 2)
16 | };
17 | struct SymmetricData
18 | {
19 | Vector3f first_hit_pos;
20 | Vector3f cur_pos;
21 | Vector3f view_dir;
22 | Vector3f grab_delta;
23 | };
24 |
25 | class BVHRenderer;
26 | class VSculptCommand;
27 |
28 | struct StrokeData
29 | {
30 | vk::VScene *scene;
31 | vk::VMeshObject *object;
32 | BMBvh *bvh;
33 | BMesh *bm;
34 | VSculptCommand *undo_redo_logger;
35 |
36 | SymmetricData symn_data;
37 | Vector3f last_pos;
38 | Vector3f cur_pos;
39 | Vector3f first_hit_pos;
40 | Vector3f view_dir;
41 | Vector3f grab_delta;
42 |
43 | int brush_type;
44 | int flag;
45 | int sym_flag; //symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ
46 |
47 | float world_radius;
48 | float rotate_angle; /*angle between first mouse and current mouse direction. Currently for rotate brush*/
49 | float max_edge_len;
50 | float min_edge_len;
51 | float edge_len_unit_threshold;
52 |
53 | float scale;
54 | float pinch_factor;
55 | float brush_strength;
56 |
57 | bool ensure_min_edge_len;
58 |
59 | BezierCurve *deform_curve;
60 | };
61 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/VSculptConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_SCULPT_CONFIG_H
2 | #define SCULPT_SCULPT_CONFIG_H
3 | #include "BezierCurve.h"
4 | #include "commonDefine.h"
5 | #include "BaseLib/UtilMacro.h"
6 | #include "VbsQt/VbsDef.h"
7 |
8 | class VSculptConfig
9 | {
10 | struct BrushConfig{
11 | BrushConfig() :
12 | strength(0.5f),
13 | spacing(10.0f),
14 | pixel_size(50),
15 | detail_size(5.0),
16 | dynamic_topo(false),
17 | falloff(VbsDef::CURVE_SMOOTH)
18 | {}
19 |
20 | float strength;
21 | float spacing;
22 | int pixel_size;
23 | float detail_size;
24 | bool dynamic_topo;
25 | VbsDef::CURVE falloff;
26 | };
27 |
28 | public:
29 | VSculptConfig();
30 | ~VSculptConfig();
31 | void setBrush(VbsDef::BRUSH);
32 | void setBrushStrength(float strength);
33 | void setBrushSpacing(float spacing);
34 | void setBrushPixelSize(int size);
35 | void setBrushDynamicTopology(bool topo);
36 | void setFalloffCurve(VbsDef::CURVE type);
37 | void setBrushDetailsize(float detail);
38 |
39 | VbsDef::BRUSH brush();
40 | float brushStrength();
41 | float brushSpacing();
42 | float brushPixelSize();
43 | float brushDynamicTopology();
44 | float brushDetailsize();
45 | VbsDef::CURVE brushFalloffCurve();
46 |
47 | private:
48 | std::vector _brush_confs;
49 | VbsDef::BRUSH _brush; /*current brush*/
50 | };
51 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/VSculptLogger.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_LOGGER_H
2 | #define SCULPT_LOGGER_H
3 |
4 | #include
5 | #include "VBvh//BMeshBvh.h"
6 | #include "VKernel/VScene.h"
7 | #include "VKernel/VMeshObject.h"
8 |
9 | using namespace vk;
10 |
11 | class VSculptLogger
12 | {
13 | private:
14 | struct BMFaceLog
15 | {
16 | BMFace *f;
17 | BMVert *verts[3];
18 | };
19 |
20 | struct BMVLog
21 | {
22 | BMVert* v;
23 | Vector3f co;
24 | };
25 |
26 | public:
27 | VSculptLogger(VScene *scene, VMeshObject *obj);
28 | VSculptLogger(VSculptLogger &&other);
29 | ~VSculptLogger();
30 | void log_nodes(const std::vector& nodes, bool keep_node = false);
31 | void undo(bool bvh_undo = false);
32 | void redo(bool bvh_undo = false);
33 | void undo_apply();
34 | const std::vector& nodes();
35 | private:
36 | void log_faces(const std::vector& nodes);
37 | void log_verts(const std::vector& nodes);
38 | private:
39 | VScene *_scene;
40 | VMeshObject* _obj;
41 | std::vector _nodes;
42 | std::vector _changed_verts;
43 | std::vector _created_faces;
44 | std::vector _deleted_faces;
45 | std::vector _created_verts;
46 | std::vector _deleted_verts;
47 | };
48 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/brush/SculptStroke.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_STROKE_H
2 | #define SCULPT_STROKE_H
3 |
4 | #include
5 | #include "StrokeData.h"
6 | #include "SculptCommand.h"
7 | #include "commonDefine.h"
8 | #include
9 | #include
10 |
11 | class SculptStroke
12 | {
13 | class StepLogger
14 | {
15 | typedef std::tuple FaceLog;
16 | typedef std::tuple VertLog;
17 | public:
18 | StepLogger(const std::vector &nodes);
19 | void restore();
20 | private:
21 | std::vector _changed_nodes;
22 | std::vector _deleted_faces;
23 | std::vector _created_faces;
24 | std::vector _changed_verts;
25 | };
26 |
27 | public:
28 | SculptStroke(StrokeData *sdata);
29 | ~SculptStroke();
30 | void add_step(bool log_step = false);
31 | void finish_stroke();
32 | void step_logger_begin();
33 | void step_logger_end();
34 | private:
35 | void calc_symm_data(size_t symm);
36 | bool is_dynamic_topology();
37 | void update_topology();
38 | void push_undo_redo();
39 | void save_origin_node_data(const std::vector &nodes);
40 | void do_brush();
41 | private:
42 | StrokeData *_data;
43 | VSculptLogger *_step_logger;
44 | };
45 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/commonDefine.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_COMMON_DEFINE_H
2 | #define SCULPT_COMMON_DEFINE_H
3 |
4 | #include "BaseLib/Point2D.h"
5 | #include "BaseLib/Point3Dd.h"
6 | #include "tbb/task_scheduler_init.h"
7 | #define TBB_PREVIEW_MEMORY_POOL 1
8 | #include "tbb/memory_pool.h"
9 | #include "tbb/cache_aligned_allocator.h"
10 | #include "tbb/mutex.h"
11 | #include
12 |
13 |
14 | class StlVertex;
15 | class NormalUpdateOp;
16 | class Transform;
17 |
18 | namespace sculpt
19 | {
20 | const size_t thread_number = tbb::task_scheduler_init::default_num_threads();
21 | const size_t min_leaf_size = 100;
22 | const size_t max_leaf_size = 150;
23 | }
24 |
25 | //now we have four bit for flag
26 | //so flag's value
27 | enum EFlag
28 | {
29 | E_VISITED = 1,
30 | E_NEW_SUBDIVISION_EDGE = 2,
31 | E_GARBAGE_SUBDIVISION_EDGE = 4
32 | };
33 |
34 | enum VFlag
35 | {
36 | V_MARK_DIRTY= 1,
37 | V_NEW_SUBDIVISION_VERTEX = 2,
38 | V_GARBAGE_SUBDIVISION_VERTEX = 4
39 | };
40 |
41 | enum FFlag
42 | {
43 | F_MARK_DIRTY = 1 << 0,
44 | F_NEW_SUBDIVISION_TRIANGLE = 1 << 1,
45 | F_GARBAGE_SUBDIVISION_TRIANGLE = 1 << 2 /*triangle created and then deleted during subdivision: we don't need it*/
46 | };
47 |
48 | enum SFlag
49 | {
50 | PICK_ORIGINAL_LOCATION = (1 << 0),
51 | DYNAMIC_TOPOLOGY = (1 << 1),
52 | AVERAGE_DATA = (1 << 2)
53 | };
54 |
55 | //typedef std::allocator PointerAllocator;
56 | typedef tbb::scalable_allocator PointerAllocator;
57 | typedef tbb::memory_pool PointerMemPool; //used inside each brush for vertex array
58 |
59 | #endif
--------------------------------------------------------------------------------
/inc/Sculpt/transform.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_Transform_H
2 | #define SCULPT_Transform_H
3 |
4 | #include "BaseLib/Point3Dd.h"
5 | #include
6 | #include "OpenGL/include/glew.h"
7 | #include
8 | class Transform
9 | {
10 | public:
11 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW
12 | public:
13 | Transform(){};
14 | ~Transform(){};
15 | void reset();
16 | Eigen::Vector2f project(const Eigen::Vector3f& point);
17 | bool unprojectScreenSpace(const int& mousex, const int& mousey, const double& depth, Point3Dd& p);
18 | bool unproject(const int& winx, const int& winy, const double& winz, Point3Dd& p);
19 | double calculateDepth(const Point3Dd& p);
20 | double worldRadius(const double& pixelRadius, const int& mouseX, const int& mouseY, const Point3Dd& location);
21 | void viewDirection(Point3Dd& viewDir);
22 | void nearFarPoints(int mouseX, int mouseY, Point3Dd& nearP, Point3Dd& farP);
23 | void nearPoint(const int& mx, const int& my, Point3Dd& nearP);
24 | void screenNormal(double& x, double& y, double& z);
25 | bool invertMatrix44(const double mat[4][4], double inverse[4][4]);
26 | void copyMatrix33Matrix44(double m1[3][3], double m2[4][4]);
27 | void mulMatrix33Vector3(const double M[3][3], const double r[3], double out[3]);
28 | void dump(std::string file);
29 | void load(std::string file);
30 |
31 | public:
32 | Eigen::Matrix4f _modelViewMat;
33 | Eigen::Matrix4f _projectMat;
34 |
35 | double _modelview[4][4];
36 | double _projection[4][4];
37 | double _invModelview[4][4];
38 | double _invProjection[4][4];
39 | int _viewport[4];
40 | double _viewDir[3];
41 |
42 | };
43 | #endif
--------------------------------------------------------------------------------
/inc/VBvh/BMeshBvhBuilder.h:
--------------------------------------------------------------------------------
1 | #ifndef VBVH_BMESH_BVH_BUILDER_H
2 | #define VBVH_BMESH_BVH_BUILDER_H
3 |
4 | #include "BMesh/BMesh.h"
5 | #include "VBvhMortonBuilder.h"
6 | #include "VPrimRef.h"
7 | #include "BMeshBvh.h"
8 | #include "tbb/scalable_allocator.h"
9 |
10 | using namespace VM;
11 | using namespace VBvh;
12 |
13 | VBVH_BEGIN_NAMESPACE
14 |
15 | class BMeshBvhBuilder
16 | {
17 | public:
18 | BMeshBvhBuilder(BMesh *bm);
19 | BMBvh* build();
20 | void computeBounds(const std::vector &faces, VPrimRef *prims, size_t tot);
21 | void addCustomDataLayer(BMeshBvhContext &info);
22 | private:
23 | void computePrimInfo(VPrimRef *prims, size_t tot, VPrimInfo &infor);
24 | BMesh *_bmesh;
25 | };
26 |
27 | VBVH_END_NAMESPACE
28 |
29 | #endif
--------------------------------------------------------------------------------
/inc/VBvh/BMeshBvhNodeSplitter.h:
--------------------------------------------------------------------------------
1 | #ifndef VBVH_BMESHBVH_NODE_SPLITER_H
2 | #define VBVH_BMESHBVH_NODE_SPLITER_H
3 | #include "VBvh/VBvhDefine.h"
4 | #include "VBvh/BMeshBvh.h"
5 | #include "VBvh/VPrimRef.h"
6 | #include "VBvh/VPrimInfor.h"
7 | #include "VBvh/VBvhBinBuilder.h"
8 |
9 | VBVH_BEGIN_NAMESPACE
10 | class BMeshBvhNodeSplitter
11 | {
12 | public:
13 | BMeshBvhNodeSplitter(BMLeafNode *node, const BMeshBvhContext &bmbvhinfo);
14 | ~BMeshBvhNodeSplitter();
15 | void run();
16 | BaseNode *root(){ return _root; };
17 | std::vector leafs(){ return _leafs; }
18 | private:
19 | const BMeshBvhContext &_bmbvh_info;
20 | BMLeafNode *_node;
21 | VPrimInfo _priminfo;
22 | VPrimRef *_prims;
23 | size_t _total;
24 |
25 | /*result*/
26 | BaseNode *_root;
27 | std::vector _leafs;
28 | };
29 |
30 | VBVH_END_NAMESPACE
31 | #endif
--------------------------------------------------------------------------------
/inc/VBvh/VBvhUtil.h:
--------------------------------------------------------------------------------
1 | #ifndef VBVH_UTIL_H
2 | #define VBVH_UTIL_H
3 | #include "VBvhDefine.h"
4 | #include "BaseLib/Point3Dd.h"
5 | #include "BMeshBvh.h"
6 | #include "VBvh/VPrimRef.h"
7 | #include "VBvh/VPrimInfor.h"
8 | #include
9 |
10 | VBVH_BEGIN_NAMESPACE
11 |
12 | bool isectRayBB(const Ray* ray, const Vector3f &lower, const Vector3f &upper, float& hitParam);
13 | void facesBoundsNormalUpdate(BMFace * const *faces, size_t num, Vector3f &lower, Vector3f &upper);
14 | void BMFacesPrimInfoCompute(BMFace *const* faces, size_t num, VPrimRef *prims, VPrimInfo &info, bool threaded = true);
15 | void debugOutputNodeBB(BaseNode *node, std::vector &segments);
16 | Vector3f convert(const Vec3fa &p);
17 |
18 | VBVH_END_NAMESPACE
19 | #endif
--------------------------------------------------------------------------------
/inc/VBvh/VMorton.h:
--------------------------------------------------------------------------------
1 | #ifndef VBVH_MORTON_H
2 | #define VBVH_MORTON_H
3 | #include "VBvhDefine.h"
4 | VBVH_BEGIN_NAMESPACE
5 |
6 | static const size_t LATTICE_BITS_PER_DIM = 10;
7 | static const size_t LATTICE_SIZE_PER_DIM = size_t(1) << LATTICE_BITS_PER_DIM;
8 |
9 | struct __declspec(align(8)) VMortonID32Bit
10 | {
11 | union {
12 | struct {
13 | unsigned int code;
14 | unsigned int index;
15 | //uint64 index;
16 | };
17 | //int64 all;
18 | };
19 |
20 | __forceinline operator unsigned() const { return code; }
21 |
22 | __forceinline unsigned int get(const unsigned int shift, const unsigned and_mask) const {
23 | return (code >> shift) & and_mask;
24 | }
25 |
26 | /*__forceinline void operator=(const MortonID32Bit& v) {
27 | all = v.all;
28 | };*/
29 |
30 | __forceinline friend std::ostream &operator<<(std::ostream &o, const VMortonID32Bit& mc) {
31 | o << "index " << mc.index << " code = " << mc.code;
32 | return o;
33 | }
34 |
35 | __forceinline bool operator<(const VMortonID32Bit &m) const { return code < m.code; }
36 | __forceinline bool operator>(const VMortonID32Bit &m) const { return code > m.code; }
37 | };
38 |
39 | VBVH_END_NAMESPACE
40 | #endif
--------------------------------------------------------------------------------
/inc/VBvh/common/simd/simd.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_SIMD_H
2 | #define SCULPT_SIMD_H
3 | #include "VBvh/common/math/mymath.h"
4 |
5 | /* include SSE emulation for Xeon Phi */
6 | #if defined (__MIC__)
7 | //# include "simd/sse_mic.h"
8 | # include "VBvh/common/simd/mic.h"
9 | #endif
10 |
11 | /* include SSE wrapper classes */
12 | #if defined(__SSE__)
13 | # include "VBvh/common/simd/sse.h"
14 | #endif
15 |
16 | /* include AVX wrapper classes */
17 | #if defined(__AVX__)
18 | #include "VBvh/common/simd/avx.h"
19 | #endif
20 |
21 | #if defined (__AVX__)
22 | #define AVX_ZERO_UPPER() _mm256_zeroupper()
23 | #else
24 | #define AVX_ZERO_UPPER()
25 | #endif
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/inc/VBvh/common/simd/sse.h:
--------------------------------------------------------------------------------
1 | #ifndef SCULPT_SSE_H
2 | #define SCULPT_SSE_H
3 | #include "VBvh/common/sys/platform.h"
4 | #include "VBvh/common/sys/intrinsics.h"
5 | #include "VBvh/common/simd/sse_special.h"
6 | #include "VBvh/VBvhDefine.h"
7 |
8 | /* Workaround for Compiler bug in VS2008 */
9 | #if (!defined(__SSE4_1__) || defined(_MSC_VER) && (_MSC_VER < 1600)) && !defined(__INTEL_COMPILER)
10 | #define _mm_blendv_ps __emu_mm_blendv_ps
11 | __forceinline __m128 _mm_blendv_ps( __m128 f, __m128 t, __m128 mask ) {
12 | return _mm_or_ps(_mm_and_ps(mask, t), _mm_andnot_ps(mask, f));
13 | }
14 | #endif
15 |
16 | /* Workaround for Compiler bug in VS2008 */
17 | #if defined(_MSC_VER) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER)
18 | #define _mm_extract_epi32 __emu_mm_extract_epi32
19 | __forceinline int _mm_extract_epi32( __m128i input, const int i ) {
20 | return input.m128i_i32[i];
21 | }
22 | #endif
23 |
24 | VBVH_BEGIN_NAMESPACE
25 |
26 | extern const __m128 _mm_lookupmask_ps[16];
27 |
28 | struct sseb;
29 | struct ssei;
30 | struct ssef;
31 |
32 | #if !defined(__MIC__)
33 | typedef ssef ssef_t;
34 | typedef ssei ssei_t;
35 |
36 | typedef ssef ssef_m;
37 | typedef ssei ssei_m;
38 | #endif
39 |
40 | VBVH_END_NAMESPACE
41 |
42 | #include "VBvh/common/simd/sseb.h"
43 | #include "VBvh/common/simd/ssei.h"
44 | #include "VBvh/common/simd/ssef.h"
45 | #endif
46 |
--------------------------------------------------------------------------------
/inc/VKernel/BMeshRemeshOp.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_REMESH_OP
2 | #define VKERNEL_REMESH_OP
3 | #include "VKernel/VMeshObject.h"
4 | #include "BMesh/BMesh.h"
5 |
6 | using namespace VM;
7 | class BMeshRemeshOp
8 | {
9 | static int count;
10 | enum
11 | {
12 | REMESH_V_FEATURE = 1 << 0,
13 | REMESH_V_CORNER = 1 << 1,
14 | REMESH_V_BOUNDARY = 1 << 2
15 | };
16 |
17 | enum
18 | {
19 | REMESH_E_FEATURE = 1 << 0
20 | };
21 |
22 | public:
23 | BMeshRemeshOp(BMesh *bm_, BMBvh *bvh_, bool feature = true);
24 | ~BMeshRemeshOp();
25 | void run();
26 | void setFeatureReserve(bool val){ _feature_ensure = val; };
27 | void setIteration(size_t iter){ _iteration = iter; };
28 | private:
29 | bool isTooShort(BMVert *v0, BMVert *v1);
30 | bool isTooLong(BMVert *v0, BMVert *v1);
31 | void begin();
32 | void end();
33 | void splitLongEdges();
34 | void collapseShortEdges();
35 | void optimizeValence();
36 | void tangentialSmooth();
37 | void projectOriginMesh();
38 | void featureDetect();
39 | private:
40 | BMesh *_bm;
41 | BMBvh *_refer_bvh;
42 | BMesh *ret_bm;
43 | float _emax, _emin, _eavg, _emaxsqr, _eminsqr;
44 | float _error;
45 | size_t _cd_v_curvature;
46 | bool _feature_ensure;
47 | size_t _iteration;
48 | };
49 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VContext.h:
--------------------------------------------------------------------------------
1 | #ifndef VSCULPT_VCONTEXT_H
2 | #define VSCULPT_VCONTEXT_H
3 |
4 | #include "VScene.h"
5 | #include
6 | #include
7 | #include
8 |
9 | VK_BEGIN_NAMESPACE
10 | struct VCommonConfig
11 | {
12 | VCommonConfig(){}
13 | };
14 |
15 | class VContext
16 | {
17 | public:
18 | static VContext* instance();
19 | public:
20 | ~VContext();
21 |
22 | VScene* scene();
23 |
24 | QQuickWindow* window();
25 | void setWindow(QQuickWindow *win);
26 |
27 | VView3DRegion* region();
28 | void setRegion(VView3DRegion *region);
29 |
30 | static void viewLine(VView3DRegion *region, Eigen::Vector2f win, Eigen::Vector3f &l1, Eigen::Vector3f &l2);
31 | static void viewRay(VView3DRegion *region, Eigen::Vector2f win, Eigen::Vector3f &org, Eigen::Vector3f &dir);
32 | static float screenDistanceToModelDistance(VView3DRegion *region, float pixel_dst, Eigen::Vector3f ref_pos);
33 | static Eigen::Vector3f project(VView3DRegion *region, Eigen::Vector3f &pos);
34 | static Eigen::Vector3f unproject(VView3DRegion *region, Eigen::Vector3f &win);
35 | static Vector3 viewModelDirection(VView3DRegion *region, VScene *scene);
36 | VCommonConfig* commonConfig();
37 | Eigen::Vector2f currentGLMouse();
38 | private:
39 | VContext();
40 | private:
41 | static VContext _context;
42 | VScene *_scene;
43 | QQuickWindow *_window;
44 | VView3DRegion *_region; /*current region under mouse position*/
45 | VCommonConfig _config;
46 | };
47 |
48 | VK_END_NAMESPACE
49 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VEffectManager.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VEFFECT_MANAGER_H
2 | #define VKERNEL_VEFFECT_MANAGER_H
3 | #include
4 | #include "VKernelCommon.h"
5 |
6 | VK_BEGIN_NAMESPACE
7 | class VEffectManager
8 | {
9 | public:
10 | VEffectManager(gte::ProgramFactory &factory, gte::BufferUpdater bufferUpdator);
11 | ~VEffectManager();
12 | private:
13 | gte::ProgramFactory &_factory;
14 | gte::BufferUpdater &_bufferUpdator;
15 | };
16 | VK_END_NAMESPACE
17 |
18 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VFloorNode.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VGRID_NODE_H
2 | #define VKERNEL_VGRID_NODE_H
3 | #include "VKernel/VKernelCommon.h"
4 | #include "VKernel/VNode.h"
5 | #include "VKernel/VScene.h"
6 | VK_BEGIN_NAMESPACE
7 | class VFloorNode : public VNode
8 | {
9 | public:
10 | VFloorNode(VScene *scene);
11 | virtual ~VFloorNode();
12 | virtual void onRender(VView3DRegion *region);
13 | private:
14 | void ensureEffect();
15 | private:
16 | VScene *_scene;
17 | std::shared_ptr _effect;
18 | std::shared_ptr _vBuffer;
19 | std::shared_ptr _iBuffer;
20 | gte::EVector4 _gridColor, _axisXColor, _axisYColor;
21 | };
22 | VK_END_NAMESPACE
23 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VKernelCommon.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VKERNEL_COMMON_H
2 | #define VKERNEL_VKERNEL_COMMON_H
3 |
4 | #define VK_BEGIN_NAMESPACE namespace vk{
5 | #define VK_END_NAMESPACE }
6 |
7 | #include
8 | #include
9 | VK_BEGIN_NAMESPACE
10 |
11 | typedef Eigen::Matrix Vector2;
12 | typedef Eigen::Matrix Vector3;
13 | typedef Eigen::Matrix Vector4;
14 | typedef Eigen::Matrix Matrix3x3;
15 | typedef Eigen::Matrix Matrix4x4;
16 |
17 | typedef Eigen::Quaternionf Quaternion;
18 | typedef Eigen::AngleAxisf AngleAxis;
19 | typedef Eigen::Transform Transform;
20 |
21 | VK_END_NAMESPACE
22 | #endif // !VKERNEL_VKERNEL_COMMON_H
23 |
--------------------------------------------------------------------------------
/inc/VKernel/VLighting.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VLIGHTING_H
2 | #define VKERNEL_VLIGHTING_H
3 |
4 | #include "VKernelCommon.h"
5 | #include
6 | #include "VNode.h"
7 |
8 | VK_BEGIN_NAMESPACE
9 |
10 | struct VLighting : public VNode
11 | {
12 | Q_OBJECT
13 | public:
14 | VLighting();
15 | ~VLighting();
16 | public:
17 | Vector4 lightPosition() const;
18 | Vector4 lightDirection() const;
19 | Vector4 lightUp() const;
20 | Vector4 lightRight() const;
21 | const Vector4& ambient() const;
22 | const Vector4& diffuse() const;
23 | const Vector4& specular() const;
24 | const Vector4& cutoff() const;
25 | const Vector4& attenuation() const;
26 | public Q_SLOTS:
27 | void setLightPosition(const Vector4 &pos);
28 | void setLightDirection(const Vector4 &dir);
29 | void setLightUp(const Vector4 &up);
30 | void setLightRight(const Vector4 &right);
31 | void setAmbient(const Vector4 &val);
32 | void setDiffuse(const Vector4 &val);
33 | void setSpecular(const Vector4 &val);
34 | void setCutoff(const Vector4 &val);
35 | void setAttenuation(const Vector4 &val);
36 | Q_SIGNALS:
37 | void lightingChanged(VLighting*);
38 | private:
39 | Vector4 _lightPosition; // default: (0,0,0,1)
40 | Vector4 _lightDirection; // default: (0,0,-1,0)
41 | Vector4 _lightUp; // default: (0,1,0,0)
42 | Vector4 _lightRight; // default: (1,0,0,0)
43 |
44 | Vector4 _ambient;
45 | Vector4 _diffuse;
46 | Vector4 _specular;
47 | Vector4 _cutoff;
48 | Vector4 _attenuation;
49 | };
50 |
51 | VK_END_NAMESPACE
52 |
53 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VMeshObject.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VBMESH_NODE_H
2 | #define VKERNEL_VBMESH_NODE_H
3 | #include
4 | #include
5 | #include "VObject.h"
6 | #include "BMesh/BMesh.h"
7 | #include "VScene.h"
8 |
9 | VK_BEGIN_NAMESPACE
10 | class VView3DRegion;
11 | class VContext;
12 | class VMeshObject;
13 |
14 |
15 |
16 | class VMeshObject : public VObject
17 | {
18 | public:
19 | enum State
20 | {
21 | STATE_NONE,
22 | STATE_SCULPT,
23 | STATE_POSE_BEING_SELECT,
24 | STATE_POSE_DEFORM
25 | };
26 | public:
27 | VMeshObject(VScene *scene, VM::BMesh *bm);
28 | virtual ~VMeshObject();
29 |
30 | virtual void syncUpdate();
31 | virtual void applyLocalTransform();
32 | virtual Eigen::Vector3f center();
33 |
34 | VM::BMesh* getBmesh();
35 | VBvh::BMBvh* getBmeshBvh();
36 |
37 |
38 | void setState(State s){ _state = s; };
39 | State state(){ return _state; };
40 |
41 | virtual bool pick(const Eigen::Vector3f& org, const Eigen::Vector3f& dir, Eigen::Vector3f& hit);
42 | virtual void onSceneRemoved();
43 | virtual void onSceneReadded();
44 | void setRenderMode(VbsDef::RENDER_MODE mode);
45 |
46 | private:
47 | void subcribeRenderData();
48 | void unscribeRenderData();
49 | private:
50 | VScene *_scene;
51 | VM::BMesh *_bmesh;
52 | VBvh::BMBvh *_bvh;
53 | State _state;
54 | };
55 | VK_END_NAMESPACE
56 |
57 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VNode.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VNODE_H
2 | #define VKERNEL_VNODE_H
3 | #include
4 | #include "VKernelCommon.h"
5 | #include
6 | #include
7 | VK_BEGIN_NAMESPACE
8 |
9 | class VView3DRegion;
10 | class VNodeVisitor
11 | {
12 | public:
13 | virtual void visit(class VNode *node) = 0;
14 | };
15 |
16 | class VNode : public QObject
17 | {
18 | Q_OBJECT
19 | public:
20 | VNode(VNode *parent = nullptr);
21 | virtual ~VNode();
22 | void accept(VNodeVisitor *visitor);
23 | virtual void syncUpdate();
24 | virtual void onRender(VView3DRegion *region);
25 | public:
26 | virtual void updateWorldTransform();
27 | Transform& worldTransform();
28 | const Transform& worldTransform() const;
29 | Transform& localTransform();
30 | const Transform& localTransform() const;
31 |
32 | protected:
33 | int _oflag;
34 | std::shared_ptr _worldTransform;
35 | std::shared_ptr _localTransform;
36 | };
37 |
38 | VK_END_NAMESPACE
39 |
40 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VNodeRender.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VOBJET_RENDER_H
2 | #define VKERNEL_VOBJET_RENDER_H
3 | #include "VKernel/VKernelCommon.h"
4 |
5 | VK_BEGIN_NAMESPACE
6 | class VContext;
7 | class VView3DRegion;
8 | class VNode;
9 | class VNodeRender
10 | {
11 | public:
12 | VNodeRender(){}
13 | virtual ~VNodeRender(){}
14 | virtual void onRender(VView3DRegion *region, Eigen::Vector4f(*cullingPlanes)[4]) = 0;
15 | virtual void syncUpdate(VContext *context, VNode *object) = 0;
16 | };
17 | VK_END_NAMESPACE
18 | #endif
--------------------------------------------------------------------------------
/inc/VKernel/VSceneRenderer.h:
--------------------------------------------------------------------------------
1 | #ifndef VKERNEL_VSCENE_RENDER_H
2 | #define VKERNEL_VSCENE_RENDER_H
3 | #include "VKernel/VKernelCommon.h"
4 | #include "VKernel/VContext.h"
5 | #include "VKernel/VNodeRender.h"
6 | #include