mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 13:50:05 +00:00
Base check-in of Hbr / Far
This commit is contained in:
parent
5d86cc4685
commit
dcb6572ae9
170
CMakeLists.txt
Normal file
170
CMakeLists.txt
Normal file
@ -0,0 +1,170 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
project(OpenSubdiv)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(OpenSubdiv_VERSION_MAJOR 0)
|
||||
set(OpenSubdiv_VERSION_MINOR 1)
|
||||
set(OpenSubdiv_VERSION_PATCH 0)
|
||||
|
||||
set(OpenSubdiv_VERSION
|
||||
${OpenSubdiv_VERSION_MAJOR}.${OpenSubdiv_VERSION_MINOR}.${OpenSubdiv_VERSION_PATCH})
|
||||
|
||||
message(STATUS "Compiling ${CMAKE_PROJECT_NAME} version ${OpenSubdiv_VERSION}")
|
||||
message(STATUS "Using cmake version ${CMAKE_VERSION}")
|
||||
|
||||
# Specify the default install path
|
||||
SET( CMAKE_INSTALL_PREFIX
|
||||
${PROJECT_BINARY_DIR}/ )
|
||||
|
||||
# Set the directory where the executables will be stored.
|
||||
set(EXECUTABLE_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/bin
|
||||
CACHE PATH
|
||||
"Directory where executables will be stored"
|
||||
)
|
||||
|
||||
# Set the directory where the libraries will be stored.
|
||||
set(LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/lib
|
||||
CACHE PATH
|
||||
"Directory where all libraries will be stored"
|
||||
)
|
||||
|
||||
# Specify the list of directories to search for cmake modules.
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
||||
)
|
||||
|
||||
# Ignore rules that will re-run cmake (this will avoid constant
|
||||
# reloading of the generated Visual Studio project).
|
||||
set(CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
add_definitions(
|
||||
# We use tbb as a header-only library, so in order to avoid
|
||||
# linking we disable tbb asserts and threading tools.
|
||||
-DTBB_USE_ASSERT=0
|
||||
-DTBB_USE_THREADING_TOOLS=0
|
||||
|
||||
# GLEW gets built as a static library.
|
||||
-DGLEW_STATIC
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
# MSVC is unfortunately not standard conforming with regards to
|
||||
# the alternative names for logical and bitwise operators:
|
||||
# http://stackoverflow.com/questions/555505/c-alternative-tokens
|
||||
# http://stackoverflow.com/questions/6006526/c-writing-or-instead-of
|
||||
#
|
||||
# This can be solved by including iso646.h, but that is a rather
|
||||
# unsatisfactory solution since we then always have to remember to
|
||||
# include this header file. Instead we define these operators
|
||||
# ourselves as command line arguments to cl.exe.
|
||||
#
|
||||
# An alternative would be to compile with the /Za option
|
||||
# (but unfortunately that breaks other code):
|
||||
# http://msdn.microsoft.com/en-us/library/0k0w269d.aspx
|
||||
add_definitions(
|
||||
/Dand=&&
|
||||
/Dand_eq=&=
|
||||
/Dbitand=&
|
||||
/Dbitor=|
|
||||
/Dcompl=~
|
||||
/Dnot=!
|
||||
/Dnot_eq=!=
|
||||
/Dor=||
|
||||
/Dor_eq=|=
|
||||
# nvcc does not seem to like a caret being the last character
|
||||
# in a command line defined preprocessor symbol, so add an
|
||||
# empty trailing comment to avoid this.
|
||||
/Dxor=^/**/
|
||||
/Dxor_eq=^=
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
/W3 # Use warning level recommended for production purposes.
|
||||
/WX # Treat all compiler warnings as errors.
|
||||
|
||||
# Make sure WinDef.h does not define min and max macros which
|
||||
# will conflict with std::min() and std::max().
|
||||
/DNOMINMAX
|
||||
|
||||
# Make sure the constants in <math.h> get defined.
|
||||
/D_USE_MATH_DEFINES
|
||||
|
||||
# Do not enforce MSVC's safe CRT replacements.
|
||||
/D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# Disable checked iterators and iterator debugging. Visual Studio
|
||||
# 2008 does not implement std::vector::data(), so we need to take the
|
||||
# address of std::vector::operator[](0) to get the memory location of
|
||||
# a vector's underlying data storage. This does not work for an empty
|
||||
# vector if checked iterators or iterator debugging is enabled.
|
||||
/D_SECURE_SCL=0
|
||||
/D_HAS_ITERATOR_DEBUGGING=0
|
||||
|
||||
# Avoid linking with tbb.lib/tbb_debug.lib done through pragmas
|
||||
# in _tbb_windef.h.
|
||||
/D__TBB_NO_IMPLICIT_LINKAGE
|
||||
)
|
||||
endif(MSVC)
|
||||
|
||||
add_subdirectory(opensubdiv)
|
||||
|
||||
add_subdirectory(regression)
|
204
cmake/FindIlmBase.cmake
Normal file
204
cmake/FindIlmBase.cmake
Normal file
@ -0,0 +1,204 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
# - Try to find the IlmBase library
|
||||
# Once done this will define
|
||||
#
|
||||
# ILMBASE_FOUND - System has OPENCL
|
||||
# ILMBASE_INCLUDE_DIRECTORY - The include directory
|
||||
# ILMBASE_LIBS_DIRECTORY - The libraries needed
|
||||
|
||||
IF(NOT DEFINED ILMBASE_LOCATION)
|
||||
IF ( ${CMAKE_HOST_UNIX} )
|
||||
IF( APPLE )
|
||||
# TODO: set to default install path when shipping out
|
||||
SET( ILMBASE_LOCATION NOTFOUND )
|
||||
ELSE()
|
||||
SET(ILMBASE_LOCATION "/usr/local/ilmbase-1.0.1/" )
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF ( WIN32 )
|
||||
SET( ILMBASE_LOCATION "C:/Program Files (x86)/ilmbase-1.0.1/" )
|
||||
ELSEIF ( WIN64 )
|
||||
SET( ILMBASE_LOCATION "C:/Program Files (x86)/ilmbase-1.0.1/" )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF ( ${CMAKE_HOST_UNIX} )
|
||||
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -lpthread")
|
||||
ELSE()
|
||||
ENDIF()
|
||||
|
||||
SET(LIBRARY_PATHS
|
||||
${ILMBASE_LOCATION}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
IF( DEFINED ILMBASE_LIBRARY_DIR )
|
||||
SET( LIBRARY_PATHS ${ILMBASE_LIBRARY_DIR} ${LIBRARY_PATHS} )
|
||||
ENDIF()
|
||||
|
||||
SET(INCLUDE_PATHS
|
||||
${ILMBASE_LOCATION}/include/OpenEXR/
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/OpenEXR/
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/usr/include/OpenEXR
|
||||
/sw/include # Fink
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
|
||||
FIND_PATH( ILMBASE_INCLUDE_DIRECTORY ImathMath.h
|
||||
PATHS
|
||||
${INCLUDE_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
DOC "The directory where ImathMath.h resides" )
|
||||
|
||||
IF( NOT DEFINED ILMBASE_IEX_LIB )
|
||||
FIND_LIBRARY( ILMBASE_IEX_LIB Iex
|
||||
PATHS
|
||||
${LIBRARY_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
DOC "The Iex library" )
|
||||
ENDIF()
|
||||
|
||||
IF( NOT DEFINED ILMBASE_ILMTHREAD_LIB )
|
||||
FIND_LIBRARY( ILMBASE_ILMTHREAD_LIB IlmThread
|
||||
PATHS
|
||||
${LIBRARY_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
DOC "The IlmThread library" )
|
||||
ENDIF()
|
||||
|
||||
IF( NOT DEFINED ILMBASE_IMATH_LIB )
|
||||
FIND_LIBRARY( ILMBASE_IMATH_LIB Imath
|
||||
PATHS
|
||||
${LIBRARY_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
DOC "The Imath library" )
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
IF ( ${ILMBASE_IEX_LIB} STREQUAL "ILMBASE_IEX_LIB-NOTFOUND" )
|
||||
MESSAGE( FATAL_ERROR "ilmbase libraries (Iex) not found, required" )
|
||||
ENDIF()
|
||||
|
||||
IF ( ${ILMBASE_ILMTHREAD_LIB} STREQUAL "ILMBASE_ILMTHREAD_LIB-NOTFOUND" )
|
||||
MESSAGE( FATAL_ERROR "ilmbase libraries (IlmThread) not found, required" )
|
||||
ENDIF()
|
||||
|
||||
IF ( ${ILMBASE_IMATH_LIB} STREQUAL "ILMBASE_IMATH_LIB-NOTFOUND" )
|
||||
MESSAGE( FATAL_ERROR "ilmbase libraries (Imath) not found, required" )
|
||||
ENDIF()
|
||||
|
||||
IF ( ${ILMBASE_INCLUDE_DIRECTORY} STREQUAL "ILMBASE_INCLUDE_DIRECTORY-NOTFOUND" )
|
||||
MESSAGE( FATAL_ERROR "ilmbase header files not found, required: ILMBASE_LOCATION: ${ILMBASE_LOCATION}" )
|
||||
ENDIF()
|
||||
|
||||
SET( ILMBASE_LIBS_DIRECTORY
|
||||
${ILMBASE_IMATH_LIB}
|
||||
${ILMBASE_ILMTHREAD_LIB}
|
||||
${ILMBASE_IEX_LIB}
|
||||
)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IlmBase DEFAULT_MSG
|
||||
ILMBASE_LOCATION
|
||||
ILMBASE_INCLUDE_DIRECTORY
|
||||
ILMBASE_LIBS_DIRECTORY
|
||||
)
|
||||
|
||||
|
||||
#MESSAGE( STATUS "ILMBASE INCLUDE PATH: ${ILMBASE_INCLUDE_DIRECTORY}" )
|
||||
#MESSAGE( STATUS "IEX LIB: ${ILMBASE_IEX_LIB}" )
|
||||
#MESSAGE( STATUS "IMATH LIB: ${ILMBASE_IMATH_LIB}" )
|
||||
|
||||
SET( ILMBASE_FOUND TRUE )
|
||||
|
227
cmake/FindMaya.cmake
Normal file
227
cmake/FindMaya.cmake
Normal file
@ -0,0 +1,227 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
# - Maya finder module
|
||||
# This module searches for a valid Maya instalation.
|
||||
# It searches for Maya's devkit, libraries, executables
|
||||
# and related paths (scripts)
|
||||
#
|
||||
# Variables that will be defined:
|
||||
# MAYA_FOUND Defined if a Maya installation has been detected
|
||||
# MAYA_EXECUTABLE Path to Maya's executable
|
||||
# MAYA_<lib>_FOUND Defined if <lib> has been found
|
||||
# MAYA_<lib>_LIBRARY Path to <lib> library
|
||||
# MAYA_INCLUDE_DIRS Path to the devkit's include directories
|
||||
#
|
||||
# IMPORTANT: Currently, there's only support for OSX platform and Maya version 2012.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011-2012 Francisco Requena <frarees@gmail.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
SET(MAYA_VERSION_2012 TRUE)
|
||||
|
||||
## add one to this list to match your install if none match
|
||||
|
||||
IF(APPLE)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
ENV MAYA_LOCATION
|
||||
"/Applications/Autodesk/maya2012.17/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2012/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2011/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2010/Maya.app/Contents"
|
||||
)
|
||||
FIND_PATH(MAYA_LIBRARY_DIR libOpenMaya.dylib
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
Maya.app/contents/MacOS/
|
||||
DOC "Maya's libraries path"
|
||||
)
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
ENV MAYA_LOCATION
|
||||
"/usr/autodesk/maya2012.17-x64"
|
||||
"/usr/autodesk/maya2012-x64"
|
||||
"/usr/autodesk/maya2011-x64"
|
||||
"/usr/autodesk/maya2010-x64"
|
||||
)
|
||||
FIND_PATH(MAYA_LIBRARY_DIR libOpenMaya.so
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
lib/
|
||||
DOC "Maya's libraries path"
|
||||
)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
ENV MAYA_LOCATION
|
||||
"C:/Program Files/Autodesk/Maya2012-x64"
|
||||
"C:/Program Files/Autodesk/Maya2012"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2012"
|
||||
"C:/Autodesk/maya-2012x64"
|
||||
"C:/Program Files/Autodesk/Maya2011-x64"
|
||||
"C:/Program Files/Autodesk/Maya2011"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2011"
|
||||
"C:/Autodesk/maya-2011x64"
|
||||
"C:/Program Files/Autodesk/Maya2010-x64"
|
||||
"C:/Program Files/Autodesk/Maya2010"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2010"
|
||||
"C:/Autodesk/maya-2010x64"
|
||||
)
|
||||
FIND_PATH(MAYA_LIBRARY_DIR OpenMaya.lib
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
lib/
|
||||
DOC "Maya's libraries path"
|
||||
)
|
||||
ENDIF(WIN32)
|
||||
|
||||
FIND_PATH(MAYA_INCLUDE_DIR maya/MFn.h
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
../../devkit/include/
|
||||
include/
|
||||
DOC "Maya's devkit headers path"
|
||||
)
|
||||
|
||||
FIND_PATH(MAYA_LIBRARY_DIR OpenMaya
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
../../devkit/include/
|
||||
include/
|
||||
DOC "Maya's devkit headers path"
|
||||
)
|
||||
|
||||
LIST(APPEND MAYA_INCLUDE_DIRS ${MAYA_INCLUDE_DIR})
|
||||
|
||||
FIND_PATH(MAYA_DEVKIT_INC_DIR GL/glext.h
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
/devkit/plug-ins/
|
||||
DOC "Maya's devkit headers path"
|
||||
)
|
||||
LIST(APPEND MAYA_INCLUDE_DIRS ${MAYA_DEVKIT_INC_DIR})
|
||||
|
||||
FOREACH(MAYA_LIB
|
||||
OpenMaya
|
||||
OpenMayaAnim
|
||||
OpenMayaFX
|
||||
OpenMayaRender
|
||||
OpenMayaUI
|
||||
Image
|
||||
Foundation
|
||||
IMFbase
|
||||
tbb
|
||||
cg
|
||||
cgGL
|
||||
)
|
||||
FIND_LIBRARY(MAYA_${MAYA_LIB}_LIBRARY ${MAYA_LIB}
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
MacOS/
|
||||
lib/
|
||||
DOC "Maya's ${MAYA_LIB} library path"
|
||||
)
|
||||
|
||||
LIST(APPEND ${MAYA_LIBRARIES} MAYA_${MAYA_LIB}_LIBRARY)
|
||||
ENDFOREACH(MAYA_LIB)
|
||||
|
||||
FIND_PROGRAM(MAYA_EXECUTABLE maya
|
||||
PATHS
|
||||
ENV MAYA_LOCATION
|
||||
${MAYA_BASE_DIR}
|
||||
PATH_SUFFIXES
|
||||
MacOS/
|
||||
bin/
|
||||
DOC "Maya's executable path"
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MAYA_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Maya DEFAULT_MSG ${MAYA_LIBRARIES} MAYA_EXECUTABLE MAYA_INCLUDE_DIRS)
|
||||
|
||||
IF(NOT MAYA_FOUND AND NOT MAYA_FIND_QUIETLY)
|
||||
MESSAGE("Remember that currently there's support only for Maya 2012. ")
|
||||
ENDIF()
|
||||
|
135
cmake/FindOpenCL.cmake
Normal file
135
cmake/FindOpenCL.cmake
Normal file
@ -0,0 +1,135 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
# - Try to find an OpenCL library
|
||||
# Once done this will define
|
||||
#
|
||||
# OPENCL_FOUND - System has OPENCL
|
||||
# OPENCL_INCLUDE_DIR - The OPENCL include directory
|
||||
# OPENCL_LIBRARIES - The libraries needed to use OPENCL
|
||||
#
|
||||
|
||||
# Copyright (c) 2010 Matthieu Volat. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# The views and conclusions contained in the software and documentation are
|
||||
# those of the authors and should not be interpreted as representing
|
||||
# official policies, either expressed or implied, of Matthieu Volat.
|
||||
|
||||
IF(OPENCL_LIBRARIES)
|
||||
SET(OpenCL_FIND_QUIETLY TRUE)
|
||||
ENDIF(OPENCL_LIBRARIES)
|
||||
|
||||
IF(APPLE)
|
||||
SET(CL_DIR OpenCL)
|
||||
ELSE(APPLE)
|
||||
SET(CL_DIR CL)
|
||||
ENDIF(APPLE)
|
||||
FIND_PATH(OPENCL_INCLUDE_DIR ${CL_DIR}/opencl.h
|
||||
PATHS
|
||||
/usr/local/cuda/include
|
||||
$ENV{AMDAPPSDKROOT}/include
|
||||
/System/Library/Frameworks/OpenCL.framework/Headers
|
||||
PATH_SUFFIXES nvidia)
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(AMD_ARCH_LIBDIR x86_64)
|
||||
SET(WIN_LIBDIR Win64)
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(AMD_ARCH_LIBDIR x86)
|
||||
SET(WIN_LIBDIR Win32)
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
FIND_LIBRARY(OPENCL_LIBRARIES
|
||||
NAMES OpenCL
|
||||
PATH
|
||||
$ENV{AMDAPPSDKROOT}/lib/${AMD_ARCH_LIBDIR}
|
||||
PATH_SUFFIXES nvidia nvidia-current ${WIN_LIBDIR})
|
||||
|
||||
IF(OPENCL_INCLUDE_DIR AND OPENCL_LIBRARIES)
|
||||
SET(OPENCL_FOUND TRUE)
|
||||
ELSE(OPENCL_INCLUDE_DIR AND OPENCL_LIBRARIES)
|
||||
SET(OPENCL_FOUND FALSE)
|
||||
ENDIF (OPENCL_INCLUDE_DIR AND OPENCL_LIBRARIES)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCL DEFAULT_MSG
|
||||
OPENCL_LIBRARIES
|
||||
OPENCL_INCLUDE_DIR
|
||||
)
|
||||
|
||||
MARK_AS_ADVANCED(OPENCL_INCLUDE_DIR OPENCL_LIBRARIES)
|
||||
|
63
opensubdiv/CMakeLists.txt
Normal file
63
opensubdiv/CMakeLists.txt
Normal file
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
add_subdirectory(hbr)
|
||||
add_subdirectory(far)
|
||||
|
||||
install( FILES version.h
|
||||
DESTINATION include/
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
|
70
opensubdiv/far/CMakeLists.txt
Normal file
70
opensubdiv/far/CMakeLists.txt
Normal file
@ -0,0 +1,70 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
set(H_FILES
|
||||
bilinearSubdivisionTables.h
|
||||
catmarkSubdivisionTables.h
|
||||
dispatcher.h
|
||||
loopSubdivisionTables.h
|
||||
meshFactory.h
|
||||
mesh.h
|
||||
subdivisionTables.h
|
||||
)
|
||||
|
||||
install( FILES ${H_FILES}
|
||||
DESTINATION include/far
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
|
340
opensubdiv/far/bilinearSubdivisionTables.h
Normal file
340
opensubdiv/far/bilinearSubdivisionTables.h
Normal file
@ -0,0 +1,340 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_BILINEAR_SUBDIVISION_TABLES_H
|
||||
#define FAR_BILINEAR_SUBDIVISION_TABLES_H
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
#include "../hbr/bilinear.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/subdivisionTables.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
// Bilinear tables store the indexing tables required in order to compute
|
||||
// the refined positions of a mesh without the help of a hierarchical data
|
||||
// structure. The advantage of this representation is its ability to be executed
|
||||
// in a massively parallel environment without data dependencies.
|
||||
//
|
||||
template <class T, class U=T> class FarBilinearSubdivisionTables : public FarSubdivisionTables<T,U> {
|
||||
|
||||
public:
|
||||
|
||||
// Memory required to store the indexing tables
|
||||
virtual size_t GetMemoryUsed() const;
|
||||
|
||||
// Compute the positions of refined vertices using the specified kernels
|
||||
virtual void Refine( int level, void * data=0 ) const;
|
||||
|
||||
// Table accessors
|
||||
typename FarSubdivisionTables<T,U>::template Table<unsigned int> const & Get_F_IT( ) const { return _F_IT; }
|
||||
|
||||
typename FarSubdivisionTables<T,U>::template Table<int> const & Get_F_ITa( ) const { return _F_ITa; }
|
||||
|
||||
private:
|
||||
|
||||
friend class FarMeshFactory<T,U>;
|
||||
friend class FarDispatcher<T,U>;
|
||||
|
||||
// Constructor : build level table at depth 'level'
|
||||
FarBilinearSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int level );
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a face.
|
||||
void computeFacePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
void computeVertexPoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typename FarSubdivisionTables<T,U>::template Table<int> _F_ITa;
|
||||
typename FarSubdivisionTables<T,U>::template Table<unsigned int> _F_IT;
|
||||
};
|
||||
|
||||
template <class T, class U> size_t
|
||||
FarBilinearSubdivisionTables<T,U>::GetMemoryUsed() const {
|
||||
return FarSubdivisionTables<T,U>::GetMemoryUsed()+
|
||||
_F_ITa.GetMemoryUsed()+
|
||||
_F_IT.GetMemoryUsed();
|
||||
}
|
||||
|
||||
// Constructor - generates indexing tables matching the bilinear subdivision scheme.
|
||||
//
|
||||
// tables codices detail :
|
||||
//
|
||||
// codices detail :
|
||||
//
|
||||
// _F_ITa[0] : offset into _F_IT array of vertices making up the face
|
||||
// _F_ITa[1] : valence of the face
|
||||
//
|
||||
// _E_ITa[0] : index of the org / dest vertices of the parent edge
|
||||
// _E_ITa[1] :
|
||||
//
|
||||
// _V_ITa[0] : index of the parent vertex
|
||||
//
|
||||
template <class T, class U>
|
||||
FarBilinearSubdivisionTables<T,U>::FarBilinearSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int maxlevel ) :
|
||||
FarSubdivisionTables<T,U>(mesh, maxlevel),
|
||||
_F_ITa(maxlevel+1),
|
||||
_F_IT(maxlevel+1)
|
||||
{
|
||||
std::vector<int> const & remap = factory._remapTable;
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
_F_ITa.Resize(factory.GetNumFaceVerticesTotal(maxlevel)*2);
|
||||
_F_IT.Resize(factory.GetNumFacesTotal(maxlevel) - factory.GetNumFacesTotal(0));
|
||||
|
||||
this->_E_IT.Resize(factory.GetNumEdgeVerticesTotal(maxlevel)*2);
|
||||
|
||||
this->_V_ITa.Resize(factory.GetNumVertexVerticesTotal(maxlevel));
|
||||
|
||||
for (int level=1; level<=maxlevel; ++level) {
|
||||
|
||||
// pointer to the first vertex corresponding to this level
|
||||
this->_vertsOffsets[level] = factory._vertVertIdx[level-1] +
|
||||
factory._vertVertsList[level-1].size();
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch * batch = & (this->_batches[level-1]);
|
||||
|
||||
// Face vertices
|
||||
// "For each vertex, gather all the vertices from the parent face."
|
||||
int offset = 0;
|
||||
int * F_ITa = this->_F_ITa[level-1];
|
||||
unsigned int * F_IT = this->_F_IT[level-1];
|
||||
batch->kernelF = (int)factory._faceVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelF; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._faceVertsList[level][i];
|
||||
assert(v);
|
||||
|
||||
HbrFace<T> * f=v->GetParentFace();
|
||||
assert(f);
|
||||
|
||||
int valence = f->GetNumVertices();
|
||||
|
||||
F_ITa[2*i+0] = offset;
|
||||
F_ITa[2*i+1] = valence;
|
||||
|
||||
for (int j=0; j<valence; ++j)
|
||||
F_IT[offset++] = remap[f->GetVertex(j)->GetID()];
|
||||
}
|
||||
_F_ITa.SetMarker(level, &F_ITa[2*batch->kernelF]);
|
||||
_F_IT.SetMarker(level, &F_IT[offset]);
|
||||
|
||||
// Edge vertices
|
||||
|
||||
// "Average the end-points of the parent edge"
|
||||
unsigned int * E_IT = this->_E_IT[level-1];
|
||||
batch->kernelE = (int)factory._edgeVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelE; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._edgeVertsList[level][i];
|
||||
assert(v);
|
||||
HbrHalfedge<T> * e = v->GetParentEdge();
|
||||
assert(e);
|
||||
|
||||
// get the indices 2 vertices from the parent edge
|
||||
E_IT[2*i+0] = remap[e->GetOrgVertex()->GetID()];
|
||||
E_IT[2*i+1] = remap[e->GetDestVertex()->GetID()];
|
||||
|
||||
}
|
||||
this->_E_IT.SetMarker(level, &E_IT[2*batch->kernelE]);
|
||||
|
||||
// Vertex vertices
|
||||
|
||||
// "Pass down the parent vertex"
|
||||
offset = 0;
|
||||
int * V_ITa = this->_V_ITa[level-1];
|
||||
batch->kernelB.first = 0;
|
||||
batch->kernelB.second = (int)factory._vertVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelB.second; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._vertVertsList[level][i],
|
||||
* pv = v->GetParentVertex();
|
||||
assert(v and pv);
|
||||
|
||||
V_ITa[i] = remap[pv->GetID()];
|
||||
|
||||
}
|
||||
this->_V_ITa.SetMarker(level, &V_ITa[batch->kernelB.second]);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarBilinearSubdivisionTables<T,U>::Refine( int level, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh and level>0);
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch const * batch = & (this->_batches[level-1]);
|
||||
|
||||
FarDispatcher<T,U> const * dispatch = this->_mesh->GetDispatcher();
|
||||
assert(dispatch);
|
||||
|
||||
int offset = this->GetFirstVertexOffset(level);
|
||||
if (batch->kernelF>0)
|
||||
dispatch->ApplyBilinearFaceVerticesKernel(this->_mesh, offset, level, 0, batch->kernelF, clientdata);
|
||||
|
||||
offset += this->GetNumFaceVertices(level);
|
||||
if (batch->kernelE>0)
|
||||
dispatch->ApplyBilinearEdgeVerticesKernel(this->_mesh, offset, level, 0, batch->kernelE, clientdata);
|
||||
|
||||
offset += this->GetNumEdgeVertices(level);
|
||||
if (batch->kernelB.first < batch->kernelB.second)
|
||||
dispatch->ApplyBilinearVertexVerticesKernel(this->_mesh, offset, level, batch->kernelB.first, batch->kernelB.second, clientdata);
|
||||
}
|
||||
|
||||
//
|
||||
// Face-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarBilinearSubdivisionTables<T,U>::computeFacePoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * F_ITa = _F_ITa[level-1];
|
||||
const unsigned int * F_IT = _F_IT[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int h = F_ITa[2*i ],
|
||||
n = F_ITa[2*i+1];
|
||||
float weight = 1.0f/n;
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[ F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[ F_IT[h+j] ], weight, clientdata );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Edge-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarBilinearSubdivisionTables<T,U>::computeEdgePoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const unsigned int * E_IT = this->_E_IT[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int eidx0 = E_IT[2*i+0],
|
||||
eidx1 = E_IT[2*i+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vertex-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarBilinearSubdivisionTables<T,U>::computeVertexPoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * V_ITa = this->_V_ITa[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int p=V_ITa[i]; // index of the parent vertex
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_BILINEAR_SUBDIVISION_TABLES_H */
|
569
opensubdiv/far/catmarkSubdivisionTables.h
Normal file
569
opensubdiv/far/catmarkSubdivisionTables.h
Normal file
@ -0,0 +1,569 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_CATMARK_SUBDIVISION_TABLES_H
|
||||
#define FAR_CATMARK_SUBDIVISION_TABLES_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
#include "../hbr/catmark.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/subdivisionTables.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
// Catmull-Clark tables store the indexing tables required in order to compute
|
||||
// the refined positions of a mesh without the help of a hierarchical data
|
||||
// structure. The advantage of this representation is its ability to be executed
|
||||
// in a massively parallel environment without data dependencies.
|
||||
//
|
||||
|
||||
template <class T, class U=T> class FarCatmarkSubdivisionTables : public FarSubdivisionTables<T,U> {
|
||||
|
||||
public:
|
||||
|
||||
// Memory required to store the indexing tables
|
||||
virtual size_t GetMemoryUsed() const;
|
||||
|
||||
// Compute the positions of refined vertices using the specified kernels
|
||||
virtual void Refine( int level, void * data=0 ) const;
|
||||
|
||||
// Table accessors
|
||||
typename FarSubdivisionTables<T,U>::template Table<unsigned int> const & Get_F_IT( ) const { return _F_IT; }
|
||||
|
||||
typename FarSubdivisionTables<T,U>::template Table<int> const & Get_F_ITa( ) const { return _F_ITa; }
|
||||
|
||||
private:
|
||||
|
||||
friend class FarMeshFactory<T,U>;
|
||||
friend class FarDispatcher<T,U>;
|
||||
|
||||
// Constructor : build level table at depth 'level'
|
||||
FarCatmarkSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int level );
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a face.
|
||||
void computeFacePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "A" Handles the k_Smooth and k_Dart rules
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "B" Handles the k_Crease and k_Corner rules
|
||||
void computeVertexPointsB(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
private:
|
||||
|
||||
typename FarSubdivisionTables<T,U>::template Table<int> _F_ITa;
|
||||
typename FarSubdivisionTables<T,U>::template Table<unsigned int> _F_IT;
|
||||
};
|
||||
|
||||
template <class T, class U> size_t
|
||||
FarCatmarkSubdivisionTables<T,U>::GetMemoryUsed() const {
|
||||
return FarSubdivisionTables<T,U>::GetMemoryUsed()+
|
||||
_F_ITa.GetMemoryUsed()+
|
||||
_F_IT.GetMemoryUsed();
|
||||
}
|
||||
|
||||
// Constructor - generates indexing tables matching the Catmull-Clark subdivision scheme.
|
||||
//
|
||||
// tables codices detail :
|
||||
//
|
||||
// _F_ITa[0] : offset into _F_IT array of vertices making up the face
|
||||
// _F_ITa[1] : valence of the face
|
||||
//
|
||||
// _E_ITa[0] : index of the org / dest vertices of the parent edge
|
||||
// _E_ITa[1] :
|
||||
// _E_ITa[2] : index of vertices refined from the faces left / right
|
||||
// _E_ITa[3] : of the parent edge
|
||||
//
|
||||
// _V_ITa[0] : offset to the corresponding adjacent vertices into _V0_IT
|
||||
// _V_ITa[1] : number of adjacent indices
|
||||
// _V_ITa[2] : index of the parent vertex
|
||||
// _V_ITa[3] : index of adjacent edge 0 (k_Crease rule)
|
||||
// _V_ITa[4] : index of adjacent edge 1 (k_Crease rule)
|
||||
//
|
||||
template <class T, class U>
|
||||
FarCatmarkSubdivisionTables<T,U>::FarCatmarkSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int maxlevel ) :
|
||||
FarSubdivisionTables<T,U>(mesh, maxlevel),
|
||||
_F_ITa(maxlevel+1),
|
||||
_F_IT(maxlevel+1)
|
||||
{
|
||||
std::vector<int> const & remap = factory._remapTable;
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
_F_ITa.Resize(factory.GetNumFaceVerticesTotal(maxlevel)*2);
|
||||
_F_IT.Resize(factory.GetNumFacesTotal(maxlevel) - factory.GetNumFacesTotal(0));
|
||||
|
||||
this->_E_IT.Resize(factory.GetNumEdgeVerticesTotal(maxlevel)*4);
|
||||
this->_E_W.Resize(factory.GetNumEdgeVerticesTotal(maxlevel)*2);
|
||||
|
||||
this->_V_ITa.Resize(factory.GetNumVertexVerticesTotal(maxlevel)*5);
|
||||
this->_V_IT.Resize(factory.GetNumAdjacentVertVerticesTotal(maxlevel)*2);
|
||||
this->_V_W.Resize(factory.GetNumVertexVerticesTotal(maxlevel));
|
||||
|
||||
for (int level=1; level<=maxlevel; ++level) {
|
||||
|
||||
// pointer to the first vertex corresponding to this level
|
||||
this->_vertsOffsets[level] = factory._vertVertIdx[level-1] +
|
||||
factory._vertVertsList[level-1].size();
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch * batch = & (this->_batches[level-1]);
|
||||
|
||||
// Face vertices
|
||||
// "For each vertex, gather all the vertices from the parent face."
|
||||
int offset = 0;
|
||||
int * F_ITa = this->_F_ITa[level-1];
|
||||
unsigned int * F_IT = this->_F_IT[level-1];
|
||||
batch->kernelF = (int)factory._faceVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelF; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._faceVertsList[level][i];
|
||||
assert(v);
|
||||
|
||||
HbrFace<T> * f=v->GetParentFace();
|
||||
assert(f);
|
||||
|
||||
int valence = f->GetNumVertices();
|
||||
|
||||
F_ITa[2*i+0] = offset;
|
||||
F_ITa[2*i+1] = valence;
|
||||
|
||||
for (int j=0; j<valence; ++j)
|
||||
F_IT[offset++] = remap[f->GetVertex(j)->GetID()];
|
||||
}
|
||||
_F_ITa.SetMarker(level, &F_ITa[2*batch->kernelF]);
|
||||
_F_IT.SetMarker(level, &F_IT[offset]);
|
||||
|
||||
// Edge vertices
|
||||
|
||||
// Triangular interpolation mode :
|
||||
// see "smoothtriangle" tag introduced in prman 3.9 and HbrCatmarkSubdivision<T>
|
||||
typename HbrCatmarkSubdivision<T>::TriangleSubdivision triangleMethod =
|
||||
dynamic_cast<HbrCatmarkSubdivision<T> *>(factory._hbrMesh->GetSubdivision())->GetTriangleSubdivisionMethod();
|
||||
|
||||
// "For each vertex, gather the 2 vertices from the parent edege and the
|
||||
// 2 child vertices from the faces to the left and right of that edge.
|
||||
// Adjust if edge has a crease or is on a boundary."
|
||||
unsigned int * E_IT = this->_E_IT[level-1];
|
||||
float * E_W = this->_E_W[level-1];
|
||||
batch->kernelE = (int)factory._edgeVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelE; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._edgeVertsList[level][i];
|
||||
assert(v);
|
||||
HbrHalfedge<T> * e = v->GetParentEdge();
|
||||
assert(e);
|
||||
|
||||
float esharp = e->GetSharpness();
|
||||
|
||||
// get the indices 2 vertices from the parent edge
|
||||
E_IT[4*i+0] = remap[e->GetOrgVertex()->GetID()];
|
||||
E_IT[4*i+1] = remap[e->GetDestVertex()->GetID()];
|
||||
|
||||
float faceWeight=0.5f, vertWeight=0.5f;
|
||||
|
||||
// in the case of a fractional sharpness, set the adjacent faces vertices
|
||||
if (!e->IsBoundary() && esharp <= 1.0f) {
|
||||
|
||||
float leftWeight, rightWeight;
|
||||
HbrFace<T>* rf = e->GetRightFace();
|
||||
HbrFace<T>* lf = e->GetLeftFace();
|
||||
|
||||
leftWeight = ( triangleMethod == HbrCatmarkSubdivision<T>::k_New && lf->GetNumVertices() == 3) ? HBR_SMOOTH_TRI_EDGE_WEIGHT : 0.25f;
|
||||
rightWeight = ( triangleMethod == HbrCatmarkSubdivision<T>::k_New && rf->GetNumVertices() == 3) ? HBR_SMOOTH_TRI_EDGE_WEIGHT : 0.25f;
|
||||
|
||||
faceWeight = 0.5f * (leftWeight + rightWeight);
|
||||
vertWeight = 0.5f * (1.0f - 2.0f * faceWeight);
|
||||
|
||||
faceWeight *= (1.0f - esharp);
|
||||
|
||||
vertWeight = 0.5f * esharp + (1.0f - esharp) * vertWeight;
|
||||
|
||||
E_IT[4*i+2] = remap[lf->Subdivide()->GetID()];
|
||||
E_IT[4*i+3] = remap[rf->Subdivide()->GetID()];
|
||||
} else {
|
||||
E_IT[4*i+2] = -1;
|
||||
E_IT[4*i+3] = -1;
|
||||
}
|
||||
E_W[2*i+0] = vertWeight;
|
||||
E_W[2*i+1] = faceWeight;
|
||||
}
|
||||
this->_E_IT.SetMarker(level, &E_IT[4*batch->kernelE]);
|
||||
this->_E_W.SetMarker(level, &E_W[2*batch->kernelE]);
|
||||
|
||||
// Vertex vertices
|
||||
|
||||
batch->InitVertexKernels( factory._vertVertsList[level].size(), 0 );
|
||||
|
||||
offset = 0;
|
||||
int * V_ITa = this->_V_ITa[level-1];
|
||||
unsigned int * V_IT = this->_V_IT[level-1];
|
||||
float * V_W = this->_V_W[level-1];
|
||||
int nverts = (int)factory._vertVertsList[level].size();
|
||||
for (int i=0; i < nverts; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._vertVertsList[level][i],
|
||||
* pv = v->GetParentVertex();
|
||||
assert(v and pv);
|
||||
|
||||
// Look at HbrCatmarkSubdivision<T>::Subdivide for more details about
|
||||
// the multi-pass interpolation
|
||||
int masks[2], npasses;
|
||||
float weights[2];
|
||||
masks[0] = pv->GetMask(false);
|
||||
masks[1] = pv->GetMask(true);
|
||||
|
||||
// If the masks are identical, only a single pass is necessary. If the
|
||||
// vertex is transitionning to another rule, two passes are necessary,
|
||||
// except when transitionning from k_Dart to k_Smooth : the same
|
||||
// compute kernel is applied twice. Combining this special case allows
|
||||
// to batch the compute kernels into fewer calls.
|
||||
if (masks[0] != masks[1] and (
|
||||
not (masks[0]==HbrVertex<T>::k_Smooth and
|
||||
masks[1]==HbrVertex<T>::k_Dart))) {
|
||||
weights[1] = pv->GetFractionalMask();
|
||||
weights[0] = 1.0f - weights[1];
|
||||
npasses = 2;
|
||||
} else {
|
||||
weights[0] = 1.0f;
|
||||
weights[1] = 0.0f;
|
||||
npasses = 1;
|
||||
}
|
||||
|
||||
int rank = this->getMaskRanking(masks[0], masks[1]);
|
||||
|
||||
V_ITa[5*i+0] = offset;
|
||||
V_ITa[5*i+1] = 0;
|
||||
V_ITa[5*i+2] = remap[ pv->GetID() ];
|
||||
V_ITa[5*i+3] = -1;
|
||||
V_ITa[5*i+4] = -1;
|
||||
|
||||
for (int p=0; p<npasses; ++p)
|
||||
switch (masks[p]) {
|
||||
case HbrVertex<T>::k_Smooth :
|
||||
case HbrVertex<T>::k_Dart : {
|
||||
HbrHalfedge<T> *e = pv->GetIncidentEdge(),
|
||||
*start = e;
|
||||
// XXXX bug : pv may not return an incident edge -
|
||||
// this loop may crash on some topologies
|
||||
do {
|
||||
V_ITa[5*i+1]++;
|
||||
|
||||
V_IT[offset++] = remap[ e->GetDestVertex()->GetID() ];
|
||||
|
||||
V_IT[offset++] = remap[ e->GetLeftFace()->Subdivide()->GetID() ];
|
||||
|
||||
e = e->GetPrev()->GetOpposite();
|
||||
} while (e != start);
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Crease : {
|
||||
|
||||
class GatherCreaseEdgesOperator : public HbrHalfedgeOperator<T> {
|
||||
public:
|
||||
HbrVertex<T> * vertex; int eidx[2]; int count; bool next;
|
||||
|
||||
GatherCreaseEdgesOperator(HbrVertex<T> * v, bool n) : vertex(v), count(0), next(n) { eidx[0]=-1; eidx[1]=-1; }
|
||||
|
||||
virtual void operator() (HbrHalfedge<T> &e) {
|
||||
if (e.IsSharp(next) and count < 2) {
|
||||
HbrVertex<T> * a = e.GetDestVertex();
|
||||
if (a==vertex)
|
||||
a = e.GetOrgVertex();
|
||||
eidx[count++]=a->GetID();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GatherCreaseEdgesOperator op( pv, p==1 );
|
||||
pv->ApplyOperatorSurroundingEdges( op );
|
||||
|
||||
assert(V_ITa[5*i+3]==-1 and V_ITa[5*i+4]==-1);
|
||||
assert(op.eidx[0]!=-1 and op.eidx[1]!=-1);
|
||||
V_ITa[5*i+3] = remap[op.eidx[0]];
|
||||
V_ITa[5*i+4] = remap[op.eidx[1]];
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Corner :
|
||||
// in the case of a k_Crease / k_Corner pass combination, we
|
||||
// need to set the valence to -1 to tell the "B" Kernel to
|
||||
// switch to k_Corner rule (as edge indices won't be -1)
|
||||
if (V_ITa[5*i+1]==0)
|
||||
V_ITa[5*i+1] = -1;
|
||||
|
||||
default : break;
|
||||
}
|
||||
|
||||
|
||||
if (rank>7)
|
||||
// the k_Corner and k_Crease single-pass cases apply a weight of 1.0
|
||||
// but this value is inverted in the kernel
|
||||
V_W[i] = 0.0;
|
||||
else
|
||||
V_W[i] = weights[0];
|
||||
|
||||
batch->AddVertex( i, rank );
|
||||
}
|
||||
this->_V_ITa.SetMarker(level, &V_ITa[5*nverts]);
|
||||
this->_V_IT.SetMarker(level, &V_IT[offset]);
|
||||
this->_V_W.SetMarker(level, &V_W[nverts]);
|
||||
|
||||
batch->kernelB.second++;
|
||||
batch->kernelA1.second++;
|
||||
batch->kernelA2.second++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarCatmarkSubdivisionTables<T,U>::Refine( int level, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh and level>0);
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch const * batch = & (this->_batches[level-1]);
|
||||
|
||||
FarDispatcher<T,U> const * dispatch = this->_mesh->GetDispatcher();
|
||||
assert(dispatch);
|
||||
|
||||
int offset = this->GetFirstVertexOffset(level);
|
||||
if (batch->kernelF>0)
|
||||
dispatch->ApplyCatmarkFaceVerticesKernel(this->_mesh, offset, level, 0, batch->kernelF, clientdata);
|
||||
|
||||
offset += this->GetNumFaceVertices(level);
|
||||
if (batch->kernelE>0)
|
||||
dispatch->ApplyCatmarkEdgeVerticesKernel(this->_mesh, offset, level, 0, batch->kernelE, clientdata);
|
||||
|
||||
offset += this->GetNumEdgeVertices(level);
|
||||
if (batch->kernelB.first < batch->kernelB.second)
|
||||
dispatch->ApplyCatmarkVertexVerticesKernelB(this->_mesh, offset, level, batch->kernelB.first, batch->kernelB.second, clientdata);
|
||||
if (batch->kernelA1.first < batch->kernelA1.second)
|
||||
dispatch->ApplyCatmarkVertexVerticesKernelA(this->_mesh, offset, false, level, batch->kernelA1.first, batch->kernelA1.second, clientdata);
|
||||
if (batch->kernelA2.first < batch->kernelA2.second)
|
||||
dispatch->ApplyCatmarkVertexVerticesKernelA(this->_mesh, offset, true, level, batch->kernelA2.first, batch->kernelA2.second, clientdata);
|
||||
}
|
||||
|
||||
//
|
||||
// Face-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarCatmarkSubdivisionTables<T,U>::computeFacePoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * F_ITa = _F_ITa[level-1];
|
||||
const unsigned int * F_IT = _F_IT[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int h = F_ITa[2*i ],
|
||||
n = F_ITa[2*i+1];
|
||||
float weight = 1.0f/n;
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[ F_IT[h+j] ], weight, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[ F_IT[h+j] ], weight, clientdata );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Edge-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarCatmarkSubdivisionTables<T,U>::computeEdgePoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const unsigned int * E_IT = this->_E_IT[level-1];
|
||||
const float * E_W = this->_E_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int eidx0 = E_IT[4*i+0],
|
||||
eidx1 = E_IT[4*i+1],
|
||||
eidx2 = E_IT[4*i+2],
|
||||
eidx3 = E_IT[4*i+3];
|
||||
|
||||
float vertWeight = E_W[i*2+0];
|
||||
|
||||
// Fully sharp edge : vertWeight = 0.5f
|
||||
vdst->AddWithWeight( vsrc[eidx0], vertWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], vertWeight, clientdata );
|
||||
|
||||
if (eidx2!=-1) {
|
||||
// Apply fractional sharpness
|
||||
float faceWeight = E_W[i*2+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx2], faceWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx3], faceWeight, clientdata );
|
||||
}
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vertex-vertices compute Kernels "A" and "B" - completely re-entrant
|
||||
//
|
||||
|
||||
// multi-pass kernel handling k_Crease and k_Corner rules
|
||||
template <class T, class U> void
|
||||
FarCatmarkSubdivisionTables<T,U>::computeVertexPointsA( int offset, bool pass, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * V_ITa = this->_V_ITa[level-1];
|
||||
const float * V_W = this->_V_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
if (not pass)
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int n=V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p=V_ITa[5*i+2], // index of the parent vertex
|
||||
eidx0=V_ITa[5*i+3], // index of the first crease rule edge
|
||||
eidx1=V_ITa[5*i+4]; // index of the second crease rule edge
|
||||
|
||||
float weight = pass ? V_W[i] : 1.0f - V_W[i];
|
||||
|
||||
// In the case of fractional weight, the weight must be inverted since
|
||||
// the value is shared with the k_Smooth kernel (statistically the
|
||||
// k_Smooth kernel runs much more often than this one)
|
||||
if (weight>0.0f and weight<1.0f and n>0)
|
||||
weight=1.0f-weight;
|
||||
|
||||
// In the case of a k_Corner / k_Crease combination, the edge indices
|
||||
// won't be null, so we use a -1 valence to detect that particular case
|
||||
if (eidx0==-1 or (pass==false and (n==-1)) ) {
|
||||
// k_Corner case
|
||||
vdst->AddWithWeight( vsrc[p], weight, clientdata );
|
||||
} else {
|
||||
// k_Crease case
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f, clientdata );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
// multi-pass kernel handling k_Dart and k_Smooth rules
|
||||
template <class T, class U> void
|
||||
FarCatmarkSubdivisionTables<T,U>::computeVertexPointsB( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * V_ITa = this->_V_ITa[level-1];
|
||||
const unsigned int * V_IT = this->_V_IT[level-1];
|
||||
const float * V_W = this->_V_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int h = V_ITa[5*i ], // offset of the vertices in the _V0_IT array
|
||||
n = V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p = V_ITa[5*i+2]; // index of the parent vertex
|
||||
|
||||
float weight = V_W[i],
|
||||
wp = 1.0f/(n*n),
|
||||
wv = (n-2.0f)*n*wp;
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], weight * wv, clientdata );
|
||||
|
||||
for (int j=0; j<n; ++j) {
|
||||
vdst->AddWithWeight( vsrc[V_IT[h+j*2 ]], weight * wp, clientdata );
|
||||
vdst->AddWithWeight( vsrc[V_IT[h+j*2+1]], weight * wp, clientdata );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_CATMARK_SUBDIVISION_TABLES_H */
|
227
opensubdiv/far/dispatcher.h
Normal file
227
opensubdiv/far/dispatcher.h
Normal file
@ -0,0 +1,227 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_DISPATCHER_H
|
||||
#define FAR_DISPATCHER_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/subdivisionTables.h"
|
||||
#include "../far/bilinearSubdivisionTables.h"
|
||||
#include "../far/catmarkSubdivisionTables.h"
|
||||
#include "../far/loopSubdivisionTables.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
// Compute dispatcher : allows client code to this API to customize parts or the
|
||||
// entire computation process. This pattern aims at hiding the logic specific to
|
||||
// the subdivision algorithms and expose a simplified access to minimalistic
|
||||
// compute kernels. By default, meshes revert to a default dispatcher that implements
|
||||
// single-threaded CPU kernels.
|
||||
//
|
||||
// - derive a dispatcher class from this one
|
||||
// - override the virtual functions
|
||||
// - pass the derived dispatched to the factory (one instance can be shared by many meshes)
|
||||
// - call the FarMesh::Subdivide() to trigger computations
|
||||
//
|
||||
// Note : the caller is responsible for deleting a custom dispatcher
|
||||
template <class T, class U=T> class FarDispatcher {
|
||||
|
||||
|
||||
protected:
|
||||
friend class FarBilinearSubdivisionTables<T,U>;
|
||||
friend class FarCatmarkSubdivisionTables<T,U>;
|
||||
friend class FarLoopSubdivisionTables<T,U>;
|
||||
friend class FarMesh<T,U>;
|
||||
|
||||
virtual void Refine(FarMesh<T,U> * mesh, int maxlevel, void * clientdata=0) const;
|
||||
|
||||
|
||||
virtual void ApplyBilinearFaceVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyBilinearEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyBilinearVertexVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
|
||||
virtual void ApplyCatmarkFaceVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyCatmarkEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyCatmarkVertexVerticesKernelB(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyCatmarkVertexVerticesKernelA(FarMesh<T,U> * mesh, int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
|
||||
virtual void ApplyLoopEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyLoopVertexVerticesKernelB(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
virtual void ApplyLoopVertexVerticesKernelA(FarMesh<T,U> * mesh, int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
private:
|
||||
friend class FarMeshFactory<T,U>;
|
||||
|
||||
static FarDispatcher _DefaultDispatcher;
|
||||
};
|
||||
|
||||
|
||||
template<class T, class U> FarDispatcher<T,U> FarDispatcher<T,U>::_DefaultDispatcher;
|
||||
|
||||
template <class T,class U> void
|
||||
FarDispatcher<T,U>::Refine( FarMesh<T,U> * mesh, int maxlevel, void * data) const {
|
||||
|
||||
assert(mesh);
|
||||
|
||||
FarSubdivisionTables<T,U> const * tables = mesh->GetSubdivision();
|
||||
|
||||
if ( (maxlevel < 0) )
|
||||
maxlevel=tables->GetMaxLevel();
|
||||
else
|
||||
maxlevel = std::min(maxlevel, tables->GetMaxLevel());
|
||||
|
||||
for (int i=1; i<maxlevel; ++i)
|
||||
tables->Refine(i, data);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyBilinearFaceVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarBilinearSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarBilinearSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeFacePoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyBilinearEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarBilinearSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarBilinearSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeEdgePoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyBilinearVertexVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarBilinearSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarBilinearSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeVertexPoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyCatmarkFaceVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarCatmarkSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarCatmarkSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeFacePoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyCatmarkEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarCatmarkSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarCatmarkSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeEdgePoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyCatmarkVertexVerticesKernelB(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarCatmarkSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarCatmarkSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeVertexPointsB(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyCatmarkVertexVerticesKernelA(FarMesh<T,U> * mesh, int offset, bool pass, int level, int start, int end, void * clientdata) const {
|
||||
FarCatmarkSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarCatmarkSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeVertexPointsA(offset, pass, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyLoopEdgeVerticesKernel(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarLoopSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarLoopSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeEdgePoints(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyLoopVertexVerticesKernelB(FarMesh<T,U> * mesh, int offset, int level, int start, int end, void * clientdata) const {
|
||||
FarLoopSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarLoopSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeVertexPointsB(offset, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarDispatcher<T,U>::ApplyLoopVertexVerticesKernelA(FarMesh<T,U> * mesh, int offset, bool pass, int level, int start, int end, void * clientdata) const {
|
||||
FarLoopSubdivisionTables<T,U> const * subdivision =
|
||||
dynamic_cast<FarLoopSubdivisionTables<T,U> const *>(mesh->GetSubdivision());
|
||||
assert(subdivision);
|
||||
subdivision->computeVertexPointsA(offset, pass, level, start, end, clientdata);
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_DISPATCHER_H */
|
459
opensubdiv/far/loopSubdivisionTables.h
Normal file
459
opensubdiv/far/loopSubdivisionTables.h
Normal file
@ -0,0 +1,459 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_LOOP_SUBDIVISION_TABLES_H
|
||||
#define FAR_LOOP_SUBDIVISION_TABLES_H
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
#include "../hbr/loop.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/subdivisionTables.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
// Loop tables store the indexing tables required in order to compute
|
||||
// the refined positions of a mesh without the help of a hierarchical data
|
||||
// structure. The advantage of this representation is its ability to be executed
|
||||
// in a massively parallel environment without data dependencies.
|
||||
//
|
||||
|
||||
template <class T, class U=T> class FarLoopSubdivisionTables : public FarSubdivisionTables<T,U> {
|
||||
|
||||
public:
|
||||
|
||||
// Compute the positions of refined vertices using the specified kernels
|
||||
virtual void Refine( int level, void * data=0 ) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class FarMeshFactory<T,U>;
|
||||
friend class FarDispatcher<T,U>;
|
||||
|
||||
// Constructor : build level table at depth 'level'
|
||||
FarLoopSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int level );
|
||||
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of an edge.
|
||||
void computeEdgePoints(int offset, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "A" Handles the k_Smooth and k_Dart rules
|
||||
void computeVertexPointsA(int offset, bool pass, int level, int start, int end, void * clientdata) const;
|
||||
|
||||
// Compute-kernel applied to vertices resulting from the refinement of a vertex
|
||||
// Kernel "B" Handles the k_Crease and k_Corner rules
|
||||
void computeVertexPointsB(int offset,int level, int start, int end, void * clientdata) const;
|
||||
|
||||
};
|
||||
|
||||
// Constructor - generates indexing tables matching the Loop subdivision scheme.
|
||||
//
|
||||
// tables codices detail :
|
||||
//
|
||||
// codices detail :
|
||||
//
|
||||
// _E_ITa[0] : index of the org / dest vertices of the parent edge
|
||||
// _E_ITa[1] :
|
||||
// _E_ITa[2] : index of vertices refined from the faces left / right
|
||||
// _E_ITa[3] : of the parent edge
|
||||
//
|
||||
// _V_ITa[0] : offset to the corresponding adjacent vertices into _V0_IT
|
||||
// _V_ITa[1] : number of adjacent indices
|
||||
// _V_ITa[2] : index of the parent vertex
|
||||
// _V_ITa[3] : index of adjacent edge 0 (k_Crease rule)
|
||||
// _V_ITa[3] : index of adjacent edge 1 (k_Crease rule)
|
||||
//
|
||||
template <class T, class U>
|
||||
FarLoopSubdivisionTables<T,U>::FarLoopSubdivisionTables( FarMeshFactory<T,U> const & factory, FarMesh<T,U> * mesh, int maxlevel )
|
||||
: FarSubdivisionTables<T,U>(mesh, maxlevel)
|
||||
{
|
||||
std::vector<int> const & remap = factory._remapTable;
|
||||
|
||||
// Allocate memory for the indexing tables
|
||||
this->_E_IT.Resize(factory.GetNumEdgeVerticesTotal(maxlevel)*4);
|
||||
this->_E_W.Resize(factory.GetNumEdgeVerticesTotal(maxlevel)*2);
|
||||
|
||||
this->_V_ITa.Resize(factory.GetNumVertexVerticesTotal(maxlevel)*5);
|
||||
this->_V_IT.Resize(factory.GetNumAdjacentVertVerticesTotal(maxlevel));
|
||||
this->_V_W.Resize(factory.GetNumVertexVerticesTotal(maxlevel));
|
||||
|
||||
for (int level=1; level<=maxlevel; ++level) {
|
||||
|
||||
// pointer to the first vertex corresponding to this level
|
||||
this->_vertsOffsets[level] = factory._vertVertIdx[level-1] +
|
||||
factory._vertVertsList[level-1].size();
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch * batch = & (this->_batches[level-1]);
|
||||
|
||||
// Edge vertices
|
||||
unsigned int * E_IT = this->_E_IT[level-1];
|
||||
float * E_W = this->_E_W[level-1];
|
||||
batch->kernelE = (int)factory._edgeVertsList[level].size();
|
||||
for (int i=0; i < batch->kernelE; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._edgeVertsList[level][i];
|
||||
assert(v);
|
||||
HbrHalfedge<T> * e = v->GetParentEdge();
|
||||
assert(e);
|
||||
|
||||
float esharp = e->GetSharpness(),
|
||||
endPtWeight = 0.5f,
|
||||
oppPtWeight = 0.5f;
|
||||
|
||||
E_IT[4*i+0]= remap[e->GetOrgVertex()->GetID()];
|
||||
E_IT[4*i+1]= remap[e->GetDestVertex()->GetID()];
|
||||
|
||||
if (!e->IsBoundary() && esharp <= 1.0f) {
|
||||
endPtWeight = 0.375f + esharp * (0.5f - 0.375f);
|
||||
oppPtWeight = 0.125f * (1 - esharp);
|
||||
|
||||
HbrHalfedge<T>* ee = e->GetNext();
|
||||
E_IT[4*i+2]= remap[ee->GetDestVertex()->GetID()];
|
||||
ee = e->GetOpposite()->GetNext();
|
||||
E_IT[4*i+3]= remap[ee->GetDestVertex()->GetID()];
|
||||
} else {
|
||||
E_IT[4*i+2]= -1;
|
||||
E_IT[4*i+3]= -1;
|
||||
}
|
||||
E_W[2*i+0] = endPtWeight;
|
||||
E_W[2*i+1] = oppPtWeight;
|
||||
}
|
||||
this->_E_IT.SetMarker(level, &E_IT[4*batch->kernelE]);
|
||||
this->_E_W.SetMarker(level, &E_W[2*batch->kernelE]);
|
||||
|
||||
// Vertex vertices
|
||||
|
||||
batch->InitVertexKernels( factory._vertVertsList[level].size(), 0 );
|
||||
|
||||
int offset = 0;
|
||||
int * V_ITa = this->_V_ITa[level-1];
|
||||
unsigned int * V_IT = this->_V_IT[level-1];
|
||||
float * V_W = this->_V_W[level-1];
|
||||
int nverts = (int)factory._vertVertsList[level].size();
|
||||
for (int i=0; i < nverts; ++i) {
|
||||
|
||||
HbrVertex<T> * v = factory._vertVertsList[level][i],
|
||||
* pv = v->GetParentVertex();
|
||||
assert(v and pv);
|
||||
|
||||
// Look at HbrCatmarkSubdivision<T>::Subdivide for more details about
|
||||
// the multi-pass interpolation
|
||||
int masks[2], npasses;
|
||||
float weights[2];
|
||||
masks[0] = pv->GetMask(false);
|
||||
masks[1] = pv->GetMask(true);
|
||||
|
||||
// If the masks are identical, only a single pass is necessary. If the
|
||||
// vertex is transitionning to another rule, two passes are necessary,
|
||||
// except when transitionning from k_Dart to k_Smooth : the same
|
||||
// compute kernel is applied twice. Combining this special case allows
|
||||
// to batch the compute kernels into fewer calls.
|
||||
if (masks[0] != masks[1] and (
|
||||
not (masks[0]==HbrVertex<T>::k_Smooth and
|
||||
masks[1]==HbrVertex<T>::k_Dart))) {
|
||||
weights[1] = pv->GetFractionalMask();
|
||||
weights[0] = 1.0f - weights[1];
|
||||
npasses = 2;
|
||||
} else {
|
||||
weights[0] = 1.0f;
|
||||
weights[1] = 0.0f;
|
||||
npasses = 1;
|
||||
}
|
||||
|
||||
int rank = this->getMaskRanking(masks[0], masks[1]);
|
||||
|
||||
V_ITa[5*i+0] = offset;
|
||||
V_ITa[5*i+1] = 0;
|
||||
V_ITa[5*i+2] = remap[ pv->GetID() ];
|
||||
V_ITa[5*i+3] = -1;
|
||||
V_ITa[5*i+4] = -1;
|
||||
|
||||
for (int p=0; p<npasses; ++p)
|
||||
switch (masks[p]) {
|
||||
case HbrVertex<T>::k_Smooth :
|
||||
case HbrVertex<T>::k_Dart : {
|
||||
HbrHalfedge<T> *e = pv->GetIncidentEdge(),
|
||||
*start = e;
|
||||
do {
|
||||
V_ITa[5*i+1]++;
|
||||
|
||||
V_IT[offset++] = remap[ e->GetDestVertex()->GetID() ];
|
||||
|
||||
e = e->GetPrev()->GetOpposite();
|
||||
} while (e != start);
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Crease : {
|
||||
|
||||
class GatherCreaseEdgesOperator : public HbrHalfedgeOperator<T> {
|
||||
public:
|
||||
HbrVertex<T> * vertex; int eidx[2]; int count; bool next;
|
||||
|
||||
GatherCreaseEdgesOperator(HbrVertex<T> * v, bool n) : vertex(v), count(0), next(n) { eidx[0]=-1; eidx[1]=-1; }
|
||||
|
||||
virtual void operator() (HbrHalfedge<T> &e) {
|
||||
if (e.IsSharp(next) and count < 2) {
|
||||
HbrVertex<T> * a = e.GetDestVertex();
|
||||
if (a==vertex)
|
||||
a = e.GetOrgVertex();
|
||||
eidx[count++]=a->GetID();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GatherCreaseEdgesOperator op( pv, p==1 );
|
||||
pv->ApplyOperatorSurroundingEdges( op );
|
||||
|
||||
assert(V_ITa[5*i+3]==-1 and V_ITa[5*i+4]==-1);
|
||||
assert(op.eidx[0]!=-1 and op.eidx[1]!=-1);
|
||||
V_ITa[5*i+3] = remap[op.eidx[0]];
|
||||
V_ITa[5*i+4] = remap[op.eidx[1]];
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Corner :
|
||||
// in the case of a k_Crease / k_Corner pass combination, we
|
||||
// need to set the valence to -1 to tell the "B" Kernel to
|
||||
// switch to k_Corner rule (as edge indices won't be -1)
|
||||
if (V_ITa[5*i+1]==0)
|
||||
V_ITa[5*i+1] = -1;
|
||||
|
||||
default : break;
|
||||
}
|
||||
|
||||
if (rank>7)
|
||||
// the k_Corner and k_Crease single-pass cases apply a weight of 1.0
|
||||
// but this value is inverted in the kernel
|
||||
V_W[i] = 0.0;
|
||||
else
|
||||
V_W[i] = weights[0];
|
||||
|
||||
batch->AddVertex( i, rank );
|
||||
}
|
||||
this->_V_ITa.SetMarker(level, &V_ITa[5*nverts]);
|
||||
this->_V_IT.SetMarker(level, &V_IT[offset]);
|
||||
this->_V_W.SetMarker(level, &V_W[nverts]);
|
||||
|
||||
batch->kernelB.second++;
|
||||
batch->kernelA1.second++;
|
||||
batch->kernelA2.second++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarLoopSubdivisionTables<T,U>::Refine( int level, void * clientdata ) const
|
||||
{
|
||||
assert(this->_mesh and level>0);
|
||||
|
||||
typename FarSubdivisionTables<T,U>::VertexKernelBatch const * batch = & (this->_batches[level-1]);
|
||||
|
||||
FarDispatcher<T,U> const * dispatch = this->_mesh->GetDispatcher();
|
||||
assert(dispatch);
|
||||
|
||||
int offset = this->GetFirstVertexOffset(level);
|
||||
if (batch->kernelE>0)
|
||||
dispatch->ApplyLoopEdgeVerticesKernel(this->_mesh, offset, level, 0, batch->kernelE, clientdata);
|
||||
|
||||
offset += this->GetNumEdgeVertices(level);
|
||||
if (batch->kernelB.first < batch->kernelB.second)
|
||||
dispatch->ApplyLoopVertexVerticesKernelB(this->_mesh, offset, level, batch->kernelB.first, batch->kernelB.second, clientdata);
|
||||
if (batch->kernelA1.first < batch->kernelA1.second)
|
||||
dispatch->ApplyLoopVertexVerticesKernelA(this->_mesh, offset, false, level, batch->kernelA1.first, batch->kernelA1.second, clientdata);
|
||||
if (batch->kernelA2.first < batch->kernelA2.second)
|
||||
dispatch->ApplyLoopVertexVerticesKernelA(this->_mesh, offset, true, level, batch->kernelA2.first, batch->kernelA2.second, clientdata);
|
||||
}
|
||||
|
||||
//
|
||||
// Edge-vertices compute Kernel - completely re-entrant
|
||||
//
|
||||
|
||||
template <class T, class U> void
|
||||
FarLoopSubdivisionTables<T,U>::computeEdgePoints( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const unsigned int * E_IT = this->_E_IT[level-1];
|
||||
const float * E_W = this->_E_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int eidx0 = E_IT[4*i+0],
|
||||
eidx1 = E_IT[4*i+1],
|
||||
eidx2 = E_IT[4*i+2],
|
||||
eidx3 = E_IT[4*i+3];
|
||||
|
||||
float endPtWeight = E_W[i*2+0];
|
||||
|
||||
// Fully sharp edge : endPtWeight = 0.5f
|
||||
vdst->AddWithWeight( vsrc[eidx0], endPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], endPtWeight, clientdata );
|
||||
|
||||
if (eidx2!=-1) {
|
||||
// Apply fractional sharpness
|
||||
float oppPtWeight = E_W[i*2+1];
|
||||
|
||||
vdst->AddWithWeight( vsrc[eidx2], oppPtWeight, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx3], oppPtWeight, clientdata );
|
||||
}
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx0], 0.5f, clientdata );
|
||||
vdst->AddVaryingWithWeight( vsrc[eidx1], 0.5f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vertex-vertices compute Kernels "A" and "B" - completely re-entrant
|
||||
//
|
||||
|
||||
// multi-pass kernel handling k_Crease and k_Corner rules
|
||||
template <class T, class U> void
|
||||
FarLoopSubdivisionTables<T,U>::computeVertexPointsA( int offset, bool pass, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * V_ITa = this->_V_ITa[level-1];
|
||||
const float * V_W = this->_V_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
if (not pass)
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int n=V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p=V_ITa[5*i+2], // index of the parent vertex
|
||||
eidx0=V_ITa[5*i+3], // index of the first crease rule edge
|
||||
eidx1=V_ITa[5*i+4]; // index of the second crease rule edge
|
||||
|
||||
float weight = pass ? V_W[i] : 1.0f - V_W[i];
|
||||
|
||||
// In the case of fractional weight, the weight must be inverted since
|
||||
// the value is shared with the k_Smooth kernel (statistically the
|
||||
// k_Smooth kernel runs much more often than this one)
|
||||
if (weight>0.0f and weight<1.0f and n>0)
|
||||
weight=1.0f-weight;
|
||||
|
||||
// In the case of a k_Corner / k_Crease combination, the edge indices
|
||||
// won't be null, so we use a -1 valence to detect that particular case
|
||||
if (eidx0==-1 or (pass==false and (n==-1)) ) {
|
||||
// k_Corner case
|
||||
vdst->AddWithWeight( vsrc[p], weight, clientdata );
|
||||
} else {
|
||||
// k_Crease case
|
||||
vdst->AddWithWeight( vsrc[p], weight * 0.75f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx0], weight * 0.125f, clientdata );
|
||||
vdst->AddWithWeight( vsrc[eidx1], weight * 0.125f, clientdata );
|
||||
}
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
// multi-pass kernel handling k_Dart and k_Smooth rules
|
||||
template <class T, class U> void
|
||||
FarLoopSubdivisionTables<T,U>::computeVertexPointsB( int offset, int level, int start, int end, void * clientdata ) const {
|
||||
|
||||
assert(this->_mesh);
|
||||
|
||||
U * vsrc = &this->_mesh->GetVertices().at(0),
|
||||
* vdst = vsrc + offset + start;
|
||||
|
||||
const int * V_ITa = this->_V_ITa[level-1];
|
||||
const unsigned int * V_IT = this->_V_IT[level-1];
|
||||
const float * V_W = this->_V_W[level-1];
|
||||
|
||||
for (int i=start; i<end; ++i, ++vdst ) {
|
||||
|
||||
vdst->Clear(clientdata);
|
||||
|
||||
int h = V_ITa[5*i ], // offset of the vertices in the _V0_IT array
|
||||
n = V_ITa[5*i+1], // number of vertices in the _VO_IT array (valence)
|
||||
p = V_ITa[5*i+2]; // index of the parent vertex
|
||||
|
||||
float weight = V_W[i],
|
||||
wp = 1.0f/n,
|
||||
beta = 0.25f * cosf((float)M_PI * 2.0f * wp) + 0.375f;
|
||||
beta = beta*beta;
|
||||
beta = (0.625f-beta)*wp;
|
||||
|
||||
vdst->AddWithWeight( vsrc[p], weight * (1.0f-(beta*n)), clientdata);
|
||||
|
||||
for (int j=0; j<n; ++j)
|
||||
vdst->AddWithWeight( vsrc[V_IT[h+j]], weight * beta );
|
||||
|
||||
vdst->AddVaryingWithWeight( vsrc[p], 1.0f, clientdata );
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_LOOP_SUBDIVISION_TABLES_H */
|
183
opensubdiv/far/mesh.h
Normal file
183
opensubdiv/far/mesh.h
Normal file
@ -0,0 +1,183 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_MESH_H
|
||||
#define FAR_MESH_H
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T, class U> class FarMeshFactory;
|
||||
template <class T, class U> class FarSubdivisionTables;
|
||||
template <class T, class U> class FarDispatcher;
|
||||
|
||||
// Core serialized subdivision mesh class.
|
||||
//
|
||||
// In order to support both interleaved & non-interleaved vertex access,
|
||||
// classes are dual-templated : T corresponds to the Hbr vertex representation
|
||||
// while U correcsponds to this library's vertex representation. In some cases,
|
||||
// the actual positions of the vertices are irrelevant, so passing an "empty"
|
||||
// vertex class to Hbr is perfectly acceptable and saves some data-copy steps.
|
||||
|
||||
template <class T, class U=T> class FarMesh {
|
||||
public:
|
||||
|
||||
~FarMesh();
|
||||
|
||||
// returns the subdivision method
|
||||
FarSubdivisionTables<T,U> const * GetSubdivision() const { return _subdivision; }
|
||||
|
||||
// returns the compute dispatcher
|
||||
FarDispatcher<T,U> const * GetDispatcher() const { return _dispatcher; }
|
||||
|
||||
enum PatchType {
|
||||
k_BilinearTriangles,
|
||||
k_BilinearQuads,
|
||||
k_Triangles,
|
||||
};
|
||||
|
||||
// returns the type of patches described by the face vertices list
|
||||
PatchType GetPatchType() const { return _patchtype; }
|
||||
|
||||
// returns the list of vertices in the mesh (from subdiv level 0 to N)
|
||||
std::vector<U> & GetVertices() { return _vertices; }
|
||||
|
||||
U & GetVertex(int index) { return _vertices[index]; }
|
||||
|
||||
// returns the list of indices of the vertices of the faces in the mesh
|
||||
std::vector<int> const & GetFaceVertices(int level) const;
|
||||
|
||||
// returns the number of coarse vertices held at the beginning of the vertex
|
||||
// buffer.
|
||||
int GetNumCoarseVertices() const;
|
||||
|
||||
// returns the total number of vertices in the mesh across across all depths
|
||||
int GetNumVertices() const { return (int)(_vertices.size()); }
|
||||
|
||||
// apply the subdivision tables to compute the positions of the vertices up
|
||||
// to 'level'
|
||||
void Subdivide(int level=-1);
|
||||
|
||||
private:
|
||||
friend class FarMeshFactory<T,U>;
|
||||
|
||||
FarMesh() : _subdivision(0), _dispatcher(0) {}
|
||||
|
||||
// non-copyable, so these are not implemented:
|
||||
FarMesh(FarMesh<T,U> const &);
|
||||
FarMesh<T,U> & operator = (FarMesh<T,U> const &);
|
||||
|
||||
// subdivision method used in this mesh
|
||||
FarSubdivisionTables<T,U> * _subdivision;
|
||||
|
||||
// customizable compute dispatcher class
|
||||
FarDispatcher<T,U> * _dispatcher;
|
||||
|
||||
// list of vertices (up to N levels of subdivision)
|
||||
std::vector<U> _vertices;
|
||||
|
||||
// list of vertex indices for each face
|
||||
std::vector< std::vector<int> > _faceverts;
|
||||
|
||||
PatchType _patchtype;
|
||||
|
||||
// number of vertices at level 0 of subdivision
|
||||
int _numCoarseVertices;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
FarMesh<T,U>::~FarMesh()
|
||||
{
|
||||
delete _subdivision;
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarMesh<T,U>::GetNumCoarseVertices() const {
|
||||
return _numCoarseVertices;
|
||||
}
|
||||
|
||||
template <class T, class U> std::vector<int> const &
|
||||
FarMesh<T,U>::GetFaceVertices(int level) const {
|
||||
if ( (level>=0) and (level<(int)_faceverts.size()) )
|
||||
return _faceverts[level];
|
||||
return _faceverts[0];
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarMesh<T,U>::Subdivide(int maxlevel) {
|
||||
|
||||
assert(_subdivision);
|
||||
|
||||
if ( (maxlevel < 0) )
|
||||
maxlevel=_subdivision->GetMaxLevel();
|
||||
else
|
||||
maxlevel = std::min(maxlevel, _subdivision->GetMaxLevel());
|
||||
|
||||
for (int i=1; i<maxlevel; ++i)
|
||||
_subdivision->Refine(i);
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_MESH_H */
|
456
opensubdiv/far/meshFactory.h
Normal file
456
opensubdiv/far/meshFactory.h
Normal file
@ -0,0 +1,456 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_MESH_FACTORY_H
|
||||
#define FAR_MESH_FACTORY_H
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
#include "../hbr/bilinear.h"
|
||||
#include "../hbr/catmark.h"
|
||||
#include "../hbr/loop.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "../far/mesh.h"
|
||||
#include "../far/dispatcher.h"
|
||||
#include "../far/bilinearSubdivisionTables.h"
|
||||
#include "../far/catmarkSubdivisionTables.h"
|
||||
#include "../far/loopSubdivisionTables.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
|
||||
// The meshFactory institutes a 2 steps process in the conversion of a mesh from
|
||||
// an HbrMesh<T>. The main reason is that client code may want to have access
|
||||
// to the remapping table that correlates vertices from both meshes for reasons
|
||||
// of their own. This is also useful to the unit-test code which can match the
|
||||
// subdivision results of both code paths for correctness.
|
||||
|
||||
template <class T, class U=T> class FarMeshFactory {
|
||||
|
||||
public:
|
||||
|
||||
// Constructor for the factory : analyzes the HbrMesh and stores
|
||||
// transient data used to create the adaptive patch representation.
|
||||
// Once the new rep has been instantiated with 'Create', this factory
|
||||
// object can be deleted safely.
|
||||
FarMeshFactory(HbrMesh<T> * mesh, int maxlevel);
|
||||
|
||||
// create a table-based mesh representation
|
||||
// XXXX : this creator will take the options for adaptive patch meshes
|
||||
FarMesh<T,U> * Create( FarDispatcher<T,U> * dispatch=0 );
|
||||
|
||||
// maximum level of subidivision supported by this factory
|
||||
int GetMaxLevel() const { return _maxlevel; }
|
||||
|
||||
// total number of vertices of a given type up to level
|
||||
int GetNumFaceVerticesTotal(int level) const {
|
||||
return sumList<HbrVertex<T> *>(_faceVertsList, level);
|
||||
}
|
||||
|
||||
int GetNumEdgeVerticesTotal(int level) const {
|
||||
return sumList<HbrVertex<T> *>(_edgeVertsList, level);
|
||||
}
|
||||
|
||||
int GetNumVertexVerticesTotal(int level) const {
|
||||
return sumList<HbrVertex<T> *>(_vertVertsList, level);
|
||||
}
|
||||
|
||||
int GetNumAdjacentVertVerticesTotal(int level) const;
|
||||
|
||||
// total number of faces across up to a level
|
||||
int GetNumFacesTotal(int level) const {
|
||||
return sumList<HbrFace<T> *>(_facesList, level);
|
||||
}
|
||||
|
||||
// return the corresponding index of the HbrVertex<T> in the new mesh
|
||||
int GetVertexID( HbrVertex<T> * v );
|
||||
|
||||
std::vector<int> const & GetRemappingTable( ) const { return _remapTable; }
|
||||
|
||||
private:
|
||||
friend class FarBilinearSubdivisionTables<T,U>;
|
||||
friend class FarCatmarkSubdivisionTables<T,U>;
|
||||
friend class FarLoopSubdivisionTables<T,U>;
|
||||
|
||||
// non-copyable, so these are not implemented:
|
||||
FarMeshFactory( FarMeshFactory const & );
|
||||
FarMeshFactory<T,U> & operator=(FarMeshFactory<T,U> const &);
|
||||
|
||||
static bool isBilinear(HbrMesh<T> * mesh);
|
||||
|
||||
static bool isCatmark(HbrMesh<T> * mesh);
|
||||
|
||||
static bool isLoop(HbrMesh<T> * mesh);
|
||||
|
||||
void copyTopology( std::vector<int> & vec, int level );
|
||||
|
||||
static void refine( HbrMesh<T> * mesh, int maxlevel );
|
||||
|
||||
template <class Type> static int sumList( std::vector<std::vector<Type> > const & list, int level );
|
||||
|
||||
HbrMesh<T> * _hbrMesh;
|
||||
|
||||
int _maxlevel,
|
||||
_numVertices,
|
||||
_numFaces;
|
||||
|
||||
// per-level counters and offsets for each type of vertex (face,edge,vert)
|
||||
std::vector<int> _faceVertIdx,
|
||||
_edgeVertIdx,
|
||||
_vertVertIdx;
|
||||
|
||||
// number of indices required for the vertex iteration table at each level
|
||||
std::vector<int> _vertVertsListSize;
|
||||
|
||||
// remapping table to translate vertex ID's between Hbr indices and the
|
||||
// order of the same vertices in the tables
|
||||
std::vector<int> _remapTable;
|
||||
|
||||
// lists of vertices sorted by type and level
|
||||
std::vector<std::vector< HbrVertex<T> *> > _faceVertsList,
|
||||
_edgeVertsList,
|
||||
_vertVertsList;
|
||||
|
||||
// list of faces sorted by level
|
||||
std::vector<std::vector< HbrFace<T> *> > _facesList;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
template <class Type> int
|
||||
FarMeshFactory<T,U>::sumList( std::vector<std::vector<Type> > const & list, int level) {
|
||||
|
||||
level = std::min(level, (int)list.size());
|
||||
int total = 0;
|
||||
for (int i=0; i<=level; ++i)
|
||||
total += (int)list[i].size();
|
||||
return total;
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarMeshFactory<T,U>::GetNumAdjacentVertVerticesTotal(int level) const {
|
||||
|
||||
level = std::min(level, GetMaxLevel());
|
||||
int total = 0;
|
||||
for (int i=0; i<=level; ++i)
|
||||
total += _vertVertsListSize[i];
|
||||
return total;
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarMeshFactory<T,U>::refine( HbrMesh<T> * mesh, int maxlevel ) {
|
||||
|
||||
for (int l=0; l<maxlevel; ++l ) {
|
||||
int nfaces = mesh->GetNumFaces();
|
||||
for (int i=0; i<nfaces; ++i) {
|
||||
HbrFace<T> * f = mesh->GetFace(i);
|
||||
if (f->GetDepth()==l)
|
||||
f->Refine();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Assumption : the order of the vertices in the HbrMesh could be set in any
|
||||
// random order, so the builder runs 2 passes over the entire vertex list to
|
||||
// gather the counters needed to generate the indexing tables.
|
||||
template <class T, class U>
|
||||
FarMeshFactory<T,U>::FarMeshFactory( HbrMesh<T> * mesh, int maxlevel ) :
|
||||
_hbrMesh(mesh),
|
||||
_maxlevel(maxlevel),
|
||||
_numVertices(-1),
|
||||
_numFaces(-1),
|
||||
_faceVertIdx(maxlevel+1,0),
|
||||
_edgeVertIdx(maxlevel+1,0),
|
||||
_vertVertIdx(maxlevel+1,0),
|
||||
_vertVertsListSize(maxlevel+1,0),
|
||||
_faceVertsList(maxlevel+1),
|
||||
_edgeVertsList(maxlevel+1),
|
||||
_vertVertsList(maxlevel+1),
|
||||
_facesList(maxlevel+1)
|
||||
{
|
||||
// non-adaptive subdivision of the Hbr mesh up to maxlevel
|
||||
refine( mesh, maxlevel);
|
||||
|
||||
int numVertices = mesh->GetNumVertices();
|
||||
int numFaces = mesh->GetNumFaces();
|
||||
|
||||
std::vector<int> faceCounts(maxlevel+1,0),
|
||||
edgeCounts(maxlevel+1,0),
|
||||
vertCounts(maxlevel+1,0);
|
||||
|
||||
// First pass (vertices) : count the vertices of each type for each depth
|
||||
// up to maxlevel (values are dependent on topology).
|
||||
int maxvertid=-1;
|
||||
for (int i=0; i<numVertices; ++i) {
|
||||
|
||||
HbrVertex<T> * v = mesh->GetVertex(i);
|
||||
assert(v);
|
||||
|
||||
int depth = v->GetFace()->GetDepth();
|
||||
|
||||
if (depth>maxlevel)
|
||||
continue;
|
||||
|
||||
if (depth==0 )
|
||||
vertCounts[depth]++;
|
||||
|
||||
if (v->GetID()>maxvertid)
|
||||
maxvertid = v->GetID();
|
||||
|
||||
if (not v->OnBoundary())
|
||||
_vertVertsListSize[depth] += v->GetValence();
|
||||
else if (v->GetValence()!=2)
|
||||
_vertVertsListSize[depth] ++;
|
||||
|
||||
if (v->GetParentFace())
|
||||
faceCounts[depth]++;
|
||||
else if (v->GetParentEdge())
|
||||
edgeCounts[depth]++;
|
||||
else if (v->GetParentVertex())
|
||||
vertCounts[depth]++;
|
||||
}
|
||||
|
||||
// Per-level offset to the first vertex of each type in the global vertex map
|
||||
_vertVertsList[0].reserve( vertCounts[0] );
|
||||
for (int l=1; l<(maxlevel+1); ++l) {
|
||||
_faceVertIdx[l]= _vertVertIdx[l-1]+vertCounts[l-1];
|
||||
_edgeVertIdx[l]= _faceVertIdx[l]+faceCounts[l];
|
||||
_vertVertIdx[l]= _edgeVertIdx[l]+edgeCounts[l];
|
||||
|
||||
_faceVertsList[l].reserve( faceCounts[l] );
|
||||
_edgeVertsList[l].reserve( edgeCounts[l] );
|
||||
_vertVertsList[l].reserve( vertCounts[l] );
|
||||
}
|
||||
|
||||
// reset counters
|
||||
faceCounts.assign(maxlevel+1,0);
|
||||
edgeCounts.assign(maxlevel+1,0);
|
||||
|
||||
_remapTable.resize( maxvertid+1, -1);
|
||||
|
||||
// Second pass (vertices) : calculate the starting indices of the sub-tables
|
||||
// (face, edge, verts...) and populate the remapping table.
|
||||
for (int i=0; i<numVertices; ++i) {
|
||||
|
||||
HbrVertex<T> * v = mesh->GetVertex(i);
|
||||
assert(v);
|
||||
|
||||
int depth = v->GetFace()->GetDepth();
|
||||
|
||||
if (depth>maxlevel)
|
||||
continue;
|
||||
|
||||
assert( _remapTable[ v->GetID() ] = -1 );
|
||||
|
||||
if (depth==0) {
|
||||
_vertVertsList[ depth ].push_back( v );
|
||||
_remapTable[ v->GetID() ] = v->GetID();
|
||||
} else if (v->GetParentFace()) {
|
||||
_remapTable[ v->GetID() ]=_faceVertIdx[depth]+faceCounts[depth]++;
|
||||
_faceVertsList[ depth ].push_back( v );
|
||||
} else if (v->GetParentEdge()) {
|
||||
_remapTable[ v->GetID() ]=_edgeVertIdx[depth]+edgeCounts[depth]++;
|
||||
_edgeVertsList[ depth ].push_back( v );
|
||||
} else if (v->GetParentVertex()) {
|
||||
// vertices need to be sorted separately based on compute kernel :
|
||||
// the remapping step is done just after this
|
||||
_vertVertsList[ depth ].push_back( v );
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the the vertices that are the child of a vertex based on their weight
|
||||
// mask. The masks combinations are ordered so as to minimize the compute
|
||||
// kernel switching ( more information on this in the HbrVertex<T> comparison
|
||||
// function 'FarSubdivisionTables<T>::compareVertices' ).
|
||||
for (size_t i=1; i<_vertVertsList.size(); ++i)
|
||||
std::sort(_vertVertsList[i].begin(), _vertVertsList[i].end(),
|
||||
FarSubdivisionTables<T,U>::compareVertices);
|
||||
|
||||
// These vertices still need a remapped index
|
||||
for (int l=1; l<(maxlevel+1); ++l)
|
||||
for (size_t i=0; i<_vertVertsList[l].size(); ++i)
|
||||
_remapTable[ _vertVertsList[l][i]->GetID() ]=_vertVertIdx[l]+i;
|
||||
|
||||
|
||||
// Third pass (faces) : populate the face lists.
|
||||
int fsize=0;
|
||||
for (int i=0; i<numFaces; ++i) {
|
||||
HbrFace<T> * f = mesh->GetFace(i);
|
||||
assert(f);
|
||||
if (f->GetDepth()==0)
|
||||
fsize += mesh->GetSubdivision()->GetFaceChildrenCount( f->GetNumVertices() );
|
||||
}
|
||||
|
||||
_facesList[0].reserve(mesh->GetNumCoarseFaces());
|
||||
_facesList[1].reserve(fsize);
|
||||
for (int l=2; l<=maxlevel; ++l)
|
||||
_facesList[l].reserve( _facesList[l-1].capacity()*4 );
|
||||
|
||||
for (int i=0; i<numFaces; ++i) {
|
||||
HbrFace<T> * f = mesh->GetFace(i);
|
||||
if (f->GetDepth()<=maxlevel)
|
||||
_facesList[ f->GetDepth() ].push_back(f);
|
||||
}
|
||||
|
||||
_numFaces = GetNumFacesTotal(maxlevel);
|
||||
_numVertices = GetNumFaceVerticesTotal(maxlevel) +
|
||||
GetNumEdgeVerticesTotal(maxlevel) +
|
||||
GetNumVertexVerticesTotal(maxlevel);
|
||||
}
|
||||
|
||||
template <class T, class U> bool
|
||||
FarMeshFactory<T,U>::isBilinear(HbrMesh<T> * mesh) {
|
||||
return typeid(*(mesh->GetSubdivision()))==typeid(HbrBilinearSubdivision<T>);
|
||||
}
|
||||
|
||||
template <class T, class U> bool
|
||||
FarMeshFactory<T,U>::isCatmark(HbrMesh<T> * mesh) {
|
||||
return typeid(*(mesh->GetSubdivision()))==typeid(HbrCatmarkSubdivision<T>);
|
||||
}
|
||||
|
||||
template <class T, class U> bool
|
||||
FarMeshFactory<T,U>::isLoop(HbrMesh<T> * mesh) {
|
||||
return typeid(*(mesh->GetSubdivision()))==typeid(HbrLoopSubdivision<T>);
|
||||
}
|
||||
|
||||
template <class T, class U> void
|
||||
FarMeshFactory<T,U>::copyTopology( std::vector<int> & vec, int level ) {
|
||||
|
||||
assert( _hbrMesh );
|
||||
|
||||
int nv=-1;
|
||||
if ( isCatmark(_hbrMesh) or isBilinear(_hbrMesh) )
|
||||
nv=4;
|
||||
else if ( isLoop(_hbrMesh) )
|
||||
nv=3;
|
||||
|
||||
assert(nv>0);
|
||||
|
||||
vec.resize( nv * _facesList[level].size(), -1 );
|
||||
|
||||
for (int i=0; i<(int)_facesList[level].size(); ++i) {
|
||||
HbrFace<T> * f = _facesList[level][i];
|
||||
assert( f and f->GetNumVertices()==nv);
|
||||
for (int j=0; j<f->GetNumVertices(); ++j)
|
||||
vec[nv*i+j]=_remapTable[f->GetVertex(j)->GetID()];
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U> FarMesh<T,U> *
|
||||
FarMeshFactory<T,U>::Create( FarDispatcher<T,U> * dispatch ) {
|
||||
|
||||
assert( _hbrMesh );
|
||||
|
||||
if (_maxlevel<1)
|
||||
return 0;
|
||||
|
||||
FarMesh<T,U> * result = new FarMesh<T,U>();
|
||||
|
||||
if (dispatch)
|
||||
result->_dispatcher = dispatch;
|
||||
else
|
||||
result->_dispatcher = & FarDispatcher<T,U>::_DefaultDispatcher;
|
||||
|
||||
if ( isBilinear( _hbrMesh ) ) {
|
||||
result->_subdivision =
|
||||
new FarBilinearSubdivisionTables<T,U>( *this, result, _maxlevel );
|
||||
} else if ( isCatmark( _hbrMesh ) ) {
|
||||
result->_subdivision =
|
||||
new FarCatmarkSubdivisionTables<T,U>( *this, result, _maxlevel );
|
||||
} else if ( isLoop(_hbrMesh) ) {
|
||||
result->_subdivision =
|
||||
new FarLoopSubdivisionTables<T,U>( *this, result, _maxlevel );
|
||||
} else
|
||||
assert(0);
|
||||
|
||||
result->_numCoarseVertices = (int)_vertVertsList[0].size();
|
||||
|
||||
// Copy the data of the coarse vertices into the vertex buffer.
|
||||
// XXXX : we should figure out a test to make sure that the vertex
|
||||
// class is not an empty placeholder (ex. non-interleaved data)
|
||||
result->_vertices.resize( _numVertices );
|
||||
for (int i=0; i<result->GetNumCoarseVertices(); ++i)
|
||||
result->_vertices[i] = _hbrMesh->GetVertex(i)->GetData();
|
||||
|
||||
// Populate topology (face verts indices)
|
||||
// XXXX : only k_BilinearQuads support for now - adaptive bicubic patches to come
|
||||
result->_patchtype = FarMesh<T,U>::k_BilinearQuads;
|
||||
|
||||
// XXXX : we should let the client decide which levels to copy,
|
||||
// they may only want vertices...
|
||||
result->_faceverts.resize(_maxlevel+1);
|
||||
for (int l=1; l<=_maxlevel; ++l)
|
||||
copyTopology(result->_faceverts[l], l);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarMeshFactory<T,U>::GetVertexID( HbrVertex<T> * v ) {
|
||||
assert( v and (v->GetID() < _remapTable.size()) );
|
||||
return _remapTable[ v->GetID() ];
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_MESH_FACTORY_H */
|
357
opensubdiv/far/subdivisionTables.h
Normal file
357
opensubdiv/far/subdivisionTables.h
Normal file
@ -0,0 +1,357 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef FAR_SUBDIVISION_TABLES_H
|
||||
#define FAR_SUBDIVISION_TABLES_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrMesh;
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T, class U> class FarMesh;
|
||||
template <class T, class U> class FarMeshFactory;
|
||||
|
||||
// Catmull-Clark tables store the indexing tables required in order to compute
|
||||
// the refined positions of a mesh without the help of a hierarchical data
|
||||
// structure. The advantage of this representation is its ability to be executed
|
||||
// in a massively parallel environment without data dependencies.
|
||||
//
|
||||
// The vertex indexing tables require the vertex buffer to be sorted based on the
|
||||
// nature of the parent of a given vertex : either a face, an edge, or a vertex.
|
||||
//
|
||||
// [...Child of a Face...]|[... Child of an Edge ...]|[... Child of a Vertex ...]
|
||||
//
|
||||
// Each segment of the buffer is associated the following tables (<T> is the type):
|
||||
// _<T>_IT : indices of all the adjacent vertices required by the compute kernels
|
||||
// _<T>_W : fractional weight of the vertex (based on sharpness & topology)
|
||||
// _<T>_ITa : codex for the two previous tables
|
||||
|
||||
// For more details see : "Feature Adaptive GPU Rendering of Catmull-Clark
|
||||
// Subdivision Surfaces" p.3 - par. 3.2
|
||||
template <class T, class U=T> class FarSubdivisionTables {
|
||||
public:
|
||||
|
||||
// Destructor
|
||||
virtual ~FarSubdivisionTables<T,U>() {}
|
||||
|
||||
// Return the highest level of subdivision possible with these tables
|
||||
int GetMaxLevel() const { return (int)(_vertsOffsets.size()); }
|
||||
|
||||
// Memory required to store the indexing tables
|
||||
virtual size_t GetMemoryUsed() const;
|
||||
|
||||
// Compute the positions of refined vertices using the specified kernels
|
||||
virtual void Refine( int level, void * clientdata=0 ) const=0;
|
||||
|
||||
// Pointer back to the mesh owning the table
|
||||
FarMesh<T,U> * GetMesh() { return _mesh; }
|
||||
|
||||
// The index of the first vertex that belongs to the level of subdivision
|
||||
// represented by this set of FarCatmarkSubdivisionTables
|
||||
int GetFirstVertexOffset( int level ) const;
|
||||
|
||||
// Number of vertices children of a face at a given level (always 0 for Loop)
|
||||
int GetNumFaceVertices( int level ) const;
|
||||
|
||||
// Number of vertices children of an edge at a given level
|
||||
int GetNumEdgeVertices( int level ) const;
|
||||
|
||||
// Number of vertices children of a vertex at a given level
|
||||
int GetNumVertexVertices( int level ) const;
|
||||
|
||||
// Total number of vertices at a given level
|
||||
int GetNumVertices( int level ) const;
|
||||
|
||||
// Indexing tables accessors
|
||||
|
||||
// Generic multi-level indexing table : the indices across all the subdivision
|
||||
// levels are stored in a single std::vector. The table class holds a sequence
|
||||
// of markers pointing to the first index at the beginning of the sequence
|
||||
// describing a given level (note that "level 1" vertices are obtained by using
|
||||
// the indices starting at "level 0" of the tables)
|
||||
template <typename Type> class Table {
|
||||
std::vector<Type> _data; // table data
|
||||
std::vector<Type *> _markers; // pointers to the first datum at each level
|
||||
public:
|
||||
// Returns the memory required to store the data in this table.
|
||||
size_t GetMemoryUsed() const {
|
||||
return _data.size() * sizeof(Type);
|
||||
}
|
||||
|
||||
void SetMarker(int level, Type * marker) {
|
||||
_markers[level] = marker;
|
||||
}
|
||||
|
||||
void Resize(int size) {
|
||||
_data.resize(size);
|
||||
_markers[0] = &_data[0];
|
||||
}
|
||||
|
||||
Table(int maxlevel) : _markers(maxlevel) { }
|
||||
|
||||
Type * operator[](int level) {
|
||||
assert(level>=0 and level<(int)_markers.size());
|
||||
return _markers[level];
|
||||
}
|
||||
|
||||
const Type * operator[](int level) const {
|
||||
return const_cast<Table *>(this)->operator[](level);
|
||||
}
|
||||
};
|
||||
|
||||
Table<unsigned int> const & Get_E_IT() const { return _E_IT; }
|
||||
|
||||
Table<float> const & Get_E_W() const { return _E_W; }
|
||||
|
||||
Table<int> const & Get_V_ITa() const { return _V_ITa; }
|
||||
|
||||
Table<unsigned int> const & Get_V_IT() const { return _V_IT; }
|
||||
|
||||
Table<float> const & Get_V_W() const { return _V_W; }
|
||||
|
||||
protected:
|
||||
friend class FarMeshFactory<T,U>;
|
||||
|
||||
FarSubdivisionTables<T,U>( FarMesh<T,U> * mesh, int maxlevel );
|
||||
|
||||
// Returns an integer based on the order in which the kernels are applied
|
||||
static int getMaskRanking( unsigned char mask0, unsigned char mask1 );
|
||||
|
||||
// Compares to vertices based on the ranking of their hbr masks combination
|
||||
static bool compareVertices( HbrVertex<T> const * x, HbrVertex<T> const * y );
|
||||
|
||||
struct VertexKernelBatch {
|
||||
int kernelF;
|
||||
int kernelE;
|
||||
|
||||
std::pair<int,int> kernelB;
|
||||
std::pair<int,int> kernelA1;
|
||||
std::pair<int,int> kernelA2;
|
||||
|
||||
VertexKernelBatch() : kernelF(0), kernelE(0) { }
|
||||
|
||||
void InitVertexKernels(int a, int b) {
|
||||
kernelB.first = kernelA1.first = kernelA2.first = a;
|
||||
kernelB.second = kernelA1.second = kernelA2.second = b;
|
||||
}
|
||||
|
||||
void AddVertex( int index, int rank ) {
|
||||
// expand the range of kernel batches based on vertex index and rank
|
||||
if (rank<7) {
|
||||
if (index < kernelB.first) kernelB.first=index;
|
||||
if (index > kernelB.second) kernelB.second=index;
|
||||
}
|
||||
if ((rank>2) and (rank<8)) {
|
||||
if (index < kernelA2.first) kernelA2.first=index;
|
||||
if (index > kernelA2.second) kernelA2.second=index;
|
||||
}
|
||||
if (rank>6) {
|
||||
if (index < kernelA1.first) kernelA1.first=index;
|
||||
if (index > kernelA1.second) kernelA1.second=index;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Returns the range of vertex indices of each of the 3 batches of VertexPoint
|
||||
// compute Kernels (kernel application order is : B / A / A)
|
||||
std::vector<VertexKernelBatch> & getKernelBatches() const { return _batches; }
|
||||
|
||||
protected:
|
||||
// mesh that owns this subdivisionTable
|
||||
FarMesh<T,U> * _mesh;
|
||||
|
||||
Table<unsigned int> _E_IT; // vertices from edge refinement
|
||||
Table<float> _E_W; // weigths
|
||||
|
||||
Table<int> _V_ITa; // vertices from vertex refinement
|
||||
Table<unsigned int> _V_IT; // indices of adjacent vertices
|
||||
Table<float> _V_W; // weights
|
||||
|
||||
std::vector<VertexKernelBatch> _batches;
|
||||
|
||||
std::vector<int> _vertsOffsets; // offset to the first vertex of each level
|
||||
private:
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
FarSubdivisionTables<T,U>::FarSubdivisionTables( FarMesh<T,U> * mesh, int maxlevel ) :
|
||||
_mesh(mesh),
|
||||
_E_IT(maxlevel+1),
|
||||
_E_W(maxlevel+1),
|
||||
_V_ITa(maxlevel+1),
|
||||
_V_IT(maxlevel+1),
|
||||
_V_W(maxlevel+1),
|
||||
_batches(maxlevel),
|
||||
_vertsOffsets(maxlevel+1,0)
|
||||
{
|
||||
assert( maxlevel > 0 );
|
||||
}
|
||||
|
||||
// The ranking matrix defines the order of execution for the various combinations
|
||||
// of Corner, Crease, Dart and Smooth topological configurations. This matrix is
|
||||
// somewhat arbitrary as it is possible to perform some permutations in the
|
||||
// ordering without adverse effects, but it does try to minimize kernel switching
|
||||
// during the exececution of Refine(). This table is identical for both the Loop
|
||||
// and Catmull-Clark schemes.
|
||||
//
|
||||
// The matrix is derived from this table :
|
||||
// Rules +----+----+----+----+----+----+----+----+----+----+
|
||||
// Pass 0 | Dt | Sm | Sm | Dt | Sm | Dt | Sm | Cr | Co | Cr |
|
||||
// Pass 1 | | | | Co | Co | Cr | Cr | Co | | |
|
||||
// Kernel +----+----+----+----+----+----+----+----+----+----+
|
||||
// Pass 0 | B | B | B | B | B | B | B | A | A | A |
|
||||
// Pass 1 | | | | A | A | A | A | A | | |
|
||||
// +----+----+----+----+----+----+----+----+----+----+
|
||||
// Rank | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|
||||
// +----+----+----+----+----+----+----+----+----+----+
|
||||
// with :
|
||||
// - A : compute kernel applying k_Crease / k_Corner rules
|
||||
// - B : compute kernel applying k_Smooth / k_Dart rules
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::getMaskRanking( unsigned char mask0, unsigned char mask1 ) {
|
||||
static short masks[4][4] = { { 0, 1, 6, 4 },
|
||||
{ 0xFF, 2, 5, 3 },
|
||||
{ 0xFF, 0xFF, 9, 7 },
|
||||
{ 0xFF, 0xFF, 0xFF, 8 } };
|
||||
return masks[mask0][mask1];
|
||||
}
|
||||
|
||||
// Compare the weight masks of 2 vertices using the following ordering table.
|
||||
//
|
||||
// Assuming 2 computer kernels :
|
||||
// - A handles the k_Crease and K_Corner rules
|
||||
// - B handles the K_Smooth and K_Dart rules
|
||||
// The vertices should be sorted so as to minimize the number execution calls of
|
||||
// these kernels to match the 2 pass interpolation scheme used in Hbr.
|
||||
template <class T, class U> bool
|
||||
FarSubdivisionTables<T,U>::compareVertices( HbrVertex<T> const * x, HbrVertex<T> const * y ) {
|
||||
|
||||
// Masks of the parent vertex decide for the current vertex.
|
||||
HbrVertex<T> * px=x->GetParentVertex(),
|
||||
* py=y->GetParentVertex();
|
||||
|
||||
assert( (getMaskRanking(px->GetMask(false), px->GetMask(true) )!=0xFF) and
|
||||
(getMaskRanking(py->GetMask(false), py->GetMask(true) )!=0xFF) );
|
||||
|
||||
return getMaskRanking(px->GetMask(false), px->GetMask(true) ) <
|
||||
getMaskRanking(py->GetMask(false), py->GetMask(true) );
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::GetFirstVertexOffset( int level ) const {
|
||||
assert(level>=0 and level<=(int)_vertsOffsets.size());
|
||||
return _vertsOffsets[level];
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::GetNumFaceVertices( int level ) const {
|
||||
assert(level>=0 and level<=(int)_batches.size());
|
||||
return _batches[level-1].kernelF;
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::GetNumEdgeVertices( int level ) const {
|
||||
assert(level>=0 and level<=(int)_batches.size());
|
||||
return _batches[level-1].kernelE;
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::GetNumVertexVertices( int level ) const {
|
||||
assert(level>=0 and level<=(int)_batches.size());
|
||||
if (level==0)
|
||||
return _mesh->GetNumCoarseVertices();
|
||||
else
|
||||
return std::max( _batches[level-1].kernelB.second,
|
||||
std::max(_batches[level-1].kernelA1.second,
|
||||
_batches[level-1].kernelA2.second));
|
||||
}
|
||||
|
||||
template <class T, class U> int
|
||||
FarSubdivisionTables<T,U>::GetNumVertices( int level ) const {
|
||||
assert(level>=0 and level<=(int)_batches.size());
|
||||
if (level==0)
|
||||
return GetNumVertexVertices(0);
|
||||
else
|
||||
return GetNumFaceVertices(level)+
|
||||
GetNumEdgeVertices(level)+
|
||||
GetNumVertexVertices(level);
|
||||
}
|
||||
|
||||
template <class T, class U> size_t
|
||||
FarSubdivisionTables<T,U>::GetMemoryUsed() const {
|
||||
return _E_IT.GetMemoryUsed()+
|
||||
_E_W.GetMemoryUsed()+
|
||||
_V_ITa.GetMemoryUsed()+
|
||||
_V_IT.GetMemoryUsed()+
|
||||
_V_W.GetMemoryUsed();
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* FAR_SUBDIVISION_TABLES_H */
|
80
opensubdiv/hbr/CMakeLists.txt
Normal file
80
opensubdiv/hbr/CMakeLists.txt
Normal file
@ -0,0 +1,80 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
set(H_FILES
|
||||
allocator.h
|
||||
bilinear.h
|
||||
catmark.h
|
||||
cornerEdit.h
|
||||
creaseEdit.h
|
||||
faceEdit.h
|
||||
face.h
|
||||
fvarData.h
|
||||
fvarEdit.h
|
||||
halfedge.h
|
||||
hierarchicalEdit.h
|
||||
holeEdit.h
|
||||
loop.h
|
||||
mesh.h
|
||||
subdivision.h
|
||||
vertexEdit.h
|
||||
vertex.h
|
||||
)
|
||||
|
||||
install( FILES ${H_FILES}
|
||||
DESTINATION include/hbr
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
|
194
opensubdiv/hbr/allocator.h
Normal file
194
opensubdiv/hbr/allocator.h
Normal file
@ -0,0 +1,194 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRALLOCATOR_H
|
||||
#define HBRALLOCATOR_H
|
||||
|
||||
typedef void (*HbrMemStatFunction)(unsigned long bytes);
|
||||
|
||||
/**
|
||||
* HbrAllocator - derived from UtBlockAllocator.h, but embedded in
|
||||
* libhbrep.
|
||||
*/
|
||||
template <typename T> class HbrAllocator {
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
HbrAllocator(size_t *memorystat, int blocksize, void (*increment)(unsigned long bytes), void (*decrement)(unsigned long bytes), size_t elemsize = sizeof(T));
|
||||
|
||||
/// Destructor
|
||||
~HbrAllocator();
|
||||
|
||||
/// Create an allocated object
|
||||
T * Allocate();
|
||||
|
||||
/// Return an allocated object to the block allocator
|
||||
void Deallocate(T *);
|
||||
|
||||
/// Clear the allocator, deleting all allocated objects.
|
||||
void Clear();
|
||||
|
||||
void SetMemStatsIncrement(void (*increment)(unsigned long bytes)) { m_increment = increment; }
|
||||
|
||||
void SetMemStatsDecrement(void (*decrement)(unsigned long bytes)) { m_decrement = decrement; }
|
||||
|
||||
private:
|
||||
size_t *m_memorystat;
|
||||
const int m_blocksize;
|
||||
int m_elemsize;
|
||||
T** m_blocks;
|
||||
|
||||
// Number of actually allocated blocks
|
||||
int m_nblocks;
|
||||
|
||||
// Size of the m_blocks array (which is NOT the number of actually
|
||||
// allocated blocks)
|
||||
int m_blockCapacity;
|
||||
|
||||
int m_freecount;
|
||||
T * m_freelist;
|
||||
|
||||
// Memory statistics tracking routines
|
||||
HbrMemStatFunction m_increment;
|
||||
HbrMemStatFunction m_decrement;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
HbrAllocator<T>::HbrAllocator(size_t *memorystat, int blocksize, void (*increment)(unsigned long bytes), void (*decrement)(unsigned long bytes), size_t elemsize)
|
||||
: m_memorystat(memorystat), m_blocksize(blocksize), m_elemsize(elemsize), m_blocks(0), m_nblocks(0), m_blockCapacity(0), m_freecount(0), m_increment(increment), m_decrement(decrement) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
HbrAllocator<T>::~HbrAllocator() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void HbrAllocator<T>::Clear() {
|
||||
for (int i = 0; i < m_nblocks; ++i) {
|
||||
// Run the destructors (placement)
|
||||
T* blockptr = m_blocks[i];
|
||||
T* startblock = blockptr;
|
||||
for (int j = 0; j < m_blocksize; ++j) {
|
||||
blockptr->~T();
|
||||
blockptr = (T*) ((char*) blockptr + m_elemsize);
|
||||
}
|
||||
free(startblock);
|
||||
if (m_decrement) m_decrement(m_blocksize * m_elemsize);
|
||||
*m_memorystat -= m_blocksize * m_elemsize;
|
||||
}
|
||||
free(m_blocks);
|
||||
m_blocks = 0;
|
||||
m_nblocks = 0;
|
||||
m_blockCapacity = 0;
|
||||
m_freecount = 0;
|
||||
m_freelist = NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T*
|
||||
HbrAllocator<T>::Allocate() {
|
||||
if (!m_freecount) {
|
||||
|
||||
// Allocate a new block
|
||||
T* block = (T*) malloc(m_blocksize * m_elemsize);
|
||||
T* blockptr = block;
|
||||
// Run the constructors on each element using placement new
|
||||
for (int i = 0; i < m_blocksize; ++i) {
|
||||
new (blockptr) T();
|
||||
blockptr = (T*) ((char*) blockptr + m_elemsize);
|
||||
}
|
||||
if (m_increment) m_increment(m_blocksize * m_elemsize);
|
||||
*m_memorystat += m_blocksize * m_elemsize;
|
||||
|
||||
// Put the block's entries on the free list
|
||||
blockptr = block;
|
||||
for (int i = 0; i < m_blocksize - 1; ++i) {
|
||||
T* next = (T*) ((char*) blockptr + m_elemsize);
|
||||
blockptr->GetNext() = next;
|
||||
blockptr = next;
|
||||
}
|
||||
blockptr->GetNext() = 0;
|
||||
m_freelist = block;
|
||||
|
||||
// Keep track of the newly allocated block
|
||||
if (m_nblocks + 1 >= m_blockCapacity) {
|
||||
m_blockCapacity = m_blockCapacity * 2;
|
||||
if (m_blockCapacity < 1) m_blockCapacity = 1;
|
||||
m_blocks = (T**) realloc(m_blocks, m_blockCapacity * sizeof(T*));
|
||||
}
|
||||
m_blocks[m_nblocks] = block;
|
||||
m_nblocks++;
|
||||
m_freecount += m_blocksize;
|
||||
}
|
||||
T* obj = m_freelist;
|
||||
m_freelist = obj->GetNext();
|
||||
obj->GetNext() = 0;
|
||||
m_freecount--;
|
||||
return obj;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
HbrAllocator<T>::Deallocate(T * obj) {
|
||||
assert(!obj->GetNext());
|
||||
obj->GetNext() = m_freelist;
|
||||
m_freelist = obj;
|
||||
m_freecount++;
|
||||
}
|
||||
|
||||
#endif /* HBRALLOCATOR_H */
|
920
opensubdiv/hbr/bilinear.h
Normal file
920
opensubdiv/hbr/bilinear.h
Normal file
@ -0,0 +1,920 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRBILINEAR_H
|
||||
#define HBRBILINEAR_H
|
||||
|
||||
/*#define HBR_DEBUG */
|
||||
#include "../hbr/subdivision.h"
|
||||
|
||||
template <class T>
|
||||
class HbrBilinearSubdivision : public HbrSubdivision<T> {
|
||||
public:
|
||||
HbrBilinearSubdivision<T>()
|
||||
: HbrSubdivision<T>() {}
|
||||
|
||||
virtual HbrSubdivision<T>* Clone() const {
|
||||
return new HbrBilinearSubdivision<T>();
|
||||
}
|
||||
|
||||
virtual void Refine(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual HbrFace<T>* RefineFaceAtVertex(HbrMesh<T>* mesh, HbrFace<T>* face, HbrVertex<T>* vertex);
|
||||
virtual void GuaranteeNeighbor(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual void GuaranteeNeighbors(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual bool VertexIsExtraordinary(HbrMesh<T>* /* mesh */, HbrVertex<T>* vertex) { return vertex->GetValence() != 4; }
|
||||
|
||||
virtual int GetFaceChildrenCount(int nvertices) const { return nvertices; }
|
||||
|
||||
private:
|
||||
|
||||
// Transfers facevarying data from a parent face to a child face
|
||||
void transferFVarToChild(HbrMesh<T>* mesh, HbrFace<T>* face, HbrFace<T>* child, int index);
|
||||
|
||||
// Transfers vertex and edge edits from a parent face to a child face
|
||||
void transferEditsToChild(HbrFace<T>* face, HbrFace<T>* child, int index);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrBilinearSubdivision<T>::transferFVarToChild(HbrMesh<T>* mesh, HbrFace<T>* face, HbrFace<T>* child, int index) {
|
||||
|
||||
typename HbrMesh<T>::InterpolateBoundaryMethod fvarinterp = mesh->GetFVarInterpolateBoundaryMethod();
|
||||
const int fvarcount = mesh->GetFVarCount();
|
||||
int fvarindex = 0;
|
||||
const int nv = face->GetNumVertices();
|
||||
bool extraordinary = (nv != 4);
|
||||
HbrVertex<T> *v = face->GetVertex(index), *childVertex;
|
||||
HbrHalfedge<T>* edge;
|
||||
|
||||
// We do the face subdivision rule first, because we may reuse the
|
||||
// result (stored in fv2) for the other subdivisions.
|
||||
float weight = 1.0f / nv;
|
||||
|
||||
// For the face center vertex, the facevarying data can be cleared
|
||||
// and averaged en masse, since the subdivision rules don't change
|
||||
// for any of the data - we use the smooth rule for all of it.
|
||||
// And since we know that the fvardata for this particular vertex
|
||||
// is smooth and therefore shareable amongst all incident faces,
|
||||
// we don't have to allocate extra storage for it. We also don't
|
||||
// have to compute it if some other face got to it first (as
|
||||
// indicated by the IsInitialized() flag).
|
||||
HbrFVarData<T>& fv2 = child->GetFVarData(extraordinary ? 2 : (index+2)%4);
|
||||
if (!fv2.IsInitialized()) {
|
||||
const int totalfvarwidth = mesh->GetTotalFVarWidth();
|
||||
fv2.ClearAll(totalfvarwidth);
|
||||
for (int j = 0; j < nv; ++j) {
|
||||
fv2.AddWithWeightAll(face->GetFVarData(j), totalfvarwidth, weight);
|
||||
}
|
||||
}
|
||||
assert(fv2.IsInitialized());
|
||||
|
||||
v->GuaranteeNeighbors();
|
||||
|
||||
// Make sure that that each of the vertices of the child face have
|
||||
// the appropriate facevarying storage as needed. If there are
|
||||
// discontinuities in any facevarying datum, the vertex must
|
||||
// allocate a new block of facevarying storage specific to the
|
||||
// child face.
|
||||
bool fv0IsSmooth, fv1IsSmooth, fv3IsSmooth;
|
||||
|
||||
childVertex = child->GetVertex(extraordinary ? 0 : (index+0)%4);
|
||||
fv0IsSmooth = v->IsFVarAllSmooth();
|
||||
if (!fv0IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv0 = childVertex->GetFVarData(child);
|
||||
|
||||
edge = face->GetEdge(index);
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
assert(edge->GetOrgVertex() == v);
|
||||
childVertex = child->GetVertex(extraordinary ? 1 : (index+1)%4);
|
||||
fv1IsSmooth = !edge->IsFVarInfiniteSharpAnywhere();
|
||||
if (!fv1IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv1 = childVertex->GetFVarData(child);
|
||||
|
||||
edge = edge->GetPrev();
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
assert(edge == face->GetEdge((index + nv - 1) % nv));
|
||||
assert(edge->GetDestVertex() == v);
|
||||
childVertex = child->GetVertex(extraordinary ? 3 : (index+3)%4);
|
||||
fv3IsSmooth = !edge->IsFVarInfiniteSharpAnywhere();
|
||||
if (!fv3IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv3 = childVertex->GetFVarData(child);
|
||||
fvarindex = 0;
|
||||
for (int fvaritem = 0; fvaritem < fvarcount; ++fvaritem) {
|
||||
// Vertex subdivision rule. Analyze whether the vertex is on the
|
||||
// boundary and whether it's an infinitely sharp corner. We
|
||||
// determine the last by checking the propagate corners flag on
|
||||
// the mesh; if it's off, we check the two edges of this face
|
||||
// incident to that vertex and determining whether they are
|
||||
// facevarying boundary edges - this is analogous to what goes on
|
||||
// for the interpolateboundary tag (which when set to
|
||||
// EDGEANDCORNER marks vertices with a valence of two as being
|
||||
// sharp corners). If propagate corners is on, we check *all*
|
||||
// faces to see if two edges side by side are facevarying boundary
|
||||
// edges. The facevarying boundary check ignores geometric
|
||||
// sharpness, otherwise we may swim at geometric creases which
|
||||
// aren't actually discontinuous.
|
||||
bool infcorner = false;
|
||||
const int fvarwidth = mesh->GetFVarWidths()[fvaritem];
|
||||
const unsigned char fvarmask = v->GetFVarMask(fvaritem);
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner) {
|
||||
if (fvarmask >= HbrVertex<T>::k_Corner) {
|
||||
infcorner = true;
|
||||
} else if (mesh->GetFVarPropagateCorners()) {
|
||||
if (v->IsFVarCorner(fvaritem)) {
|
||||
infcorner = true;
|
||||
}
|
||||
} else {
|
||||
if (face->GetEdge(index)->GetFVarSharpness(fvaritem, true) && face->GetEdge(index)->GetPrev()->GetFVarSharpness(fvaritem, true)) {
|
||||
infcorner = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Infinitely sharp vertex rule. Applied if the vertex is:
|
||||
// - undergoing no facevarying boundary interpolation;
|
||||
// - at a geometric crease, in either boundary interpolation case; or
|
||||
// - is an infinitely sharp facevarying vertex, in the EDGEANDCORNER case; or
|
||||
// - has a mask equal or greater than one, in the "always
|
||||
// sharp" interpolate boundary case
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
(fvarinterp == HbrMesh<T>::k_InterpolateBoundaryAlwaysSharp &&
|
||||
fvarmask >= 1) ||
|
||||
v->GetSharpness() > HbrVertex<T>::k_Smooth ||
|
||||
infcorner) {
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 1.0f);
|
||||
}
|
||||
// Dart rule: unlike geometric creases, because there's two
|
||||
// discontinuous values for the one incident edge, we use the
|
||||
// boundary rule and not the smooth rule
|
||||
else if (fvarmask == 1) {
|
||||
assert(!v->OnBoundary());
|
||||
|
||||
// Use 0.75 of the current vert
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.75f);
|
||||
|
||||
// 0.125 of "two adjacent edge vertices", which in actuality
|
||||
// are the facevarying values of the same vertex but on each
|
||||
// side of the single incident facevarying sharp edge
|
||||
HbrHalfedge<T>* start = v->GetIncidentEdge(), *nextedge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
if (edge->GetFVarSharpness(fvaritem)) {
|
||||
break;
|
||||
}
|
||||
nextedge = v->GetNextEdge(edge);
|
||||
if (nextedge == start) {
|
||||
assert(0); // we should have found it by now
|
||||
break;
|
||||
} else if (!nextedge) {
|
||||
// should never get into this case - if the vertex is
|
||||
// on a boundary, it can never be a facevarying dart
|
||||
// vertex
|
||||
assert(0);
|
||||
edge = edge->GetPrev();
|
||||
break;
|
||||
} else {
|
||||
edge = nextedge;
|
||||
}
|
||||
}
|
||||
HbrVertex<T>* w = edge->GetDestVertex();
|
||||
HbrFace<T>* bestface = edge->GetLeftFace();
|
||||
int j;
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
bestface = edge->GetRightFace();
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
}
|
||||
// Boundary vertex rule
|
||||
else if (fvarmask != 0) {
|
||||
|
||||
// Use 0.75 of the current vert
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.75f);
|
||||
|
||||
// Compute 0.125 of two adjacent edge vertices. However the
|
||||
// two adjacent edge vertices we use must be part of the
|
||||
// facevarying "boundary". To find the first edge we cycle
|
||||
// counterclockwise around the current vertex v and look for
|
||||
// the first boundary edge
|
||||
|
||||
HbrFace<T>* bestface = face;
|
||||
HbrHalfedge<T>* bestedge = face->GetEdge(index)->GetPrev();
|
||||
HbrHalfedge<T>* starte = bestedge->GetOpposite();
|
||||
HbrVertex<T>* w = 0;
|
||||
if (!starte) {
|
||||
w = face->GetEdge(index)->GetPrev()->GetOrgVertex();
|
||||
} else {
|
||||
HbrHalfedge<T>* e = starte, *next;
|
||||
assert(starte->GetOrgVertex() == v);
|
||||
do {
|
||||
if (e->GetFVarSharpness(fvaritem) || !e->GetLeftFace()) {
|
||||
bestface = e->GetRightFace();
|
||||
bestedge = e;
|
||||
break;
|
||||
}
|
||||
next = v->GetNextEdge(e);
|
||||
if (!next) {
|
||||
bestface = e->GetLeftFace();
|
||||
w = e->GetPrev()->GetOrgVertex();
|
||||
break;
|
||||
}
|
||||
e = next;
|
||||
} while (e && e != starte);
|
||||
}
|
||||
if (!w) w = bestedge->GetDestVertex();
|
||||
int j;
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
|
||||
// Look for the other edge by cycling clockwise around v
|
||||
bestface = face;
|
||||
bestedge = face->GetEdge(index);
|
||||
starte = bestedge;
|
||||
w = 0;
|
||||
if (HbrHalfedge<T>* e = starte) {
|
||||
assert(starte->GetOrgVertex() == v);
|
||||
do {
|
||||
if (e->GetFVarSharpness(fvaritem) || !e->GetRightFace()) {
|
||||
bestface = e->GetLeftFace();
|
||||
bestedge = e;
|
||||
break;
|
||||
}
|
||||
assert(e->GetOpposite());
|
||||
e = v->GetPreviousEdge(e);
|
||||
} while (e && e != starte);
|
||||
}
|
||||
if (!w) w = bestedge->GetDestVertex();
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
|
||||
}
|
||||
// Smooth rule. Here, we can take a shortcut if we know that
|
||||
// the vertex is smooth and some other vertex has completely
|
||||
// computed the facevarying values
|
||||
else if (!fv0IsSmooth || !fv0.IsInitialized()) {
|
||||
int valence = v->GetValence();
|
||||
float invvalencesquared = 1.0f / (valence * valence);
|
||||
|
||||
// Use n-2/n of the current vertex value
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, invvalencesquared * valence * (valence - 2));
|
||||
|
||||
// Add 1/n^2 of surrounding edge vertices and surrounding face
|
||||
// averages. We loop over all surrounding faces..
|
||||
HbrHalfedge<T>* start = v->GetIncidentEdge(), *edge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
HbrFace<T>* g = edge->GetLeftFace();
|
||||
weight = invvalencesquared / g->GetNumVertices();
|
||||
// .. and compute the average of each face. At the same
|
||||
// time, we look for the edge on that face whose origin is
|
||||
// the same as v, and add a contribution from its
|
||||
// destination vertex value; this takes care of the
|
||||
// surrounding edge vertex addition.
|
||||
for (int j = 0; j < g->GetNumVertices(); ++j) {
|
||||
fv0.AddWithWeight(g->GetFVarData(j), fvarindex, fvarwidth, weight);
|
||||
if (g->GetEdge(j)->GetOrgVertex() == v) {
|
||||
fv0.AddWithWeight(g->GetFVarData((j + 1) % g->GetNumVertices()), fvarindex, fvarwidth, invvalencesquared);
|
||||
}
|
||||
}
|
||||
edge = v->GetNextEdge(edge);
|
||||
if (edge == start) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Edge subdivision rule
|
||||
edge = face->GetEdge(index);
|
||||
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
edge->GetFVarSharpness(fvaritem) || edge->IsBoundary()) {
|
||||
|
||||
// Sharp edge rule
|
||||
fv1.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.5f);
|
||||
fv1.AddWithWeight(face->GetFVarData((index + 1) % nv), fvarindex, fvarwidth, 0.5f);
|
||||
} else if (!fv1IsSmooth || !fv1.IsInitialized()) {
|
||||
// Smooth edge subdivision. Add 0.25 of adjacent vertices
|
||||
fv1.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.25f);
|
||||
fv1.AddWithWeight(face->GetFVarData((index + 1) % nv), fvarindex, fvarwidth, 0.25f);
|
||||
// Local subdivided face vertex
|
||||
fv1.AddWithWeight(fv2, fvarindex, fvarwidth, 0.25f);
|
||||
// Add 0.25 * average of neighboring face vertices
|
||||
HbrFace<T>* oppFace = edge->GetRightFace();
|
||||
weight = 0.25f / oppFace->GetNumVertices();
|
||||
for (int j = 0; j < oppFace->GetNumVertices(); ++j) {
|
||||
fv1.AddWithWeight(oppFace->GetFVarData(j), fvarindex, fvarwidth, weight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Edge subdivision rule
|
||||
edge = edge->GetPrev();
|
||||
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
edge->GetFVarSharpness(fvaritem) || edge->IsBoundary()) {
|
||||
|
||||
// Sharp edge rule
|
||||
fv3.SetWithWeight(face->GetFVarData((index + nv - 1) % nv), fvarindex, fvarwidth, 0.5f);
|
||||
fv3.AddWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.5f);
|
||||
} else if (!fv3IsSmooth || !fv3.IsInitialized()) {
|
||||
// Smooth edge subdivision. Add 0.25 of adjacent vertices
|
||||
fv3.SetWithWeight(face->GetFVarData((index + nv - 1) % nv), fvarindex, fvarwidth, 0.25f);
|
||||
fv3.AddWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.25f);
|
||||
// Local subdivided face vertex
|
||||
fv3.AddWithWeight(fv2, fvarindex, fvarwidth, 0.25f);
|
||||
// Add 0.25 * average of neighboring face vertices
|
||||
HbrFace<T>* oppFace = edge->GetRightFace();
|
||||
weight = 0.25f / oppFace->GetNumVertices();
|
||||
for (int j = 0; j < oppFace->GetNumVertices(); ++j) {
|
||||
fv3.AddWithWeight(oppFace->GetFVarData(j), fvarindex, fvarwidth, weight);
|
||||
}
|
||||
}
|
||||
|
||||
fvarindex += fvarwidth;
|
||||
}
|
||||
fv0.SetInitialized();
|
||||
fv1.SetInitialized();
|
||||
fv3.SetInitialized();
|
||||
|
||||
// Special handling of ptex index for extraordinary faces: make
|
||||
// sure the children get their indices reassigned to be
|
||||
// consecutive within the block reserved for the parent.
|
||||
if (face->GetNumVertices() != 4 && face->GetPtexIndex() != -1) {
|
||||
child->SetPtexIndex(face->GetPtexIndex() + index);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrBilinearSubdivision<T>::transferEditsToChild(HbrFace<T>* face, HbrFace<T>* child, int index) {
|
||||
|
||||
// Hand down pointers to hierarchical edits
|
||||
if (HbrHierarchicalEdit<T>** edits = face->GetHierarchicalEdits()) {
|
||||
while (HbrHierarchicalEdit<T>* edit = *edits) {
|
||||
if (!edit->IsRelevantToFace(face)) break;
|
||||
if (edit->GetNSubfaces() > face->GetDepth() &&
|
||||
(edit->GetSubface(face->GetDepth()) == index)) {
|
||||
child->SetHierarchicalEdits(edits);
|
||||
break;
|
||||
}
|
||||
edits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrBilinearSubdivision<T>::Refine(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
// Create new quadrilateral children faces from this face
|
||||
HbrFace<T>* child;
|
||||
HbrVertex<T>* vertices[4];
|
||||
HbrHalfedge<T>* edge = face->GetFirstEdge();
|
||||
HbrHalfedge<T>* prevedge = edge->GetPrev();
|
||||
HbrHalfedge<T>* childedge;
|
||||
int nv = face->GetNumVertices();
|
||||
float sharpness;
|
||||
bool extraordinary = (nv != 4);
|
||||
// The funny indexing on vertices is done only for
|
||||
// non-extraordinary faces in order to correctly preserve
|
||||
// parametric space through the refinement. If we split an
|
||||
// extraordinary face then it doesn't matter.
|
||||
for (int i = 0; i < nv; ++i) {
|
||||
if (!face->GetChild(i)) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Kid " << i << "\n";
|
||||
#endif
|
||||
HbrVertex<T>* vertex = edge->GetOrgVertex();
|
||||
if (extraordinary) {
|
||||
vertices[0] = vertex->Subdivide();
|
||||
vertices[1] = edge->Subdivide();
|
||||
vertices[2] = face->Subdivide();
|
||||
vertices[3] = prevedge->Subdivide();
|
||||
} else {
|
||||
vertices[i] = vertex->Subdivide();
|
||||
vertices[(i+1)%4] = edge->Subdivide();
|
||||
vertices[(i+2)%4] = face->Subdivide();
|
||||
vertices[(i+3)%4] = prevedge->Subdivide();
|
||||
}
|
||||
child = mesh->NewFace(4, vertices, face, i);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Creating face " << *child << " during refine\n";
|
||||
#endif
|
||||
|
||||
// Hand down edge sharpnesses
|
||||
childedge = vertex->Subdivide()->GetEdge(edge->Subdivide());
|
||||
assert(childedge);
|
||||
if ((sharpness = edge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
SubdivideCreaseWeight(edge, edge->GetDestVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(edge);
|
||||
|
||||
childedge = prevedge->Subdivide()->GetEdge(vertex->Subdivide());
|
||||
assert(childedge);
|
||||
if ((sharpness = prevedge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
SubdivideCreaseWeight(prevedge, prevedge->GetOrgVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(prevedge);
|
||||
|
||||
if (mesh->GetTotalFVarWidth()) {
|
||||
transferFVarToChild(mesh, face, child, i);
|
||||
}
|
||||
|
||||
transferEditsToChild(face, child, i);
|
||||
}
|
||||
prevedge = edge;
|
||||
edge = edge->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrFace<T>*
|
||||
HbrBilinearSubdivision<T>::RefineFaceAtVertex(HbrMesh<T>* mesh, HbrFace<T>* face, HbrVertex<T>* vertex) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " forcing refine on " << *face << " at " << *vertex << '\n';
|
||||
#endif
|
||||
|
||||
// Create new quadrilateral children faces from this face
|
||||
HbrHalfedge<T>* edge = face->GetFirstEdge();
|
||||
HbrHalfedge<T>* prevedge = edge->GetPrev();
|
||||
HbrHalfedge<T>* childedge;
|
||||
int nv = face->GetNumVertices();
|
||||
float sharpness;
|
||||
bool extraordinary = (nv != 4);
|
||||
// The funny indexing on vertices is done only for
|
||||
// non-extraordinary faces in order to correctly preserve
|
||||
// parametric space through the refinement. If we split an
|
||||
// extraordinary face then it doesn't matter.
|
||||
for (int i = 0; i < nv; ++i) {
|
||||
if (edge->GetOrgVertex() == vertex) {
|
||||
if (!face->GetChild(i)) {
|
||||
HbrFace<T>* child;
|
||||
HbrVertex<T>* vertices[4];
|
||||
if (extraordinary) {
|
||||
vertices[0] = vertex->Subdivide();
|
||||
vertices[1] = edge->Subdivide();
|
||||
vertices[2] = face->Subdivide();
|
||||
vertices[3] = prevedge->Subdivide();
|
||||
} else {
|
||||
vertices[i] = vertex->Subdivide();
|
||||
vertices[(i+1)%4] = edge->Subdivide();
|
||||
vertices[(i+2)%4] = face->Subdivide();
|
||||
vertices[(i+3)%4] = prevedge->Subdivide();
|
||||
}
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Kid " << i << "\n";
|
||||
std::cerr << " subdivision created " << *vertices[0] << '\n';
|
||||
std::cerr << " subdivision created " << *vertices[1] << '\n';
|
||||
std::cerr << " subdivision created " << *vertices[2] << '\n';
|
||||
std::cerr << " subdivision created " << *vertices[3] << '\n';
|
||||
#endif
|
||||
child = mesh->NewFace(4, vertices, face, i);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Creating face " << *child << " during refine\n";
|
||||
#endif
|
||||
// Hand down edge sharpness
|
||||
childedge = vertex->Subdivide()->GetEdge(edge->Subdivide());
|
||||
assert(childedge);
|
||||
if ((sharpness = edge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
SubdivideCreaseWeight(edge, edge->GetDestVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(edge);
|
||||
|
||||
childedge = prevedge->Subdivide()->GetEdge(vertex->Subdivide());
|
||||
assert(childedge);
|
||||
if ((sharpness = prevedge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
SubdivideCreaseWeight(prevedge, prevedge->GetOrgVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(prevedge);
|
||||
|
||||
if (mesh->GetTotalFVarWidth()) {
|
||||
transferFVarToChild(mesh, face, child, i);
|
||||
}
|
||||
|
||||
transferEditsToChild(face, child, i);
|
||||
return child;
|
||||
} else {
|
||||
return face->GetChild(i);
|
||||
}
|
||||
}
|
||||
prevedge = edge;
|
||||
edge = edge->GetNext();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrBilinearSubdivision<T>::GuaranteeNeighbor(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) {
|
||||
if (edge->GetOpposite()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For the given edge: if the parent of either of its incident
|
||||
// vertices is itself a _face_, then ensuring that this parent
|
||||
// face has refined at a particular vertex is sufficient to
|
||||
// ensure that both of the faces on each side of the edge have
|
||||
// been created.
|
||||
bool destParentWasEdge = true;
|
||||
HbrFace<T>* parentFace = edge->GetOrgVertex()->GetParentFace();
|
||||
HbrHalfedge<T>* parentEdge = edge->GetDestVertex()->GetParentEdge();
|
||||
if (!parentFace) {
|
||||
destParentWasEdge = false;
|
||||
parentFace = edge->GetDestVertex()->GetParentFace();
|
||||
parentEdge = edge->GetOrgVertex()->GetParentEdge();
|
||||
}
|
||||
|
||||
if (parentFace) {
|
||||
|
||||
// Make sure we deal with a parent halfedge which is
|
||||
// associated with the parent face
|
||||
if (parentEdge->GetFace() != parentFace) {
|
||||
parentEdge = parentEdge->GetOpposite();
|
||||
}
|
||||
// If one of the vertices had a parent face, the other one MUST
|
||||
// have been a child of an edge
|
||||
assert(parentEdge && parentEdge->GetFace() == parentFace);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\nparent edge is " << *parentEdge << "\n";
|
||||
#endif
|
||||
|
||||
// The vertex to refine at depends on whether the
|
||||
// destination or origin vertex of this edge had a parent
|
||||
// edge
|
||||
if (destParentWasEdge) {
|
||||
RefineFaceAtVertex(mesh, parentFace, parentEdge->GetOrgVertex());
|
||||
} else {
|
||||
RefineFaceAtVertex(mesh, parentFace, parentEdge->GetDestVertex());
|
||||
}
|
||||
|
||||
// It should always be the case that the opposite now exists -
|
||||
// we can't have a boundary case here
|
||||
assert(edge->GetOpposite());
|
||||
} else {
|
||||
HbrVertex<T>* parentVertex = edge->GetOrgVertex()->GetParentVertex();
|
||||
parentEdge = edge->GetDestVertex()->GetParentEdge();
|
||||
if (!parentVertex) {
|
||||
parentVertex = edge->GetDestVertex()->GetParentVertex();
|
||||
parentEdge = edge->GetOrgVertex()->GetParentEdge();
|
||||
}
|
||||
|
||||
if (parentVertex) {
|
||||
|
||||
assert(parentEdge);
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\nparent edge is " << *parentEdge << "\n";
|
||||
#endif
|
||||
|
||||
// 1. Go up to the parent of my face
|
||||
|
||||
parentFace = edge->GetFace()->GetParent();
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\nparent face is " << *parentFace << "\n";
|
||||
#endif
|
||||
|
||||
// 2. Ask the opposite face (if it exists) to refine
|
||||
if (parentFace) {
|
||||
|
||||
// A vertex can be associated with either of two
|
||||
// parent halfedges. If the parent edge that we're
|
||||
// interested in doesn't match then we should look at
|
||||
// its opposite
|
||||
if (parentEdge->GetFace() != parentFace)
|
||||
parentEdge = parentEdge->GetOpposite();
|
||||
assert(parentEdge->GetFace() == parentFace);
|
||||
|
||||
// Make sure the parent edge has its neighbor as well
|
||||
GuaranteeNeighbor(mesh, parentEdge);
|
||||
|
||||
// Now access that neighbor and refine it
|
||||
if (parentEdge->GetRightFace()) {
|
||||
RefineFaceAtVertex(mesh, parentEdge->GetRightFace(), parentVertex);
|
||||
|
||||
// FIXME: assertion?
|
||||
assert(edge->GetOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrBilinearSubdivision<T>::GuaranteeNeighbors(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\n\nneighbor guarantee at " << *vertex << " invoked\n";
|
||||
#endif
|
||||
|
||||
// If the vertex is a child of a face, guaranteeing the neighbors
|
||||
// of the vertex is simply a matter of ensuring the parent face
|
||||
// has refined.
|
||||
HbrFace<T>* parentFace = vertex->GetParentFace();
|
||||
if (parentFace) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " forcing full refine on parent face\n";
|
||||
#endif
|
||||
Refine(mesh, parentFace);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise if the vertex is a child of an edge, we need to
|
||||
// ensure that the parent faces on either side of the parent edge
|
||||
// 1) exist, and 2) have refined at both vertices of the parent
|
||||
// edge
|
||||
HbrHalfedge<T>* parentEdge = vertex->GetParentEdge();
|
||||
if (parentEdge) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " forcing full refine on adjacent faces of parent edge\n";
|
||||
#endif
|
||||
HbrVertex<T>* dest = parentEdge->GetDestVertex();
|
||||
HbrVertex<T>* org = parentEdge->GetOrgVertex();
|
||||
GuaranteeNeighbor(mesh, parentEdge);
|
||||
parentFace = parentEdge->GetLeftFace();
|
||||
RefineFaceAtVertex(mesh, parentFace, dest);
|
||||
RefineFaceAtVertex(mesh, parentFace, org);
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " on the right face?\n";
|
||||
#endif
|
||||
parentFace = parentEdge->GetRightFace();
|
||||
// The right face may not necessarily exist even after
|
||||
// GuaranteeNeighbor
|
||||
if (parentFace) {
|
||||
RefineFaceAtVertex(mesh, parentFace, dest);
|
||||
RefineFaceAtVertex(mesh, parentFace, org);
|
||||
}
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " end force\n";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// The last case: the vertex is a child of a vertex. In this case
|
||||
// we have to first recursively guarantee that the parent's
|
||||
// adjacent faces also exist.
|
||||
HbrVertex<T>* parentVertex = vertex->GetParentVertex();
|
||||
if (parentVertex) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " recursive parent vertex guarantee call\n";
|
||||
#endif
|
||||
parentVertex->GuaranteeNeighbors();
|
||||
|
||||
// And then we refine all the face neighbors of the
|
||||
// parentVertex
|
||||
HbrHalfedge<T>* start = parentVertex->GetIncidentEdge(), *edge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
HbrFace<T>* f = edge->GetLeftFace();
|
||||
RefineFaceAtVertex(mesh, f, parentVertex);
|
||||
edge = parentVertex->GetNextEdge(edge);
|
||||
if (edge == start) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrBilinearSubdivision<T>::HasLimit(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
if (face->IsHole()) return false;
|
||||
// A limit face exists if all the bounding edges have limit curves
|
||||
for (int i = 0; i < face->GetNumVertices(); ++i) {
|
||||
if (!HasLimit(mesh, face->GetEdge(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrBilinearSubdivision<T>::HasLimit(HbrMesh<T>* /* mesh */, HbrHalfedge<T>* /* edge */) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrBilinearSubdivision<T>::HasLimit(HbrMesh<T>* /* mesh */, HbrVertex<T>* vertex) {
|
||||
vertex->GuaranteeNeighbors();
|
||||
switch (vertex->GetMask(false)) {
|
||||
case HbrVertex<T>::k_Smooth:
|
||||
case HbrVertex<T>::k_Dart:
|
||||
return !vertex->OnBoundary();
|
||||
break;
|
||||
case HbrVertex<T>::k_Crease:
|
||||
case HbrVertex<T>::k_Corner:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrBilinearSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
// Face rule: simply average all vertices on the face
|
||||
HbrVertex<T>* v = mesh->NewVertex();
|
||||
T& data = v->GetData();
|
||||
int nv = face->GetNumVertices();
|
||||
float weight = 1.0f / nv;
|
||||
|
||||
HbrHalfedge<T>* edge = face->GetFirstEdge();
|
||||
for (int i = 0; i < face->GetNumVertices(); ++i) {
|
||||
HbrVertex<T>* w = edge->GetOrgVertex();
|
||||
// If there are vertex edits we have to make sure the edit
|
||||
// has been applied
|
||||
if (mesh->HasVertexEdits()) {
|
||||
w->GuaranteeNeighbors();
|
||||
}
|
||||
data.AddWithWeight(w->GetData(), weight);
|
||||
data.AddVaryingWithWeight(w->GetData(), weight);
|
||||
edge = edge->GetNext();
|
||||
}
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Subdividing at " << *face << "\n";
|
||||
#endif
|
||||
|
||||
// Set the extraordinary flag if the face had anything other than
|
||||
// 4 vertices
|
||||
if (nv != 4) v->SetExtraordinary();
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " created " << *v << "\n";
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrBilinearSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
float esharp = edge->GetSharpness();
|
||||
std::cerr << "Subdividing at " << *edge << " (sharpness = " << esharp << ")";
|
||||
#endif
|
||||
|
||||
HbrVertex<T>* v = mesh->NewVertex();
|
||||
T& data = v->GetData();
|
||||
|
||||
|
||||
// If there's the possibility of a crease edits, make sure the
|
||||
// edit has been applied
|
||||
if (mesh->HasCreaseEdits()) {
|
||||
edge->GuaranteeNeighbor();
|
||||
}
|
||||
|
||||
// If there's the possibility of vertex edits on either vertex, we
|
||||
// have to make sure the edit has been applied
|
||||
if (mesh->HasVertexEdits()) {
|
||||
edge->GetOrgVertex()->GuaranteeNeighbors();
|
||||
edge->GetDestVertex()->GuaranteeNeighbors();
|
||||
}
|
||||
|
||||
// Average the two end points
|
||||
data.AddWithWeight(edge->GetOrgVertex()->GetData(), 0.5f);
|
||||
data.AddWithWeight(edge->GetDestVertex()->GetData(), 0.5f);
|
||||
|
||||
// Varying data is always the average of two end points
|
||||
data.AddVaryingWithWeight(edge->GetOrgVertex()->GetData(), 0.5f);
|
||||
data.AddVaryingWithWeight(edge->GetDestVertex()->GetData(), 0.5f);
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " created " << *v << "\n";
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrBilinearSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
|
||||
HbrVertex<T>* v;
|
||||
|
||||
// If there are vertex edits we have to make sure the edit has
|
||||
// been applied by guaranteeing the neighbors of the
|
||||
// vertex. Unfortunately in this case, we can't share the data
|
||||
// with the parent
|
||||
if (mesh->HasVertexEdits()) {
|
||||
vertex->GuaranteeNeighbors();
|
||||
|
||||
v = mesh->NewVertex();
|
||||
T& data = v->GetData();
|
||||
|
||||
// Just copy the old value
|
||||
data.AddWithWeight(vertex->GetData(), 1.0f);
|
||||
|
||||
// Varying data is always just propogated down
|
||||
data.AddVaryingWithWeight(vertex->GetData(), 1.0f);
|
||||
|
||||
} else {
|
||||
// Create a new vertex that just shares the same data
|
||||
v = mesh->NewVertex(vertex->GetData());
|
||||
}
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Subdividing at " << *vertex << "\n";
|
||||
std::cerr << " created " << *v << "\n";
|
||||
#endif
|
||||
// Inherit extraordinary flag and sharpness
|
||||
if (vertex->IsExtraordinary()) v->SetExtraordinary();
|
||||
float sharp = vertex->GetSharpness();
|
||||
if (sharp >= HbrVertex<T>::k_InfinitelySharp) {
|
||||
v->SetSharpness(HbrVertex<T>::k_InfinitelySharp);
|
||||
} else if (sharp > HbrVertex<T>::k_Smooth) {
|
||||
sharp -= 1.0f;
|
||||
if (sharp < (float) HbrVertex<T>::k_Smooth) {
|
||||
sharp = (float) HbrVertex<T>::k_Smooth;
|
||||
}
|
||||
v->SetSharpness(sharp);
|
||||
} else {
|
||||
v->SetSharpness(HbrVertex<T>::k_Smooth);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif /* HBRBILINEAR_H */
|
1141
opensubdiv/hbr/catmark.h
Normal file
1141
opensubdiv/hbr/catmark.h
Normal file
File diff suppressed because it is too large
Load Diff
120
opensubdiv/hbr/cornerEdit.h
Normal file
120
opensubdiv/hbr/cornerEdit.h
Normal file
@ -0,0 +1,120 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRCORNEREDIT_H
|
||||
#define HBRCORNEREDIT_H
|
||||
|
||||
template <class T> class HbrCornerEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrCornerEdit<T>& path) {
|
||||
out << "vertex path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << static_cast<int>(path.vertexid) << "), sharpness = " << path.sharpness;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrCornerEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrCornerEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, unsigned char _vertexid, typename HbrHierarchicalEdit<T>::Operation _op, float _sharpness)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), op(_op), sharpness(_sharpness) {
|
||||
}
|
||||
|
||||
HbrCornerEdit(int _faceid, int _nsubfaces, int *_subfaces, int _vertexid, typename HbrHierarchicalEdit<T>::Operation _op, float _sharpness)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), op(_op), sharpness(_sharpness) {
|
||||
}
|
||||
|
||||
virtual ~HbrCornerEdit() {}
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrCornerEdit<T>& path);
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
// Modify vertex sharpness. Note that we could actually do
|
||||
// this in ApplyEditToVertex as well!
|
||||
float sharp;
|
||||
if (op == HbrHierarchicalEdit<T>::Set) {
|
||||
sharp = sharpness;
|
||||
} else if (op == HbrHierarchicalEdit<T>::Add) {
|
||||
sharp = face->GetVertex(vertexid)->GetSharpness() + sharpness;
|
||||
} else if (op == HbrHierarchicalEdit<T>::Subtract) {
|
||||
sharp = face->GetVertex(vertexid)->GetSharpness() - sharpness;
|
||||
}
|
||||
if (sharp < HbrVertex<T>::k_Smooth) {
|
||||
sharp = HbrVertex<T>::k_Smooth;
|
||||
}
|
||||
if (sharp > HbrVertex<T>::k_InfinitelySharp) {
|
||||
sharp = HbrVertex<T>::k_InfinitelySharp;
|
||||
}
|
||||
face->GetVertex(vertexid)->SetSharpness(sharp);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// ID of the edge (you can think of this also as the id of the
|
||||
// origin vertex of the two-vertex length edge)
|
||||
const unsigned char vertexid;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
// sharpness of the vertex edit
|
||||
const float sharpness;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRCORNEREDIT_H */
|
122
opensubdiv/hbr/creaseEdit.h
Normal file
122
opensubdiv/hbr/creaseEdit.h
Normal file
@ -0,0 +1,122 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRCREASEEDIT_H
|
||||
#define HBRCREASEEDIT_H
|
||||
|
||||
template <class T> class HbrCreaseEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrCreaseEdit<T>& path) {
|
||||
out << "edge path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << static_cast<int>(path.edgeid) << "), sharpness = " << path.sharpness;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrCreaseEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrCreaseEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, unsigned char _edgeid, typename HbrHierarchicalEdit<T>::Operation _op, float _sharpness)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), edgeid(_edgeid), op(_op), sharpness(_sharpness) {
|
||||
}
|
||||
|
||||
HbrCreaseEdit(int _faceid, int _nsubfaces, int *_subfaces, int _edgeid, typename HbrHierarchicalEdit<T>::Operation _op, float _sharpness)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), edgeid(_edgeid), op(_op), sharpness(_sharpness) {
|
||||
}
|
||||
|
||||
virtual ~HbrCreaseEdit() {}
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrCreaseEdit<T>& path);
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
// Modify edge sharpness
|
||||
float sharp;
|
||||
if (op == HbrHierarchicalEdit<T>::Set) {
|
||||
sharp = sharpness;
|
||||
} else if (op == HbrHierarchicalEdit<T>::Add) {
|
||||
sharp = face->GetEdge(edgeid)->GetSharpness() + sharpness;
|
||||
} else if (op == HbrHierarchicalEdit<T>::Subtract) {
|
||||
sharp = face->GetEdge(edgeid)->GetSharpness() - sharpness;
|
||||
}
|
||||
if (sharp < HbrHalfedge<T>::k_Smooth)
|
||||
sharp = HbrHalfedge<T>::k_Smooth;
|
||||
if (sharp > HbrHalfedge<T>::k_InfinitelySharp)
|
||||
sharp = HbrHalfedge<T>::k_InfinitelySharp;
|
||||
// We have to make sure the neighbor of the edge exists at
|
||||
// this point. Otherwise, if it comes into being late, it
|
||||
// will clobber the overriden sharpness and we will lose
|
||||
// the edit.
|
||||
face->GetEdge(edgeid)->GuaranteeNeighbor();
|
||||
face->GetEdge(edgeid)->SetSharpness(sharp);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// ID of the edge (you can think of this also as the id of the
|
||||
// origin vertex of the two-vertex length edge)
|
||||
const unsigned char edgeid;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
// sharpness of the edge edit
|
||||
const float sharpness;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRCREASEEDIT_H */
|
774
opensubdiv/hbr/face.h
Normal file
774
opensubdiv/hbr/face.h
Normal file
@ -0,0 +1,774 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRFACE_H
|
||||
#define HBRFACE_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
|
||||
#include "../hbr/fvarData.h"
|
||||
#include "../hbr/allocator.h"
|
||||
#ifdef HBRSTITCH
|
||||
#include "libgprims/stitch.h"
|
||||
#include "libgprims/stitchInternal.h"
|
||||
#endif
|
||||
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrMesh;
|
||||
template <class T> class HbrHierarchicalEdit;
|
||||
|
||||
template <class T> std::ostream& operator<<(std::ostream& out, const HbrFace<T>& face);
|
||||
|
||||
// A descriptor for a path to a face
|
||||
struct HbrFacePath {
|
||||
void Print() const {
|
||||
printf("%d", topface);
|
||||
for (std::list<int>::const_iterator i = remainder.begin(); i != remainder.end(); ++i) {
|
||||
printf(" %d", *i);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int topface;
|
||||
std::list<int> remainder;
|
||||
friend bool operator< (const HbrFacePath& x, const HbrFacePath& y);
|
||||
};
|
||||
|
||||
inline bool operator< (const HbrFacePath& x, const HbrFacePath& y) {
|
||||
if (x.topface != y.topface) {
|
||||
return x.topface < y.topface;
|
||||
} else if (x.remainder.size() != y.remainder.size()) {
|
||||
return x.remainder.size() < y.remainder.size();
|
||||
} else {
|
||||
std::list<int>::const_iterator i = x.remainder.begin();
|
||||
std::list<int>::const_iterator j = y.remainder.begin();
|
||||
for ( ; i != x.remainder.end(); ++i, ++j) {
|
||||
if (*i != *j) return (*i < *j);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> class HbrFace {
|
||||
|
||||
private:
|
||||
friend class HbrAllocator<HbrFace<T> >;
|
||||
friend class HbrHalfedge<T>;
|
||||
HbrFace();
|
||||
~HbrFace();
|
||||
|
||||
public:
|
||||
|
||||
void Initialize(HbrMesh<T>* mesh, HbrFace<T>* parent, int childindex, int id, int uindex, int nvertices, HbrVertex<T>** vertices, int fvarwidth = 0, int depth = 0);
|
||||
void Destroy();
|
||||
|
||||
// Returns the mesh to which this face belongs
|
||||
HbrMesh<T>* GetMesh() const { return mesh; }
|
||||
|
||||
// Return number of vertices
|
||||
int GetNumVertices() const { return nvertices; }
|
||||
|
||||
// Return face ID
|
||||
int GetID() const { return id; }
|
||||
|
||||
// Return the first halfedge of the face
|
||||
HbrHalfedge<T>* GetFirstEdge() const {
|
||||
if (nvertices > 4) {
|
||||
return const_cast<HbrHalfedge<T>*>(&extraedges[0]);
|
||||
} else {
|
||||
return const_cast<HbrHalfedge<T>*>(&edges[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the halfedge which originates at the vertex with the
|
||||
// indicated origin index
|
||||
HbrHalfedge<T>* GetEdge(int index) const;
|
||||
|
||||
// Return the vertex with the indicated index
|
||||
HbrVertex<T>* GetVertex(int index) const;
|
||||
|
||||
// Return the parent of this face
|
||||
HbrFace<T>* GetParent() const { return parent; }
|
||||
|
||||
// Set the child
|
||||
void SetChild(int index, HbrFace<T>* face);
|
||||
|
||||
// Return the child with the indicated index
|
||||
HbrFace<T>* GetChild(int index) const {
|
||||
if (!children || index < 0 || index >= mesh->GetSubdivision()->GetFaceChildrenCount(nvertices)) return 0;
|
||||
return children[index];
|
||||
}
|
||||
|
||||
// Subdivide the face into a vertex if needed and return
|
||||
HbrVertex<T>* Subdivide();
|
||||
|
||||
// Remove the reference to subdivided vertex
|
||||
void RemoveChild() { vchild = 0; }
|
||||
|
||||
// "Hole" flags used by subdivision to drop faces
|
||||
bool IsHole() const { return hole; }
|
||||
void SetHole() { hole = 1; }
|
||||
|
||||
// Coarse faces are the top level faces of a mesh. This will be
|
||||
// set by mesh->Finish()
|
||||
bool IsCoarse() const { return coarse; }
|
||||
void SetCoarse() { coarse = 1; }
|
||||
|
||||
// Protected faces cannot be garbage collected; this may be set on
|
||||
// coarse level faces if the mesh is shared
|
||||
bool IsProtected() const { return protect; }
|
||||
void SetProtected() { protect = 1; }
|
||||
void ClearProtected() { protect = 0; }
|
||||
|
||||
// Simple bookkeeping needed for garbage collection by HbrMesh
|
||||
bool IsCollected() const { return collected; }
|
||||
void SetCollected() { collected = 1; }
|
||||
void ClearCollected() { collected = 0; }
|
||||
|
||||
// Refine the face
|
||||
void Refine();
|
||||
|
||||
// Unrefine the face
|
||||
void Unrefine();
|
||||
|
||||
// Returns true if the face has a limit surface
|
||||
bool HasLimit();
|
||||
|
||||
// Returns memory statistics
|
||||
unsigned long GetMemStats() const;
|
||||
|
||||
// Return facevarying data from the appropriate vertex index
|
||||
// registered to this face. Note that this may either be "generic"
|
||||
// facevarying item (data.GetFace() == 0) or one specifically
|
||||
// registered to the face (data.GetFace() == this) - this is
|
||||
// important when trying to figure out whether the vertex has
|
||||
// created some storage for the item designed to store
|
||||
// discontinuous values for this face.
|
||||
HbrFVarData<T>& GetFVarData(int index) {
|
||||
return GetVertex(index)->GetFVarData(this);
|
||||
}
|
||||
|
||||
// Mark this face as being used, which in turn increments the
|
||||
// usage counter of all vertices in the support for the face. A
|
||||
// used face can not be garbage collected
|
||||
void MarkUsage();
|
||||
|
||||
// Clears the usage of this face, which in turn decrements the
|
||||
// usage counter of all vertices in the support for the face and
|
||||
// marks the face as a candidate for garbage collection
|
||||
void ClearUsage();
|
||||
|
||||
// A face can be cleaned if all of its vertices are not being
|
||||
// used; has no children; and (for top level faces) deletion of
|
||||
// its edges will not leave singular vertices
|
||||
bool GarbageCollectable() const;
|
||||
|
||||
// Connect this face to a list of hierarchical edits
|
||||
void SetHierarchicalEdits(HbrHierarchicalEdit<T>** edits);
|
||||
|
||||
// Return the list of hierarchical edits associated with this face
|
||||
HbrHierarchicalEdit<T>** GetHierarchicalEdits() const { return edits; }
|
||||
|
||||
// Whether the face has certain types of edits (not necessarily
|
||||
// local - could apply to a subface)
|
||||
bool HasVertexEdits() const { return hasVertexEdits; }
|
||||
void MarkVertexEdits() { hasVertexEdits = 1; }
|
||||
|
||||
// Return the depth of the face
|
||||
int GetDepth() const { return static_cast<int>(depth); }
|
||||
|
||||
// Return the uniform index of the face. This is different
|
||||
// from the ID because it may be shared with other faces
|
||||
int GetUniformIndex() const { return uindex; }
|
||||
|
||||
// Set the uniform index of the face
|
||||
void SetUniformIndex(int i) { uindex = i; }
|
||||
|
||||
// Return the ptex index
|
||||
int GetPtexIndex() const { return ptexindex; }
|
||||
|
||||
// Set the ptex index of the face
|
||||
void SetPtexIndex(int i) { ptexindex = i; }
|
||||
|
||||
// Used by block allocator
|
||||
HbrFace<T>*& GetNext() { return parent; }
|
||||
|
||||
HbrFacePath GetPath() const {
|
||||
HbrFacePath path;
|
||||
const HbrFace<T>* f = this, *p = GetParent();
|
||||
while (p) {
|
||||
int nchildren = mesh->GetSubdivision()->GetFaceChildrenCount(p->nvertices);
|
||||
for (int i = 0; i < nchildren; ++i) {
|
||||
if (p->children[i] == f) {
|
||||
path.remainder.push_front(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
f = p;
|
||||
p = f->GetParent();
|
||||
}
|
||||
path.topface = f->GetID();
|
||||
assert(GetDepth() == 0 || static_cast<int>(path.remainder.size()) == GetDepth());
|
||||
return path;
|
||||
}
|
||||
|
||||
void PrintPath() const {
|
||||
GetPath().Print();
|
||||
}
|
||||
|
||||
// Returns the blind pointer to client data
|
||||
void *GetClientData() const {
|
||||
return clientData;
|
||||
}
|
||||
|
||||
// Sets the blind pointer to client data
|
||||
void SetClientData(void *data) {
|
||||
clientData = data;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Mesh to which this face belongs
|
||||
HbrMesh<T>* mesh;
|
||||
|
||||
// Unique id for this face
|
||||
int id;
|
||||
|
||||
// Uniform index
|
||||
int uindex;
|
||||
|
||||
// Ptex index
|
||||
int ptexindex;
|
||||
|
||||
// Number of vertices (and number of edges)
|
||||
int nvertices;
|
||||
|
||||
// Halfedge array for this face
|
||||
// HbrHalfedge::GetIndex() relies on this being size 4
|
||||
HbrHalfedge<T> edges[4];
|
||||
|
||||
// Edge storage if this face is not a triangle or quad
|
||||
HbrHalfedge<T>* extraedges;
|
||||
|
||||
// Pointer to parent face
|
||||
HbrFace<T>* parent;
|
||||
|
||||
// Children (pointer) array
|
||||
HbrFace<T>** children;
|
||||
|
||||
// Subdivided vertex child
|
||||
HbrVertex<T>* vchild;
|
||||
|
||||
// Bits used by halfedges to track facevarying sharpnesses
|
||||
unsigned int *fvarbits;
|
||||
|
||||
#ifdef HBRSTITCH
|
||||
// Pointers to stitch edges and data used by the half edges.
|
||||
StitchEdge **stitchEdges;
|
||||
void **stitchDatas;
|
||||
#endif
|
||||
|
||||
// Pointer to a list of hierarchical edits applicable to this face
|
||||
HbrHierarchicalEdit<T>** edits;
|
||||
|
||||
// Blind client data pointer
|
||||
void * clientData;
|
||||
|
||||
// Depth of the face in the mesh hierarchy - coarse faces are
|
||||
// level 0. (Hmmm.. is it safe to assume that we'll never
|
||||
// subdivide to greater than 255?)
|
||||
unsigned char depth;
|
||||
|
||||
unsigned short hole:1;
|
||||
unsigned short coarse:1;
|
||||
unsigned short protect:1;
|
||||
unsigned short collected:1;
|
||||
unsigned short hasVertexEdits:1;
|
||||
unsigned short initialized:1;
|
||||
unsigned short destroyed:1;
|
||||
};
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
|
||||
template <class T>
|
||||
HbrFace<T>::HbrFace()
|
||||
: mesh(0), id(-1), uindex(-1), ptexindex(-1), nvertices(0), extraedges(0), parent(0), children(0), vchild(0), fvarbits(0),
|
||||
#ifdef HBRSTITCH
|
||||
stitchEdges(0),
|
||||
stitchDatas(0),
|
||||
#endif
|
||||
edits(0), clientData(0), depth(0), hole(0), coarse(0), protect(0), collected(0), hasVertexEdits(0), initialized(0), destroyed(0) {
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::Initialize(HbrMesh<T>* m, HbrFace<T>* _parent, int childindex, int fid, int _uindex, int nv, HbrVertex<T>** vertices, int /* fvarwidth */, int _depth) {
|
||||
mesh = m;
|
||||
id = fid;
|
||||
uindex = _uindex;
|
||||
ptexindex = -1;
|
||||
nvertices = nv;
|
||||
extraedges = 0;
|
||||
children = 0;
|
||||
vchild = 0;
|
||||
fvarbits = 0;
|
||||
#ifdef HBRSTITCH
|
||||
stitchEdges = 0;
|
||||
stitchDatas = 0;
|
||||
#endif
|
||||
clientData = 0;
|
||||
edits = 0;
|
||||
depth = _depth;
|
||||
hole = 0;
|
||||
coarse = 0;
|
||||
protect = 0;
|
||||
collected = 0;
|
||||
hasVertexEdits = 0;
|
||||
initialized = 1;
|
||||
destroyed = 0;
|
||||
|
||||
int i;
|
||||
const int fvarcount = mesh->GetFVarCount();
|
||||
int fvarbitsSizePerEdge = ((fvarcount + 15) / 16);
|
||||
|
||||
if (nv > 4) {
|
||||
|
||||
// If we have more than four vertices, we ignore the
|
||||
// overallocation and allocate our own buffers for stitch
|
||||
// edges and facevarying data.
|
||||
#ifdef HBRSTITCH
|
||||
if (mesh->GetStitchCount()) {
|
||||
stitchEdges = new StitchEdge*[mesh->GetStitchCount() * nv];
|
||||
stitchDatas = new void*[nv];
|
||||
for (i = 0; i < mesh->GetStitchCount() * nv; ++i) {
|
||||
stitchEdges[i] = 0;
|
||||
}
|
||||
for (i = 0; i < nv; ++i) {
|
||||
stitchDatas[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (fvarcount) {
|
||||
// We allocate fvarbits in one chunk.
|
||||
// fvarbits needs capacity for two bits per fvardatum per edge,
|
||||
// minimum size one integer per edge
|
||||
const size_t fvarbitsSize = nv * (fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
char *buffer = (char*) malloc(fvarbitsSize);
|
||||
fvarbits = (unsigned int*) buffer;
|
||||
}
|
||||
|
||||
// We also ignore the edge array and allocate extra storage -
|
||||
// this simplifies GetNext and GetPrev math in HbrHalfede
|
||||
extraedges = new HbrHalfedge<T>[nv];
|
||||
|
||||
} else {
|
||||
// Under four vertices: upstream allocation for the class has
|
||||
// been over allocated to include storage for stitchEdges
|
||||
// and fvarbits. Just point our pointers at it.
|
||||
char *buffer = ((char *) this + sizeof(*this));
|
||||
#ifdef HBRSTITCH
|
||||
if (mesh->GetStitchCount()) {
|
||||
stitchEdges = (StitchEdge**) buffer;
|
||||
buffer += 4 * mesh->GetStitchCount() * sizeof(StitchEdge*);
|
||||
stitchDatas = (void**) buffer;
|
||||
for (i = 0; i < mesh->GetStitchCount() * 4; ++i) {
|
||||
stitchEdges[i] = 0;
|
||||
}
|
||||
for (i = 0; i < 4; ++i) {
|
||||
stitchDatas[i] = 0;
|
||||
}
|
||||
buffer += 4 * sizeof(void*);
|
||||
}
|
||||
#endif
|
||||
if (fvarcount) {
|
||||
fvarbits = (unsigned int*) buffer;
|
||||
}
|
||||
}
|
||||
|
||||
// Must do this before we create edges
|
||||
if (_parent) {
|
||||
_parent->SetChild(childindex, this);
|
||||
}
|
||||
|
||||
// Edges must be constructed in this two part approach: we must
|
||||
// ensure that opposite/next/previous ptrs are all set up
|
||||
// correctly, before we can begin adding incident edges to
|
||||
// vertices.
|
||||
int next;
|
||||
unsigned int *curfvarbits = fvarbits;
|
||||
for (i = 0, next = 1; i < nv; ++i, ++next) {
|
||||
if (next == nv) next = 0;
|
||||
HbrHalfedge<T>* opposite = vertices[next]->GetEdge(vertices[i]);
|
||||
GetEdge(i)->Initialize(opposite, i, vertices[i], curfvarbits, this);
|
||||
if (opposite) opposite->SetOpposite(GetEdge(i));
|
||||
if (fvarbits) {
|
||||
curfvarbits = curfvarbits + fvarbitsSizePerEdge;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nv; ++i) {
|
||||
vertices[i]->AddIncidentEdge(GetEdge(i));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrFace<T>::~HbrFace() {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::Destroy() {
|
||||
if (initialized && !destroyed) {
|
||||
int i;
|
||||
#ifdef HBRSTITCH
|
||||
const int stitchCount = mesh->GetStitchCount();
|
||||
#endif
|
||||
|
||||
// Remove children's references to self
|
||||
if (children) {
|
||||
int nchildren = mesh->GetSubdivision()->GetFaceChildrenCount(nvertices);
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
if (children[i]) {
|
||||
children[i]->parent = 0;
|
||||
children[i] = 0;
|
||||
}
|
||||
}
|
||||
delete[] children;
|
||||
children = 0;
|
||||
}
|
||||
|
||||
// Deleting the incident edges from the vertices in this way is
|
||||
// the safest way of doing things. Doing it in the halfedge
|
||||
// destructor will not work well because it disrupts cycle
|
||||
// finding/incident edge replacement in the vertex code.
|
||||
// We also take this time to clean up any orphaned stitches
|
||||
// still belonging to the edges.
|
||||
for (i = 0; i < nvertices; ++i) {
|
||||
HbrHalfedge<T> *edge = GetEdge(i);
|
||||
#ifdef HBRSTITCH
|
||||
edge->DestroyStitchEdges(stitchCount);
|
||||
#endif
|
||||
HbrVertex<T>* vertex = edge->GetOrgVertex();
|
||||
if (fvarbits) {
|
||||
HbrFVarData<T>& fvt = vertex->GetFVarData(this);
|
||||
if (fvt.GetFace() == this) {
|
||||
fvt.SetFace(0);
|
||||
}
|
||||
}
|
||||
vertex->RemoveIncidentEdge(edge);
|
||||
vertex->UnGuaranteeNeighbors();
|
||||
}
|
||||
if (extraedges) {
|
||||
delete[] extraedges;
|
||||
extraedges = 0;
|
||||
}
|
||||
|
||||
// Remove parent's reference to self
|
||||
if (parent) {
|
||||
bool parentHasOtherKids = false;
|
||||
assert(parent->children);
|
||||
int nchildren = mesh->GetSubdivision()->GetFaceChildrenCount(parent->nvertices);
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
if (parent->children[i] == this) {
|
||||
parent->children[i] = 0;
|
||||
} else if (parent->children[i]) parentHasOtherKids = true;
|
||||
}
|
||||
// After cleaning the parent's reference to self, the parent
|
||||
// may be able to clean itself up
|
||||
if (!parentHasOtherKids) {
|
||||
delete[] parent->children;
|
||||
parent->children = 0;
|
||||
if (parent->GarbageCollectable()) {
|
||||
mesh->DeleteFace(parent);
|
||||
}
|
||||
}
|
||||
parent = 0;
|
||||
}
|
||||
|
||||
// Orphan the child vertex
|
||||
if (vchild) {
|
||||
vchild->SetParent(static_cast<HbrFace*>(0));
|
||||
vchild = 0;
|
||||
}
|
||||
|
||||
if (nvertices > 4 && fvarbits) {
|
||||
free(fvarbits);
|
||||
#ifdef HBRSTITCH
|
||||
if (stitchEdges) {
|
||||
delete[] stitchEdges;
|
||||
}
|
||||
if (stitchDatas) {
|
||||
delete[] stitchDatas;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fvarbits = 0;
|
||||
#ifdef HBRSTITCH
|
||||
stitchEdges = 0;
|
||||
stitchDatas = 0;
|
||||
#endif
|
||||
|
||||
// Make sure the four edges intrinsic to face are properly cleared
|
||||
// if they were used
|
||||
if (nvertices <= 4) {
|
||||
for (i = 0; i < nvertices; ++i) {
|
||||
GetEdge(i)->Clear();
|
||||
}
|
||||
}
|
||||
nvertices = 0;
|
||||
initialized = 0;
|
||||
destroyed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrHalfedge<T>*
|
||||
HbrFace<T>::GetEdge(int index) const {
|
||||
assert(index >= 0 && index < nvertices);
|
||||
if (nvertices > 4) {
|
||||
return extraedges + index;
|
||||
} else {
|
||||
return const_cast<HbrHalfedge<T>*>(edges + index);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrFace<T>::GetVertex(int index) const {
|
||||
assert(index >= 0 && index < nvertices);
|
||||
if (nvertices > 4) {
|
||||
return extraedges[index].GetOrgVertex();
|
||||
} else {
|
||||
return edges[index].GetOrgVertex();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::SetChild(int index, HbrFace<T>* face) {
|
||||
// Construct the children array if it doesn't already exist
|
||||
int i;
|
||||
if (!children) {
|
||||
int nchildren = mesh->GetSubdivision()->GetFaceChildrenCount(nvertices);
|
||||
children = new HbrFace<T>*[nchildren];
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
children[i] = 0;
|
||||
}
|
||||
}
|
||||
children[index] = face;
|
||||
face->parent = this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrFace<T>::Subdivide() {
|
||||
if (vchild) return vchild;
|
||||
vchild = mesh->GetSubdivision()->Subdivide(mesh, this);
|
||||
vchild->SetParent(this);
|
||||
return vchild;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::Refine() {
|
||||
mesh->GetSubdivision()->Refine(mesh, this);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::Unrefine() {
|
||||
// Delete the children, via the mesh (so that the mesh loses
|
||||
// references to the children)
|
||||
if (children) {
|
||||
int nchildren = mesh->GetSubdivision()->GetFaceChildrenCount(nvertices);
|
||||
for (int i = 0; i < nchildren; ++i) {
|
||||
if (children[i]) mesh->DeleteFace(children[i]);
|
||||
}
|
||||
delete[] children;
|
||||
children = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrFace<T>::HasLimit() {
|
||||
return mesh->GetSubdivision()->HasLimit(mesh, this);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned long
|
||||
HbrFace<T>::GetMemStats() const {
|
||||
return sizeof(HbrFace<T>);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::MarkUsage() {
|
||||
// Must increment the usage on all vertices which are in the
|
||||
// support for this face
|
||||
HbrVertex<T>* v;
|
||||
HbrHalfedge<T>* e = GetFirstEdge(), *ee, *eee, *start;
|
||||
for (int i = 0; i < nvertices; ++i) {
|
||||
v = e->GetOrgVertex();
|
||||
v->GuaranteeNeighbors();
|
||||
start = v->GetIncidentEdge();
|
||||
ee = start;
|
||||
do {
|
||||
HbrFace<T>* f = ee->GetLeftFace();
|
||||
eee = f->GetFirstEdge();
|
||||
for (int j = 0; j < f->GetNumVertices(); ++j) {
|
||||
eee->GetOrgVertex()->IncrementUsage();
|
||||
eee = eee->GetNext();
|
||||
}
|
||||
ee = v->GetNextEdge(ee);
|
||||
if (ee == start) break;
|
||||
} while (ee);
|
||||
e = e->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::ClearUsage() {
|
||||
bool gc = false;
|
||||
|
||||
// Must mark all vertices which may affect this face
|
||||
HbrVertex<T>* v, *vv;
|
||||
HbrHalfedge<T>* e = GetFirstEdge(), *ee, *eee, *start;
|
||||
for (int i = 0; i < nvertices; ++i) {
|
||||
v = e->GetOrgVertex();
|
||||
start = v->GetIncidentEdge();
|
||||
ee = start;
|
||||
do {
|
||||
HbrFace<T>* f = ee->GetLeftFace();
|
||||
eee = f->GetFirstEdge();
|
||||
for (int j = 0; j < f->GetNumVertices(); ++j) {
|
||||
vv = eee->GetOrgVertex();
|
||||
vv->DecrementUsage();
|
||||
if (!vv->IsUsed()) {
|
||||
mesh->AddGarbageCollectableVertex(vv);
|
||||
gc = true;
|
||||
}
|
||||
eee = eee->GetNext();
|
||||
}
|
||||
ee = v->GetNextEdge(ee);
|
||||
if (ee == start) break;
|
||||
} while (ee);
|
||||
e = e->GetNext();
|
||||
}
|
||||
if (gc) mesh->GarbageCollect();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrFace<T>::GarbageCollectable() const {
|
||||
if (children || protect) return false;
|
||||
for (int i = 0; i < nvertices; ++i) {
|
||||
HbrHalfedge<T>* edge = GetEdge(i);
|
||||
HbrVertex<T>* vertex = edge->GetOrgVertex();
|
||||
if (vertex->IsUsed()) return false;
|
||||
if (!GetParent() && vertex->EdgeRemovalWillMakeSingular(edge)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFace<T>::SetHierarchicalEdits(HbrHierarchicalEdit<T>** _edits) {
|
||||
edits = _edits;
|
||||
|
||||
// Walk the list of edits and look for any which apply locally.
|
||||
while (HbrHierarchicalEdit<T>* edit = *_edits) {
|
||||
if (!edit->IsRelevantToFace(this)) break;
|
||||
edit->ApplyEditToFace(this);
|
||||
_edits++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrFace<T>& face) {
|
||||
out << "face " << face.GetID() << ", " << face.GetNumVertices() << " vertices (";
|
||||
for (int i = 0; i < face.GetNumVertices(); ++i) {
|
||||
HbrHalfedge<T>* e = face.GetEdge(i);
|
||||
out << *(e->GetOrgVertex());
|
||||
if (e->IsBoundary()) {
|
||||
out << " -/-> ";
|
||||
} else {
|
||||
out << " ---> ";
|
||||
}
|
||||
}
|
||||
out << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrFaceOperator {
|
||||
public:
|
||||
virtual void operator() (HbrFace<T> &face) = 0;
|
||||
virtual ~HbrFaceOperator() {}
|
||||
};
|
||||
|
||||
#endif /* HBRFACE_H */
|
144
opensubdiv/hbr/faceEdit.h
Normal file
144
opensubdiv/hbr/faceEdit.h
Normal file
@ -0,0 +1,144 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRFACEEDIT_H
|
||||
#define HBRFACEEDIT_H
|
||||
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
|
||||
template <class T> class HbrFaceEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrFaceEdit<T>& path) {
|
||||
out << "face path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << ")";
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrFaceEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrFaceEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, int _index, int _width, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), index(_index), width(_width), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
HbrFaceEdit(int _faceid, int _nsubfaces, int *_subfaces, int _index, int _width, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), index(_index), width(_width), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
#ifdef PRMAN
|
||||
HbrFaceEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, int _index, int _width, typename HbrHierarchicalEdit<T>::Operation _op, RtToken _edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), index(_index), width(_width), op(_op) {
|
||||
edit = new float[width];
|
||||
RtString* sedit = (RtString*) edit;
|
||||
*sedit = _edit;
|
||||
}
|
||||
|
||||
HbrFaceEdit(int _faceid, int _nsubfaces, int *_subfaces, int _index, int _width, typename HbrHierarchicalEdit<T>::Operation _op, RtToken _edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), index(_index), width(_width), op(_op) {
|
||||
edit = new float[width];
|
||||
RtString* sedit = (RtString*) edit;
|
||||
*sedit = _edit;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~HbrFaceEdit() {
|
||||
delete[] edit;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrFaceEdit<T>& path);
|
||||
|
||||
// Return index of variable this edit applies to
|
||||
int GetIndex() const { return index; }
|
||||
|
||||
// Return width of the variable
|
||||
int GetWidth() const { return width; }
|
||||
|
||||
// Get the numerical value of the edit
|
||||
const float* GetEdit() const { return edit; }
|
||||
|
||||
// Get the type of operation
|
||||
typename HbrHierarchicalEdit<T>::Operation GetOperation() const { return op; }
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
int oldUniformIndex = face->GetUniformIndex();
|
||||
|
||||
// Change the face's uniform index
|
||||
face->SetUniformIndex(face->GetMesh()->NewUniformIndex());
|
||||
|
||||
// Apply edit
|
||||
face->GetVertex(0)->GetData().ApplyFaceEdit(oldUniformIndex, face->GetUniformIndex(), *const_cast<const HbrFaceEdit<T>*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int index;
|
||||
int width;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
float* edit;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRFACEEDIT_H */
|
205
opensubdiv/hbr/fvarData.h
Normal file
205
opensubdiv/hbr/fvarData.h
Normal file
@ -0,0 +1,205 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRFVARDATA_H
|
||||
#define HBRFVARDATA_H
|
||||
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
|
||||
template <class T> class HbrFVarEdit;
|
||||
template <class T> class HbrFace;
|
||||
|
||||
// This class implements a "face varying vector item". Really it's
|
||||
// just a smart wrapper around face varying data (itself just a bunch
|
||||
// of floats) stored on each vertex.
|
||||
template <class T> class HbrFVarData {
|
||||
|
||||
public:
|
||||
|
||||
HbrFVarData(float *dataptr)
|
||||
: initialized(false), face(0), data(dataptr) {
|
||||
}
|
||||
|
||||
~HbrFVarData() {
|
||||
Uninitialize();
|
||||
}
|
||||
|
||||
// Sets the face pointer
|
||||
void SetFace(const HbrFace<T> *_face) {
|
||||
face = _face;
|
||||
}
|
||||
|
||||
// Returns the face pointer
|
||||
const HbrFace<T> * GetFace() const {
|
||||
return face;
|
||||
}
|
||||
|
||||
// Clears the initialized flag
|
||||
void Uninitialize() {
|
||||
initialized = false;
|
||||
face = 0;
|
||||
}
|
||||
|
||||
// Returns initialized flag
|
||||
bool IsInitialized() const {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
// Sets initialized flag
|
||||
void SetInitialized() {
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// Return the data from the NgpFVVector
|
||||
float* GetData(int item) const { return &data[item]; }
|
||||
|
||||
// Clears the indicates value of this item
|
||||
void Clear(int startindex, int width) {
|
||||
memset(data + startindex, 0, width * sizeof(float));
|
||||
}
|
||||
|
||||
// Clears all values of this item
|
||||
void ClearAll(int width) {
|
||||
initialized = true;
|
||||
memset(data, 0, width * sizeof(float));
|
||||
}
|
||||
|
||||
// Set values of the indicated item (with the indicated weighing)
|
||||
// on this item
|
||||
void SetWithWeight(const HbrFVarData& fvvi, int startindex, int width, float weight) {
|
||||
float *dst = data + startindex, *src = fvvi.data + startindex;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
*dst++ = weight * *src++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add values of the indicated item (with the indicated weighing)
|
||||
// to this item
|
||||
void AddWithWeight(const HbrFVarData& fvvi, int startindex, int width, float weight) {
|
||||
float *dst = data + startindex, *src = fvvi.data + startindex;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
*dst++ += weight * *src++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add all values of the indicated item (with the indicated
|
||||
// weighing) to this item
|
||||
void AddWithWeightAll(const HbrFVarData& fvvi, int width, float weight) {
|
||||
float *dst = data, *src = fvvi.data;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
*dst++ += weight * *src++;
|
||||
}
|
||||
}
|
||||
|
||||
// Compare all values item against a float buffer. Returns true
|
||||
// if all values match
|
||||
bool CompareAll(int width, const float *values, float tolerance=0.0f) const {
|
||||
if (!initialized) return false;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
if (fabsf(values[i] - data[i]) > tolerance) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Initializes data
|
||||
void SetAllData(int width, const float *values) {
|
||||
initialized = true;
|
||||
memcpy(data, values, width * sizeof(float));
|
||||
}
|
||||
|
||||
// Compare this item against another item with tolerance. Returns
|
||||
// true if it compares identical
|
||||
bool Compare(const HbrFVarData& fvvi, int startindex, int width, float tolerance=0.0f) const {
|
||||
for (int i = 0; i < width; ++i) {
|
||||
if (fabsf(data[startindex + i] - fvvi.data[startindex + i]) > tolerance) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Modify the data of the item with an edit
|
||||
void ApplyFVarEdit(const HbrFVarEdit<T>& edit);
|
||||
|
||||
private:
|
||||
bool initialized;
|
||||
const HbrFace<T> *face;
|
||||
float* const data;
|
||||
};
|
||||
|
||||
#include "../hbr/fvarEdit.h"
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFVarData<T>::ApplyFVarEdit(const HbrFVarEdit<T>& edit) {
|
||||
float *dst = data + edit.GetIndex() + edit.GetOffset();
|
||||
const float *src = edit.GetEdit();
|
||||
for (int i = 0; i < edit.GetWidth(); ++i) {
|
||||
switch(edit.GetOperation()) {
|
||||
case HbrVertexEdit<T>::Set:
|
||||
*dst++ = *src++;
|
||||
break;
|
||||
case HbrVertexEdit<T>::Add:
|
||||
*dst++ += *src++;
|
||||
break;
|
||||
case HbrVertexEdit<T>::Subtract:
|
||||
*dst++ -= *src++;
|
||||
}
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
#endif /* HBRFVARDATA_H */
|
143
opensubdiv/hbr/fvarEdit.h
Normal file
143
opensubdiv/hbr/fvarEdit.h
Normal file
@ -0,0 +1,143 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRFVAREDIT_H
|
||||
#define HBRFVAREDIT_H
|
||||
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
#include "../hbr/vertexEdit.h"
|
||||
|
||||
template <class T> class HbrFVarEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrFVarEdit<T>& path) {
|
||||
out << "vertex path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << static_cast<int>(path.vertexid) << "), edit = (" << path.edit[0] << ',' << path.edit[1] << ',' << path.edit[2] << ')';
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrFVarEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrFVarEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, unsigned char _vertexid, int _index, int _width, int _offset, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), offset(_offset), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
HbrFVarEdit(int _faceid, int _nsubfaces, int *_subfaces, int _vertexid, int _index, int _width, int _offset, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), offset(_offset), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
virtual ~HbrFVarEdit() {
|
||||
delete[] edit;
|
||||
}
|
||||
|
||||
// Return the vertex id (the last element in the path)
|
||||
unsigned char GetVertexID() const { return vertexid; }
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrFVarEdit<T>& path);
|
||||
|
||||
// Return index into the facevarying data
|
||||
int GetIndex() const { return index; }
|
||||
|
||||
// Return width of the data
|
||||
int GetWidth() const { return width; }
|
||||
|
||||
// Return offset of the data
|
||||
int GetOffset() const { return offset; }
|
||||
|
||||
// Get the numerical value of the edit
|
||||
const float* GetEdit() const { return edit; }
|
||||
|
||||
// Get the type of operation
|
||||
typename HbrHierarchicalEdit<T>::Operation GetOperation() const { return op; }
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
// The edit will modify the data and almost certainly
|
||||
// create a discontinuity, so allocate storage for a new
|
||||
// copy of the existing data specific to the face (or use
|
||||
// one that already exists) and modify that
|
||||
HbrFVarData<T> &fvt = face->GetVertex(vertexid)->GetFVarData(face);
|
||||
if (fvt.GetFace() != face) {
|
||||
// This is the generic fvt, allocate a new copy and edit it
|
||||
HbrFVarData<T> &newfvt = face->GetVertex(vertexid)->NewFVarData(face);
|
||||
newfvt.SetAllData(face->GetMesh()->GetTotalFVarWidth(), fvt.GetData(0));
|
||||
newfvt.ApplyFVarEdit(*const_cast<const HbrFVarEdit<T>*>(this));
|
||||
} else {
|
||||
fvt.ApplyFVarEdit(*const_cast<const HbrFVarEdit<T>*>(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const unsigned char vertexid;
|
||||
const int index;
|
||||
const int width;
|
||||
const int offset;
|
||||
float* edit;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRFVAREDIT_H */
|
645
opensubdiv/hbr/halfedge.h
Normal file
645
opensubdiv/hbr/halfedge.h
Normal file
@ -0,0 +1,645 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRHALFEDGE_H
|
||||
#define HBRHALFEDGE_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#ifdef HBRSTITCH
|
||||
#include "libgprims/stitch.h"
|
||||
#include "libgprims/stitchInternal.h"
|
||||
#endif
|
||||
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrMesh;
|
||||
|
||||
template <class T> std::ostream& operator<<(std::ostream& out, const HbrHalfedge<T>& edge);
|
||||
|
||||
template <class T> class HbrHalfedge {
|
||||
|
||||
public:
|
||||
|
||||
HbrHalfedge(): opposite(0), incidentFace(0), incidentVertex(0), vchild(0), sharpness(0.0f)
|
||||
#ifdef HBRSTITCH
|
||||
, stitchccw(1), raystitchccw(1)
|
||||
#endif
|
||||
, coarse(1)
|
||||
{
|
||||
}
|
||||
|
||||
~HbrHalfedge();
|
||||
|
||||
void Clear();
|
||||
|
||||
// Finish the initialization of the halfedge. Should only be
|
||||
// called by HbrFace
|
||||
void Initialize(HbrHalfedge<T>* opposite, int index, HbrVertex<T>* origin, unsigned int *fvarbits, HbrFace<T>* face);
|
||||
|
||||
// Returns the opposite half edge
|
||||
HbrHalfedge<T>* GetOpposite() const { return opposite; }
|
||||
|
||||
// Sets the opposite half edge
|
||||
void SetOpposite(HbrHalfedge<T>* opposite) { this->opposite = opposite; sharpness = opposite->sharpness; }
|
||||
|
||||
// Returns the next clockwise halfedge around the incident face
|
||||
HbrHalfedge<T>* GetNext() const {
|
||||
if (lastedge) {
|
||||
return (HbrHalfedge<T>*) ((char*) this - (incidentFace->GetNumVertices() - 1) * sizeof(HbrHalfedge<T>));
|
||||
} else {
|
||||
return (HbrHalfedge<T>*) ((char*) this + sizeof(HbrHalfedge<T>));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the previous counterclockwise halfedge around the incident face
|
||||
HbrHalfedge<T>* GetPrev() const {
|
||||
if (firstedge) {
|
||||
return (HbrHalfedge<T>*) ((char*) this + (incidentFace->GetNumVertices() - 1) * sizeof(HbrHalfedge<T>));
|
||||
} else {
|
||||
return (HbrHalfedge<T>*) ((char*) this - sizeof(HbrHalfedge<T>));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the index of the edge relative to its incident face.
|
||||
// This relies on knowledge of the face's edge allocation pattern
|
||||
int GetIndex() const {
|
||||
// we allocate room for up to 4 values (to handle tri or quad)
|
||||
// in the edges array. If there are more than that, they _all_
|
||||
// go in the extra edges array.
|
||||
if (this >= incidentFace->edges &&
|
||||
this < incidentFace->edges + 4) {
|
||||
return this - incidentFace->edges;
|
||||
} else {
|
||||
return this - incidentFace->extraedges;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the incident vertex
|
||||
HbrVertex<T>* GetVertex() const {
|
||||
return incidentVertex;
|
||||
}
|
||||
|
||||
// Returns the source vertex
|
||||
HbrVertex<T>* GetOrgVertex() const {
|
||||
return incidentVertex;
|
||||
}
|
||||
|
||||
// Changes the origin vertex. Generally not a good idea to do
|
||||
void SetOrgVertex(HbrVertex<T>* v) { incidentVertex = v; }
|
||||
|
||||
// Returns the destination vertex
|
||||
HbrVertex<T>* GetDestVertex() const { return GetNext()->GetOrgVertex(); }
|
||||
|
||||
// Returns the incident facet
|
||||
HbrFace<T>* GetFace() const { return incidentFace; }
|
||||
|
||||
// Returns the mesh to which this edge belongs
|
||||
HbrMesh<T>* GetMesh() const { return incidentFace->GetMesh(); }
|
||||
|
||||
// Returns the face on the right
|
||||
HbrFace<T>* GetRightFace() const { return opposite ? opposite->GetLeftFace() : NULL; }
|
||||
|
||||
// Return the face on the left of the halfedge
|
||||
HbrFace<T>* GetLeftFace() const { return incidentFace; }
|
||||
|
||||
// Returns whether this is a boundary edge
|
||||
bool IsBoundary() const { return opposite == 0; }
|
||||
|
||||
// Tag the edge as being an infinitely sharp facevarying edge
|
||||
void SetFVarInfiniteSharp(int datum, bool infsharp) {
|
||||
int intindex = datum >> 4;
|
||||
unsigned int bits = infsharp << ((datum & 15) * 2);
|
||||
getFVarInfSharp()[intindex] |= bits;
|
||||
if (opposite) {
|
||||
opposite->getFVarInfSharp()[intindex] |= bits;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy fvar infinite sharpness flags from another edge
|
||||
void CopyFVarInfiniteSharpness(HbrHalfedge<T>* edge) {
|
||||
unsigned int *fvarinfsharp = getFVarInfSharp();
|
||||
if (fvarinfsharp) {
|
||||
const int fvarcount = GetMesh()->GetFVarCount();
|
||||
int fvarbitsSizePerEdge = ((fvarcount + 15) / 16);
|
||||
memcpy(fvarinfsharp, edge->getFVarInfSharp(), fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns whether the edge is infinitely sharp in facevarying for
|
||||
// a particular facevarying datum
|
||||
bool GetFVarInfiniteSharp(int datum);
|
||||
|
||||
// Returns whether the edge is infinitely sharp in any facevarying
|
||||
// datum
|
||||
bool IsFVarInfiniteSharpAnywhere();
|
||||
|
||||
// Get the sharpness relative to facevarying data
|
||||
float GetFVarSharpness(int datum, bool ignoreGeometry=false);
|
||||
|
||||
// Returns the (raw) sharpness of the edge
|
||||
float GetSharpness() const { return sharpness; }
|
||||
|
||||
// Sets the sharpness of the edge
|
||||
void SetSharpness(float sharp) { sharpness = sharp; if (opposite) opposite->sharpness = sharp; ClearMask(); }
|
||||
|
||||
// Returns whether the edge is sharp at the current level of
|
||||
// subdivision (next = false) or at the next level of subdivision
|
||||
// (next = true).
|
||||
bool IsSharp(bool next) const { return (next ? (sharpness > 0.0f) : (sharpness >= 1.0f)); }
|
||||
|
||||
// Clears the masks of the adjacent edge vertices. Usually called
|
||||
// when a change in edge sharpness occurs.
|
||||
void ClearMask() { GetOrgVertex()->ClearMask(); GetDestVertex()->ClearMask(); }
|
||||
|
||||
// Subdivide the edge into a vertex if needed and return
|
||||
HbrVertex<T>* Subdivide();
|
||||
|
||||
// Make sure the edge has its opposite face
|
||||
void GuaranteeNeighbor();
|
||||
|
||||
// Remove the reference to subdivided vertex
|
||||
void RemoveChild() { vchild = 0; }
|
||||
|
||||
// Sharpness constants
|
||||
enum Mask {
|
||||
k_Smooth = 0,
|
||||
k_Sharp = 1,
|
||||
k_InfinitelySharp = 10
|
||||
};
|
||||
|
||||
#ifdef HBRSTITCH
|
||||
StitchEdge* GetStitchEdge(int i) {
|
||||
StitchEdge **stitchEdge = getStitchEdges();
|
||||
// If the stitch edge exists, the ownership is transferred to
|
||||
// the caller. Make sure the opposite edge loses ownership as
|
||||
// well.
|
||||
if (stitchEdge[i]) {
|
||||
if (opposite) {
|
||||
opposite->getStitchEdges()[i] = 0;
|
||||
}
|
||||
return StitchGetEdge(&stitchEdge[i]);
|
||||
}
|
||||
// If the stitch edge does not exist then we create one now.
|
||||
// Make sure the opposite edge gets a copy of it too
|
||||
else {
|
||||
StitchGetEdge(&stitchEdge[i]);
|
||||
if (opposite) {
|
||||
opposite->getStitchEdges()[i] = stitchEdge[i];
|
||||
}
|
||||
return stitchEdge[i];
|
||||
}
|
||||
}
|
||||
|
||||
// If stitch edge exists, and this edge has no opposite, destroy
|
||||
// it
|
||||
void DestroyStitchEdges(int stitchcount) {
|
||||
if (!opposite) {
|
||||
StitchEdge **stitchEdge = getStitchEdges();
|
||||
for (int i = 0; i < stitchcount; ++i) {
|
||||
if (stitchEdge[i]) {
|
||||
StitchFreeEdge(stitchEdge[i]);
|
||||
stitchEdge[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StitchEdge* GetRayStitchEdge(int i) {
|
||||
return GetStitchEdge(i + 2);
|
||||
}
|
||||
|
||||
// Splits our split edge between our children. We'd better have
|
||||
// subdivided this edge by this point
|
||||
void SplitStitchEdge(int i) {
|
||||
StitchEdge* se = GetStitchEdge(i);
|
||||
HbrHalfedge<T>* ea = GetOrgVertex()->Subdivide()->GetEdge(Subdivide());
|
||||
HbrHalfedge<T>* eb = Subdivide()->GetEdge(GetDestVertex()->Subdivide());
|
||||
StitchEdge **ease = ea->getStitchEdges();
|
||||
StitchEdge **ebse = eb->getStitchEdges();
|
||||
if (i >= 2) { // ray tracing stitches
|
||||
if (!raystitchccw) {
|
||||
StitchSplitEdge(se, &ease[i], &ebse[i], false, 0, 0, 0);
|
||||
} else {
|
||||
StitchSplitEdge(se, &ebse[i], &ease[i], true, 0, 0, 0);
|
||||
}
|
||||
ea->raystitchccw = eb->raystitchccw = raystitchccw;
|
||||
if (eb->opposite) {
|
||||
eb->opposite->getStitchEdges()[i] = ebse[i];
|
||||
eb->opposite->raystitchccw = raystitchccw;
|
||||
}
|
||||
if (ea->opposite) {
|
||||
ea->opposite->getStitchEdges()[i] = ease[i];
|
||||
ea->opposite->raystitchccw = raystitchccw;
|
||||
}
|
||||
} else {
|
||||
if (!stitchccw) {
|
||||
StitchSplitEdge(se, &ease[i], &ebse[i], false, 0, 0, 0);
|
||||
} else {
|
||||
StitchSplitEdge(se, &ebse[i], &ease[i], true, 0, 0, 0);
|
||||
}
|
||||
ea->stitchccw = eb->stitchccw = stitchccw;
|
||||
if (eb->opposite) {
|
||||
eb->opposite->getStitchEdges()[i] = ebse[i];
|
||||
eb->opposite->stitchccw = stitchccw;
|
||||
}
|
||||
if (ea->opposite) {
|
||||
ea->opposite->getStitchEdges()[i] = ease[i];
|
||||
ea->opposite->stitchccw = stitchccw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SplitRayStitchEdge(int i) {
|
||||
SplitStitchEdge(i + 2);
|
||||
}
|
||||
|
||||
void SetStitchEdge(int i, StitchEdge* edge) {
|
||||
StitchEdge **stitchEdges = getStitchEdges();
|
||||
stitchEdges[i] = edge;
|
||||
if (opposite) {
|
||||
opposite->getStitchEdges()[i] = edge;
|
||||
}
|
||||
}
|
||||
|
||||
void SetRayStitchEdge(int i, StitchEdge* edge) {
|
||||
StitchEdge **stitchEdges = getStitchEdges();
|
||||
stitchEdges[i+2] = edge;
|
||||
if (opposite) {
|
||||
opposite->getStitchEdges()[i+2] = edge;
|
||||
}
|
||||
}
|
||||
|
||||
void* GetStitchData() const {
|
||||
if (stitchdatavalid) return *(incidentFace->stitchDatas + GetIndex());
|
||||
else return 0;
|
||||
}
|
||||
|
||||
void SetStitchData(void* data) {
|
||||
*(incidentFace->stitchDatas + GetIndex()) = data;
|
||||
stitchdatavalid = data ? 1 : 0;
|
||||
if (opposite) {
|
||||
*(opposite->incidentFace->stitchDatas + opposite->GetIndex()) = data;
|
||||
opposite->stitchdatavalid = stitchdatavalid;
|
||||
}
|
||||
}
|
||||
|
||||
bool GetStitchCCW(bool raytraced) const { return raytraced ? raystitchccw : stitchccw; }
|
||||
|
||||
void ClearStitchCCW(bool raytraced) {
|
||||
if (raytraced) {
|
||||
raystitchccw = 0;
|
||||
if (opposite) opposite->raystitchccw = 0;
|
||||
} else {
|
||||
stitchccw = 0;
|
||||
if (opposite) opposite->stitchccw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ToggleStitchCCW(bool raytraced) {
|
||||
if (raytraced) {
|
||||
raystitchccw = 1 - raystitchccw;
|
||||
if (opposite) opposite->raystitchccw = raystitchccw;
|
||||
} else {
|
||||
stitchccw = 1 - stitchccw;
|
||||
if (opposite) opposite->stitchccw = stitchccw;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Marks the edge as being "coarse" (belonging to the control
|
||||
// mesh). Generally this distinction only needs to be made if
|
||||
// we're worried about interpolateboundary behaviour
|
||||
void SetCoarse(bool c) { coarse = c; }
|
||||
bool IsCoarse() const { return coarse; }
|
||||
|
||||
private:
|
||||
HbrHalfedge<T>* opposite;
|
||||
HbrFace<T>* incidentFace;
|
||||
|
||||
// Index of incident vertex
|
||||
HbrVertex<T>* incidentVertex;
|
||||
|
||||
// Index of child vertex
|
||||
HbrVertex<T>* vchild;
|
||||
float sharpness;
|
||||
|
||||
#ifdef HBRSTITCH
|
||||
unsigned char stitchccw:1;
|
||||
unsigned char raystitchccw:1;
|
||||
unsigned char stitchdatavalid:1;
|
||||
#endif
|
||||
unsigned char coarse:1;
|
||||
unsigned char lastedge:1;
|
||||
unsigned char firstedge:1;
|
||||
|
||||
// Returns bitmask indicating whether a given facevarying datum
|
||||
// for the edge is infinitely sharp. Each datum has two bits, and
|
||||
// if those two bits are set to 3, it means the status has not
|
||||
// been computed yet.
|
||||
unsigned int *getFVarInfSharp() {
|
||||
unsigned int *fvarbits = incidentFace->fvarbits;
|
||||
if (fvarbits) {
|
||||
int fvarbitsSizePerEdge = ((GetMesh()->GetFVarCount() + 15) / 16);
|
||||
return fvarbits + GetIndex() * fvarbitsSizePerEdge;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HBRSTITCH
|
||||
StitchEdge **getStitchEdges() {
|
||||
return incidentFace->stitchEdges + GetMesh()->GetStitchCount() * GetIndex();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrHalfedge<T>::Initialize(HbrHalfedge<T>* opposite, int index, HbrVertex<T>* origin, unsigned int *fvarbits, HbrFace<T>* face) {
|
||||
this->opposite = opposite;
|
||||
incidentVertex = origin;
|
||||
incidentFace = face;
|
||||
lastedge = (index == face->GetNumVertices() - 1);
|
||||
firstedge = (index == 0);
|
||||
if (opposite) {
|
||||
sharpness = opposite->sharpness;
|
||||
#ifdef HBRSTITCH
|
||||
StitchEdge **stitchEdges = getStitchEdges();
|
||||
for (int i = 0; i < face->GetMesh()->GetStitchCount(); ++i) {
|
||||
stitchEdges[i] = opposite->getStitchEdges()[i];
|
||||
}
|
||||
stitchccw = opposite->stitchccw;
|
||||
raystitchccw = opposite->raystitchccw;
|
||||
stitchdatavalid = 0;
|
||||
if (stitchEdges && opposite->GetStitchData()) {
|
||||
*(incidentFace->stitchDatas + index) = opposite->GetStitchData();
|
||||
stitchdatavalid = 1;
|
||||
}
|
||||
#endif
|
||||
if (fvarbits) {
|
||||
const int fvarcount = face->GetMesh()->GetFVarCount();
|
||||
int fvarbitsSizePerEdge = ((fvarcount + 15) / 16);
|
||||
memcpy(fvarbits, opposite->getFVarInfSharp(), fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
}
|
||||
} else {
|
||||
sharpness = 0.0f;
|
||||
#ifdef HBRSTITCH
|
||||
StitchEdge **stitchEdges = getStitchEdges();
|
||||
for (int i = 0; i < face->GetMesh()->GetStitchCount(); ++i) {
|
||||
stitchEdges[i] = 0;
|
||||
}
|
||||
stitchccw = 1;
|
||||
raystitchccw = 1;
|
||||
stitchdatavalid = 0;
|
||||
#endif
|
||||
if (fvarbits) {
|
||||
const int fvarcount = face->GetMesh()->GetFVarCount();
|
||||
int fvarbitsSizePerEdge = ((fvarcount + 15) / 16);
|
||||
memset(fvarbits, 0xff, fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrHalfedge<T>::~HbrHalfedge() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrHalfedge<T>::Clear() {
|
||||
if (opposite) {
|
||||
opposite->opposite = 0;
|
||||
if (vchild) {
|
||||
// Transfer ownership of the vchild to the opposite ptr
|
||||
opposite->vchild = vchild;
|
||||
// Done this way just for assertion sanity
|
||||
vchild->SetParent(static_cast<HbrHalfedge*>(0));
|
||||
vchild->SetParent(opposite);
|
||||
vchild = 0;
|
||||
}
|
||||
opposite = 0;
|
||||
}
|
||||
// Orphan the child vertex
|
||||
else if (vchild) {
|
||||
vchild->SetParent(static_cast<HbrHalfedge*>(0));
|
||||
vchild = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrHalfedge<T>::Subdivide() {
|
||||
if (vchild) return vchild;
|
||||
// Make sure that our opposite doesn't "own" a subdivided vertex
|
||||
// already. If it does, use that
|
||||
if (opposite && opposite->vchild) return opposite->vchild;
|
||||
HbrMesh<T>* mesh = GetMesh();
|
||||
vchild = mesh->GetSubdivision()->Subdivide(mesh, this);
|
||||
vchild->SetParent(this);
|
||||
return vchild;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrHalfedge<T>::GuaranteeNeighbor() {
|
||||
HbrMesh<T>* mesh = GetMesh();
|
||||
mesh->GetSubdivision()->GuaranteeNeighbor(mesh, this);
|
||||
}
|
||||
|
||||
// Determines whether an edge is infinitely sharp as far as its
|
||||
// facevarying data is concerned. Happens if the faces on both sides
|
||||
// disagree on the facevarying data at either of the shared vertices
|
||||
// on the edge.
|
||||
template <class T>
|
||||
bool
|
||||
HbrHalfedge<T>::GetFVarInfiniteSharp(int datum) {
|
||||
|
||||
// Check to see if already initialized
|
||||
int intindex = datum >> 4;
|
||||
int shift = (datum & 15) << 1;
|
||||
unsigned int *fvarinfsharp = getFVarInfSharp();
|
||||
unsigned int bits = (fvarinfsharp[intindex] >> shift) & 0x3;
|
||||
if (bits != 3) {
|
||||
assert (bits != 2);
|
||||
return bits ? true : false;
|
||||
}
|
||||
|
||||
// If there is no face varying data it can't be infinitely sharp!
|
||||
const int fvarwidth = GetMesh()->GetTotalFVarWidth();
|
||||
if (!fvarwidth) {
|
||||
bits = ~(0x3 << shift);
|
||||
fvarinfsharp[intindex] &= bits;
|
||||
if (opposite) opposite->getFVarInfSharp()[intindex] &= bits;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If either incident face is missing, it's a geometric boundary
|
||||
// edge, and also a facevarying boundary edge
|
||||
HbrFace<T>* left = GetLeftFace(), *right = GetRightFace();
|
||||
if (!left || !right) {
|
||||
bits = ~(0x2 << shift);
|
||||
fvarinfsharp[intindex] &= bits;
|
||||
if (opposite) opposite->getFVarInfSharp()[intindex] &= bits;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Look for the indices on each face which correspond to the
|
||||
// origin and destination vertices of the edge
|
||||
int lorg = -1, ldst = -1, rorg = -1, rdst = -1, i, nv;
|
||||
HbrHalfedge<T>* e;
|
||||
e = left->GetFirstEdge();
|
||||
nv = left->GetNumVertices();
|
||||
for (i = 0; i < nv; ++i) {
|
||||
if (e->GetOrgVertex() == GetOrgVertex()) lorg = i;
|
||||
if (e->GetOrgVertex() == GetDestVertex()) ldst = i;
|
||||
e = e->GetNext();
|
||||
}
|
||||
e = right->GetFirstEdge();
|
||||
nv = right->GetNumVertices();
|
||||
for (i = 0; i < nv; ++i) {
|
||||
if (e->GetOrgVertex() == GetOrgVertex()) rorg = i;
|
||||
if (e->GetOrgVertex() == GetDestVertex()) rdst = i;
|
||||
e = e->GetNext();
|
||||
}
|
||||
assert(lorg >= 0 && ldst >= 0 && rorg >= 0 && rdst >= 0);
|
||||
// Compare the facevarying data to some tolerance
|
||||
const int startindex = GetMesh()->GetFVarIndices()[datum];
|
||||
const int width = GetMesh()->GetFVarWidths()[datum];
|
||||
if (!right->GetFVarData(rorg).Compare(left->GetFVarData(lorg), startindex, width, 0.001f) ||
|
||||
!right->GetFVarData(rdst).Compare(left->GetFVarData(ldst), startindex, width, 0.001f)) {
|
||||
bits = ~(0x2 << shift);
|
||||
fvarinfsharp[intindex] &= bits;
|
||||
if (opposite) opposite->getFVarInfSharp()[intindex] &= bits;
|
||||
return true;
|
||||
}
|
||||
|
||||
bits = ~(0x3 << shift);
|
||||
fvarinfsharp[intindex] &= bits;
|
||||
if (opposite) opposite->getFVarInfSharp()[intindex] &= bits;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrHalfedge<T>::IsFVarInfiniteSharpAnywhere() {
|
||||
for (int i = 0; i < GetMesh()->GetFVarCount(); ++i) {
|
||||
if (GetFVarInfiniteSharp(i)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
float
|
||||
HbrHalfedge<T>::GetFVarSharpness(int datum, bool ignoreGeometry) {
|
||||
|
||||
bool infsharp = GetFVarInfiniteSharp(datum);
|
||||
|
||||
if (infsharp) return k_InfinitelySharp;
|
||||
|
||||
if (!ignoreGeometry) {
|
||||
// If it's a geometrically sharp edge it's going to be a
|
||||
// facevarying sharp edge too
|
||||
if (sharpness > k_Smooth) {
|
||||
return k_InfinitelySharp;
|
||||
}
|
||||
}
|
||||
return k_Smooth;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
std::ostream&
|
||||
operator<<(std::ostream& out, const HbrHalfedge<T>& edge) {
|
||||
if (edge.IsBoundary()) out << "boundary ";
|
||||
out << "edge connecting ";
|
||||
if (edge.GetOrgVertex())
|
||||
out << *edge.GetOrgVertex();
|
||||
else
|
||||
out << "(none)";
|
||||
out << " to ";
|
||||
if (edge.GetDestVertex()) {
|
||||
out << *edge.GetDestVertex();
|
||||
} else {
|
||||
out << "(none)";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// Sorts half edges by the relative ordering of the incident faces'
|
||||
// paths.
|
||||
template <class T>
|
||||
class HbrHalfedgeCompare {
|
||||
public:
|
||||
bool operator() (const HbrHalfedge<T>* a, HbrHalfedge<T>* b) const {
|
||||
return (a->GetFace()->GetPath() < b->GetFace()->GetPath());
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class HbrHalfedgeOperator {
|
||||
public:
|
||||
virtual void operator() (HbrHalfedge<T> &edge) = 0;
|
||||
virtual ~HbrHalfedgeOperator() {}
|
||||
};
|
||||
|
||||
#endif /* HBRHALFEDGE_H */
|
185
opensubdiv/hbr/hierarchicalEdit.h
Normal file
185
opensubdiv/hbr/hierarchicalEdit.h
Normal file
@ -0,0 +1,185 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRHIERARCHICALEDIT_H
|
||||
#define HBRHIERARCHICALEDIT_H
|
||||
|
||||
template <class T> class HbrHierarchicalEdit;
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrVertex;
|
||||
|
||||
template <class T>
|
||||
class HbrHierarchicalEdit {
|
||||
|
||||
public:
|
||||
typedef enum Operation {
|
||||
Set,
|
||||
Add,
|
||||
Subtract
|
||||
} Operation;
|
||||
|
||||
protected:
|
||||
|
||||
HbrHierarchicalEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces)
|
||||
: faceid(_faceid), nsubfaces(_nsubfaces) {
|
||||
subfaces = new unsigned char[_nsubfaces];
|
||||
for (int i = 0; i < nsubfaces; ++i) {
|
||||
subfaces[i] = _subfaces[i];
|
||||
}
|
||||
}
|
||||
|
||||
HbrHierarchicalEdit(int _faceid, int _nsubfaces, int *_subfaces)
|
||||
: faceid(_faceid), nsubfaces(_nsubfaces) {
|
||||
subfaces = new unsigned char[_nsubfaces];
|
||||
for (int i = 0; i < nsubfaces; ++i) {
|
||||
subfaces[i] = static_cast<unsigned char>(_subfaces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~HbrHierarchicalEdit() {
|
||||
delete[] subfaces;
|
||||
}
|
||||
|
||||
bool operator<(const HbrHierarchicalEdit& p) const {
|
||||
if (faceid < p.faceid) return true;
|
||||
if (faceid > p.faceid) return false;
|
||||
int minlength = nsubfaces;
|
||||
if (minlength > p.nsubfaces) minlength = p.nsubfaces;
|
||||
for (int i = 0; i < minlength; ++i) {
|
||||
if (subfaces[i] < p.subfaces[i]) return true;
|
||||
if (subfaces[i] > p.subfaces[i]) return false;
|
||||
}
|
||||
return (nsubfaces < p.nsubfaces);
|
||||
}
|
||||
|
||||
// Return the face id (the first element in the path)
|
||||
int GetFaceID() const { return faceid; }
|
||||
|
||||
// Return the number of subfaces in the path
|
||||
int GetNSubfaces() const { return nsubfaces; }
|
||||
|
||||
// Return a subface element in the path
|
||||
unsigned char GetSubface(int index) const { return subfaces[index]; }
|
||||
|
||||
// Determines whether this hierarchical edit is relevant to the
|
||||
// face in question
|
||||
bool IsRelevantToFace(HbrFace<T>* face) const;
|
||||
|
||||
// Applys edit to face. All subclasses may override this method
|
||||
virtual void ApplyEditToFace(HbrFace<T>* /* face */) {}
|
||||
|
||||
// Applys edit to vertex. Subclasses may override this method.
|
||||
virtual void ApplyEditToVertex(HbrFace<T>* /* face */, HbrVertex<T>* /* vertex */) {}
|
||||
|
||||
#ifdef PRMAN
|
||||
// Gets the effect of this hierarchical edit on the bounding box.
|
||||
// Subclasses may override this method
|
||||
virtual void ApplyToBound(struct bbox& /* box */, RtMatrix * /* mx */) {}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// ID of the top most face in the mesh which begins the path
|
||||
const int faceid;
|
||||
|
||||
// Number of subfaces
|
||||
const int nsubfaces;
|
||||
|
||||
// IDs of the subfaces
|
||||
unsigned char *subfaces;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class HbrHierarchicalEditComparator {
|
||||
public:
|
||||
bool operator() (const HbrHierarchicalEdit<T>* path1, const HbrHierarchicalEdit<T>* path2) const {
|
||||
return (*path1 < *path2);
|
||||
}
|
||||
};
|
||||
|
||||
#include "../hbr/face.h"
|
||||
#include <string.h>
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const {
|
||||
|
||||
// Key assumption: the face's first vertex edit is relevant to
|
||||
// that face. We will then compare ourselves to that edit and if
|
||||
// the first part of our subpath is identical to the entirety of
|
||||
// that subpath, this edit is relevant.
|
||||
|
||||
// Calling code is responsible for making sure we don't
|
||||
// dereference a null pointer here
|
||||
HbrHierarchicalEdit<T>* p = *face->GetHierarchicalEdits();
|
||||
if (!p) return false;
|
||||
|
||||
if (this == p) return true;
|
||||
|
||||
if (faceid != p->faceid) return false;
|
||||
|
||||
// If our path length is less than the face depth, it should mean
|
||||
// that we're dealing with another face somewhere up the path, so
|
||||
// we're not relevant
|
||||
if (nsubfaces < face->GetDepth()) return false;
|
||||
|
||||
if (memcmp(subfaces, p->subfaces, face->GetDepth() * sizeof(unsigned char)) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* HBRHIERARCHICALEDIT_H */
|
96
opensubdiv/hbr/holeEdit.h
Normal file
96
opensubdiv/hbr/holeEdit.h
Normal file
@ -0,0 +1,96 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRHOLEEDIT_H
|
||||
#define HBRHOLEEDIT_H
|
||||
|
||||
template <class T> class HbrHoleEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrHoleEdit<T>& path) {
|
||||
out << "edge path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << ")";
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrHoleEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrHoleEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces) {
|
||||
}
|
||||
|
||||
HbrHoleEdit(int _faceid, int _nsubfaces, int *_subfaces)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces) {
|
||||
}
|
||||
|
||||
virtual ~HbrHoleEdit() {}
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrHoleEdit<T>& path);
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
face->SetHole();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRHOLEEDIT_H */
|
997
opensubdiv/hbr/loop.h
Normal file
997
opensubdiv/hbr/loop.h
Normal file
@ -0,0 +1,997 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRLOOP_H
|
||||
#define HBRLOOP_H
|
||||
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../hbr/subdivision.h"
|
||||
|
||||
/* #define HBR_DEBUG */
|
||||
|
||||
template <class T>
|
||||
class HbrLoopSubdivision : public HbrSubdivision<T>{
|
||||
public:
|
||||
HbrLoopSubdivision<T>()
|
||||
: HbrSubdivision<T>() {}
|
||||
|
||||
virtual HbrSubdivision<T>* Clone() const {
|
||||
return new HbrLoopSubdivision<T>();
|
||||
}
|
||||
|
||||
virtual void Refine(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual HbrFace<T>* RefineFaceAtVertex(HbrMesh<T>* mesh, HbrFace<T>* face, HbrVertex<T>* vertex);
|
||||
virtual void GuaranteeNeighbor(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual void GuaranteeNeighbors(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual bool HasLimit(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrHalfedge<T>* edge);
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
virtual bool VertexIsExtraordinary(HbrMesh<T>* mesh, HbrVertex<T>* vertex) { return vertex->GetValence() != 6; }
|
||||
|
||||
virtual int GetFaceChildrenCount(int nvertices) const { return 4; }
|
||||
|
||||
private:
|
||||
|
||||
// Transfers facevarying data from a parent face to a child face
|
||||
void transferFVarToChild(HbrMesh<T>* mesh, HbrFace<T>* face, HbrFace<T>* child, int index);
|
||||
|
||||
// Transfers vertex and edge edits from a parent face to a child face
|
||||
void transferEditsToChild(HbrFace<T>* face, HbrFace<T>* child, int index);
|
||||
|
||||
// Generates the fourth child of a triangle: the triangle in the
|
||||
// middle whose vertices have parents which are all edges
|
||||
void refineFaceAtMiddle(HbrMesh<T>* mesh, HbrFace<T>* face);
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::transferFVarToChild(HbrMesh<T>* mesh, HbrFace<T>* face, HbrFace<T>* child, int index) {
|
||||
typename HbrMesh<T>::InterpolateBoundaryMethod fvarinterp = mesh->GetFVarInterpolateBoundaryMethod();
|
||||
HbrVertex<T>* childVertex;
|
||||
|
||||
// In the case of index == 3, this is the middle face, and so
|
||||
// we need to do three edge subdivision rules
|
||||
if (index == 3) {
|
||||
const int fvarcount = mesh->GetFVarCount();
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
HbrHalfedge<T> *edge = face->GetEdge(i);
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
childVertex = child->GetVertex((i + 2) % 3);
|
||||
bool fvIsSmooth = !edge->IsFVarInfiniteSharpAnywhere();
|
||||
if (!fvIsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv = childVertex->GetFVarData(child);
|
||||
int fvarindex = 0;
|
||||
for (int fvaritem = 0; fvaritem < fvarcount; ++fvaritem) {
|
||||
const int fvarwidth = mesh->GetFVarWidths()[fvaritem];
|
||||
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
face->GetEdge(i)->GetFVarSharpness(fvaritem) || face->GetEdge(i)->IsBoundary()) {
|
||||
|
||||
// Sharp edge rule
|
||||
fv.SetWithWeight(face->GetFVarData(i), fvarindex, fvarwidth, 0.5f);
|
||||
fv.AddWithWeight(face->GetFVarData((i + 1) % 3), fvarindex, fvarwidth, 0.5f);
|
||||
} else if (!fvIsSmooth || !fv.IsInitialized()) {
|
||||
// Smooth edge subdivision. Add 0.375 of adjacent vertices
|
||||
fv.SetWithWeight(face->GetFVarData(i), fvarindex, fvarwidth, 0.375f);
|
||||
fv.AddWithWeight(face->GetFVarData((i + 1) % 3), fvarindex, fvarwidth, 0.375f);
|
||||
// Add 0.125 of opposite vertices
|
||||
fv.AddWithWeight(face->GetFVarData((i + 2) % 3), fvarindex, fvarwidth, 0.125f);
|
||||
HbrFace<T>* oppFace = face->GetEdge(i)->GetRightFace();
|
||||
for (int j = 0; j < oppFace->GetNumVertices(); ++j) {
|
||||
if (oppFace->GetVertex(j) == face->GetVertex(i)) {
|
||||
fv.AddWithWeight(oppFace->GetFVarData((j+1)%oppFace->GetNumVertices()), fvarindex, fvarwidth, 0.125f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fvarindex += fvarwidth;
|
||||
}
|
||||
fv.SetInitialized();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
HbrHalfedge<T>* edge;
|
||||
HbrVertex<T>* v = face->GetVertex(index);
|
||||
|
||||
// Otherwise we proceed with one vertex and two edge subdivision
|
||||
// applications. First the vertex subdivision rule. Analyze
|
||||
// whether the vertex is on the boundary and whether it's an
|
||||
// infinitely sharp corner. We determine the last by checking the
|
||||
// propagate corners flag on the mesh; if it's off, we check the
|
||||
// two edges of this face incident to that vertex and determining
|
||||
// whether they are facevarying boundary edges - this is analogous
|
||||
// to what goes on for the interpolateboundary tag (which when set
|
||||
// to EDGEANDCORNER marks vertices with a valence of two as being
|
||||
// sharp corners). If propagate corners is on, we check *all*
|
||||
// faces to see if two edges side by side are facevarying boundary
|
||||
// edges. The facevarying boundary check ignores geometric
|
||||
// sharpness, otherwise we may swim at geometric creases which
|
||||
// aren't actually discontinuous.
|
||||
//
|
||||
// We need to make sure that that each of the vertices of the
|
||||
// child face have the appropriate facevarying storage as
|
||||
// needed. If there are discontinuities in any facevarying datum,
|
||||
// the vertex must allocate a new block of facevarying storage
|
||||
// specific to the child face.
|
||||
|
||||
v->GuaranteeNeighbors();
|
||||
|
||||
|
||||
bool fv0IsSmooth, fv1IsSmooth, fv2IsSmooth;
|
||||
|
||||
childVertex = child->GetVertex(index);
|
||||
fv0IsSmooth = v->IsFVarAllSmooth();
|
||||
if (!fv0IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv0 = childVertex->GetFVarData(child);
|
||||
|
||||
edge = face->GetEdge(index);
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
assert(edge->GetOrgVertex() == v);
|
||||
childVertex = child->GetVertex((index + 1) % 3);
|
||||
fv1IsSmooth = !edge->IsFVarInfiniteSharpAnywhere();
|
||||
if (!fv1IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv1 = childVertex->GetFVarData(child);
|
||||
|
||||
edge = edge->GetPrev();
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
assert(edge == face->GetEdge((index + 2) % 3));
|
||||
assert(edge->GetDestVertex() == v);
|
||||
childVertex = child->GetVertex((index + 2) % 3);
|
||||
fv2IsSmooth = !edge->IsFVarInfiniteSharpAnywhere();
|
||||
if (!fv2IsSmooth) {
|
||||
childVertex->NewFVarData(child);
|
||||
}
|
||||
HbrFVarData<T>& fv2 = childVertex->GetFVarData(child);
|
||||
|
||||
const int fvarcount = mesh->GetFVarCount();
|
||||
int fvarindex = 0;
|
||||
for (int fvaritem = 0; fvaritem < fvarcount; ++fvaritem) {
|
||||
bool infcorner = false;
|
||||
const int fvarwidth = mesh->GetFVarWidths()[fvaritem];
|
||||
const char fvarmask = v->GetFVarMask(fvaritem);
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner) {
|
||||
if (fvarmask >= HbrVertex<T>::k_Corner) {
|
||||
infcorner = true;
|
||||
} else if (mesh->GetFVarPropagateCorners()) {
|
||||
if (v->IsFVarCorner(fvaritem)) {
|
||||
infcorner = true;
|
||||
}
|
||||
} else {
|
||||
if (face->GetEdge(index)->GetFVarSharpness(fvaritem, true) && face->GetEdge(index)->GetPrev()->GetFVarSharpness(fvaritem, true)) {
|
||||
infcorner = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Infinitely sharp vertex rule. Applied if the vertex is:
|
||||
// - undergoing no facevarying boundary interpolation;
|
||||
// - at a geometric crease, in either boundary interpolation case; or
|
||||
// - is an infinitely sharp facevarying vertex, in the EDGEANDCORNER case; or
|
||||
// - has a mask equal or greater than one, in the "always
|
||||
// sharp" interpolate boundary case
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
(fvarinterp == HbrMesh<T>::k_InterpolateBoundaryAlwaysSharp &&
|
||||
fvarmask >= 1) ||
|
||||
v->GetSharpness() > HbrVertex<T>::k_Smooth ||
|
||||
infcorner) {
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 1.0f);
|
||||
}
|
||||
// Dart rule: unlike geometric creases, because there's two
|
||||
// discontinuous values for the one incident edge, we use the
|
||||
// boundary rule and not the smooth rule
|
||||
else if (fvarmask == 1) {
|
||||
// Use 0.75 of the current vert
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.75f);
|
||||
|
||||
// 0.125 of "two adjacent edge vertices", which in actuality
|
||||
// are the facevarying values of the same vertex but on each
|
||||
// side of the single incident facevarying sharp edge
|
||||
HbrHalfedge<T>* start = v->GetIncidentEdge(), *edge, *nextedge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
if (edge->GetFVarSharpness(fvaritem)) {
|
||||
break;
|
||||
}
|
||||
nextedge = v->GetNextEdge(edge);
|
||||
if (nextedge == start) {
|
||||
assert(0); // we should have found it by now
|
||||
break;
|
||||
} else if (!nextedge) {
|
||||
// should never get into this case - if the vertex is
|
||||
// on a boundary, it can never be a facevarying dart
|
||||
// vertex
|
||||
assert(0);
|
||||
edge = edge->GetPrev();
|
||||
break;
|
||||
} else {
|
||||
edge = nextedge;
|
||||
}
|
||||
}
|
||||
HbrVertex<T>* w = edge->GetDestVertex();
|
||||
HbrFace<T>* bestface = edge->GetLeftFace();
|
||||
int j;
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
bestface = edge->GetRightFace();
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
}
|
||||
// Boundary vertex rule (can use FVarSmooth, which is equivalent
|
||||
// to checking that it's sharper than a dart)
|
||||
else if (fvarmask != 0) {
|
||||
|
||||
// Use 0.75 of the current vert
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.75f);
|
||||
|
||||
// Compute 0.125 of two adjacent edge vertices. However the
|
||||
// two adjacent edge vertices we use must be part of the
|
||||
// facevarying "boundary". To find the first edge we cycle
|
||||
// counterclockwise around the current vertex v and look for
|
||||
// the first boundary edge
|
||||
|
||||
HbrFace<T>* bestface = face;
|
||||
HbrHalfedge<T>* bestedge = face->GetEdge(index)->GetPrev();
|
||||
HbrHalfedge<T>* starte = bestedge->GetOpposite();
|
||||
HbrVertex<T>* w = 0;
|
||||
if (!starte) {
|
||||
w = face->GetEdge(index)->GetPrev()->GetOrgVertex();
|
||||
} else {
|
||||
HbrHalfedge<T>* e = starte, *next;
|
||||
assert(starte->GetOrgVertex() == v);
|
||||
do {
|
||||
if (e->GetFVarSharpness(fvaritem) || !e->GetLeftFace()) {
|
||||
bestface = e->GetRightFace();
|
||||
bestedge = e;
|
||||
break;
|
||||
}
|
||||
next = v->GetNextEdge(e);
|
||||
if (!next) {
|
||||
bestface = e->GetLeftFace();
|
||||
w = e->GetPrev()->GetOrgVertex();
|
||||
break;
|
||||
}
|
||||
e = next;
|
||||
} while (e && e != starte);
|
||||
}
|
||||
if (!w) w = bestedge->GetDestVertex();
|
||||
int j;
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
|
||||
// Look for the other edge by cycling clockwise around v
|
||||
bestface = face;
|
||||
bestedge = face->GetEdge(index);
|
||||
starte = bestedge;
|
||||
w = 0;
|
||||
if (HbrHalfedge<T>* e = starte) {
|
||||
assert(starte->GetOrgVertex() == v);
|
||||
do {
|
||||
if (e->GetFVarSharpness(fvaritem) || !e->GetRightFace()) {
|
||||
bestface = e->GetLeftFace();
|
||||
bestedge = e;
|
||||
break;
|
||||
}
|
||||
assert(e->GetOpposite());
|
||||
e = v->GetPreviousEdge(e);
|
||||
} while (e && e != starte);
|
||||
}
|
||||
if (!w) w = bestedge->GetDestVertex();
|
||||
for (j = 0; j < bestface->GetNumVertices(); ++j) {
|
||||
if (bestface->GetVertex(j) == w) break;
|
||||
}
|
||||
assert(j != bestface->GetNumVertices());
|
||||
fv0.AddWithWeight(bestface->GetFVarData(j), fvarindex, fvarwidth, 0.125f);
|
||||
|
||||
}
|
||||
// Smooth rule
|
||||
else if (!fv0IsSmooth || !fv0.IsInitialized()) {
|
||||
int valence = v->GetValence();
|
||||
float invvalence = 1.0f / valence;
|
||||
float beta = 0.25f * cosf((float)M_PI * 2.0f * invvalence) + 0.375f;
|
||||
beta = beta * beta;
|
||||
beta = (0.625f - beta) * invvalence;
|
||||
|
||||
// Use 1 - beta * valence of the current vertex value
|
||||
fv0.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 1 - (beta * valence));
|
||||
|
||||
// Add beta of surrounding vertices averages. We loop over all
|
||||
// surrounding faces..
|
||||
HbrHalfedge<T>* start = v->GetIncidentEdge(), *edge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
HbrFace<T>* g = edge->GetLeftFace();
|
||||
|
||||
// .. and look for the edge on that face whose origin is
|
||||
// the same as v, and add a contribution from its
|
||||
// destination vertex value; this takes care of the
|
||||
// surrounding edge vertex addition.
|
||||
for (int j = 0; j < g->GetNumVertices(); ++j) {
|
||||
if (g->GetEdge(j)->GetOrgVertex() == v) {
|
||||
fv0.AddWithWeight(g->GetFVarData((j + 1) % g->GetNumVertices()), fvarindex, fvarwidth, beta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
edge = v->GetNextEdge(edge);
|
||||
if (edge == start) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Edge subdivision rule
|
||||
HbrHalfedge<T>* edge = face->GetEdge(index);
|
||||
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
edge->GetFVarSharpness(fvaritem) || edge->IsBoundary()) {
|
||||
|
||||
// Sharp edge rule
|
||||
fv1.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.5f);
|
||||
fv1.AddWithWeight(face->GetFVarData((index + 1) % 3), fvarindex, fvarwidth, 0.5f);
|
||||
} else if (!fv1IsSmooth || !fv1.IsInitialized()) {
|
||||
// Smooth edge subdivision. Add 0.375 of adjacent vertices
|
||||
fv1.SetWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.375f);
|
||||
fv1.AddWithWeight(face->GetFVarData((index + 1) % 3), fvarindex, fvarwidth, 0.375f);
|
||||
// Add 0.125 of opposite vertices
|
||||
fv1.AddWithWeight(face->GetFVarData((index + 2) % 3), fvarindex, fvarwidth, 0.125f);
|
||||
HbrFace<T>* oppFace = edge->GetRightFace();
|
||||
for (int j = 0; j < oppFace->GetNumVertices(); ++j) {
|
||||
if (oppFace->GetVertex(j) == v) {
|
||||
fv1.AddWithWeight(oppFace->GetFVarData((j+1)%oppFace->GetNumVertices()), fvarindex, fvarwidth, 0.125f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Edge subdivision rule
|
||||
edge = edge->GetPrev();
|
||||
|
||||
if (fvarinterp == HbrMesh<T>::k_InterpolateBoundaryNone ||
|
||||
edge->GetFVarSharpness(fvaritem) || edge->IsBoundary()) {
|
||||
|
||||
// Sharp edge rule
|
||||
fv2.SetWithWeight(face->GetFVarData((index + 2) % 3), fvarindex, fvarwidth, 0.5f);
|
||||
fv2.AddWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.5f);
|
||||
} else if (!fv2IsSmooth || !fv2.IsInitialized()) {
|
||||
// Smooth edge subdivision. Add 0.375 of adjacent vertices
|
||||
fv2.SetWithWeight(face->GetFVarData((index + 2) % 3), fvarindex, fvarwidth, 0.375f);
|
||||
fv2.AddWithWeight(face->GetFVarData(index), fvarindex, fvarwidth, 0.375f);
|
||||
// Add 0.125 of opposite vertices
|
||||
fv2.AddWithWeight(face->GetFVarData((index + 1) % 3), fvarindex, fvarwidth, 0.125f);
|
||||
|
||||
HbrFace<T>* oppFace = edge->GetRightFace();
|
||||
for (int j = 0; j < oppFace->GetNumVertices(); ++j) {
|
||||
if (oppFace->GetVertex(j) == v) {
|
||||
fv2.AddWithWeight(oppFace->GetFVarData((j+2)%oppFace->GetNumVertices()), fvarindex, fvarwidth, 0.125f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fvarindex += fvarwidth;
|
||||
}
|
||||
fv0.SetInitialized();
|
||||
fv1.SetInitialized();
|
||||
fv2.SetInitialized();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::transferEditsToChild(HbrFace<T>* face, HbrFace<T>* child, int index) {
|
||||
|
||||
// Hand down pointers to hierarchical edits
|
||||
if (HbrHierarchicalEdit<T>** edits = face->GetHierarchicalEdits()) {
|
||||
while (HbrHierarchicalEdit<T>* edit = *edits) {
|
||||
if (!edit->IsRelevantToFace(face)) break;
|
||||
if (edit->GetNSubfaces() > face->GetDepth() &&
|
||||
(edit->GetSubface(face->GetDepth()) == index)) {
|
||||
child->SetHierarchicalEdits(edits);
|
||||
break;
|
||||
}
|
||||
edits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::Refine(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\n\nRefining face " << *face << "\n";
|
||||
#endif
|
||||
|
||||
assert(face->GetNumVertices() == 3); // or triangulate it?
|
||||
|
||||
HbrHalfedge<T>* edge = face->GetFirstEdge();
|
||||
HbrHalfedge<T>* prevedge = edge->GetPrev();
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
HbrVertex<T>* vertex = edge->GetOrgVertex();
|
||||
if (!face->GetChild(i)) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Kid " << i << "\n";
|
||||
#endif
|
||||
HbrFace<T>* child;
|
||||
HbrVertex<T>* vertices[3];
|
||||
|
||||
vertices[i] = vertex->Subdivide();
|
||||
vertices[(i + 1) % 3] = edge->Subdivide();
|
||||
vertices[(i + 2) % 3] = prevedge->Subdivide();
|
||||
child = mesh->NewFace(3, vertices, face, i);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Creating face " << *child << " during refine\n";
|
||||
#endif
|
||||
|
||||
// Hand down edge sharpness
|
||||
float sharpness;
|
||||
HbrHalfedge<T>* childedge;
|
||||
|
||||
childedge = child->GetEdge(i);
|
||||
if ((sharpness = edge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
HbrSubdivision<T>::SubdivideCreaseWeight(
|
||||
edge, edge->GetDestVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(edge);
|
||||
|
||||
childedge = child->GetEdge((i+2)%3);
|
||||
if ((sharpness = prevedge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
HbrSubdivision<T>::SubdivideCreaseWeight(
|
||||
prevedge, prevedge->GetOrgVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(prevedge);
|
||||
|
||||
if (mesh->GetTotalFVarWidth()) {
|
||||
transferFVarToChild(mesh, face, child, i);
|
||||
}
|
||||
|
||||
transferEditsToChild(face, child, i);
|
||||
|
||||
}
|
||||
prevedge = edge;
|
||||
edge = edge->GetNext();
|
||||
}
|
||||
|
||||
refineFaceAtMiddle(mesh, face);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrFace<T>*
|
||||
HbrLoopSubdivision<T>::RefineFaceAtVertex(HbrMesh<T>* mesh, HbrFace<T>* face, HbrVertex<T>* vertex) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " forcing refine on " << *face << " at " << *vertex << '\n';
|
||||
#endif
|
||||
HbrHalfedge<T>* edge = face->GetFirstEdge();
|
||||
HbrHalfedge<T>* prevedge = edge->GetPrev();
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (edge->GetOrgVertex() == vertex) {
|
||||
if (!face->GetChild(i)) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Kid " << i << "\n";
|
||||
#endif
|
||||
HbrFace<T>* child;
|
||||
HbrVertex<T>* vertices[3];
|
||||
|
||||
vertices[i] = vertex->Subdivide();
|
||||
vertices[(i + 1) % 3] = edge->Subdivide();
|
||||
vertices[(i + 2) % 3] = prevedge->Subdivide();
|
||||
child = mesh->NewFace(3, vertices, face, i);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Creating face " << *child << " during refine\n";
|
||||
#endif
|
||||
|
||||
// Hand down edge sharpness
|
||||
float sharpness;
|
||||
HbrHalfedge<T>* childedge;
|
||||
|
||||
childedge = child->GetEdge(i);
|
||||
if ((sharpness = edge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
HbrSubdivision<T>::SubdivideCreaseWeight(
|
||||
edge, edge->GetDestVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(edge);
|
||||
|
||||
childedge = child->GetEdge((i+2)%3);
|
||||
if ((sharpness = prevedge->GetSharpness()) > HbrHalfedge<T>::k_Smooth) {
|
||||
HbrSubdivision<T>::SubdivideCreaseWeight(
|
||||
prevedge, prevedge->GetOrgVertex(), childedge);
|
||||
}
|
||||
childedge->CopyFVarInfiniteSharpness(prevedge);
|
||||
|
||||
if (mesh->GetTotalFVarWidth()) {
|
||||
transferFVarToChild(mesh, face, child, i);
|
||||
}
|
||||
|
||||
transferEditsToChild(face, child, i);
|
||||
|
||||
return child;
|
||||
} else {
|
||||
return face->GetChild(i);
|
||||
}
|
||||
}
|
||||
prevedge = edge;
|
||||
edge = edge->GetNext();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::GuaranteeNeighbor(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) {
|
||||
if (edge->GetOpposite()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\n\nneighbor guarantee at " << *edge << " invoked\n";
|
||||
#endif
|
||||
|
||||
/*
|
||||
Imagine the following:
|
||||
|
||||
X
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
X \
|
||||
/\ \
|
||||
2/ \3 \
|
||||
/ \ \
|
||||
X------X--------X
|
||||
1
|
||||
|
||||
If the parent of _both_ incident vertices are themselves edges,
|
||||
(like the edge marked 3 above), then this edge is in the center
|
||||
of the parent face. Refining the parent face in the middle or
|
||||
refining the parent face at one vertex (where the two parent
|
||||
edges meet) should suffice
|
||||
*/
|
||||
HbrHalfedge<T>* parentEdge1 = edge->GetOrgVertex()->GetParentEdge();
|
||||
HbrHalfedge<T>* parentEdge2 = edge->GetDestVertex()->GetParentEdge();
|
||||
if (parentEdge1 && parentEdge2) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "two parent edge situation\n";
|
||||
#endif
|
||||
HbrFace<T>* parentFace = parentEdge1->GetFace();
|
||||
assert(parentFace == parentEdge2->GetFace());
|
||||
if(parentEdge1->GetOrgVertex() == parentEdge2->GetDestVertex()) {
|
||||
refineFaceAtMiddle(mesh, parentFace);
|
||||
} else {
|
||||
RefineFaceAtVertex(mesh, parentFace, parentEdge1->GetOrgVertex());
|
||||
}
|
||||
assert(edge->GetOpposite());
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise we're in the situation of edge 1 or edge 2 in the
|
||||
// diagram above.
|
||||
if (parentEdge1) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "parent edge 1 " << *parentEdge1 << "\n";
|
||||
#endif
|
||||
HbrVertex<T>* parentVertex2 = edge->GetDestVertex()->GetParentVertex();
|
||||
assert(parentVertex2);
|
||||
RefineFaceAtVertex(mesh, parentEdge1->GetLeftFace(), parentVertex2);
|
||||
if (parentEdge1->GetRightFace()) {
|
||||
RefineFaceAtVertex(mesh, parentEdge1->GetRightFace(), parentVertex2);
|
||||
}
|
||||
} else if (parentEdge2) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "parent edge 2 " << *parentEdge2 << "\n";
|
||||
#endif
|
||||
HbrVertex<T>* parentVertex1 = edge->GetOrgVertex()->GetParentVertex();
|
||||
assert(parentVertex1);
|
||||
RefineFaceAtVertex(mesh, parentEdge2->GetLeftFace(), parentVertex1);
|
||||
if (parentEdge2->GetRightFace()) {
|
||||
RefineFaceAtVertex(mesh, parentEdge2->GetRightFace(), parentVertex1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::GuaranteeNeighbors(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "\n\nneighbor guarantee at " << *vertex << " invoked\n";
|
||||
#endif
|
||||
|
||||
assert(vertex->GetParentFace() == 0);
|
||||
|
||||
// The first case: the vertex is a child of an edge. Make sure
|
||||
// that the parent faces on either side of the parent edge exist,
|
||||
// and have 1) refined at both vertices of the parent edge, and 2)
|
||||
// have refined their "middle" face (which doesn't live at either
|
||||
// vertex).
|
||||
|
||||
HbrHalfedge<T>* parentEdge = vertex->GetParentEdge();
|
||||
if (parentEdge) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "parent edge situation " << *parentEdge << "\n";
|
||||
#endif
|
||||
HbrVertex<T>* dest = parentEdge->GetDestVertex();
|
||||
HbrVertex<T>* org = parentEdge->GetOrgVertex();
|
||||
GuaranteeNeighbor(mesh, parentEdge);
|
||||
HbrFace<T>* parentFace = parentEdge->GetLeftFace();
|
||||
RefineFaceAtVertex(mesh, parentFace, dest);
|
||||
RefineFaceAtVertex(mesh, parentFace, org);
|
||||
refineFaceAtMiddle(mesh, parentFace);
|
||||
parentFace = parentEdge->GetRightFace();
|
||||
// The right face may not necessarily exist even after
|
||||
// GuaranteeNeighbor
|
||||
if (parentFace) {
|
||||
RefineFaceAtVertex(mesh, parentFace, dest);
|
||||
RefineFaceAtVertex(mesh, parentFace, org);
|
||||
refineFaceAtMiddle(mesh, parentFace);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// The second case: the vertex is a child of a vertex. In this case
|
||||
// we have to recursively guarantee that the parent's adjacent
|
||||
// faces also exist.
|
||||
HbrVertex<T>* parentVertex = vertex->GetParentVertex();
|
||||
if (parentVertex) {
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "parent vertex situation " << *parentVertex << "\n";
|
||||
#endif
|
||||
parentVertex->GuaranteeNeighbors();
|
||||
|
||||
// And then we refine all the face neighbors of the parent
|
||||
// vertex
|
||||
HbrHalfedge<T>* start = parentVertex->GetIncidentEdge(), *edge;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
HbrFace<T>* f = edge->GetLeftFace();
|
||||
RefineFaceAtVertex(mesh, f, parentVertex);
|
||||
edge = parentVertex->GetNextEdge(edge);
|
||||
if (edge == start) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrLoopSubdivision<T>::HasLimit(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
if (face->IsHole()) return false;
|
||||
// A limit face exists if all the bounding edges have limit curves
|
||||
for (int i = 0; i < face->GetNumVertices(); ++i) {
|
||||
if (!HasLimit(mesh, face->GetEdge(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrLoopSubdivision<T>::HasLimit(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) {
|
||||
// A sharp edge has a limit curve if both endpoints have limits.
|
||||
// A smooth edge has a limit if both endpoints have limits and
|
||||
// the edge isn't on the boundary.
|
||||
|
||||
if (edge->GetSharpness() >= HbrHalfedge<T>::k_InfinitelySharp) return true;
|
||||
|
||||
if (!HasLimit(mesh, edge->GetOrgVertex()) || !HasLimit(mesh, edge->GetDestVertex())) return false;
|
||||
|
||||
return !edge->IsBoundary();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrLoopSubdivision<T>::HasLimit(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
vertex->GuaranteeNeighbors();
|
||||
switch (vertex->GetMask(false)) {
|
||||
case HbrVertex<T>::k_Smooth:
|
||||
case HbrVertex<T>::k_Dart:
|
||||
return !vertex->OnBoundary();
|
||||
break;
|
||||
case HbrVertex<T>::k_Crease:
|
||||
case HbrVertex<T>::k_Corner:
|
||||
default:
|
||||
if (vertex->IsVolatile()) {
|
||||
// Search for any incident semisharp boundary edge
|
||||
HbrHalfedge<T>* start = vertex->GetIncidentEdge(), *edge, *next;
|
||||
edge = start;
|
||||
while (edge) {
|
||||
if (edge->IsBoundary() && edge->GetSharpness() < HbrHalfedge<T>::k_InfinitelySharp) {
|
||||
return false;
|
||||
}
|
||||
next = vertex->GetNextEdge(edge);
|
||||
if (next == start) {
|
||||
break;
|
||||
} else if (!next) {
|
||||
edge = edge->GetPrev();
|
||||
if (edge->IsBoundary() && edge->GetSharpness() < HbrHalfedge<T>::k_InfinitelySharp) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
edge = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrLoopSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
// In loop subdivision, faces never subdivide
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrLoopSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Subdividing at " << *edge << "\n";
|
||||
#endif
|
||||
// Ensure the opposite face exists.
|
||||
GuaranteeNeighbor(mesh, edge);
|
||||
|
||||
float esharp = edge->GetSharpness();
|
||||
HbrVertex<T>* v = mesh->NewVertex();
|
||||
T& data = v->GetData();
|
||||
|
||||
// If there's the possibility of vertex edits on either vertex, we
|
||||
// have to make sure the edit has been applied
|
||||
if (mesh->HasVertexEdits()) {
|
||||
edge->GetOrgVertex()->GuaranteeNeighbors();
|
||||
edge->GetDestVertex()->GuaranteeNeighbors();
|
||||
}
|
||||
|
||||
if (!edge->IsBoundary() && esharp <= 1.0f) {
|
||||
|
||||
// Of the two half-edges, pick one of them consistently such
|
||||
// that the org and dest vertices are also consistent through
|
||||
// multi-threading. It doesn't matter as far as the
|
||||
// theoretical calculation is concerned, but it is desirable
|
||||
// to be consistent about it in the face of the limitations of
|
||||
// floating point commutativity. So we always pick the
|
||||
// half-edge such that its incident face is the smallest of
|
||||
// the two faces, as far as the face paths are concerned.
|
||||
if (edge->GetOpposite() && edge->GetOpposite()->GetFace()->GetPath() < edge->GetFace()->GetPath()) {
|
||||
edge = edge->GetOpposite();
|
||||
}
|
||||
|
||||
// Handle both the smooth and fractional sharpness cases. We
|
||||
// lerp between the sharp case (average of the two end points)
|
||||
// and the unsharp case (3/8 of each of the two end points
|
||||
// plus 1/8 of the two opposite face averages).
|
||||
|
||||
// Lerp end point weight between non sharp contribution of
|
||||
// 3/8 and the sharp contribution of 0.5.
|
||||
float endPtWeight = 0.375f + esharp * (0.5f - 0.375f);
|
||||
data.AddWithWeight(edge->GetOrgVertex()->GetData(), endPtWeight);
|
||||
data.AddWithWeight(edge->GetDestVertex()->GetData(), endPtWeight);
|
||||
|
||||
// Lerp the opposite pt weights between non sharp contribution
|
||||
// of 1/8 and the sharp contribution of 0.
|
||||
float oppPtWeight = 0.125f * (1 - esharp);
|
||||
HbrHalfedge<T>* ee = edge->GetNext();
|
||||
data.AddWithWeight(ee->GetDestVertex()->GetData(), oppPtWeight);
|
||||
ee = edge->GetOpposite()->GetNext();
|
||||
data.AddWithWeight(ee->GetDestVertex()->GetData(), oppPtWeight);
|
||||
} else {
|
||||
// Fully sharp edge, just average the two end points
|
||||
data.AddWithWeight(edge->GetOrgVertex()->GetData(), 0.5f);
|
||||
data.AddWithWeight(edge->GetDestVertex()->GetData(), 0.5f);
|
||||
}
|
||||
|
||||
// Varying data is always the average of two end points
|
||||
data.AddVaryingWithWeight(edge->GetOrgVertex()->GetData(), 0.5f);
|
||||
data.AddVaryingWithWeight(edge->GetDestVertex()->GetData(), 0.5f);
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << " created " << *v << "\n";
|
||||
#endif
|
||||
|
||||
// Only boundary edges will create extraordinary vertices
|
||||
if (edge->IsBoundary()) {
|
||||
v->SetExtraordinary();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
HbrVertex<T>*
|
||||
HbrLoopSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
|
||||
// Ensure the ring of faces around this vertex exists before
|
||||
// we compute the valence
|
||||
vertex->GuaranteeNeighbors();
|
||||
|
||||
float valence = static_cast<float>(vertex->GetValence());
|
||||
float invvalence = 1.0f / valence;
|
||||
|
||||
HbrVertex<T>* v = mesh->NewVertex();
|
||||
T& data = v->GetData();
|
||||
|
||||
// Due to fractional weights we may need to do two subdivision
|
||||
// passes
|
||||
int masks[2];
|
||||
float weights[2];
|
||||
int passes;
|
||||
masks[0] = vertex->GetMask(false);
|
||||
masks[1] = vertex->GetMask(true);
|
||||
// If the masks are different, we subdivide twice: once using the
|
||||
// current mask, once using the mask at the next level of
|
||||
// subdivision, then use fractional mask weights to weigh
|
||||
// each weighing
|
||||
if (masks[0] != masks[1]) {
|
||||
weights[1] = vertex->GetFractionalMask();
|
||||
weights[0] = 1.0f - weights[1];
|
||||
passes = 2;
|
||||
} else {
|
||||
weights[0] = 1.0f;
|
||||
weights[1] = 0.0f;
|
||||
passes = 1;
|
||||
}
|
||||
for (int i = 0; i < passes; ++i) {
|
||||
switch (masks[i]) {
|
||||
case HbrVertex<T>::k_Smooth:
|
||||
case HbrVertex<T>::k_Dart: {
|
||||
float beta = 0.25f * cosf((float)M_PI * 2.0f * invvalence) + 0.375f;
|
||||
beta = beta * beta;
|
||||
beta = (0.625f - beta) * invvalence;
|
||||
|
||||
data.AddWithWeight(vertex->GetData(), weights[i] * (1 - (beta * valence)));
|
||||
|
||||
HbrSubdivision<T>::AddSurroundingVerticesWithWeight(
|
||||
mesh, vertex, weights[i] * beta, &data);
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Crease: {
|
||||
// Compute 3/4 of old vertex value
|
||||
data.AddWithWeight(vertex->GetData(), weights[i] * 0.75f);
|
||||
|
||||
// Add 0.125f of the (hopefully only two!) neighbouring
|
||||
// sharp edges
|
||||
HbrSubdivision<T>::AddCreaseEdgesWithWeight(
|
||||
mesh, vertex, i == 1, weights[i] * 0.125f, &data);
|
||||
break;
|
||||
}
|
||||
case HbrVertex<T>::k_Corner:
|
||||
default: {
|
||||
// Just copy the old value
|
||||
data.AddWithWeight(vertex->GetData(), weights[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Varying data is always just propogated down
|
||||
data.AddVaryingWithWeight(vertex->GetData(), 1.0f);
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Subdividing at " << *vertex << "\n";
|
||||
std::cerr << " created " << *v << "\n";
|
||||
#endif
|
||||
// Inherit extraordinary flag and sharpness
|
||||
if (vertex->IsExtraordinary()) v->SetExtraordinary();
|
||||
float sharp = vertex->GetSharpness();
|
||||
if (sharp >= HbrVertex<T>::k_InfinitelySharp) {
|
||||
v->SetSharpness(HbrVertex<T>::k_InfinitelySharp);
|
||||
} else if (sharp > HbrVertex<T>::k_Smooth) {
|
||||
v->SetSharpness(std::max((float) HbrVertex<T>::k_Smooth, sharp - 1.0f));
|
||||
} else {
|
||||
v->SetSharpness(HbrVertex<T>::k_Smooth);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrLoopSubdivision<T>::refineFaceAtMiddle(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Refining middle face of " << *face << "\n";
|
||||
#endif
|
||||
|
||||
if (!face->GetChild(3)) {
|
||||
HbrFace<T>* child;
|
||||
HbrVertex<T>* vertices[3];
|
||||
|
||||
// The fourth face is not an obvious child of any vertex. We
|
||||
// assign it index 3 despite there being no fourth vertex in
|
||||
// the triangle. The ordering of vertices here is done to
|
||||
// preserve parametric space as best we can
|
||||
vertices[0] = face->GetEdge(1)->Subdivide();
|
||||
vertices[1] = face->GetEdge(2)->Subdivide();
|
||||
vertices[2] = face->GetEdge(0)->Subdivide();
|
||||
child = mesh->NewFace(3, vertices, face, 3);
|
||||
#ifdef HBR_DEBUG
|
||||
std::cerr << "Creating face " << *child << "\n";
|
||||
#endif
|
||||
if (mesh->GetTotalFVarWidth()) {
|
||||
transferFVarToChild(mesh, face, child, 3);
|
||||
}
|
||||
|
||||
transferEditsToChild(face, child, 3);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HBRLOOP_H */
|
1080
opensubdiv/hbr/mesh.h
Normal file
1080
opensubdiv/hbr/mesh.h
Normal file
File diff suppressed because it is too large
Load Diff
294
opensubdiv/hbr/subdivision.h
Normal file
294
opensubdiv/hbr/subdivision.h
Normal file
@ -0,0 +1,294 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRSUBDIVISION_H
|
||||
#define HBRSUBDIVISION_H
|
||||
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrMesh;
|
||||
template <class T> class HbrSubdivision {
|
||||
public:
|
||||
HbrSubdivision<T>()
|
||||
: creaseSubdivision(k_CreaseNormal) {}
|
||||
|
||||
virtual ~HbrSubdivision<T>() {}
|
||||
|
||||
virtual HbrSubdivision<T>* Clone() const = 0;
|
||||
|
||||
// How to subdivide a face
|
||||
virtual void Refine(HbrMesh<T>* mesh, HbrFace<T>* face) = 0;
|
||||
|
||||
// Subdivide a face only at a particular vertex (creating one child)
|
||||
virtual HbrFace<T>* RefineFaceAtVertex(HbrMesh<T>* mesh, HbrFace<T>* face, HbrVertex<T>* vertex) = 0;
|
||||
|
||||
// Refine all faces around a particular vertex
|
||||
virtual void RefineAtVertex(HbrMesh<T>* mesh, HbrVertex<T>* vertex);
|
||||
|
||||
// Given an edge, try to ensure the edge's opposite exists by
|
||||
// forcing refinement up the hierarchy
|
||||
virtual void GuaranteeNeighbor(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) = 0;
|
||||
|
||||
// Given an vertex, ensure all faces in the ring around it exist
|
||||
// by forcing refinement up the hierarchy
|
||||
virtual void GuaranteeNeighbors(HbrMesh<T>* mesh, HbrVertex<T>* vertex) = 0;
|
||||
|
||||
// Returns true if the vertex, edge, or face has a limit point,
|
||||
// curve, or surface associated with it
|
||||
virtual bool HasLimit(HbrMesh<T>* /* mesh */, HbrFace<T>* /* face */) { return true; }
|
||||
virtual bool HasLimit(HbrMesh<T>* /* mesh */, HbrHalfedge<T>* /* edge */) { return true; }
|
||||
virtual bool HasLimit(HbrMesh<T>* /* mesh */, HbrVertex<T>* /* vertex */) { return true; }
|
||||
|
||||
// How to turn faces, edges, and vertices into vertices
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrFace<T>* face) = 0;
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrHalfedge<T>* edge) = 0;
|
||||
virtual HbrVertex<T>* Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) = 0;
|
||||
|
||||
// Returns true if the vertex is extraordinary in the subdivision scheme
|
||||
virtual bool VertexIsExtraordinary(HbrMesh<T>* /* mesh */, HbrVertex<T>* /* vertex */) { return false; }
|
||||
|
||||
// Crease subdivision rules. When subdividing a edge with a crease
|
||||
// strength, we get two child subedges, and we need to determine
|
||||
// what weights to assign these subedges. The "normal" rule
|
||||
// is to simply assign the current edge's crease strength - 1
|
||||
// to both of the child subedges. The "Chaikin" rule looks at the
|
||||
// current edge and incident edges to the current edge's end
|
||||
// vertices, and weighs them; for more information consult
|
||||
// the Geri's Game paper.
|
||||
enum CreaseSubdivision {
|
||||
k_CreaseNormal,
|
||||
k_CreaseChaikin
|
||||
};
|
||||
CreaseSubdivision GetCreaseSubdivisionMethod() const { return creaseSubdivision; }
|
||||
void SetCreaseSubdivisionMethod(CreaseSubdivision method) { creaseSubdivision = method; }
|
||||
|
||||
// Figures out how to assign a crease weight on an edge to its
|
||||
// subedge. The subedge must be a child of the parent edge
|
||||
// (either subedge->GetOrgVertex() or subedge->GetDestVertex()
|
||||
// == edge->Subdivide()). The vertex supplied must NOT be
|
||||
// a parent of the subedge; it is either the origin or
|
||||
// destination vertex of edge.
|
||||
void SubdivideCreaseWeight(HbrHalfedge<T>* edge, HbrVertex<T>* vertex, HbrHalfedge<T>* subedge);
|
||||
|
||||
// Returns the expected number of children faces after subdivision
|
||||
// for a face with the given number of vertices.
|
||||
virtual int GetFaceChildrenCount(int nvertices) const = 0;
|
||||
|
||||
protected:
|
||||
CreaseSubdivision creaseSubdivision;
|
||||
|
||||
// Helper routine for subclasses: for a given vertex, sums
|
||||
// contributions from surrounding vertices
|
||||
void AddSurroundingVerticesWithWeight(HbrMesh<T>* mesh, HbrVertex<T>* vertex, float weight, T* data);
|
||||
|
||||
// Helper routine for subclasses: for a given vertex with a crease
|
||||
// mask, adds contributions from the two crease edges
|
||||
void AddCreaseEdgesWithWeight(HbrMesh<T>* mesh, HbrVertex<T>* vertex, bool next, float weight, T* data);
|
||||
|
||||
private:
|
||||
// Helper class used by AddSurroundingVerticesWithWeight
|
||||
class SmoothSubdivisionVertexOperator : public HbrVertexOperator<T> {
|
||||
public:
|
||||
SmoothSubdivisionVertexOperator(T* data, bool meshHasEdits, float weight)
|
||||
: m_data(data),
|
||||
m_meshHasEdits(meshHasEdits),
|
||||
m_weight(weight)
|
||||
{
|
||||
}
|
||||
virtual void operator() (HbrVertex<T> &vertex) {
|
||||
// Must ensure vertex edits have been applied
|
||||
if (m_meshHasEdits) {
|
||||
vertex.GuaranteeNeighbors();
|
||||
}
|
||||
m_data->AddWithWeight(vertex.GetData(), m_weight);
|
||||
}
|
||||
private:
|
||||
T* m_data;
|
||||
const bool m_meshHasEdits;
|
||||
const float m_weight;
|
||||
};
|
||||
|
||||
// Helper class used by AddCreaseEdgesWithWeight
|
||||
class CreaseSubdivisionHalfedgeOperator : public HbrHalfedgeOperator<T> {
|
||||
public:
|
||||
CreaseSubdivisionHalfedgeOperator(HbrVertex<T> *vertex, T* data, bool meshHasEdits, bool next, float weight)
|
||||
: m_vertex(vertex),
|
||||
m_data(data),
|
||||
m_meshHasEdits(meshHasEdits),
|
||||
m_next(next),
|
||||
m_weight(weight),
|
||||
m_count(0)
|
||||
{
|
||||
}
|
||||
virtual void operator() (HbrHalfedge<T> &edge) {
|
||||
if (m_count < 2 && edge.IsSharp(m_next)) {
|
||||
HbrVertex<T>* a = edge.GetDestVertex();
|
||||
if (a == m_vertex) a = edge.GetOrgVertex();
|
||||
// Must ensure vertex edits have been applied
|
||||
if (m_meshHasEdits) {
|
||||
a->GuaranteeNeighbors();
|
||||
}
|
||||
m_data->AddWithWeight(a->GetData(), m_weight);
|
||||
m_count++;
|
||||
}
|
||||
}
|
||||
private:
|
||||
HbrVertex<T>* m_vertex;
|
||||
T* m_data;
|
||||
const bool m_meshHasEdits;
|
||||
const bool m_next;
|
||||
const float m_weight;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
private:
|
||||
// Helper class used by RefineAtVertex.
|
||||
class RefineFaceAtVertexOperator : public HbrFaceOperator<T> {
|
||||
public:
|
||||
RefineFaceAtVertexOperator(HbrSubdivision<T>* subdivision, HbrMesh<T>* mesh, HbrVertex<T> *vertex)
|
||||
: m_subdivision(subdivision),
|
||||
m_mesh(mesh),
|
||||
m_vertex(vertex)
|
||||
{
|
||||
}
|
||||
virtual void operator() (HbrFace<T> &face) {
|
||||
m_subdivision->RefineFaceAtVertex(m_mesh, &face, m_vertex);
|
||||
}
|
||||
private:
|
||||
HbrSubdivision<T>* const m_subdivision;
|
||||
HbrMesh<T>* const m_mesh;
|
||||
HbrVertex<T>* const m_vertex;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrSubdivision<T>::RefineAtVertex(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
GuaranteeNeighbors(mesh, vertex);
|
||||
RefineFaceAtVertexOperator op(this, mesh, vertex);
|
||||
vertex->ApplyOperatorSurroundingFaces(op);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrSubdivision<T>::SubdivideCreaseWeight(HbrHalfedge<T>* edge, HbrVertex<T>* vertex, HbrHalfedge<T>* subedge) {
|
||||
|
||||
float sharpness = edge->GetSharpness();
|
||||
|
||||
// In all methods, if the parent edge is infinitely sharp, the
|
||||
// child edge is also infinitely sharp
|
||||
if (sharpness >= HbrHalfedge<T>::k_InfinitelySharp) {
|
||||
subedge->SetSharpness(HbrHalfedge<T>::k_InfinitelySharp);
|
||||
}
|
||||
|
||||
// Chaikin's curve subdivision: use 3/4 of the parent sharpness,
|
||||
// plus 1/4 of crease sharpnesses incident to vertex
|
||||
else if (creaseSubdivision == HbrSubdivision<T>::k_CreaseChaikin) {
|
||||
|
||||
float childsharp = 0.0f;
|
||||
|
||||
// Add 1/4 of the sharpness of all crease edges incident to
|
||||
// the vertex (other than this crease edge)
|
||||
std::list<HbrHalfedge<T>*> edges;
|
||||
vertex->GuaranteeNeighbors();
|
||||
vertex->GetSurroundingEdges(edges);
|
||||
|
||||
int n = 0;
|
||||
for (typename std::list<HbrHalfedge<T>*>::iterator ei = edges.begin(); ei != edges.end(); ++ei) {
|
||||
if (*ei == edge) continue;
|
||||
if ((*ei)->GetSharpness() > HbrHalfedge<T>::k_Smooth) {
|
||||
childsharp += (*ei)->GetSharpness();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
if (n) {
|
||||
childsharp = childsharp * 0.25f / n;
|
||||
}
|
||||
|
||||
// Add 3/4 of the sharpness of this crease edge
|
||||
childsharp += sharpness * 0.75f;
|
||||
childsharp -= 1.0f;
|
||||
if (childsharp < (float) HbrHalfedge<T>::k_Smooth) {
|
||||
childsharp = (float) HbrHalfedge<T>::k_Smooth;
|
||||
}
|
||||
subedge->SetSharpness(childsharp);
|
||||
|
||||
} else {
|
||||
sharpness -= 1.0f;
|
||||
if (sharpness < (float) HbrHalfedge<T>::k_Smooth) {
|
||||
sharpness = (float) HbrHalfedge<T>::k_Smooth;
|
||||
}
|
||||
subedge->SetSharpness(sharpness);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrSubdivision<T>::AddSurroundingVerticesWithWeight(HbrMesh<T>* mesh, HbrVertex<T>* vertex, float weight, T* data) {
|
||||
SmoothSubdivisionVertexOperator op(data, mesh->HasVertexEdits(), weight);
|
||||
vertex->ApplyOperatorSurroundingVertices(op);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrSubdivision<T>::AddCreaseEdgesWithWeight(HbrMesh<T>* mesh, HbrVertex<T>* vertex, bool next, float weight, T* data) {
|
||||
CreaseSubdivisionHalfedgeOperator op(vertex, data, mesh->HasVertexEdits(), next, weight);
|
||||
vertex->ApplyOperatorSurroundingEdges(op);
|
||||
}
|
||||
#endif /* HBRSUBDIVISION_H */
|
1500
opensubdiv/hbr/vertex.h
Normal file
1500
opensubdiv/hbr/vertex.h
Normal file
File diff suppressed because it is too large
Load Diff
263
opensubdiv/hbr/vertexEdit.h
Normal file
263
opensubdiv/hbr/vertexEdit.h
Normal file
@ -0,0 +1,263 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef HBRVERTEXEDIT_H
|
||||
#define HBRVERTEXEDIT_H
|
||||
|
||||
#include <algorithm>
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
|
||||
template <class T> class HbrVertexEdit;
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& out, const HbrVertexEdit<T>& path) {
|
||||
out << "vertex path = (" << path.faceid << ' ';
|
||||
for (int i = 0; i < path.nsubfaces; ++i) {
|
||||
out << static_cast<int>(path.subfaces[i]) << ' ';
|
||||
}
|
||||
return out << static_cast<int>(path.vertexid) << "), edit = (" << path.edit[0] << ',' << path.edit[1] << ',' << path.edit[2] << ')';
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class HbrVertexEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrVertexEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, unsigned char _vertexid, int _index, int _width, bool _isP, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), isP(_isP), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
HbrVertexEdit(int _faceid, int _nsubfaces, int *_subfaces, int _vertexid, int _index, int _width, bool _isP, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), isP(_isP), op(_op) {
|
||||
edit = new float[width];
|
||||
memcpy(edit, _edit, width * sizeof(float));
|
||||
}
|
||||
|
||||
virtual ~HbrVertexEdit() {
|
||||
delete[] edit;
|
||||
}
|
||||
|
||||
// Return the vertex id (the last element in the path)
|
||||
unsigned char GetVertexID() const { return vertexid; }
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrVertexEdit<T>& path);
|
||||
|
||||
// Return index of variable this edit applies to
|
||||
int GetIndex() const { return index; }
|
||||
|
||||
// Return width of the variable
|
||||
int GetWidth() const { return width; }
|
||||
|
||||
// Get the numerical value of the edit
|
||||
const float* GetEdit() const { return edit; }
|
||||
|
||||
// Get the type of operation
|
||||
typename HbrHierarchicalEdit<T>::Operation GetOperation() const { return op; }
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
// Tags the vertex as being edited; it'll figure out what to
|
||||
// when GuaranteeNeighbor is called
|
||||
face->GetVertex(vertexid)->SetVertexEdit();
|
||||
}
|
||||
// In any event, mark the face as having a vertex edit (which
|
||||
// may only be applied on subfaces)
|
||||
face->MarkVertexEdits();
|
||||
}
|
||||
|
||||
virtual void ApplyEditToVertex(HbrFace<T>* face, HbrVertex<T>* vertex) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth() &&
|
||||
face->GetVertex(vertexid) == vertex) {
|
||||
vertex->GetData().ApplyVertexEdit(*const_cast<const HbrVertexEdit<T>*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRMAN
|
||||
virtual void ApplyToBound(struct bbox& bbox, RtMatrix *mx) {
|
||||
if (isP) {
|
||||
struct xyz p = *(struct xyz*)edit;
|
||||
if (mx)
|
||||
MxTransformByMatrix(&p, &p, *mx, 1);
|
||||
if (op == HbrHierarchicalEdit<T>::Set) {
|
||||
bbox.min.x = std::min(bbox.min.x, p.x);
|
||||
bbox.min.y = std::min(bbox.min.y, p.y);
|
||||
bbox.min.z = std::min(bbox.min.z, p.z);
|
||||
bbox.max.x = std::max(bbox.max.x, p.x);
|
||||
bbox.max.y = std::max(bbox.max.y, p.y);
|
||||
bbox.max.z = std::max(bbox.max.z, p.z);
|
||||
} else if (op == HbrHierarchicalEdit<T>::Add ||
|
||||
op == HbrHierarchicalEdit<T>::Subtract) {
|
||||
bbox.min.x -= fabsf(p.x);
|
||||
bbox.min.y -= fabsf(p.y);
|
||||
bbox.min.z -= fabsf(p.z);
|
||||
bbox.max.x += fabsf(p.x);
|
||||
bbox.max.y += fabsf(p.y);
|
||||
bbox.max.z += fabsf(p.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
const unsigned char vertexid;
|
||||
int index;
|
||||
int width;
|
||||
unsigned isP:1;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
float* edit;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class HbrMovingVertexEdit : public HbrHierarchicalEdit<T> {
|
||||
|
||||
public:
|
||||
|
||||
HbrMovingVertexEdit(int _faceid, int _nsubfaces, unsigned char *_subfaces, unsigned char _vertexid, int _index, int _width, bool _isP, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), isP(_isP), op(_op) {
|
||||
edit = new float[width * 2];
|
||||
memcpy(edit, _edit, 2 * width * sizeof(float));
|
||||
}
|
||||
|
||||
HbrMovingVertexEdit(int _faceid, int _nsubfaces, int *_subfaces, int _vertexid, int _index, int _width, bool _isP, typename HbrHierarchicalEdit<T>::Operation _op, float *_edit)
|
||||
: HbrHierarchicalEdit<T>(_faceid, _nsubfaces, _subfaces), vertexid(_vertexid), index(_index), width(_width), isP(_isP), op(_op) {
|
||||
edit = new float[width * 2];
|
||||
memcpy(edit, _edit, 2 * width * sizeof(float));
|
||||
}
|
||||
|
||||
virtual ~HbrMovingVertexEdit() {
|
||||
delete[] edit;
|
||||
}
|
||||
|
||||
// Return the vertex id (the last element in the path)
|
||||
unsigned char GetVertexID() const { return vertexid; }
|
||||
|
||||
friend std::ostream& operator<< <T> (std::ostream& out, const HbrVertexEdit<T>& path);
|
||||
|
||||
// Return index of variable this edit applies to
|
||||
int GetIndex() const { return index; }
|
||||
|
||||
// Return width of the variable
|
||||
int GetWidth() const { return width; }
|
||||
|
||||
// Get the numerical value of the edit
|
||||
const float* GetEdit() const { return edit; }
|
||||
|
||||
// Get the type of operation
|
||||
typename HbrHierarchicalEdit<T>::Operation GetOperation() const { return op; }
|
||||
|
||||
virtual void ApplyEditToFace(HbrFace<T>* face) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth()) {
|
||||
// Tags the vertex as being edited; it'll figure out what to
|
||||
// when GuaranteeNeighbor is called
|
||||
face->GetVertex(vertexid)->SetVertexEdit();
|
||||
}
|
||||
// In any event, mark the face as having a vertex edit (which
|
||||
// may only be applied on subfaces)
|
||||
face->MarkVertexEdits();
|
||||
}
|
||||
|
||||
virtual void ApplyEditToVertex(HbrFace<T>* face, HbrVertex<T>* vertex) {
|
||||
if (HbrHierarchicalEdit<T>::GetNSubfaces() == face->GetDepth() &&
|
||||
face->GetVertex(vertexid) == vertex) {
|
||||
vertex->GetData().ApplyMovingVertexEdit(*const_cast<const HbrMovingVertexEdit<T>*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRMAN
|
||||
virtual void ApplyToBound(struct bbox& bbox, RtMatrix *mx) {
|
||||
if (isP) {
|
||||
struct xyz p1 = *(struct xyz*)edit;
|
||||
struct xyz p2 = *(struct xyz*)&edit[3];
|
||||
if (mx) {
|
||||
MxTransformByMatrix(&p1, &p1, *mx, 1);
|
||||
MxTransformByMatrix(&p2, &p2, *mx, 1);
|
||||
}
|
||||
if (op == HbrVertexEdit<T>::Set) {
|
||||
bbox.min.x = std::min(std::min(bbox.min.x, p1.x), p2.x);
|
||||
bbox.min.y = std::min(std::min(bbox.min.y, p1.y), p2.y);
|
||||
bbox.min.z = std::min(std::min(bbox.min.z, p1.z), p2.z);
|
||||
bbox.max.x = std::max(std::max(bbox.max.x, p1.x), p2.x);
|
||||
bbox.max.y = std::max(std::max(bbox.max.y, p1.y), p2.y);
|
||||
bbox.max.z = std::max(std::max(bbox.max.z, p1.z), p2.z);
|
||||
} else if (op == HbrVertexEdit<T>::Add ||
|
||||
op == HbrVertexEdit<T>::Subtract) {
|
||||
float maxx = std::max(fabsf(p1.x), fabsf(p2.x));
|
||||
float maxy = std::max(fabsf(p1.y), fabsf(p2.y));
|
||||
float maxz = std::max(fabsf(p1.z), fabsf(p2.z));
|
||||
bbox.min.x -= maxx;
|
||||
bbox.min.y -= maxy;
|
||||
bbox.min.z -= maxz;
|
||||
bbox.max.x += maxx;
|
||||
bbox.max.y += maxy;
|
||||
bbox.max.z += maxz;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
const unsigned char vertexid;
|
||||
int index;
|
||||
int width;
|
||||
unsigned isP:1;
|
||||
typename HbrHierarchicalEdit<T>::Operation op;
|
||||
float* edit;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HBRVERTEXEDIT_H */
|
63
opensubdiv/version.h
Normal file
63
opensubdiv/version.h
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#ifndef OPENSUBDIV_VERSION_H
|
||||
#define OPENSUBDIV_VERSION_H
|
||||
|
||||
#define OPENSUBDIV_VERSION v1_0
|
||||
|
||||
#endif /* OPENSUBDIV_VERSION_H */
|
58
regression/CMakeLists.txt
Normal file
58
regression/CMakeLists.txt
Normal file
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
add_subdirectory(far_regression)
|
404
regression/common/shape_utils.h
Normal file
404
regression/common/shape_utils.h
Normal file
@ -0,0 +1,404 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef SHAPE_UTILS_H
|
||||
#define SHAPE_UTILS_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static char const * sgets( char * s, int size, char ** stream ) {
|
||||
for (int i=0; i<size; ++i) {
|
||||
if ( (*stream)[i]=='\n' or (*stream)[i]=='\0') {
|
||||
|
||||
memcpy(s, *stream, i);
|
||||
s[i]='\0';
|
||||
|
||||
if ((*stream)[i]=='\0')
|
||||
return 0;
|
||||
else {
|
||||
(*stream) += i+1;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
struct shape {
|
||||
|
||||
struct tag {
|
||||
|
||||
static tag * parseTag( char const * stream );
|
||||
|
||||
std::string name;
|
||||
std::vector<int> intargs;
|
||||
std::vector<float> floatargs;
|
||||
std::vector<std::string> stringargs;
|
||||
};
|
||||
|
||||
static shape * parseShape(char const * shapestr, int axis=1);
|
||||
|
||||
~shape();
|
||||
|
||||
int getNverts() const { return (int)verts.size()/3; }
|
||||
|
||||
int getNfaces() const { return (int)nvertsPerFace.size(); }
|
||||
|
||||
std::vector<float> verts;
|
||||
std::vector<float> uvs;
|
||||
std::vector<int> nvertsPerFace;
|
||||
std::vector<int> faceverts;
|
||||
std::vector<int> faceuvs;
|
||||
std::vector<tag *> tags;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
shape::~shape() {
|
||||
for (int i=0; i<(int)tags.size(); ++i)
|
||||
delete tags[i];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
shape::tag * shape::tag::parseTag(char const * line) {
|
||||
tag * t = 0;
|
||||
|
||||
const char* cp = &line[2];
|
||||
|
||||
char name[15];
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%s", &name )!=1) return t;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
|
||||
int nints=0, nfloats=0, nstrings=0;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%d/%d/%d", &nints, &nfloats, &nstrings)!=3) return t;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
|
||||
std::vector<int> intargs;
|
||||
for (int i=0; i<nints; ++i) {
|
||||
int val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%d", &val)!=1) return t;
|
||||
intargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
std::vector<float> floatargs;
|
||||
for (int i=0; i<nfloats; ++i) {
|
||||
float val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%f", &val)!=1) return t;
|
||||
floatargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
std::vector<std::string> stringargs;
|
||||
for (int i=0; i<nstrings; ++i) {
|
||||
char * val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%s", &val)!=1) return t;
|
||||
stringargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
t = new shape::tag;
|
||||
t->name = name;
|
||||
t->intargs = intargs;
|
||||
t->floatargs = floatargs;
|
||||
t->stringargs = stringargs;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
shape * shape::parseShape(char const * shapestr, int axis ) {
|
||||
|
||||
shape * s = new shape;
|
||||
|
||||
char * str=const_cast<char *>(shapestr), line[256];
|
||||
bool done = false;
|
||||
while( not done )
|
||||
{ done = sgets(line, sizeof(line), &str)==0;
|
||||
char* end = &line[strlen(line)-1];
|
||||
if (*end == '\n') *end = '\0'; // strip trailing nl
|
||||
float x, y, z, u, v;
|
||||
switch (line[0]) {
|
||||
case 'v': switch (line[1])
|
||||
{ case ' ': if(sscanf(line, "v %f %f %f", &x, &y, &z) == 3)
|
||||
s->verts.push_back(x);
|
||||
switch( axis ) {
|
||||
case 0 : s->verts.push_back(-z);
|
||||
s->verts.push_back(y); break;
|
||||
case 1 : s->verts.push_back(y);
|
||||
s->verts.push_back(z); break;
|
||||
} break;
|
||||
case 't': if(sscanf(line, "vt %f %f", &u, &v) == 2) {
|
||||
s->uvs.push_back(u);
|
||||
s->uvs.push_back(v);
|
||||
} break;
|
||||
case 'n' : break; // skip normals for now
|
||||
}
|
||||
break;
|
||||
case 'f': if(line[1] == ' ') {
|
||||
int vi, ti, ni;
|
||||
const char* cp = &line[2];
|
||||
while (*cp == ' ') cp++;
|
||||
int nverts = 0, nitems=0;
|
||||
while( (nitems=sscanf(cp, "%d/%d/%d", &vi, &ti, &ni))>0) {
|
||||
nverts++;
|
||||
s->faceverts.push_back(vi-1);
|
||||
if(nitems >= 1) s->faceuvs.push_back(ti-1);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
while (*cp == ' ') cp++;
|
||||
}
|
||||
s->nvertsPerFace.push_back(nverts);
|
||||
}
|
||||
break;
|
||||
case 't' : if(line[1] == ' ') {
|
||||
shape::tag * t = tag::parseTag( line );
|
||||
if (t)
|
||||
s->tags.push_back(t);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
void applyTags( HbrMesh<T> * mesh, shape * sh ) {
|
||||
|
||||
for (int i=0; i<(int)sh->tags.size(); ++i) {
|
||||
shape::tag * t = sh->tags[i];
|
||||
|
||||
if (t->name=="crease") {
|
||||
for (int j=0; j<(int)t->intargs.size()-1; ++j) {
|
||||
HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] ),
|
||||
* w = mesh->GetVertex( t->intargs[j+1] );
|
||||
HbrHalfedge<T> * e = 0;
|
||||
if( v && w ) {
|
||||
if( !(e = v->GetEdge(w) ) )
|
||||
e = w->GetEdge(v);
|
||||
if(e) {
|
||||
int nfloat = (int) t->floatargs.size();
|
||||
e->SetSharpness( std::max(0.0f, ((nfloat > 1) ? t->floatargs[j] : t->floatargs[0])) );
|
||||
} else
|
||||
printf("cannot find edge for crease tag (%d,%d)\n", t->intargs[j], t->intargs[j+1] );
|
||||
}
|
||||
}
|
||||
} else if (t->name=="corner") {
|
||||
for (int j=0; j<(int)t->intargs.size(); ++j) {
|
||||
HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] );
|
||||
if(v) {
|
||||
int nfloat = (int) t->floatargs.size();
|
||||
v->SetSharpness( std::max(0.0f, ((nfloat > 1) ? t->floatargs[j] : t->floatargs[0])) );
|
||||
} else
|
||||
printf("cannot find vertex for corner tag (%d)\n", t->intargs[j] );
|
||||
}
|
||||
} else if (t->name=="hole") {
|
||||
for (int j=0; j<(int)t->intargs.size(); ++j) {
|
||||
HbrFace<T> * f = mesh->GetFace( t->intargs[j] );
|
||||
if(f) {
|
||||
f->SetHole();
|
||||
} else
|
||||
printf("cannot find face for hole tag (%d)\n", t->intargs[j] );
|
||||
}
|
||||
} else if (t->name=="interpolateboundary") {
|
||||
if ((int)t->intargs.size()!=1) {
|
||||
printf("expecting 1 integer for \"interpolateboundary\" tag n. %d\n", i);
|
||||
continue;
|
||||
}
|
||||
switch( t->intargs[0] )
|
||||
{ case 0 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryNone); break;
|
||||
case 1 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner); break;
|
||||
case 2 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeOnly); break;
|
||||
default: printf("unknown interpolation boundary : %d\n", t->intargs[0] ); break;
|
||||
}
|
||||
} else if (t->name=="facevaryingpropagatecorners") {
|
||||
if ((int)t->intargs.size()==1)
|
||||
mesh->SetFVarPropagateCorners( t->intargs[0] != 0 );
|
||||
else
|
||||
printf( "expecting single int argument for \"facevaryingpropagatecorners\"\n" );
|
||||
} else if (t->name=="creasemethod") {
|
||||
|
||||
HbrCatmarkSubdivision<T> * scheme =
|
||||
dynamic_cast<HbrCatmarkSubdivision<T> *>( mesh->GetSubdivision() );
|
||||
|
||||
if (not scheme) {
|
||||
printf("the \"creasemethod\" tag can only be applied to Catmark meshes\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((int)t->stringargs.size()==0) {
|
||||
printf("the \"creasemethod\" tag expects a string argument\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if( t->stringargs[0]=="normal" )
|
||||
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_Old);
|
||||
else if( t->stringargs[0]=="chaikin" )
|
||||
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_New);
|
||||
else
|
||||
printf("the \"creasemethod\" tag only accepts \"normal\" or \"chaikin\" as value (%s)\n", t->stringargs[0].c_str());
|
||||
|
||||
} else if (t->name=="vertexedit" or t->name=="edgeedit") {
|
||||
printf("hierarchical edits not supported (yet)\n");
|
||||
} else {
|
||||
printf("Unknown tag : \"%s\" - skipping\n", t->name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum Scheme {
|
||||
kBilinear,
|
||||
kCatmark,
|
||||
kLoop
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> HbrMesh<T> *
|
||||
simpleHbr( char const * shapestr, Scheme scheme=kCatmark) {
|
||||
|
||||
shape * sh = shape::parseShape( shapestr );
|
||||
|
||||
HbrMesh<T> * mesh = 0;
|
||||
|
||||
static HbrBilinearSubdivision<T> _bilinear;
|
||||
static HbrLoopSubdivision<T> _loop;
|
||||
static HbrCatmarkSubdivision<T> _catmark;
|
||||
|
||||
switch (scheme) {
|
||||
case kBilinear : mesh = new HbrMesh<T>( &_bilinear ); break;
|
||||
case kLoop : mesh = new HbrMesh<T>( &_loop ); break;
|
||||
case kCatmark : mesh = new HbrMesh<T>( &_catmark ); break;
|
||||
}
|
||||
|
||||
int numverts = sh->getNverts(),
|
||||
numfaces = sh->getNfaces();
|
||||
|
||||
T v;
|
||||
for(int i=0;i<numverts; i++ ) {
|
||||
v.SetPos( sh->verts[i*3], sh->verts[i*3+1], sh->verts[i*3+2] );
|
||||
mesh->NewVertex( i, v );
|
||||
}
|
||||
|
||||
const int * fv=&(sh->faceverts[0]);
|
||||
for(int f=0, ptxidx=0;f<numfaces; f++ ) {
|
||||
int nv = sh->nvertsPerFace[f];
|
||||
|
||||
if ((scheme==kLoop) and (nv!=3)) {
|
||||
printf("Trying to create a Loop surbd with non-triangle face\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for(int j=0;j<nv;j++) {
|
||||
HbrVertex<T> * origin = mesh->GetVertex( fv[j] );
|
||||
HbrVertex<T> * destination = mesh->GetVertex( fv[ (j+1)%nv] );
|
||||
HbrHalfedge<T> * opposite = destination->GetEdge(origin);
|
||||
|
||||
if(origin==NULL || destination==NULL) {
|
||||
printf(" An edge was specified that connected a nonexistent vertex\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(origin == destination) {
|
||||
printf(" An edge was specified that connected a vertex to itself\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(opposite && opposite->GetOpposite() ) {
|
||||
printf(" A non-manifold edge incident to more than 2 faces was found\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(origin->GetEdge(destination)) {
|
||||
printf(" An edge connecting two vertices was specified more than once."
|
||||
" It's likely that an incident face was flipped\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
HbrFace<T> * face = mesh->NewFace(nv, (int *)fv, 0);
|
||||
|
||||
face->SetPtexIndex(ptxidx);
|
||||
|
||||
if ( (scheme==kCatmark or scheme==kBilinear) and nv != 4 )
|
||||
ptxidx+=nv;
|
||||
else
|
||||
ptxidx++;
|
||||
|
||||
fv+=nv;
|
||||
}
|
||||
|
||||
applyTags( mesh, sh );
|
||||
|
||||
mesh->Finish();
|
||||
|
||||
delete sh;
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
|
||||
#endif /* SHAPE_UTILS_H */
|
87
regression/far_regression/CMakeLists.txt
Normal file
87
regression/far_regression/CMakeLists.txt
Normal file
@ -0,0 +1,87 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
find_package(IlmBase)
|
||||
|
||||
if(NOT ILMBASE_FOUND)
|
||||
message(WARNING
|
||||
"IlmBase could not be found, so the OpenSubdiv far library regression "
|
||||
"will not be available. If you do have IlmBase installed and see this"
|
||||
" message, please add your Maya path to cmake/FindMaya.cmake or set it "
|
||||
"in the ILMBASE_LOCATION environment variable."
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${ILMBASE_INCLUDE_DIRECTORY}
|
||||
${PROJECT_SOURCE_DIR}/opensubdiv
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
|
||||
add_executable(far_regression
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries(far_regression
|
||||
${ILMBASE_LIBS_DIRECTORY}
|
||||
)
|
||||
|
6
regression/far_regression/blah.cpp
Normal file
6
regression/far_regression/blah.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <hbr/mesh.h>
|
||||
|
||||
int main(int, char **) {
|
||||
}
|
173
regression/far_regression/example_createMesh.py
Normal file
173
regression/far_regression/example_createMesh.py
Normal file
@ -0,0 +1,173 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
"""
|
||||
Example
|
||||
|
||||
Description:
|
||||
Create a Maya Mesh using OpenMaya
|
||||
|
||||
in Maya's python editor :
|
||||
|
||||
import example_createMesh
|
||||
reload(example_createMesh)
|
||||
|
||||
example_createMesh.readPolyFile('/host/devel/rtc3/trees/dev/amber/bin/pbr2/script')
|
||||
|
||||
"""
|
||||
|
||||
from maya import OpenMaya as om
|
||||
from itertools import chain
|
||||
import maya.cmds as cmds
|
||||
|
||||
def getDagPath(nodeName):
|
||||
"""Get an MDagPath for the associated node name
|
||||
"""
|
||||
selList = om.MSelectionList()
|
||||
selList.add(nodeName)
|
||||
dagPath = om.MDagPath()
|
||||
selList.getDagPath(0, dagPath)
|
||||
return dagPath
|
||||
|
||||
def convertToMIntArray(listOfInts):
|
||||
newMIntArray = om.MIntArray(len(listOfInts))
|
||||
for i in range(len(listOfInts)):
|
||||
val = listOfInts[i]
|
||||
newMIntArray.set(val, i)
|
||||
return newMIntArray
|
||||
|
||||
|
||||
def convertToMPointArray(listOfVertexTuples):
|
||||
newMPointArray = om.MPointArray(len(listOfVertexTuples))
|
||||
for i in range(len(listOfVertexTuples)):
|
||||
v = listOfVertexTuples[i]
|
||||
newMPointArray.set(i, v[0], v[1], v[2], 1.0)
|
||||
return newMPointArray
|
||||
|
||||
|
||||
def createMesh(vertices, polygons, parent=None):
|
||||
'''Create a mesh with the specified vertices and polygons
|
||||
'''
|
||||
# The parameters used in MFnMesh.create() can all be derived from the
|
||||
# input vertices and polygon lists
|
||||
|
||||
numVertices = len(vertices)
|
||||
numPolygons = len(polygons)
|
||||
|
||||
verticesM = convertToMPointArray(vertices)
|
||||
|
||||
polygonCounts = [len(i) for i in polygons]
|
||||
polygonCountsM = convertToMIntArray(polygonCounts)
|
||||
|
||||
# Flatten the list of lists
|
||||
# Reference: http://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python
|
||||
polygonConnects = list(chain.from_iterable(polygons))
|
||||
polygonConnectsM = convertToMIntArray(polygonConnects)
|
||||
|
||||
# Determine parent
|
||||
if parent == None:
|
||||
parentM = om.MObject()
|
||||
else:
|
||||
parentM = getDagPath(parent).node()
|
||||
|
||||
# Create Mesh
|
||||
newMesh = om.MFnMesh()
|
||||
newTransformOrShape = newMesh.create(
|
||||
numVertices,
|
||||
numPolygons,
|
||||
verticesM,
|
||||
polygonCountsM,
|
||||
polygonConnectsM,
|
||||
parentM)
|
||||
|
||||
dagpath = om.MDagPath()
|
||||
om.MDagPath.getAPathTo( newTransformOrShape, dagpath )
|
||||
|
||||
# Assign the default shader to the mesh.
|
||||
cmds.sets(
|
||||
dagpath.fullPathName(),
|
||||
edit=True,
|
||||
forceElement='initialShadingGroup')
|
||||
|
||||
return dagpath.partialPathName()
|
||||
|
||||
def readPolyFile(path):
|
||||
polys = ''
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
polys = ''
|
||||
for line in f.readlines():
|
||||
polys += line.rstrip()
|
||||
except:
|
||||
print 'Cannot read '+str(path)
|
||||
|
||||
polys = eval(polys)
|
||||
|
||||
tx = 0.0
|
||||
ty = 0.0
|
||||
for poly in polys:
|
||||
verts = poly['verts']
|
||||
faces = poly['faces']
|
||||
parent = None
|
||||
dagpath = createMesh(verts, faces, parent)
|
||||
cmds.move( tx, ty, 0, dagpath, absolute=True )
|
||||
tx+=4.0
|
||||
if tx > 16.0:
|
||||
tx=0.0
|
||||
ty+=4.0
|
530
regression/far_regression/main.cpp
Normal file
530
regression/far_regression/main.cpp
Normal file
@ -0,0 +1,530 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <hbr/mesh.h>
|
||||
#include <hbr/face.h>
|
||||
#include <hbr/vertex.h>
|
||||
#include <hbr/halfedge.h>
|
||||
#include <hbr/catmark.h>
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
|
||||
#include <ImathVec.h>
|
||||
|
||||
#include "../common/shape_utils.h"
|
||||
|
||||
//
|
||||
// Regression testing matching Far to Hbr (default CPU implementation)
|
||||
//
|
||||
// Notes:
|
||||
// - precision is currently held at 1e-6
|
||||
//
|
||||
// - results cannot be bitwise identical as some vertex interpolations
|
||||
// are not happening in the same order.
|
||||
//
|
||||
// - only vertex interpolation is being tested at the moment.
|
||||
//
|
||||
#define PRECISION 1e-6
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Vertex class implementation
|
||||
struct xyzVV {
|
||||
xyzVV() { }
|
||||
xyzVV( int /*i*/ ) { }
|
||||
xyzVV( float x, float y, float z ) : _pos(x,y,z) { }
|
||||
xyzVV( const Imath::Vec3<float> & v ) : _pos(v) { }
|
||||
xyzVV( const xyzVV & src ) : _pos(src._pos) { }
|
||||
~xyzVV( ) { }
|
||||
|
||||
void AddWithWeight(const xyzVV& src, float weight, void * =0 ) { _pos+=weight*src._pos; }
|
||||
void AddVaryingWithWeight(const xyzVV& , float, void * =0 ) { }
|
||||
void Clear( void * =0 ) { _pos.setValue(0.f, 0.f, 0.f); }
|
||||
void SetPos(float x, float y, float z) { _pos=Imath::Vec3<float>(x,y,z); }
|
||||
const Imath::Vec3<float>& GetPos() const { return _pos; }
|
||||
|
||||
private:
|
||||
Imath::Vec3<float> _pos;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class xyzFV;
|
||||
typedef HbrMesh<xyzVV> xyzmesh;
|
||||
typedef HbrFace<xyzVV> xyzface;
|
||||
typedef HbrVertex<xyzVV> xyzvertex;
|
||||
typedef HbrHalfedge<xyzVV> xyzhalfedge;
|
||||
typedef HbrFaceOperator<xyzVV> xyzFaceOperator;
|
||||
typedef HbrVertexOperator<xyzVV> xyzVertexOperator;
|
||||
|
||||
typedef OpenSubdiv::FarMesh<xyzVV> fMesh;
|
||||
typedef OpenSubdiv::FarMeshFactory<xyzVV> fMeshFactory;
|
||||
typedef OpenSubdiv::FarSubdivisionTables<xyzVV> fMeshSubdivision;
|
||||
|
||||
static bool g_debugmode = false;
|
||||
static bool g_dumphbr = false;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// visual debugging using Maya
|
||||
// python dictionary dump - requires the script createMesh.py to read into Maya
|
||||
// format is : [ { 'verts':[(1,0,0),(2,0,0)],
|
||||
// 'faces':[[1 2 3 4],[5,6,7,8]] }, ... ]
|
||||
//------------------------------------------------------------------------------
|
||||
static void dumpVerts( xyzmesh * mesh, int level ) {
|
||||
printf("\t'verts':[\t");
|
||||
for (int i=0, counter=0; i<mesh->GetNumVertices(); ++i) {
|
||||
xyzvertex * v = mesh->GetVertex(i);
|
||||
if ( v->GetFace()->GetDepth()==level) {
|
||||
printf("(%10f, %10f, %10f), ",v->GetData().GetPos()[0],
|
||||
v->GetData().GetPos()[1],
|
||||
v->GetData().GetPos()[2] );
|
||||
counter++;
|
||||
}
|
||||
if (counter!=0 and (counter+1)%6==0) printf("\n\t\t\t");
|
||||
}
|
||||
printf("],\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void dumpFaces( xyzmesh * mesh, int level ) {
|
||||
int vertofs = 0;
|
||||
for (int i=0; i<mesh->GetNumVertices(); ++i)
|
||||
if (mesh->GetVertex(i)->GetFace()->GetDepth()==level) {
|
||||
vertofs = i;
|
||||
break;
|
||||
}
|
||||
|
||||
printf("\t'faces':[\t");
|
||||
int nfaces = mesh->GetNumFaces();
|
||||
|
||||
for (int i=0, counter=0; i<nfaces; ++i) {
|
||||
xyzface * f = mesh->GetFace(i);
|
||||
if (f->IsHole())
|
||||
continue;
|
||||
if (f->GetDepth()==level) {
|
||||
if (f->GetNumVertices()==4)
|
||||
printf("[%6d, %6d, %6d, %6d], ", f->GetVertex(0)->GetID()-vertofs,
|
||||
f->GetVertex(1)->GetID()-vertofs,
|
||||
f->GetVertex(2)->GetID()-vertofs,
|
||||
f->GetVertex(3)->GetID()-vertofs );
|
||||
else if (f->GetNumVertices()==3)
|
||||
printf("[%6d, %6d, %6d], ", f->GetVertex(0)->GetID()-vertofs,
|
||||
f->GetVertex(1)->GetID()-vertofs,
|
||||
f->GetVertex(2)->GetID()-vertofs );
|
||||
|
||||
++counter;
|
||||
if (counter!=0 and (counter+4)%32==0)
|
||||
printf("\n\t\t\t");
|
||||
}
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// dump an Hbr mesh to console
|
||||
static void dumpXYZMesh( xyzmesh * mesh, int level, Scheme /* loop */ =kCatmark ) {
|
||||
printf("{ ");
|
||||
dumpVerts(mesh, level);
|
||||
dumpFaces(mesh, level);
|
||||
printf("},\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void dumpVerts( fMesh * mesh, int level ) {
|
||||
std::vector<xyzVV> & verts = mesh->GetVertices();
|
||||
|
||||
int firstvert = mesh->GetSubdivision()->GetFirstVertexOffset(level),
|
||||
numverts = mesh->GetSubdivision()->GetNumVertices(level);
|
||||
|
||||
printf("\t'verts':[\t");
|
||||
for (int i=firstvert; i<(firstvert+numverts); ++i) {
|
||||
printf("(%10f, %10f, %10f), ",verts[i].GetPos()[0],
|
||||
verts[i].GetPos()[1],
|
||||
verts[i].GetPos()[2] );
|
||||
if (i!=0 and (i+1)%6==0)
|
||||
printf("\n\t\t\t");
|
||||
}
|
||||
printf("],\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void dumpQuadFaces( fMesh * mesh, int level ) {
|
||||
std::vector<int> const & fverts = mesh->GetFaceVertices(level);
|
||||
|
||||
int ofs = mesh->GetSubdivision()->GetFirstVertexOffset(level);
|
||||
|
||||
printf("\t'faces':[\t");
|
||||
for (size_t i=0; i<(fverts.size()); i+=4) {
|
||||
printf("[%6d, %6d, %6d, %6d], ", fverts[i ]-ofs,
|
||||
fverts[i+1]-ofs,
|
||||
fverts[i+2]-ofs,
|
||||
fverts[i+3]-ofs );
|
||||
if (i!=0 and (i+4)%32==0)
|
||||
printf("\n\t\t\t");
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void dumpTriFaces( fMesh * mesh, int level ) {
|
||||
std::vector<int> const & fverts = mesh->GetFaceVertices(level);
|
||||
|
||||
int ofs = mesh->GetSubdivision()->GetFirstVertexOffset(level);
|
||||
|
||||
printf("\t'faces':[\t");
|
||||
for (size_t i=0; i<(fverts.size()); i+=3) {
|
||||
printf("[%6d, %6d, %6d], ", fverts[i]-ofs, fverts[i+1]-ofs, fverts[i+2]-ofs );
|
||||
if (i!=0 and (i+4)%32==0)
|
||||
printf("\n\t\t\t");
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
static void dumpMesh( fMesh * mesh, int level, Scheme scheme=kCatmark ) {
|
||||
printf("{ ");
|
||||
dumpVerts(mesh,level);
|
||||
switch (scheme) {
|
||||
case kLoop : dumpTriFaces(mesh,level); break;
|
||||
case kBilinear :
|
||||
case kCatmark : dumpQuadFaces(mesh, level); break;
|
||||
}
|
||||
printf("},\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int checkMesh( char const * msg, xyzmesh * hmesh, int levels, Scheme scheme=kCatmark ) {
|
||||
|
||||
assert(msg);
|
||||
|
||||
int count=0;
|
||||
Imath::Vec3<float> deltaAvg(0.0, 0.0, 0.0);
|
||||
Imath::Vec3<float> deltaCnt(0,0,0);
|
||||
|
||||
// subdivide on the Nsd side
|
||||
fMeshFactory fact( hmesh, levels );
|
||||
fMesh * m = fact.Create( );
|
||||
m->Subdivide( );
|
||||
|
||||
if (g_debugmode) {
|
||||
for (int i=1; i<=levels; ++i)
|
||||
if (g_dumphbr)
|
||||
dumpXYZMesh( hmesh, i, scheme );
|
||||
else
|
||||
dumpMesh( m, i, scheme );
|
||||
} else
|
||||
printf("- %s (scheme=%d)\n", msg, scheme);
|
||||
|
||||
std::vector<int> const & remap = fact.GetRemappingTable();
|
||||
|
||||
int nverts = m->GetNumVertices();
|
||||
|
||||
// compare vertex results (only position for now - we need to expand w/ some vertex data)
|
||||
for (int i=1; i<nverts; ++i) {
|
||||
|
||||
xyzvertex * hv = hmesh->GetVertex(i);
|
||||
xyzVV & nv = m->GetVertex( remap[hv->GetID()] );
|
||||
|
||||
if ( hv->GetData().GetPos()[0] != nv.GetPos()[0] )
|
||||
deltaCnt[0]++;
|
||||
if ( hv->GetData().GetPos()[1] != nv.GetPos()[1] )
|
||||
deltaCnt[1]++;
|
||||
if ( hv->GetData().GetPos()[2] != nv.GetPos()[2] )
|
||||
deltaCnt[2]++;
|
||||
|
||||
Imath::Vec3<float> delta = hv->GetData().GetPos() - nv.GetPos();
|
||||
|
||||
deltaAvg+=delta;
|
||||
|
||||
float dist = delta.length();
|
||||
if ( dist > PRECISION ) {
|
||||
if (not g_debugmode)
|
||||
printf("// HbrVertex<T> %d fails : dist=%.10f (%.10f %.10f %.10f)"
|
||||
" (%.10f %.10f %.10f)\n", i, dist, hv->GetData().GetPos()[0],
|
||||
hv->GetData().GetPos()[1],
|
||||
hv->GetData().GetPos()[2],
|
||||
nv.GetPos()[0],
|
||||
nv.GetPos()[1],
|
||||
nv.GetPos()[2] );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (deltaCnt[0])
|
||||
deltaAvg[0]/=deltaCnt[0];
|
||||
if (deltaCnt[1])
|
||||
deltaAvg[1]/=deltaCnt[1];
|
||||
if (deltaCnt[2])
|
||||
deltaAvg[2]/=deltaCnt[2];
|
||||
|
||||
if (not g_debugmode) {
|
||||
printf(" delta ratio : (%d/%d %d/%d %d/%d)\n", (int)deltaCnt.x, nverts,
|
||||
(int)deltaCnt.y, nverts,
|
||||
(int)deltaCnt.x, nverts );
|
||||
printf(" average delta : (%.10f %.10f %.10f)\n", deltaAvg.x,
|
||||
deltaAvg.y,
|
||||
deltaAvg.z );
|
||||
if (count==0)
|
||||
printf(" success !\n");
|
||||
}
|
||||
|
||||
delete hmesh;
|
||||
delete m;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void parseArgs(int argc, char ** argv) {
|
||||
if (argc>1) {
|
||||
for (int i=1; i<argc; ++i) {
|
||||
if (strcmp(argv[i],"-debug")==0)
|
||||
g_debugmode=true;
|
||||
else if (strcmp(argv[i],"-dumphbr")==0) {
|
||||
g_debugmode=true;
|
||||
g_dumphbr=true;
|
||||
} else {
|
||||
printf("Unknown argument \"%s\". Valid arguments are [\"-debug\", \"-dumphbr\"].\n", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
int levels=5, total=0;
|
||||
|
||||
parseArgs(argc, argv);
|
||||
|
||||
#define test_catmark_edgeonly
|
||||
#define test_catmark_edgecorner
|
||||
#define test_catmark_pyramid
|
||||
#define test_catmark_pyramid_creases0
|
||||
#define test_catmark_pyramid_creases1
|
||||
#define test_catmark_cube
|
||||
#define test_catmark_cube_creases0
|
||||
#define test_catmark_cube_creases1
|
||||
#define test_catmark_cube_corner0
|
||||
#define test_catmark_cube_corner1
|
||||
#define test_catmark_cube_corner2
|
||||
#define test_catmark_cube_corner3
|
||||
#define test_catmark_cube_corner4
|
||||
#define test_catmark_dart
|
||||
#define test_catmark_tent
|
||||
#define test_catmark_tent_creases0
|
||||
#define test_catmark_tent_creases1
|
||||
|
||||
#define test_loop_triangle_edgeonly
|
||||
#define test_loop_triangle_edgecorner
|
||||
#define test_loop_icosahedron
|
||||
#define test_loop_cube
|
||||
#define test_loop_cube_creases0
|
||||
#define test_loop_cube_creases1
|
||||
|
||||
#define test_bilinear_cube
|
||||
if (g_debugmode)
|
||||
printf("[ ");
|
||||
else
|
||||
printf("precision : %f\n",PRECISION);
|
||||
|
||||
#ifdef test_catmark_edgeonly
|
||||
#include "../shapes/catmark_edgeonly.h"
|
||||
total += checkMesh( "test_catmark_edgeonly", simpleHbr<xyzVV>(catmark_edgeonly), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_edgecorner
|
||||
#include "../shapes/catmark_edgecorner.h"
|
||||
total += checkMesh( "test_catmark_edgeonly", simpleHbr<xyzVV>(catmark_edgecorner), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_pyramid
|
||||
#include "../shapes/catmark_pyramid.h"
|
||||
total += checkMesh( "test_catmark_pyramid", simpleHbr<xyzVV>(catmark_pyramid), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_pyramid_creases0
|
||||
#include "../shapes/catmark_pyramid_creases0.h"
|
||||
total += checkMesh( "test_catmark_pyramid_creases0", simpleHbr<xyzVV>(catmark_pyramid_creases0), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_pyramid_creases1
|
||||
#include "../shapes/catmark_pyramid_creases1.h"
|
||||
total += checkMesh( "test_catmark_pyramid_creases1", simpleHbr<xyzVV>(catmark_pyramid_creases1), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube
|
||||
#include "../shapes/catmark_cube.h"
|
||||
total += checkMesh( "test_catmark_cube", simpleHbr<xyzVV>(catmark_cube), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_creases0
|
||||
#include "../shapes/catmark_cube_creases0.h"
|
||||
total += checkMesh( "test_catmark_cube_creases0", simpleHbr<xyzVV>(catmark_cube_creases0), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_creases1
|
||||
#include "../shapes/catmark_cube_creases1.h"
|
||||
total += checkMesh( "test_catmark_cube_creases1", simpleHbr<xyzVV>(catmark_cube_creases1), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_corner0
|
||||
#include "../shapes/catmark_cube_corner0.h"
|
||||
total += checkMesh( "test_catmark_cube_corner0", simpleHbr<xyzVV>(catmark_cube_corner0), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_corner1
|
||||
#include "../shapes/catmark_cube_corner1.h"
|
||||
total += checkMesh( "test_catmark_cube_corner1", simpleHbr<xyzVV>(catmark_cube_corner1), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_corner2
|
||||
#include "../shapes/catmark_cube_corner2.h"
|
||||
total += checkMesh( "test_catmark_cube_corner2", simpleHbr<xyzVV>(catmark_cube_corner2), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_corner3
|
||||
#include "../shapes/catmark_cube_corner3.h"
|
||||
total += checkMesh( "test_catmark_cube_corner3", simpleHbr<xyzVV>(catmark_cube_corner3), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_cube_corner4
|
||||
#include "../shapes/catmark_cube_corner4.h"
|
||||
total += checkMesh( "test_catmark_cube_corner4", simpleHbr<xyzVV>(catmark_cube_corner4), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_dart
|
||||
#include "../shapes/catmark_dart.h"
|
||||
total += checkMesh( "test_catmark_dart", simpleHbr<xyzVV>(catmark_dart), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_tent
|
||||
#include "../shapes/catmark_tent.h"
|
||||
total += checkMesh( "test_catmark_tent", simpleHbr<xyzVV>(catmark_tent), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_tent_creases0
|
||||
#include "../shapes/catmark_tent_creases0.h"
|
||||
total += checkMesh( "test_catmark_tent_creases0", simpleHbr<xyzVV>(catmark_tent_creases0), levels );
|
||||
#endif
|
||||
|
||||
#ifdef test_catmark_tent_creases1
|
||||
#include "../shapes/catmark_tent_creases1.h"
|
||||
total += checkMesh( "test_catmark_tent_creases1", simpleHbr<xyzVV>(catmark_tent_creases1), levels );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef test_loop_triangle_edgeonly
|
||||
#include "../shapes/loop_triangle_edgeonly.h"
|
||||
total += checkMesh( "test_loop_triangle_edgeonly", simpleHbr<xyzVV>(loop_triangle_edgeonly, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_triangle_edgecorner
|
||||
#include "../shapes/loop_triangle_edgecorner.h"
|
||||
total += checkMesh( "test_loop_triangle_edgecorner", simpleHbr<xyzVV>(loop_triangle_edgecorner, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_saddle_edgeonly
|
||||
#include "../shapes/loop_saddle_edgeonly.h"
|
||||
total += checkMesh( "test_loop_saddle_edgeonly", simpleHbr<xyzVV>(loop_saddle_edgeonly, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_saddle_edgecorner
|
||||
#include "../shapes/loop_saddle_edgecorner.h"
|
||||
total += checkMesh( "test_loop_saddle_edgecorner", simpleHbr<xyzVV>(loop_saddle_edgecorner, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_icosahedron
|
||||
#include "../shapes/loop_icosahedron.h"
|
||||
total += checkMesh( "test_loop_icosahedron", simpleHbr<xyzVV>(loop_icosahedron, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_cube
|
||||
#include "../shapes/loop_cube.h"
|
||||
total += checkMesh( "test_loop_cube", simpleHbr<xyzVV>(loop_cube, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_cube_creases0
|
||||
#include "../shapes/loop_cube_creases0.h"
|
||||
total += checkMesh( "test_loop_cube_creases0", simpleHbr<xyzVV>(loop_cube_creases0, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
#ifdef test_loop_cube_creases1
|
||||
#include "../shapes/loop_cube_creases1.h"
|
||||
total += checkMesh( "test_loop_cube_creases1", simpleHbr<xyzVV>(loop_cube_creases1, kLoop), levels, kLoop );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef test_bilinear_cube
|
||||
#include "../shapes/bilinear_cube.h"
|
||||
total += checkMesh( "test_bilinear_cube", simpleHbr<xyzVV>(bilinear_cube, kBilinear), levels, kBilinear );
|
||||
#endif
|
||||
|
||||
|
||||
if (g_debugmode)
|
||||
printf("]\n");
|
||||
else {
|
||||
if (total==0)
|
||||
printf("All tests passed.\n");
|
||||
else
|
||||
printf("Total failures : %d\n", total);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
113
regression/shapes/bilinear_cube.h
Normal file
113
regression/shapes/bilinear_cube.h
Normal file
@ -0,0 +1,113 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * bilinear_cube =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
;
|
113
regression/shapes/catmark_cube.h
Normal file
113
regression/shapes/catmark_cube.h
Normal file
@ -0,0 +1,113 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
;
|
114
regression/shapes/catmark_cube_corner0.h
Normal file
114
regression/shapes/catmark_cube_corner0.h
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_corner0 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t corner 1/1/0 0 0.7\n"
|
||||
;
|
114
regression/shapes/catmark_cube_corner1.h
Normal file
114
regression/shapes/catmark_cube_corner1.h
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_corner1 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t corner 1/1/0 0 1.4\n"
|
||||
;
|
114
regression/shapes/catmark_cube_corner2.h
Normal file
114
regression/shapes/catmark_cube_corner2.h
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_corner2 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t corner 1/1/0 0 2.8\n"
|
||||
;
|
114
regression/shapes/catmark_cube_corner3.h
Normal file
114
regression/shapes/catmark_cube_corner3.h
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_corner3 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t corner 1/1/0 0 3.0\n"
|
||||
;
|
114
regression/shapes/catmark_cube_corner4.h
Normal file
114
regression/shapes/catmark_cube_corner4.h
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_corner4 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t corner 1/1/0 0 10.0\n"
|
||||
;
|
116
regression/shapes/catmark_cube_creases0.h
Normal file
116
regression/shapes/catmark_cube_creases0.h
Normal file
@ -0,0 +1,116 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_creases0 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t crease 2/1/0 0 1 2.0\n"
|
||||
"t crease 2/1/0 1 3 2.0\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
;
|
126
regression/shapes/catmark_cube_creases1.h
Normal file
126
regression/shapes/catmark_cube_creases1.h
Normal file
@ -0,0 +1,126 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_cube_creases1 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 0.000000 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v 0.000000 -1.414214 -1.000000\n"
|
||||
"v 1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.000000 0.000000 -1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 4/4/3 3/3/4\n"
|
||||
"f 3/3/5 4/4/6 6/6/7 5/5/8\n"
|
||||
"f 5/5/9 6/6/10 8/8/11 7/7/12\n"
|
||||
"f 7/7/13 8/8/14 2/10/15 1/9/16\n"
|
||||
"f 2/2/17 8/11/18 6/12/19 4/4/20\n"
|
||||
"f 7/13/21 1/1/22 3/3/23 5/14/24\n"
|
||||
"t crease 2/1/0 0 1 5.0\n"
|
||||
"t crease 2/1/0 1 3 5.0\n"
|
||||
"t crease 2/1/0 3 2 5.0\n"
|
||||
"t crease 2/1/0 2 0 5.0\n"
|
||||
"t crease 2/1/0 4 5 5.0\n"
|
||||
"t crease 2/1/0 5 7 5.0\n"
|
||||
"t crease 2/1/0 7 6 5.0\n"
|
||||
"t crease 2/1/0 6 4 5.0\n"
|
||||
"t crease 2/1/0 0 6 5.0\n"
|
||||
"t crease 2/1/0 1 7 5.0\n"
|
||||
"t crease 2/1/0 2 4 5.0\n"
|
||||
"t crease 2/1/0 3 5 0.1\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
;
|
156
regression/shapes/catmark_dart.h
Normal file
156
regression/shapes/catmark_dart.h
Normal file
@ -0,0 +1,156 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_dart =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -2.000000 0.000000\n"
|
||||
"v 2.000000 0.000000 0.000000\n"
|
||||
"v 0.000000 2.000000 0.000000\n"
|
||||
"v -2.000000 0.000000 0.000000\n"
|
||||
"v -0.500000 -1.500000 0.000000\n"
|
||||
"v -1.000000 -1.000000 0.000000\n"
|
||||
"v -1.500000 -0.500000 0.000000\n"
|
||||
"v 1.500000 -0.500000 0.000000\n"
|
||||
"v 1.000000 -1.000000 1.000000\n"
|
||||
"v 0.500000 -1.500000 0.000000\n"
|
||||
"v 0.500000 1.500000 0.000000\n"
|
||||
"v 1.000000 1.000000 0.000000\n"
|
||||
"v 1.500000 0.500000 0.000000\n"
|
||||
"v -1.500000 0.500000 0.000000\n"
|
||||
"v -1.000000 1.000000 0.000000\n"
|
||||
"v -0.500000 1.500000 0.000000\n"
|
||||
"v 0.000000 -1.000000 0.000000\n"
|
||||
"v 0.500000 -0.500000 1.000000\n"
|
||||
"v 1.000000 0.000000 0.000000\n"
|
||||
"v -0.500000 -0.500000 0.000000\n"
|
||||
"v 0.000000 0.000000 1.000000\n"
|
||||
"v 0.500000 0.500000 0.000000\n"
|
||||
"v -1.000000 0.000000 0.000000\n"
|
||||
"v -0.500000 0.500000 0.000000\n"
|
||||
"v 0.000000 1.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vn 1.000000 0.000000 0.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.187366 0.000000 0.982290\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.325058 0.325058 0.888074\n"
|
||||
"vn 0.325058 0.325058 0.888074\n"
|
||||
"vn 1.000000 0.000000 0.000000\n"
|
||||
"vn -0.325058 -0.325058 0.888074\n"
|
||||
"vn -0.325058 -0.325058 0.888074\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 1.000000 0.000000 0.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.161559 0.359427 0.919082\n"
|
||||
"vn -0.359427 -0.161559 0.919082\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.256506 0.256506 0.931885\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.187366 0.982290\n"
|
||||
"vn -0.198757 0.198757 0.959683\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 1.000000 0.000000 0.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"s 1\n"
|
||||
"f 4/1/1 7/7/2 23/23/3 14/14/4\n"
|
||||
"f 13/13/5 19/19/6 8/8/7 2/3/8\n"
|
||||
"f 10/10/9 17/17/10 5/5/11 1/4/12\n"
|
||||
"f 9/9/13 18/18/14 17/17/10 10/10/9\n"
|
||||
"f 8/8/7 19/19/6 18/18/14 9/9/13\n"
|
||||
"f 12/12/15 22/22/16 19/19/6 13/13/5\n"
|
||||
"f 17/17/10 20/20/17 6/6/18 5/5/11\n"
|
||||
"f 18/18/14 21/21/19 20/20/17 17/17/10\n"
|
||||
"f 19/19/6 22/22/16 21/21/19 18/18/14\n"
|
||||
"f 11/11/20 25/25/21 22/22/16 12/12/15\n"
|
||||
"f 20/20/17 23/23/3 7/7/2 6/6/18\n"
|
||||
"f 21/21/19 24/24/22 23/23/3 20/20/17\n"
|
||||
"f 22/22/16 25/25/21 24/24/22 21/21/19\n"
|
||||
"f 16/16/23 25/25/21 11/11/20 3/2/24\n"
|
||||
"f 15/15/25 24/24/22 25/25/21 16/16/23\n"
|
||||
"f 14/14/4 23/23/3 24/24/22 15/15/25\n"
|
||||
"t crease 2/1/0 8 17 2.0\n"
|
||||
"t crease 2/1/0 17 20 2.0\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
76
regression/shapes/catmark_edgecorner.h
Normal file
76
regression/shapes/catmark_edgecorner.h
Normal file
@ -0,0 +1,76 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_edgecorner =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.0 -2.0 0.0\n"
|
||||
"v 2.0 0.0 0.0\n"
|
||||
"v 0.0 2.0 0.0\n"
|
||||
"v -2.0 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"s off\n"
|
||||
"f 4/4/4 3/3/3 2/2/2 1/1/1\n"
|
||||
"t interpolateboundary 1/0/0 1\n"
|
||||
"\n"
|
||||
;
|
76
regression/shapes/catmark_edgeonly.h
Normal file
76
regression/shapes/catmark_edgeonly.h
Normal file
@ -0,0 +1,76 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_edgeonly =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.0 -2.0 0.0\n"
|
||||
"v 2.0 0.0 0.0\n"
|
||||
"v 0.0 2.0 0.0\n"
|
||||
"v -2.0 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"s off\n"
|
||||
"f 4/4/4 3/3/3 2/2/2 1/1/1\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
98
regression/shapes/catmark_pyramid.h
Normal file
98
regression/shapes/catmark_pyramid.h
Normal file
@ -0,0 +1,98 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_pyramid =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.0 0.0 2.0\n"
|
||||
"v 0.0 -2.0 0.0\n"
|
||||
"v 2.0 0.0 0.0\n"
|
||||
"v 0.0 2.0 0.0\n"
|
||||
"v -2.0 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 1/1/1 3/3/3 4/4/4\n"
|
||||
"f 1/1/1 4/4/4 5/5/5\n"
|
||||
"f 1/1/1 5/5/5 2/2/2\n"
|
||||
"f 5/5/5 4/4/4 3/3/3 2/2/2\n"
|
||||
"\n"
|
||||
;
|
103
regression/shapes/catmark_pyramid_creases0.h
Normal file
103
regression/shapes/catmark_pyramid_creases0.h
Normal file
@ -0,0 +1,103 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_pyramid_creases0 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.0 0.0 2.0\n"
|
||||
"v 0.0 -2.0 0.0\n"
|
||||
"v 2.0 0.0 0.0\n"
|
||||
"v 0.0 2.0 0.0\n"
|
||||
"v -2.0 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 1/1/1 3/3/3 4/4/4\n"
|
||||
"f 1/1/1 4/4/4 5/5/5\n"
|
||||
"f 1/1/1 5/5/5 2/2/2\n"
|
||||
"f 5/5/5 4/4/4 3/3/3 2/2/2\n"
|
||||
"t crease 2/1/0 4 3 3.0\n"
|
||||
"t crease 2/1/0 3 2 3.0\n"
|
||||
"t crease 2/1/0 2 1 3.0\n"
|
||||
"t crease 2/1/0 1 4 3.0\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
105
regression/shapes/catmark_pyramid_creases1.h
Normal file
105
regression/shapes/catmark_pyramid_creases1.h
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_pyramid_creases1 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.0 0.0 2.0\n"
|
||||
"v 0.0 -2.0 0.0\n"
|
||||
"v 2.0 0.0 0.0\n"
|
||||
"v 0.0 2.0 0.0\n"
|
||||
"v -2.0 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vt 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"vn 0.0 0.0 0.0\n"
|
||||
"s off\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 1/1/1 3/3/3 4/4/4\n"
|
||||
"f 1/1/1 4/4/4 5/5/5\n"
|
||||
"f 1/1/1 5/5/5 2/2/2\n"
|
||||
"f 5/5/5 4/4/4 3/3/3 2/2/2\n"
|
||||
"t crease 2/1/0 1 2 2.5\n"
|
||||
"t crease 2/1/0 2 3 2.5\n"
|
||||
"t crease 2/1/0 3 4 2.5\n"
|
||||
"t crease 2/1/0 4 1 2.5\n"
|
||||
"t corner 1/1/0 0 3.5\n"
|
||||
"t corner 1/1/0 1 2.5\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
139
regression/shapes/catmark_tent.h
Normal file
139
regression/shapes/catmark_tent.h
Normal file
@ -0,0 +1,139 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_tent =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.697056 0.000000\n"
|
||||
"v 0.565686 -1.131370 0.000000\n"
|
||||
"v 1.131371 -0.565686 0.800000\n"
|
||||
"v 1.697056 0.000000 0.000000\n"
|
||||
"v -0.565686 -1.131370 0.000000\n"
|
||||
"v 0.000000 -0.565686 0.000000\n"
|
||||
"v 0.565686 0.000000 0.800000\n"
|
||||
"v 1.131370 0.565686 0.000000\n"
|
||||
"v -1.131371 -0.565686 0.000000\n"
|
||||
"v -0.565686 0.000000 0.000000\n"
|
||||
"v 0.000000 0.565686 0.000000\n"
|
||||
"v 0.565686 1.131371 0.000000\n"
|
||||
"v -1.697056 0.000000 0.000000\n"
|
||||
"v -1.131370 0.565686 0.000000\n"
|
||||
"v -0.565686 1.131371 0.000000\n"
|
||||
"v 0.000000 1.697056 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.333333 0.000000\n"
|
||||
"vt 0.333333 0.333333\n"
|
||||
"vt 0.000000 0.333333\n"
|
||||
"vt 0.666667 0.000000\n"
|
||||
"vt 0.666667 0.333333\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 0.333333\n"
|
||||
"vt 0.333333 0.666667\n"
|
||||
"vt 0.000000 0.666667\n"
|
||||
"vt 0.666667 0.666667\n"
|
||||
"vt 1.000000 0.666667\n"
|
||||
"vt 0.333333 1.000000\n"
|
||||
"vt 0.000000 1.000000\n"
|
||||
"vt 0.666667 1.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.500000 0.500000 0.707107\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"f 1/1/1 2/2/2 6/3/3 5/4/4\n"
|
||||
"f 2/2/5 3/5/6 7/6/7 6/3/8\n"
|
||||
"f 3/5/9 4/7/10 8/8/11 7/6/12\n"
|
||||
"f 5/4/13 6/3/14 10/9/15 9/10/16\n"
|
||||
"f 6/3/17 7/6/18 11/11/19 10/9/20\n"
|
||||
"f 7/6/21 8/8/22 12/12/23 11/11/24\n"
|
||||
"f 9/10/25 10/9/26 14/13/27 13/14/28\n"
|
||||
"f 10/9/29 11/11/30 15/15/31 14/13/32\n"
|
||||
"f 11/11/33 12/12/34 16/16/35 15/15/36\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
141
regression/shapes/catmark_tent_creases0.h
Normal file
141
regression/shapes/catmark_tent_creases0.h
Normal file
@ -0,0 +1,141 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_tent_creases0 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.697056 0.000000\n"
|
||||
"v 0.565686 -1.131370 0.000000\n"
|
||||
"v 1.131371 -0.565686 0.800000\n"
|
||||
"v 1.697056 0.000000 0.000000\n"
|
||||
"v -0.565686 -1.131370 0.000000\n"
|
||||
"v 0.000000 -0.565686 0.000000\n"
|
||||
"v 0.565686 0.000000 0.800000\n"
|
||||
"v 1.131370 0.565686 0.000000\n"
|
||||
"v -1.131371 -0.565686 0.000000\n"
|
||||
"v -0.565686 0.000000 0.000000\n"
|
||||
"v 0.000000 0.565686 0.000000\n"
|
||||
"v 0.565686 1.131371 0.000000\n"
|
||||
"v -1.697056 0.000000 0.000000\n"
|
||||
"v -1.131370 0.565686 0.000000\n"
|
||||
"v -0.565686 1.131371 0.000000\n"
|
||||
"v 0.000000 1.697056 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.333333 0.000000\n"
|
||||
"vt 0.333333 0.333333\n"
|
||||
"vt 0.000000 0.333333\n"
|
||||
"vt 0.666667 0.000000\n"
|
||||
"vt 0.666667 0.333333\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 0.333333\n"
|
||||
"vt 0.333333 0.666667\n"
|
||||
"vt 0.000000 0.666667\n"
|
||||
"vt 0.666667 0.666667\n"
|
||||
"vt 1.000000 0.666667\n"
|
||||
"vt 0.333333 1.000000\n"
|
||||
"vt 0.000000 1.000000\n"
|
||||
"vt 0.666667 1.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.500000 0.500000 0.707107\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"f 1/1/1 2/2/2 6/3/3 5/4/4\n"
|
||||
"f 2/2/5 3/5/6 7/6/7 6/3/8\n"
|
||||
"f 3/5/9 4/7/10 8/8/11 7/6/12\n"
|
||||
"f 5/4/13 6/3/14 10/9/15 9/10/16\n"
|
||||
"f 6/3/17 7/6/18 11/11/19 10/9/20\n"
|
||||
"f 7/6/21 8/8/22 12/12/23 11/11/24\n"
|
||||
"f 9/10/25 10/9/26 14/13/27 13/14/28\n"
|
||||
"f 10/9/29 11/11/30 15/15/31 14/13/32\n"
|
||||
"f 11/11/33 12/12/34 16/16/35 15/15/36\n"
|
||||
"t crease 2/1/0 2 6 2.0\n"
|
||||
"t crease 2/1/0 6 10 2.0\n"
|
||||
"t interpolateboundary 1/0/0 1\n"
|
||||
"\n"
|
||||
;
|
142
regression/shapes/catmark_tent_creases1.h
Normal file
142
regression/shapes/catmark_tent_creases1.h
Normal file
@ -0,0 +1,142 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * catmark_tent_creases1 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 -1.697056 0.000000\n"
|
||||
"v 0.565686 -1.131370 0.000000\n"
|
||||
"v 1.131371 -0.565686 0.800000\n"
|
||||
"v 1.697056 0.000000 0.000000\n"
|
||||
"v -0.565686 -1.131370 0.000000\n"
|
||||
"v 0.000000 -0.565686 0.000000\n"
|
||||
"v 0.565686 0.000000 0.800000\n"
|
||||
"v 1.131370 0.565686 0.000000\n"
|
||||
"v -1.131371 -0.565686 0.000000\n"
|
||||
"v -0.565686 0.000000 0.000000\n"
|
||||
"v 0.000000 0.565686 0.000000\n"
|
||||
"v 0.565686 1.131371 0.000000\n"
|
||||
"v -1.697056 0.000000 0.000000\n"
|
||||
"v -1.131370 0.565686 0.000000\n"
|
||||
"v -0.565686 1.131371 0.000000\n"
|
||||
"v 0.000000 1.697056 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 0.333333 0.000000\n"
|
||||
"vt 0.333333 0.333333\n"
|
||||
"vt 0.000000 0.333333\n"
|
||||
"vt 0.666667 0.000000\n"
|
||||
"vt 0.666667 0.333333\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 0.333333\n"
|
||||
"vt 0.333333 0.666667\n"
|
||||
"vt 0.000000 0.666667\n"
|
||||
"vt 0.666667 0.666667\n"
|
||||
"vt 1.000000 0.666667\n"
|
||||
"vt 0.333333 1.000000\n"
|
||||
"vt 0.000000 1.000000\n"
|
||||
"vt 0.666667 1.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.270598 -0.270598 0.923880\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.500000 0.500000 0.707107\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.289735 -0.134467 0.947614\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.183013 0.183013 0.965926\n"
|
||||
"vn 0.258819 0.557678 0.788675\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.149576 0.000000 0.988750\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.155051 0.155051 0.975663\n"
|
||||
"vn 0.000000 0.302905 0.953021\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"f 1/1/1 2/2/2 6/3/3 5/4/4\n"
|
||||
"f 2/2/5 3/5/6 7/6/7 6/3/8\n"
|
||||
"f 3/5/9 4/7/10 8/8/11 7/6/12\n"
|
||||
"f 5/4/13 6/3/14 10/9/15 9/10/16\n"
|
||||
"f 6/3/17 7/6/18 11/11/19 10/9/20\n"
|
||||
"f 7/6/21 8/8/22 12/12/23 11/11/24\n"
|
||||
"f 9/10/25 10/9/26 14/13/27 13/14/28\n"
|
||||
"f 10/9/29 11/11/30 15/15/31 14/13/32\n"
|
||||
"f 11/11/33 12/12/34 16/16/35 15/15/36\n"
|
||||
"t crease 2/1/0 2 6 2.0\n"
|
||||
"t crease 2/1/0 6 10 2.0\n"
|
||||
"t corner 1/1/0 6 3.0\n"
|
||||
"t interpolateboundary 1/0/0 1\n"
|
||||
"\n"
|
||||
;
|
132
regression/shapes/loop_cube.h
Normal file
132
regression/shapes/loop_cube.h
Normal file
@ -0,0 +1,132 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_cube =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 1.414214 -0.000000 1.000000\n"
|
||||
"v -0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 -0.000000 -1.000000\n"
|
||||
"v -0.000000 -1.414214 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 3/3/4 2/2/5 4/4/6\n"
|
||||
"f 3/3/7 4/4/8 5/5/9\n"
|
||||
"f 5/5/10 4/4/11 6/6/12\n"
|
||||
"f 5/5/13 6/6/14 7/7/15\n"
|
||||
"f 7/7/16 6/6/17 8/8/18\n"
|
||||
"f 7/7/19 8/8/20 1/9/21\n"
|
||||
"f 1/9/22 8/8/23 2/10/24\n"
|
||||
"f 2/2/25 8/11/26 4/4/27\n"
|
||||
"f 4/4/28 8/11/29 6/12/30\n"
|
||||
"f 7/13/31 1/1/32 5/14/33\n"
|
||||
"f 5/14/34 1/1/35 3/3/36\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
134
regression/shapes/loop_cube_creases0.h
Normal file
134
regression/shapes/loop_cube_creases0.h
Normal file
@ -0,0 +1,134 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_cube_creases0 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 1.414214 -0.000000 1.000000\n"
|
||||
"v -0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 -0.000000 -1.000000\n"
|
||||
"v -0.000000 -1.414214 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 3/3/4 2/2/5 4/4/6\n"
|
||||
"f 3/3/7 4/4/8 5/5/9\n"
|
||||
"f 5/5/10 4/4/11 6/6/12\n"
|
||||
"f 5/5/13 6/6/14 7/7/15\n"
|
||||
"f 7/7/16 6/6/17 8/8/18\n"
|
||||
"f 7/7/19 8/8/20 1/9/21\n"
|
||||
"f 1/9/22 8/8/23 2/10/24\n"
|
||||
"f 2/2/25 8/11/26 4/4/27\n"
|
||||
"f 4/4/28 8/11/29 6/12/30\n"
|
||||
"f 7/13/31 1/1/32 5/14/33\n"
|
||||
"f 5/14/34 1/1/35 3/3/36\n"
|
||||
"t crease 2/1/0 1 3 2.8\n"
|
||||
"t crease 2/1/0 3 2 2.8\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
144
regression/shapes/loop_cube_creases1.h
Normal file
144
regression/shapes/loop_cube_creases1.h
Normal file
@ -0,0 +1,144 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_cube_creases1 =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.000000 1.414214 1.000000\n"
|
||||
"v -1.414214 0.000000 1.000000\n"
|
||||
"v 1.414214 -0.000000 1.000000\n"
|
||||
"v -0.000000 -1.414214 1.000000\n"
|
||||
"v 1.414214 -0.000000 -1.000000\n"
|
||||
"v -0.000000 -1.414214 -1.000000\n"
|
||||
"v 0.000000 1.414214 -1.000000\n"
|
||||
"v -1.414214 0.000000 -1.000000\n"
|
||||
"vt 0.375000 0.000000\n"
|
||||
"vt 0.625000 0.000000\n"
|
||||
"vt 0.375000 0.250000\n"
|
||||
"vt 0.625000 0.250000\n"
|
||||
"vt 0.375000 0.500000\n"
|
||||
"vt 0.625000 0.500000\n"
|
||||
"vt 0.375000 0.750000\n"
|
||||
"vt 0.625000 0.750000\n"
|
||||
"vt 0.375000 1.000000\n"
|
||||
"vt 0.625000 1.000000\n"
|
||||
"vt 0.875000 0.000000\n"
|
||||
"vt 0.875000 0.250000\n"
|
||||
"vt 0.125000 0.000000\n"
|
||||
"vt 0.125000 0.250000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.000000 0.000000 -1.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn -0.707107 -0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"vn 0.707107 0.707107 0.000000\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 3/3/4 2/2/5 4/4/6\n"
|
||||
"f 3/3/7 4/4/8 5/5/9\n"
|
||||
"f 5/5/10 4/4/11 6/6/12\n"
|
||||
"f 5/5/13 6/6/14 7/7/15\n"
|
||||
"f 7/7/16 6/6/17 8/8/18\n"
|
||||
"f 7/7/19 8/8/20 1/9/21\n"
|
||||
"f 1/9/22 8/8/23 2/10/24\n"
|
||||
"f 2/2/25 8/11/26 4/4/27\n"
|
||||
"f 4/4/28 8/11/29 6/12/30\n"
|
||||
"f 7/13/31 1/1/32 5/14/33\n"
|
||||
"f 5/14/34 1/1/35 3/3/36\n"
|
||||
"t crease 2/1/0 1 3 5.0\n"
|
||||
"t crease 2/1/0 3 2 5.0\n"
|
||||
"t crease 2/1/0 2 0 5.0\n"
|
||||
"t crease 2/1/0 0 1 5.0\n"
|
||||
"t crease 2/1/0 7 5 5.0\n"
|
||||
"t crease 2/1/0 5 4 5.0\n"
|
||||
"t crease 2/1/0 4 6 5.0\n"
|
||||
"t crease 2/1/0 6 7 5.0\n"
|
||||
"t crease 2/1/0 2 4 0.2\n"
|
||||
"t crease 2/1/0 0 6 5.0\n"
|
||||
"t crease 2/1/0 1 7 5.0\n"
|
||||
"t crease 2/1/0 3 5 5.0\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
128
regression/shapes/loop_icosahedron.h
Normal file
128
regression/shapes/loop_icosahedron.h
Normal file
@ -0,0 +1,128 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_icosahedron =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"v 0.850651 0.000000 -0.525731\n"
|
||||
"v 0.850651 -0.000000 0.525731\n"
|
||||
"v -0.850651 -0.000000 0.525731\n"
|
||||
"v -0.850651 0.000000 -0.525731\n"
|
||||
"v 0.000000 -0.525731 0.850651\n"
|
||||
"v 0.000000 0.525731 0.850651\n"
|
||||
"v 0.000000 0.525731 -0.850651\n"
|
||||
"v 0.000000 -0.525731 -0.850651\n"
|
||||
"v -0.525731 -0.850651 -0.000000\n"
|
||||
"v 0.525731 -0.850651 -0.000000\n"
|
||||
"v 0.525731 0.850651 0.000000\n"
|
||||
"v -0.525731 0.850651 0.000000\n"
|
||||
"vt 0.181818 0.250000\n"
|
||||
"vt 0.363636 0.250000\n"
|
||||
"vt 0.545455 0.250000\n"
|
||||
"vt 0.727273 0.250000\n"
|
||||
"vt 0.909091 0.250000\n"
|
||||
"vt 0.090909 0.416667\n"
|
||||
"vt 0.272727 0.416667\n"
|
||||
"vt 0.454545 0.416667\n"
|
||||
"vt 0.636364 0.416667\n"
|
||||
"vt 0.818182 0.416667\n"
|
||||
"vt 1.000000 0.416667\n"
|
||||
"vt 0.000000 0.583333\n"
|
||||
"vt 0.181818 0.583333\n"
|
||||
"vt 0.363636 0.583333\n"
|
||||
"vt 0.545455 0.583333\n"
|
||||
"vt 0.727273 0.583333\n"
|
||||
"vt 0.909091 0.583333\n"
|
||||
"vt 0.090909 0.750000\n"
|
||||
"vt 0.272727 0.750000\n"
|
||||
"vt 0.454545 0.750000\n"
|
||||
"vt 0.636364 0.750000\n"
|
||||
"vt 0.818182 0.750000\n"
|
||||
"vn 0.850651 -0.000000 0.525731\n"
|
||||
"vn 0.525731 -0.850651 -0.000000\n"
|
||||
"vn 0.850651 0.000000 -0.525731\n"
|
||||
"vn 0.525731 0.850651 0.000000\n"
|
||||
"vn -0.000000 -0.525731 -0.850651\n"
|
||||
"vn 0.000000 0.525731 -0.850651\n"
|
||||
"vn -0.000000 -0.525731 0.850651\n"
|
||||
"vn -0.000000 0.525731 0.850651\n"
|
||||
"vn -0.850651 0.000000 -0.525731\n"
|
||||
"vn -0.525731 -0.850651 0.000000\n"
|
||||
"vn -0.850651 0.000000 0.525731\n"
|
||||
"vn -0.525731 0.850651 0.000000\n"
|
||||
"f 2/17/1 10/22/2 1/16/3\n"
|
||||
"f 1/16/3 11/10/4 2/17/1\n"
|
||||
"f 1/16/3 8/15/5 7/9/6\n"
|
||||
"f 1/16/3 7/9/6 11/10/4\n"
|
||||
"f 1/16/3 10/21/2 8/15/5\n"
|
||||
"f 5/13/7 2/12/1 6/6/8\n"
|
||||
"f 10/18/2 2/12/1 5/13/7\n"
|
||||
"f 2/17/1 11/10/4 6/11/8\n"
|
||||
"f 4/8/9 9/14/10 3/7/11\n"
|
||||
"f 3/7/11 12/2/12 4/8/9\n"
|
||||
"f 5/13/7 6/6/8 3/7/11\n"
|
||||
"f 3/7/11 9/14/10 5/13/7\n"
|
||||
"f 6/6/8 12/1/12 3/7/11\n"
|
||||
"f 7/9/6 8/15/5 4/8/9\n"
|
||||
"f 4/8/9 12/3/12 7/9/6\n"
|
||||
"f 4/8/9 8/15/5 9/14/10\n"
|
||||
"f 5/13/7 9/14/10 10/19/2\n"
|
||||
"f 6/11/8 11/10/4 12/5/12\n"
|
||||
"f 7/9/6 12/4/12 11/10/4\n"
|
||||
"f 8/15/5 10/20/2 9/14/10\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
101
regression/shapes/loop_saddle_edgecorner.h
Normal file
101
regression/shapes/loop_saddle_edgecorner.h
Normal file
@ -0,0 +1,101 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_saddle_edgecorner =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"mtllib saddle.mtl\n"
|
||||
"g default\n"
|
||||
"v -0.707107 0.007107 0.000000\n"
|
||||
"v 0.000000 -0.700000 0.000000\n"
|
||||
"v 0.707107 0.007107 0.000000\n"
|
||||
"v -0.000000 0.714214 0.000000\n"
|
||||
"v 1.414214 0.714214 1.000000\n"
|
||||
"v -1.414214 -0.700000 -1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.500000 0.500000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.500000 0.500000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"s off\n"
|
||||
"g polySurface15\n"
|
||||
"usemtl initialShadingGroup\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 1/4/4 3/5/5 4/6/6\n"
|
||||
"f 4/7/7 3/8/8 5/9/9\n"
|
||||
"f 6/10/10 2/11/11 1/12/12\n"
|
||||
"t interpolateboundary 1/0/0 1\n"
|
||||
"\n"
|
||||
;
|
101
regression/shapes/loop_saddle_edgeonly.h
Normal file
101
regression/shapes/loop_saddle_edgeonly.h
Normal file
@ -0,0 +1,101 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_saddle_edgeonly =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"mtllib saddle.mtl\n"
|
||||
"g default\n"
|
||||
"v -0.707107 0.007107 0.000000\n"
|
||||
"v 0.000000 -0.700000 0.000000\n"
|
||||
"v 0.707107 0.007107 0.000000\n"
|
||||
"v -0.000000 0.714214 0.000000\n"
|
||||
"v 1.414214 0.714214 1.000000\n"
|
||||
"v -1.414214 -0.700000 -1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.500000 0.500000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 1.000000 1.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.500000 0.500000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"vn -0.500000 -0.500000 0.707107\n"
|
||||
"s off\n"
|
||||
"g polySurface15\n"
|
||||
"usemtl initialShadingGroup\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"f 1/4/4 3/5/5 4/6/6\n"
|
||||
"f 4/7/7 3/8/8 5/9/9\n"
|
||||
"f 6/10/10 2/11/11 1/12/12\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
77
regression/shapes/loop_triangle_edgecorner.h
Normal file
77
regression/shapes/loop_triangle_edgecorner.h
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_triangle_edgecorner =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"mtllib triangle.mtl\n"
|
||||
"g default\n"
|
||||
"v 0.000000 1.500000 0.000000\n"
|
||||
"v -2.000000 -1.500000 0.000000\n"
|
||||
"v 2.000000 -1.500000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.384615 0.923077\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"s off\n"
|
||||
"g polySurface1\n"
|
||||
"usemtl initialShadingGroup\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"t interpolateboundary 1/0/0 1\n"
|
||||
"\n"
|
||||
;
|
77
regression/shapes/loop_triangle_edgeonly.h
Normal file
77
regression/shapes/loop_triangle_edgeonly.h
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
static char const * loop_triangle_edgeonly =
|
||||
"# This file uses centimeters as units for non-parametric coordinates.\n"
|
||||
"\n"
|
||||
"mtllib triangle.mtl\n"
|
||||
"g default\n"
|
||||
"v 0.000000 1.500000 0.000000\n"
|
||||
"v -2.000000 -1.500000 0.000000\n"
|
||||
"v 2.000000 -1.500000 0.000000\n"
|
||||
"vt 0.000000 0.000000\n"
|
||||
"vt 1.000000 0.000000\n"
|
||||
"vt 0.384615 0.923077\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"vn 0.000000 0.000000 1.000000\n"
|
||||
"s off\n"
|
||||
"g polySurface1\n"
|
||||
"usemtl initialShadingGroup\n"
|
||||
"f 1/1/1 2/2/2 3/3/3\n"
|
||||
"t interpolateboundary 1/0/0 2\n"
|
||||
"\n"
|
||||
;
|
Loading…
Reference in New Issue
Block a user