fix: some file didn't have the svn:eol-style native yet
This commit is contained in:
@@ -1,80 +1,80 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BulletMayaPlugin", "BulletMayaPlugin.vcproj", "{681412B0-F197-4A2F-9263-DEA2E8690146}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF} = {A0958CD9-0E39-4A77-3711-9B488F508FBF}
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A} = {7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319} = {61BD1097-CF2E-B296-DAA9-73A6FE135319}
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142} = {B1B5F775-54A9-2437-E4AC-7E817E492142}
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE} = {6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletcollision", "..\..\msvc\8\libbulletcollision.vcproj", "{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletdynamics", "..\..\msvc\8\libbulletdynamics.vcproj", "{61BD1097-CF2E-B296-DAA9-73A6FE135319}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletmath", "..\..\msvc\8\libbulletmath.vcproj", "{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGIMPACTUtils", "..\..\msvc\8\libGIMPACTUtils.vcproj", "{B1B5F775-54A9-2437-E4AC-7E817E492142}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblibxml", "..\..\msvc\8\liblibxml.vcproj", "{A0958CD9-0E39-4A77-3711-9B488F508FBF}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugDll|Win32 = DebugDll|Win32
|
||||
ReleaseDll|Win32 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BulletMayaPlugin", "BulletMayaPlugin.vcproj", "{681412B0-F197-4A2F-9263-DEA2E8690146}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF} = {A0958CD9-0E39-4A77-3711-9B488F508FBF}
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A} = {7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319} = {61BD1097-CF2E-B296-DAA9-73A6FE135319}
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142} = {B1B5F775-54A9-2437-E4AC-7E817E492142}
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE} = {6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletcollision", "..\..\msvc\8\libbulletcollision.vcproj", "{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletdynamics", "..\..\msvc\8\libbulletdynamics.vcproj", "{61BD1097-CF2E-B296-DAA9-73A6FE135319}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletmath", "..\..\msvc\8\libbulletmath.vcproj", "{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGIMPACTUtils", "..\..\msvc\8\libGIMPACTUtils.vcproj", "{B1B5F775-54A9-2437-E4AC-7E817E492142}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblibxml", "..\..\msvc\8\liblibxml.vcproj", "{A0958CD9-0E39-4A77-3711-9B488F508FBF}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugDll|Win32 = DebugDll|Win32
|
||||
ReleaseDll|Win32 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{681412B0-F197-4A2F-9263-DEA2E8690146}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{61BD1097-CF2E-B296-DAA9-73A6FE135319}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{B1B5F775-54A9-2437-E4AC-7E817E492142}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{A0958CD9-0E39-4A77-3711-9B488F508FBF}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,96 +1,96 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
#PROJECT(MayaPlugin)
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
|
||||
IF ( UNIX AND NOT APPLE )
|
||||
ADD_DEFINITIONS(-DLINUX)
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_WARNING_LEVEL 4)
|
||||
|
||||
#SET (CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
/usr/autodesk/maya2009-x64
|
||||
/usr/autodesk/maya2008-x64
|
||||
/usr/autodesk/maya
|
||||
"C:/Program Files/Autodesk/Maya2008"
|
||||
"C:/Program Files/Autodesk/Maya2009"
|
||||
"C:/Program Files/Autodesk/Maya8.5"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2010"
|
||||
)
|
||||
|
||||
IF (MAYA_BASE_DIR)
|
||||
message ("Maya found at location " ${MAYA_BASE_DIR})
|
||||
|
||||
SET(MAYA_INC_DIR ${MAYA_BASE_DIR}/include)
|
||||
SET(MAYA_LIB_DIR ${MAYA_BASE_DIR}/lib)
|
||||
|
||||
INCLUDE_DIRECTORIES(${MAYA_INC_DIR} ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/MayaPlugin )
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
|
||||
ADD_DEFINITIONS(-D_BOOL)
|
||||
ADD_DEFINITIONS(-DREQUIRE_IOSTREAM)
|
||||
|
||||
SET(TARGET_H
|
||||
box_shape.h bt_sphere_shape.h dSolverNode.h rigid_body_impl.h
|
||||
box_shape_impl.h collision_shape.h mathUtils.h rigidBodyNode.h
|
||||
bt_box_shape.h collision_shape_impl.h mayaUtils.h solver.h
|
||||
bt_collision_shape.h collisionShapeNode.h mesh_shape.h solver_impl.h
|
||||
bt_convex_hull_shape.h convex_hull_shape.h mesh_shape_impl.h sphere_shape.h
|
||||
bt_mesh_shape.h convex_hull_shape_impl.h plane_shape.h sphere_shape_impl.h
|
||||
bt_plane_shape.h dRigidBodyArrayCmd.h plane_shape_impl.h
|
||||
bt_rigid_body.h dRigidBodyCmd.h rigidBodyArrayNode.h
|
||||
bt_solver.h dSolverCmd.h rigid_body.h pdbIO.h
|
||||
shared_ptr.h drawUtils.h
|
||||
)
|
||||
|
||||
SET(TARGET_SRC
|
||||
pluginMain.cpp bulletExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp
|
||||
solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp
|
||||
pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp
|
||||
constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp
|
||||
constraint/dsixdofConstraintCmd.cpp constraint/nailConstraintNode.cpp constraint/sliderConstraintNode.cpp
|
||||
)
|
||||
|
||||
ADD_LIBRARY(BulletMayaPlugin SHARED ${TARGET_H} ${TARGET_SRC})
|
||||
|
||||
|
||||
|
||||
IF (WIN32)
|
||||
SET(MAYA_LIBS OpenMaya Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
|
||||
IF (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X64")
|
||||
ELSE (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X86")
|
||||
ENDIF (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES SUFFIX ".mll")
|
||||
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "/export:initializePlugin /export:uninitializePlugin")
|
||||
ELSE (WIN32)
|
||||
SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
ENDIF(WIN32)
|
||||
|
||||
#OPTION(BUILD_STANDALONE "Build a standalone exporter program")
|
||||
#
|
||||
#IF (BUILD_STANDALONE)
|
||||
# IF (WIN32)
|
||||
#
|
||||
# ELSE (WIN32)
|
||||
# SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim)
|
||||
# ADD_EXECUTABLE(me ${TARGET_H} ${TARGET_SRC} standalone.cpp)
|
||||
# LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
# TARGET_LINK_LIBRARIES(me ${MAYA_LIBS} pthread m imf)
|
||||
# ENDIF (WIN32)
|
||||
#ENDIF (BUILD_STANDALONE)
|
||||
|
||||
ELSE()
|
||||
MESSAGE("Maya not found, try adding your Maya path in Bullet/Extras/MayaPlugin/CMakeListst.txt under FIND_PATH(MAYA_BASE_DIR ...")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
#PROJECT(MayaPlugin)
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
|
||||
IF ( UNIX AND NOT APPLE )
|
||||
ADD_DEFINITIONS(-DLINUX)
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_WARNING_LEVEL 4)
|
||||
|
||||
#SET (CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
/usr/autodesk/maya2009-x64
|
||||
/usr/autodesk/maya2008-x64
|
||||
/usr/autodesk/maya
|
||||
"C:/Program Files/Autodesk/Maya2008"
|
||||
"C:/Program Files/Autodesk/Maya2009"
|
||||
"C:/Program Files/Autodesk/Maya8.5"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2010"
|
||||
)
|
||||
|
||||
IF (MAYA_BASE_DIR)
|
||||
message ("Maya found at location " ${MAYA_BASE_DIR})
|
||||
|
||||
SET(MAYA_INC_DIR ${MAYA_BASE_DIR}/include)
|
||||
SET(MAYA_LIB_DIR ${MAYA_BASE_DIR}/lib)
|
||||
|
||||
INCLUDE_DIRECTORIES(${MAYA_INC_DIR} ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/MayaPlugin )
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
|
||||
ADD_DEFINITIONS(-D_BOOL)
|
||||
ADD_DEFINITIONS(-DREQUIRE_IOSTREAM)
|
||||
|
||||
SET(TARGET_H
|
||||
box_shape.h bt_sphere_shape.h dSolverNode.h rigid_body_impl.h
|
||||
box_shape_impl.h collision_shape.h mathUtils.h rigidBodyNode.h
|
||||
bt_box_shape.h collision_shape_impl.h mayaUtils.h solver.h
|
||||
bt_collision_shape.h collisionShapeNode.h mesh_shape.h solver_impl.h
|
||||
bt_convex_hull_shape.h convex_hull_shape.h mesh_shape_impl.h sphere_shape.h
|
||||
bt_mesh_shape.h convex_hull_shape_impl.h plane_shape.h sphere_shape_impl.h
|
||||
bt_plane_shape.h dRigidBodyArrayCmd.h plane_shape_impl.h
|
||||
bt_rigid_body.h dRigidBodyCmd.h rigidBodyArrayNode.h
|
||||
bt_solver.h dSolverCmd.h rigid_body.h pdbIO.h
|
||||
shared_ptr.h drawUtils.h
|
||||
)
|
||||
|
||||
SET(TARGET_SRC
|
||||
pluginMain.cpp bulletExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp
|
||||
solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp
|
||||
pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp
|
||||
constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp
|
||||
constraint/dsixdofConstraintCmd.cpp constraint/nailConstraintNode.cpp constraint/sliderConstraintNode.cpp
|
||||
)
|
||||
|
||||
ADD_LIBRARY(BulletMayaPlugin SHARED ${TARGET_H} ${TARGET_SRC})
|
||||
|
||||
|
||||
|
||||
IF (WIN32)
|
||||
SET(MAYA_LIBS OpenMaya Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
|
||||
IF (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X64")
|
||||
ELSE (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X86")
|
||||
ENDIF (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES SUFFIX ".mll")
|
||||
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "/export:initializePlugin /export:uninitializePlugin")
|
||||
ELSE (WIN32)
|
||||
SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
|
||||
LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
ENDIF(WIN32)
|
||||
|
||||
#OPTION(BUILD_STANDALONE "Build a standalone exporter program")
|
||||
#
|
||||
#IF (BUILD_STANDALONE)
|
||||
# IF (WIN32)
|
||||
#
|
||||
# ELSE (WIN32)
|
||||
# SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim)
|
||||
# ADD_EXECUTABLE(me ${TARGET_H} ${TARGET_SRC} standalone.cpp)
|
||||
# LINK_DIRECTORIES(${MAYA_LIB_DIR})
|
||||
# TARGET_LINK_LIBRARIES(me ${MAYA_LIBS} pthread m imf)
|
||||
# ENDIF (WIN32)
|
||||
#ENDIF (BUILD_STANDALONE)
|
||||
|
||||
ELSE()
|
||||
MESSAGE("Maya not found, try adding your Maya path in Bullet/Extras/MayaPlugin/CMakeListst.txt under FIND_PATH(MAYA_BASE_DIR ...")
|
||||
ENDIF()
|
||||
@@ -1,81 +1,81 @@
|
||||
; example1.nsi
|
||||
;
|
||||
; This script is perhaps one of the simplest NSIs you can make. All of the
|
||||
; optional settings are left to their default settings. The installer simply
|
||||
; prompts the user asking them where to install, and drops a copy of "MyProg.exe"
|
||||
; there.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Dynamica Bullet 2.76 physics plugin for Maya 2009"
|
||||
|
||||
; The file to write
|
||||
OutFile "DynamicaForMaya2009_64bit.exe"
|
||||
|
||||
|
||||
; The default installation directory
|
||||
InstallDir $PROGRAMFILES\DynamicaBullet2.76\
|
||||
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
; The text to prompt the user to enter a directory
|
||||
DirText "This will install Dynamica Bullet For Maya. Choose destination directory"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "" ;No components page, name is not important
|
||||
;Create Dynamica directories
|
||||
;CreateDirectory "$INSTDIR\dll"
|
||||
CreateDirectory "$INSTDIR\doc"
|
||||
CreateDirectory "$INSTDIR\scenes\"
|
||||
CreateDirectory "$INSTDIR\icons"
|
||||
CreateDirectory "$INSTDIR\plug-ins"
|
||||
CreateDirectory "$INSTDIR\scripts"
|
||||
|
||||
;SetOutPath "$INSTDIR\dll"
|
||||
;File "dll\*.dll"
|
||||
SetOutPath "$INSTDIR\doc"
|
||||
File "doc\*.*"
|
||||
SetOutPath "$INSTDIR\scenes"
|
||||
File "scenes\*.*"
|
||||
SetOutPath "$INSTDIR\icons"
|
||||
File "icons\*.*"
|
||||
SetOutPath "$INSTDIR\plug-ins"
|
||||
File "BulletMayaPlugin.mll"
|
||||
;File "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\msvcp80.dll"
|
||||
;File "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\msvcr80.dll"
|
||||
|
||||
File "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcp90.dll"
|
||||
File "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcr90.dll"
|
||||
|
||||
SetOutPath "$INSTDIR\scripts"
|
||||
File "scripts\*.*"
|
||||
SetOutPath "$DOCUMENTS\maya\modules\"
|
||||
File "BulletDynamica.6_module"
|
||||
|
||||
FileOpen $0 $DOCUMENTS\maya\modules\BulletDynamica.6_module a
|
||||
FileSeek $0 0 END
|
||||
FileWrite $0 "$INSTDIR$\n"
|
||||
FileClose $0
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\Dynamica Bullet"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Documentation.lnk" "$INSTDIR\doc\index.html"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Examples.lnk" "$INSTDIR\scenes\"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
ExecShell "open" "$INSTDIR\doc\index.html"
|
||||
|
||||
WriteUninstaller $INSTDIR\Uninstall.exe
|
||||
SectionEnd ; end the section
|
||||
|
||||
Section "Uninstall"
|
||||
ClearErrors
|
||||
MessageBox MB_YESNO "Uninstall Bullet for MAYA?" IDNO end
|
||||
|
||||
Delete "$DOCUMENTS\maya\modules\DynamicaBullet.6_module"
|
||||
RMDir /r "$SMPROGRAMS\Dynamica Bullet\"
|
||||
RMDir /r "$INSTDIR"
|
||||
end:
|
||||
; example1.nsi
|
||||
;
|
||||
; This script is perhaps one of the simplest NSIs you can make. All of the
|
||||
; optional settings are left to their default settings. The installer simply
|
||||
; prompts the user asking them where to install, and drops a copy of "MyProg.exe"
|
||||
; there.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Dynamica Bullet 2.76 physics plugin for Maya 2009"
|
||||
|
||||
; The file to write
|
||||
OutFile "DynamicaForMaya2009_64bit.exe"
|
||||
|
||||
|
||||
; The default installation directory
|
||||
InstallDir $PROGRAMFILES\DynamicaBullet2.76\
|
||||
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
; The text to prompt the user to enter a directory
|
||||
DirText "This will install Dynamica Bullet For Maya. Choose destination directory"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "" ;No components page, name is not important
|
||||
;Create Dynamica directories
|
||||
;CreateDirectory "$INSTDIR\dll"
|
||||
CreateDirectory "$INSTDIR\doc"
|
||||
CreateDirectory "$INSTDIR\scenes\"
|
||||
CreateDirectory "$INSTDIR\icons"
|
||||
CreateDirectory "$INSTDIR\plug-ins"
|
||||
CreateDirectory "$INSTDIR\scripts"
|
||||
|
||||
;SetOutPath "$INSTDIR\dll"
|
||||
;File "dll\*.dll"
|
||||
SetOutPath "$INSTDIR\doc"
|
||||
File "doc\*.*"
|
||||
SetOutPath "$INSTDIR\scenes"
|
||||
File "scenes\*.*"
|
||||
SetOutPath "$INSTDIR\icons"
|
||||
File "icons\*.*"
|
||||
SetOutPath "$INSTDIR\plug-ins"
|
||||
File "BulletMayaPlugin.mll"
|
||||
;File "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\msvcp80.dll"
|
||||
;File "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\msvcr80.dll"
|
||||
|
||||
File "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcp90.dll"
|
||||
File "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcr90.dll"
|
||||
|
||||
SetOutPath "$INSTDIR\scripts"
|
||||
File "scripts\*.*"
|
||||
SetOutPath "$DOCUMENTS\maya\modules\"
|
||||
File "BulletDynamica.6_module"
|
||||
|
||||
FileOpen $0 $DOCUMENTS\maya\modules\BulletDynamica.6_module a
|
||||
FileSeek $0 0 END
|
||||
FileWrite $0 "$INSTDIR$\n"
|
||||
FileClose $0
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\Dynamica Bullet"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Documentation.lnk" "$INSTDIR\doc\index.html"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Examples.lnk" "$INSTDIR\scenes\"
|
||||
CreateShortCut "$SMPROGRAMS\Dynamica Bullet\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
ExecShell "open" "$INSTDIR\doc\index.html"
|
||||
|
||||
WriteUninstaller $INSTDIR\Uninstall.exe
|
||||
SectionEnd ; end the section
|
||||
|
||||
Section "Uninstall"
|
||||
ClearErrors
|
||||
MessageBox MB_YESNO "Uninstall Bullet for MAYA?" IDNO end
|
||||
|
||||
Delete "$DOCUMENTS\maya\modules\DynamicaBullet.6_module"
|
||||
RMDir /r "$SMPROGRAMS\Dynamica Bullet\"
|
||||
RMDir /r "$INSTDIR"
|
||||
end:
|
||||
SectionEnd
|
||||
@@ -1,160 +1,160 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||
01/27/2010 : Replaced COLLADA export with Bullet binary export
|
||||
*/
|
||||
|
||||
#include "bulletExport.h"
|
||||
#include "solver.h"
|
||||
#include "solver_impl.h"
|
||||
|
||||
#if defined (_WIN32)
|
||||
#define strcasecmp stricmp
|
||||
#elif defined (OSMac_)
|
||||
extern "C" int strcasecmp (const char *, const char *);
|
||||
|
||||
#endif
|
||||
|
||||
#define NO_SMOOTHING_GROUP -1
|
||||
#define INITIALIZE_SMOOTHING -2
|
||||
#define INVALID_ID -1
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MString ObjTranslator::fExtension = "bullet";
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
void* ObjTranslator::creator()
|
||||
{
|
||||
return new ObjTranslator();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MStatus ObjTranslator::reader ( const MFileObject& file,
|
||||
const MString& options,
|
||||
FileAccessMode mode)
|
||||
{
|
||||
fprintf(stderr, "Bullet Physics import is not available yet\n");
|
||||
return MS::kFailure;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MStatus ObjTranslator::writer ( const MFileObject& file,
|
||||
const MString& options,
|
||||
FileAccessMode mode )
|
||||
|
||||
{
|
||||
MStatus status;
|
||||
|
||||
MString mname = file.fullName(), unitName;
|
||||
|
||||
//just pass in the filename
|
||||
|
||||
#if defined (OSMac_)
|
||||
char fname[256];//MAXPATHLEN];
|
||||
strcpy (fname, file.fullName().asChar());
|
||||
// fp = fopen(fname,"wb");//MAYAMACTODO
|
||||
#else
|
||||
const char *fname = mname.asChar();
|
||||
// fp = fopen(fname,"w");
|
||||
#endif
|
||||
|
||||
shared_ptr<solver_impl_t> solv = solver_t::get_solver();
|
||||
|
||||
solv->export_bullet_file(fname);
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
bool ObjTranslator::haveReadMethod () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
bool ObjTranslator::haveWriteMethod () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MString ObjTranslator::defaultExtension () const
|
||||
{
|
||||
// return MString("bullet");
|
||||
return fExtension;
|
||||
}
|
||||
|
||||
MString ObjTranslator::filter() const
|
||||
{
|
||||
//return "*.bullet;*.dae";
|
||||
return "*.bullet";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MPxFileTranslator::MFileKind ObjTranslator::identifyFile (
|
||||
const MFileObject& fileName,
|
||||
const char* buffer,
|
||||
short size) const
|
||||
{
|
||||
const char * name = fileName.name().asChar();
|
||||
int nameLength = strlen(name);
|
||||
|
||||
if ((nameLength > 7) && !strcasecmp(name+nameLength-7, ".bullet"))
|
||||
return kCouldBeMyFileType;
|
||||
else
|
||||
return kNotMyFileType;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
MStatus ObjTranslator::exportSelected( )
|
||||
{
|
||||
MStatus status;
|
||||
MString filename;
|
||||
|
||||
|
||||
// Create an iterator for the active selection list
|
||||
//
|
||||
MSelectionList slist;
|
||||
MGlobal::getActiveSelectionList( slist );
|
||||
MItSelectionList iter( slist );
|
||||
|
||||
if (iter.isDone()) {
|
||||
fprintf(stderr,"Error: Nothing is selected.\n");
|
||||
return MS::kFailure;
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MStatus ObjTranslator::exportAll( )
|
||||
{
|
||||
MStatus status = MS::kSuccess;
|
||||
|
||||
return status;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||
01/27/2010 : Replaced COLLADA export with Bullet binary export
|
||||
*/
|
||||
|
||||
#include "bulletExport.h"
|
||||
#include "solver.h"
|
||||
#include "solver_impl.h"
|
||||
|
||||
#if defined (_WIN32)
|
||||
#define strcasecmp stricmp
|
||||
#elif defined (OSMac_)
|
||||
extern "C" int strcasecmp (const char *, const char *);
|
||||
|
||||
#endif
|
||||
|
||||
#define NO_SMOOTHING_GROUP -1
|
||||
#define INITIALIZE_SMOOTHING -2
|
||||
#define INVALID_ID -1
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MString ObjTranslator::fExtension = "bullet";
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
void* ObjTranslator::creator()
|
||||
{
|
||||
return new ObjTranslator();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MStatus ObjTranslator::reader ( const MFileObject& file,
|
||||
const MString& options,
|
||||
FileAccessMode mode)
|
||||
{
|
||||
fprintf(stderr, "Bullet Physics import is not available yet\n");
|
||||
return MS::kFailure;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MStatus ObjTranslator::writer ( const MFileObject& file,
|
||||
const MString& options,
|
||||
FileAccessMode mode )
|
||||
|
||||
{
|
||||
MStatus status;
|
||||
|
||||
MString mname = file.fullName(), unitName;
|
||||
|
||||
//just pass in the filename
|
||||
|
||||
#if defined (OSMac_)
|
||||
char fname[256];//MAXPATHLEN];
|
||||
strcpy (fname, file.fullName().asChar());
|
||||
// fp = fopen(fname,"wb");//MAYAMACTODO
|
||||
#else
|
||||
const char *fname = mname.asChar();
|
||||
// fp = fopen(fname,"w");
|
||||
#endif
|
||||
|
||||
shared_ptr<solver_impl_t> solv = solver_t::get_solver();
|
||||
|
||||
solv->export_bullet_file(fname);
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
bool ObjTranslator::haveReadMethod () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
bool ObjTranslator::haveWriteMethod () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MString ObjTranslator::defaultExtension () const
|
||||
{
|
||||
// return MString("bullet");
|
||||
return fExtension;
|
||||
}
|
||||
|
||||
MString ObjTranslator::filter() const
|
||||
{
|
||||
//return "*.bullet;*.dae";
|
||||
return "*.bullet";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MPxFileTranslator::MFileKind ObjTranslator::identifyFile (
|
||||
const MFileObject& fileName,
|
||||
const char* buffer,
|
||||
short size) const
|
||||
{
|
||||
const char * name = fileName.name().asChar();
|
||||
int nameLength = strlen(name);
|
||||
|
||||
if ((nameLength > 7) && !strcasecmp(name+nameLength-7, ".bullet"))
|
||||
return kCouldBeMyFileType;
|
||||
else
|
||||
return kNotMyFileType;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
MStatus ObjTranslator::exportSelected( )
|
||||
{
|
||||
MStatus status;
|
||||
MString filename;
|
||||
|
||||
|
||||
// Create an iterator for the active selection list
|
||||
//
|
||||
MSelectionList slist;
|
||||
MGlobal::getActiveSelectionList( slist );
|
||||
MItSelectionList iter( slist );
|
||||
|
||||
if (iter.isDone()) {
|
||||
fprintf(stderr,"Error: Nothing is selected.\n");
|
||||
return MS::kFailure;
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
MStatus ObjTranslator::exportAll( )
|
||||
{
|
||||
MStatus status = MS::kSuccess;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||
01/27/2010 : Replaced COLLADA export with Bullet binary export
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BULLET_EXPORT_H
|
||||
#define BULLET_EXPORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <maya/MStatus.h>
|
||||
#include <maya/MPxCommand.h>
|
||||
#include <maya/MString.h>
|
||||
#include <maya/MStringArray.h>
|
||||
#include <maya/MArgList.h>
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
#include <maya/MItSelectionList.h>
|
||||
#include <maya/MPoint.h>
|
||||
#include <maya/MPointArray.h>
|
||||
#include <maya/MDagPath.h>
|
||||
#include <maya/MDagPathArray.h>
|
||||
//#include <maya/MFnPlugin.h>
|
||||
#include <maya/MFnMesh.h>
|
||||
#include <maya/MFnSet.h>
|
||||
#include <maya/MItMeshPolygon.h>
|
||||
#include <maya/MItMeshVertex.h>
|
||||
#include <maya/MItMeshEdge.h>
|
||||
#include <maya/MFloatVector.h>
|
||||
#include <maya/MFloatVectorArray.h>
|
||||
#include <maya/MFloatArray.h>
|
||||
#include <maya/MObjectArray.h>
|
||||
#include <maya/MObject.h>
|
||||
//#include <maya/MPlug.h>
|
||||
#include <maya/MPxFileTranslator.h>
|
||||
#include <maya/MFnDagNode.h>
|
||||
#include <maya/MItDag.h>
|
||||
#include <maya/MDistance.h>
|
||||
#include <maya/MIntArray.h>
|
||||
#include <maya/MIOStream.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
class ObjTranslator : public MPxFileTranslator {
|
||||
public:
|
||||
ObjTranslator () {};
|
||||
virtual ~ObjTranslator () {};
|
||||
static void* creator();
|
||||
|
||||
MStatus reader ( const MFileObject& file,
|
||||
const MString& optionsString,
|
||||
FileAccessMode mode);
|
||||
|
||||
MStatus writer ( const MFileObject& file,
|
||||
const MString& optionsString,
|
||||
FileAccessMode mode );
|
||||
bool haveReadMethod () const;
|
||||
bool haveWriteMethod () const;
|
||||
MString defaultExtension () const;
|
||||
|
||||
MString filter() const;
|
||||
|
||||
MFileKind identifyFile ( const MFileObject& fileName,
|
||||
const char* buffer,
|
||||
short size) const;
|
||||
protected:
|
||||
static MString fExtension;
|
||||
|
||||
private:
|
||||
MStatus exportSelected();
|
||||
MStatus exportAll();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //BULLET_EXPORT_H
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||
01/27/2010 : Replaced COLLADA export with Bullet binary export
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BULLET_EXPORT_H
|
||||
#define BULLET_EXPORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <maya/MStatus.h>
|
||||
#include <maya/MPxCommand.h>
|
||||
#include <maya/MString.h>
|
||||
#include <maya/MStringArray.h>
|
||||
#include <maya/MArgList.h>
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
#include <maya/MItSelectionList.h>
|
||||
#include <maya/MPoint.h>
|
||||
#include <maya/MPointArray.h>
|
||||
#include <maya/MDagPath.h>
|
||||
#include <maya/MDagPathArray.h>
|
||||
//#include <maya/MFnPlugin.h>
|
||||
#include <maya/MFnMesh.h>
|
||||
#include <maya/MFnSet.h>
|
||||
#include <maya/MItMeshPolygon.h>
|
||||
#include <maya/MItMeshVertex.h>
|
||||
#include <maya/MItMeshEdge.h>
|
||||
#include <maya/MFloatVector.h>
|
||||
#include <maya/MFloatVectorArray.h>
|
||||
#include <maya/MFloatArray.h>
|
||||
#include <maya/MObjectArray.h>
|
||||
#include <maya/MObject.h>
|
||||
//#include <maya/MPlug.h>
|
||||
#include <maya/MPxFileTranslator.h>
|
||||
#include <maya/MFnDagNode.h>
|
||||
#include <maya/MItDag.h>
|
||||
#include <maya/MDistance.h>
|
||||
#include <maya/MIntArray.h>
|
||||
#include <maya/MIOStream.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
class ObjTranslator : public MPxFileTranslator {
|
||||
public:
|
||||
ObjTranslator () {};
|
||||
virtual ~ObjTranslator () {};
|
||||
static void* creator();
|
||||
|
||||
MStatus reader ( const MFileObject& file,
|
||||
const MString& optionsString,
|
||||
FileAccessMode mode);
|
||||
|
||||
MStatus writer ( const MFileObject& file,
|
||||
const MString& optionsString,
|
||||
FileAccessMode mode );
|
||||
bool haveReadMethod () const;
|
||||
bool haveWriteMethod () const;
|
||||
MString defaultExtension () const;
|
||||
|
||||
MString filter() const;
|
||||
|
||||
MFileKind identifyFile ( const MFileObject& fileName,
|
||||
const char* buffer,
|
||||
short size) const;
|
||||
protected:
|
||||
static MString fExtension;
|
||||
|
||||
private:
|
||||
MStatus exportSelected();
|
||||
MStatus exportAll();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //BULLET_EXPORT_H
|
||||
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "hingeConstraintNode.h"
|
||||
#include "dHingeConstraintCmd.h"
|
||||
|
||||
|
||||
MString dHingeConstraintCmd::typeName("dHingeConstraint");
|
||||
|
||||
dHingeConstraintCmd::dHingeConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dHingeConstraintCmd::~dHingeConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dHingeConstraintCmd::creator()
|
||||
{
|
||||
return new dHingeConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dHingeConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dHingeConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(hingeConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "hingeConstraintNode.h"
|
||||
#include "dHingeConstraintCmd.h"
|
||||
|
||||
|
||||
MString dHingeConstraintCmd::typeName("dHingeConstraint");
|
||||
|
||||
dHingeConstraintCmd::dHingeConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dHingeConstraintCmd::~dHingeConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dHingeConstraintCmd::creator()
|
||||
{
|
||||
return new dHingeConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dHingeConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dHingeConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(hingeConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.h
|
||||
|
||||
#ifndef DYN_HINGE_CONSTRAINT_CMD_H
|
||||
#define DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dHingeConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dHingeConstraintCmd();
|
||||
virtual ~dHingeConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_HINGE_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.h
|
||||
|
||||
#ifndef DYN_HINGE_CONSTRAINT_CMD_H
|
||||
#define DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dHingeConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dHingeConstraintCmd();
|
||||
virtual ~dHingeConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "nailConstraintNode.h"
|
||||
#include "dNailConstraintCmd.h"
|
||||
|
||||
|
||||
MString dNailConstraintCmd::typeName("dNailConstraint");
|
||||
|
||||
dNailConstraintCmd::dNailConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dNailConstraintCmd::~dNailConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dNailConstraintCmd::creator()
|
||||
{
|
||||
return new dNailConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dNailConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dNailConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "nailConstraintNode.h"
|
||||
#include "dNailConstraintCmd.h"
|
||||
|
||||
|
||||
MString dNailConstraintCmd::typeName("dNailConstraint");
|
||||
|
||||
dNailConstraintCmd::dNailConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dNailConstraintCmd::~dNailConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dNailConstraintCmd::creator()
|
||||
{
|
||||
return new dNailConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dNailConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dNailConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.h
|
||||
|
||||
#ifndef DYN_NAIL_CONSTRAINT_CMD_H
|
||||
#define DYN_NAIL_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dNailConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dNailConstraintCmd();
|
||||
virtual ~dNailConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.h
|
||||
|
||||
#ifndef DYN_NAIL_CONSTRAINT_CMD_H
|
||||
#define DYN_NAIL_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dNailConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dNailConstraintCmd();
|
||||
virtual ~dNailConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sliderConstraintNode.h"
|
||||
#include "dSliderConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSliderConstraintCmd::typeName("dSliderConstraint");
|
||||
|
||||
dSliderConstraintCmd::dSliderConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSliderConstraintCmd::~dSliderConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSliderConstraintCmd::creator()
|
||||
{
|
||||
return new dSliderConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSliderConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSliderConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sliderConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sliderConstraintNode.h"
|
||||
#include "dSliderConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSliderConstraintCmd::typeName("dSliderConstraint");
|
||||
|
||||
dSliderConstraintCmd::dSliderConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSliderConstraintCmd::~dSliderConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSliderConstraintCmd::creator()
|
||||
{
|
||||
return new dSliderConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSliderConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSliderConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sliderConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
#define DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSliderConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSliderConstraintCmd();
|
||||
virtual ~dSliderConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
#define DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSliderConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSliderConstraintCmd();
|
||||
virtual ~dSliderConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sixdofConstraintNode.h"
|
||||
#include "dsixdofConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSixdofConstraintCmd::typeName("dSixdofConstraint");
|
||||
|
||||
dSixdofConstraintCmd::dSixdofConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSixdofConstraintCmd::~dSixdofConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSixdofConstraintCmd::creator()
|
||||
{
|
||||
return new dSixdofConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSixdofConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSixdofConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sixdofConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sixdofConstraintNode.h"
|
||||
#include "dsixdofConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSixdofConstraintCmd::typeName("dSixdofConstraint");
|
||||
|
||||
dSixdofConstraintCmd::dSixdofConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSixdofConstraintCmd::~dSixdofConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSixdofConstraintCmd::creator()
|
||||
{
|
||||
return new dSixdofConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSixdofConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSixdofConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sixdofConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
#define DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSixdofConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSixdofConstraintCmd();
|
||||
virtual ~dSixdofConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
#define DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSixdofConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSixdofConstraintCmd();
|
||||
virtual ~dSixdofConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,213 +1,213 @@
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
@@ -1,213 +1,213 @@
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
@@ -1,213 +1,213 @@
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
@@ -1,213 +1,213 @@
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
/* XPM */
|
||||
static char * dynamicaCreatePinConstraint_xpm[] = {
|
||||
"32 32 178 2",
|
||||
" c #B1B1B1",
|
||||
". c #A8A8A8",
|
||||
"+ c #A5A5A5",
|
||||
"@ c #718172",
|
||||
"# c #6D866F",
|
||||
"$ c #999999",
|
||||
"% c #9B9B9B",
|
||||
"& c #7B9B7E",
|
||||
"* c #77CF80",
|
||||
"= c #69846C",
|
||||
"- c #8F8F8F",
|
||||
"; c #989898",
|
||||
"> c #82A185",
|
||||
", c #88EC91",
|
||||
"' c #57DD63",
|
||||
") c #529C59",
|
||||
"! c #878787",
|
||||
"~ c #A2A2A2",
|
||||
"{ c #949494",
|
||||
"] c #88AA8B",
|
||||
"^ c #8EED97",
|
||||
"/ c #58E465",
|
||||
"( c #23DC34",
|
||||
"_ c #30B33C",
|
||||
": c #667A68",
|
||||
"< c #959595",
|
||||
"[ c #9E9E9E",
|
||||
"} c #757C76",
|
||||
"| c #9BD9A1",
|
||||
"1 c #87EC90",
|
||||
"2 c #4BE259",
|
||||
"3 c #17DA29",
|
||||
"4 c #04D718",
|
||||
"5 c #13C624",
|
||||
"6 c #528C57",
|
||||
"7 c #8B8B8B",
|
||||
"8 c #A9A9A9",
|
||||
"9 c #A6A6A6",
|
||||
"0 c #717371",
|
||||
"a c #99CB9E",
|
||||
"b c #9BEFA3",
|
||||
"c c #6FE87A",
|
||||
"d c #30DE40",
|
||||
"e c #09D71C",
|
||||
"f c #00D614",
|
||||
"g c #33A73E",
|
||||
"h c #8E8E8E",
|
||||
"i c #93BB97",
|
||||
"j c #A3F0AA",
|
||||
"k c #82EB8C",
|
||||
"l c #49E257",
|
||||
"m c #15D927",
|
||||
"n c #01D615",
|
||||
"o c #28B235",
|
||||
"p c #419B49",
|
||||
"q c #508D56",
|
||||
"r c #9F9F9F",
|
||||
"s c #89A68C",
|
||||
"t c #A6F1AD",
|
||||
"u c #8DED96",
|
||||
"v c #59E466",
|
||||
"w c #21DB32",
|
||||
"x c #24B532",
|
||||
"y c #858585",
|
||||
"z c #969696",
|
||||
"A c #929292",
|
||||
"B c #809281",
|
||||
"C c #A7EBAD",
|
||||
"D c #94EE9C",
|
||||
"E c #67E773",
|
||||
"F c #2DDD3D",
|
||||
"G c #06D119",
|
||||
"H c #5E8061",
|
||||
"I c #A0A0A0",
|
||||
"J c #919191",
|
||||
"K c #8A8A8A",
|
||||
"L c #778278",
|
||||
"M c #A0E2A6",
|
||||
"N c #99EFA1",
|
||||
"O c #73E87E",
|
||||
"P c #3BDF4A",
|
||||
"Q c #10D923",
|
||||
"R c #36A441",
|
||||
"S c #BE0000",
|
||||
"T c #A20000",
|
||||
"U c #7C1D14",
|
||||
"V c #88744E",
|
||||
"W c #877D52",
|
||||
"X c #8B8F5F",
|
||||
"Y c #95CA89",
|
||||
"Z c #77E982",
|
||||
"` c #46E155",
|
||||
" . c #03D617",
|
||||
".. c #13C424",
|
||||
"+. c #69766B",
|
||||
"@. c #AAAAAA",
|
||||
"#. c #747D74",
|
||||
"$. c #94D79B",
|
||||
"%. c #86EC8F",
|
||||
"&. c #7EEA88",
|
||||
"*. c #6DE878",
|
||||
"=. c #47E155",
|
||||
"-. c #1CDB2E",
|
||||
";. c #4C9053",
|
||||
">. c #75C27C",
|
||||
",. c #7AEA84",
|
||||
"'. c #74E97F",
|
||||
"). c #68E774",
|
||||
"!. c #5AE467",
|
||||
"~. c #4CE25A",
|
||||
"{. c #38DF48",
|
||||
"]. c #1DDB2F",
|
||||
"^. c #07D71A",
|
||||
"/. c #23B631",
|
||||
"(. c #848484",
|
||||
"_. c #66896A",
|
||||
":. c #49C955",
|
||||
"<. c #35DF45",
|
||||
"[. c #2BDD3C",
|
||||
"}. c #22DB33",
|
||||
"|. c #1ADA2C",
|
||||
"1. c #11D924",
|
||||
"2. c #09CE1C",
|
||||
"3. c #5D8160",
|
||||
"4. c #69786A",
|
||||
"5. c #32B03E",
|
||||
"6. c #02D616",
|
||||
"7. c #2BAF37",
|
||||
"8. c #898989",
|
||||
"9. c #A4A4A4",
|
||||
"0. c #7F7F7F",
|
||||
"a. c #399141",
|
||||
"b. c #06D019",
|
||||
"c. c #24B631",
|
||||
"d. c #A7A7A7",
|
||||
"e. c #AFAFAF",
|
||||
"f. c #BDBDBD",
|
||||
"g. c #528156",
|
||||
"h. c #12C223",
|
||||
"i. c #14C424",
|
||||
"j. c #6C746C",
|
||||
"k. c #AEAEAE",
|
||||
"l. c #EBEBEB",
|
||||
"m. c #F4F4F4",
|
||||
"n. c #C2C2C2",
|
||||
"o. c #697A6A",
|
||||
"p. c #26AE33",
|
||||
"q. c #09CE1B",
|
||||
"r. c #627D64",
|
||||
"s. c #A3A3A3",
|
||||
"t. c #C7C7C7",
|
||||
"u. c #FCFCFC",
|
||||
"v. c #E6E6E6",
|
||||
"w. c #DFDFDF",
|
||||
"x. c #409C48",
|
||||
"y. c #04D217",
|
||||
"z. c #6E726F",
|
||||
"A. c #B0B0B0",
|
||||
"B. c #F8F8F8",
|
||||
"C. c #8D8D8D",
|
||||
"D. c #528B57",
|
||||
"E. c #1BA610",
|
||||
"F. c #5B835F",
|
||||
"G. c #DDDDDD",
|
||||
"H. c #EAEAEA",
|
||||
"I. c #880000",
|
||||
"J. c #B5B5B5",
|
||||
"K. c #DEDEDE",
|
||||
"L. c #E9E9E9",
|
||||
"M. c #A1A1A1",
|
||||
"N. c #CACACA",
|
||||
"O. c #DCDCDC",
|
||||
"P. c #ACACAC",
|
||||
"Q. c #D8D8D8",
|
||||
"R. c #C6C6C6",
|
||||
"S. c #ADADAD",
|
||||
"T. c #BA0000",
|
||||
"U. c #BB0000",
|
||||
" ",
|
||||
" . + ",
|
||||
" . @ # $ ",
|
||||
" % & * = - ",
|
||||
" ; > , ' ) ! ~ ",
|
||||
" { ] ^ / ( _ : < ",
|
||||
" [ } | 1 2 3 4 5 6 7 8 ",
|
||||
" 9 0 a b c d e f f f g h ",
|
||||
" 7 i j k l m n f o p q r ",
|
||||
" h s t u v w 4 f x y z r ",
|
||||
" A B C D E F e f G H I ",
|
||||
" 8 J - K L M N O P Q n f R h ",
|
||||
" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ",
|
||||
" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ",
|
||||
" S y >.,.'.).!.~.{.].^.f f /.(. ",
|
||||
" S I _.:.<.[.}.|.1.^.n f 2.3.r ",
|
||||
" S ; 4.5.^.4 4 6.n f f 7.8. ",
|
||||
" S 9.0.a.b.f f f f f c.y ",
|
||||
" S d.e.f.g.h.f f f f i.j.k. ",
|
||||
" S e.; l.m.n.o.p.f f f q.r.8 ",
|
||||
" S s.t.u.v.w.; (.x.y.f /.z.A. ",
|
||||
" S @.~ B.v.w.9 9.A.C.D.E.F.r ",
|
||||
" S r G.H.w.9.9. $ I.$ ",
|
||||
" S + J.m.K.s.9. S ",
|
||||
" S k.$ L.G.M.9. S ",
|
||||
" S s.N.O.I + S ",
|
||||
" S P.+ Q.r + S ",
|
||||
" S ~ R.r 9 S ",
|
||||
" S S.s.[ P. S ",
|
||||
" S S S S T.U.S S S S S S S S S S S S ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
xcopy /S /Y /C /I /h icons\*.xpm "C:\Program Files\Autodesk\Maya8.5\icons"
|
||||
xcopy /S /Y /C /I /h scripts\*.mel "C:\Program Files\Autodesk\Maya8.5\scripts"
|
||||
xcopy /S /Y /C /I /h BulletMayaPluginDebug.mll "C:\Program Files\Autodesk\Maya8.5\bin\plug-ins"
|
||||
xcopy /S /Y /C /I /h icons\*.xpm "C:\Program Files\Autodesk\Maya8.5\icons"
|
||||
xcopy /S /Y /C /I /h scripts\*.mel "C:\Program Files\Autodesk\Maya8.5\scripts"
|
||||
xcopy /S /Y /C /I /h BulletMayaPluginDebug.mll "C:\Program Files\Autodesk\Maya8.5\bin\plug-ins"
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//base.h
|
||||
|
||||
#ifndef MVL_BASE_H
|
||||
#define MVL_BASE_H
|
||||
|
||||
namespace mvl {
|
||||
|
||||
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//base.h
|
||||
|
||||
#ifndef MVL_BASE_H
|
||||
#define MVL_BASE_H
|
||||
|
||||
namespace mvl {
|
||||
|
||||
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,399 +1,399 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//mat.h
|
||||
|
||||
#ifndef MVL_MAT_H
|
||||
#define MVL_MAT_H
|
||||
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
class mat
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef T* iterator;
|
||||
typedef T const* const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
public:
|
||||
enum {
|
||||
Rows = R,
|
||||
Cols = C,
|
||||
Size = Rows * Cols,
|
||||
};
|
||||
|
||||
public:
|
||||
//constructors
|
||||
explicit mat() {}
|
||||
|
||||
template<typename T2>
|
||||
mat(mat<T2, Rows, Cols> const& m)
|
||||
{
|
||||
*this = m;
|
||||
}
|
||||
|
||||
explicit mat(value_type val)
|
||||
{
|
||||
for(int i = 0; i < Size; ++i){
|
||||
m_data[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01,
|
||||
value_type m10, value_type m11)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11;
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01, value_type m02,
|
||||
value_type m10, value_type m11, value_type m12,
|
||||
value_type m20, value_type m21, value_type m22)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01; operator()(0, 2) = m02;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11; operator()(1, 2) = m12;
|
||||
operator()(2, 0) = m20; operator()(2, 1) = m21; operator()(2, 2) = m22;
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01, value_type m02, value_type m03,
|
||||
value_type m10, value_type m11, value_type m12, value_type m13,
|
||||
value_type m20, value_type m21, value_type m22, value_type m23,
|
||||
value_type m30, value_type m31, value_type m32, value_type m33)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01; operator()(0, 2) = m02; operator()(0, 3) = m03;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11; operator()(1, 2) = m12; operator()(1, 3) = m13;
|
||||
operator()(2, 0) = m20; operator()(2, 1) = m21; operator()(2, 2) = m22; operator()(2, 3) = m23;
|
||||
operator()(3, 0) = m30; operator()(3, 1) = m31; operator()(3, 2) = m32; operator()(3, 3) = m33;
|
||||
}
|
||||
|
||||
public:
|
||||
//data access
|
||||
value_type operator()(std::size_t i, std::size_t j) const { return m_data[j * Rows + i]; }
|
||||
reference operator()(std::size_t i, std::size_t j) { return m_data[j * Rows + i]; }
|
||||
|
||||
public:
|
||||
//stl
|
||||
static std::size_t size() { return Size; }
|
||||
static std::size_t max_size() { return Size; }
|
||||
static bool empty() { return false; }
|
||||
|
||||
iterator begin() { return m_data; }
|
||||
iterator end() { return m_data + Size; }
|
||||
const_iterator begin() const { return m_data; }
|
||||
const_iterator end() const { return m_data + Size; }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
value_type front() { return m_data[0]; }
|
||||
value_type back() { return m_data[Size - 1]; }
|
||||
const_reference front() const { return m_data[0]; }
|
||||
const_reference back() const { return m_data[Size - 1]; }
|
||||
|
||||
friend std::ostream& operator << (std::ostream& out, mat const& m) {
|
||||
out << "(";
|
||||
for(size_t i = 0; i < Rows - 1; i++) {
|
||||
for(size_t j = 0; j < Cols; j++) {
|
||||
out << m(i, j) << ", ";
|
||||
}
|
||||
out << std::endl;
|
||||
}
|
||||
for(size_t j = 0; j < Cols - 1; j++) {
|
||||
out << m(Rows - 1, j) << ", ";
|
||||
}
|
||||
out << m(Rows - 1, Cols - 1) << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
public:
|
||||
//
|
||||
mat& operator=(mat const& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2>
|
||||
mat& operator=(mat<T2, Rows, Cols> const& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
//data is stored in column major order, so the matrix can passed directly to the graphics APIs
|
||||
T m_data[Size];
|
||||
};
|
||||
|
||||
//assignment operators
|
||||
// OP(mat<T1>, mat<T2>)
|
||||
// OP(mat<T>, T)
|
||||
|
||||
#define MAT_IMPLEMENT_MACRO(OP) \
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C> \
|
||||
inline \
|
||||
mat<T1, R, C>& \
|
||||
operator OP(mat<T1, R, C>& lhs, mat<T2, R, C> const& rhs) { \
|
||||
for(int i = 0; i < C * R; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
template<typename T, std::size_t R, std::size_t C> \
|
||||
inline \
|
||||
mat<T, R, C>& \
|
||||
operator OP(mat<T, R, C>& lhs, typename mat<T, R, C>::value_type const& rhs) { \
|
||||
for(int i = 0; i < C * R; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
|
||||
MAT_IMPLEMENT_MACRO(+=)
|
||||
MAT_IMPLEMENT_MACRO(-=)
|
||||
MAT_IMPLEMENT_MACRO(*=)
|
||||
MAT_IMPLEMENT_MACRO(/=)
|
||||
|
||||
#undef MAT_IMPLEMENT_MACRO
|
||||
|
||||
//operator + (mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator + (mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) + rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator - (mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator - (mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) - rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (mat, POD)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator * (mat<T1, R, C> const& lhs, T2 const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) * rhs;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (POD, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator * (T1 const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs * rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator / (mat, POD)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator / (mat<T1, R, C> const& lhs, T2 const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) / rhs;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_prod(mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
element_prod(mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) * rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_div(mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
element_div(mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) / rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//unary operator -(mat)
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<T, R, C>
|
||||
operator -(mat<T, R, C> const& rhs) {
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = -rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix transpose
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<T, R, C>
|
||||
trans(mat<T, R, C> const& rhs) {
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = rhs(j, i);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//identity matrix
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
mat<T, Sz, Sz>
|
||||
identity() {
|
||||
mat<T, Sz, Sz> res;
|
||||
for(int i = 0; i < Sz ; ++i) {
|
||||
for(int j = 0; j < Sz; ++j) {
|
||||
res(i, j) = i == j ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix diagonal as vector (for square matrices)
|
||||
template<typename T, std::size_t N>
|
||||
inline
|
||||
vec<T, N>
|
||||
diag(mat<T, N, N> const& rhs) {
|
||||
vec<T, N> res;
|
||||
for(int i = 0; i < N; ++i) {
|
||||
res[i] = rhs(i, i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix row as vector
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<T, C>
|
||||
row(mat<T, R, C> const& rhs, std::size_t r) {
|
||||
vec<T, C> res;
|
||||
for(int i = 0; i < C; ++i) {
|
||||
res[i] = rhs(r, i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix column as vector
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<T, R>
|
||||
col(mat<T, R, C> const& rhs, std::size_t c) {
|
||||
vec<T, R> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
res[i] = rhs(i, c);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//matrix-matrix product
|
||||
template<typename T1, typename T2, std::size_t R1, std::size_t C1, std::size_t C2>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R1, C2>
|
||||
prod(mat<T1, R1, C1> const& lhs, mat<T2, C1, C2> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R1, C2> res;
|
||||
for(int i = 0; i < R1; ++i) {
|
||||
for(int j = 0; j < C2; ++j) {
|
||||
res(i, j) = 0;
|
||||
for(int k = 0; k < C1; ++k) {
|
||||
res(i, j) += lhs(i, k) * rhs(k, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix - column vector product
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, R>
|
||||
prod(mat<T1, R, C> const& lhs, vec<T2, C> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, R> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
res(i) = 0;
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i) += lhs(i, j) * rhs(j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
#endif
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//mat.h
|
||||
|
||||
#ifndef MVL_MAT_H
|
||||
#define MVL_MAT_H
|
||||
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
class mat
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef T* iterator;
|
||||
typedef T const* const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
public:
|
||||
enum {
|
||||
Rows = R,
|
||||
Cols = C,
|
||||
Size = Rows * Cols,
|
||||
};
|
||||
|
||||
public:
|
||||
//constructors
|
||||
explicit mat() {}
|
||||
|
||||
template<typename T2>
|
||||
mat(mat<T2, Rows, Cols> const& m)
|
||||
{
|
||||
*this = m;
|
||||
}
|
||||
|
||||
explicit mat(value_type val)
|
||||
{
|
||||
for(int i = 0; i < Size; ++i){
|
||||
m_data[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01,
|
||||
value_type m10, value_type m11)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11;
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01, value_type m02,
|
||||
value_type m10, value_type m11, value_type m12,
|
||||
value_type m20, value_type m21, value_type m22)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01; operator()(0, 2) = m02;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11; operator()(1, 2) = m12;
|
||||
operator()(2, 0) = m20; operator()(2, 1) = m21; operator()(2, 2) = m22;
|
||||
}
|
||||
|
||||
explicit mat(value_type m00, value_type m01, value_type m02, value_type m03,
|
||||
value_type m10, value_type m11, value_type m12, value_type m13,
|
||||
value_type m20, value_type m21, value_type m22, value_type m23,
|
||||
value_type m30, value_type m31, value_type m32, value_type m33)
|
||||
{
|
||||
operator()(0, 0) = m00; operator()(0, 1) = m01; operator()(0, 2) = m02; operator()(0, 3) = m03;
|
||||
operator()(1, 0) = m10; operator()(1, 1) = m11; operator()(1, 2) = m12; operator()(1, 3) = m13;
|
||||
operator()(2, 0) = m20; operator()(2, 1) = m21; operator()(2, 2) = m22; operator()(2, 3) = m23;
|
||||
operator()(3, 0) = m30; operator()(3, 1) = m31; operator()(3, 2) = m32; operator()(3, 3) = m33;
|
||||
}
|
||||
|
||||
public:
|
||||
//data access
|
||||
value_type operator()(std::size_t i, std::size_t j) const { return m_data[j * Rows + i]; }
|
||||
reference operator()(std::size_t i, std::size_t j) { return m_data[j * Rows + i]; }
|
||||
|
||||
public:
|
||||
//stl
|
||||
static std::size_t size() { return Size; }
|
||||
static std::size_t max_size() { return Size; }
|
||||
static bool empty() { return false; }
|
||||
|
||||
iterator begin() { return m_data; }
|
||||
iterator end() { return m_data + Size; }
|
||||
const_iterator begin() const { return m_data; }
|
||||
const_iterator end() const { return m_data + Size; }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
value_type front() { return m_data[0]; }
|
||||
value_type back() { return m_data[Size - 1]; }
|
||||
const_reference front() const { return m_data[0]; }
|
||||
const_reference back() const { return m_data[Size - 1]; }
|
||||
|
||||
friend std::ostream& operator << (std::ostream& out, mat const& m) {
|
||||
out << "(";
|
||||
for(size_t i = 0; i < Rows - 1; i++) {
|
||||
for(size_t j = 0; j < Cols; j++) {
|
||||
out << m(i, j) << ", ";
|
||||
}
|
||||
out << std::endl;
|
||||
}
|
||||
for(size_t j = 0; j < Cols - 1; j++) {
|
||||
out << m(Rows - 1, j) << ", ";
|
||||
}
|
||||
out << m(Rows - 1, Cols - 1) << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
public:
|
||||
//
|
||||
mat& operator=(mat const& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2>
|
||||
mat& operator=(mat<T2, Rows, Cols> const& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
//data is stored in column major order, so the matrix can passed directly to the graphics APIs
|
||||
T m_data[Size];
|
||||
};
|
||||
|
||||
//assignment operators
|
||||
// OP(mat<T1>, mat<T2>)
|
||||
// OP(mat<T>, T)
|
||||
|
||||
#define MAT_IMPLEMENT_MACRO(OP) \
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C> \
|
||||
inline \
|
||||
mat<T1, R, C>& \
|
||||
operator OP(mat<T1, R, C>& lhs, mat<T2, R, C> const& rhs) { \
|
||||
for(int i = 0; i < C * R; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
template<typename T, std::size_t R, std::size_t C> \
|
||||
inline \
|
||||
mat<T, R, C>& \
|
||||
operator OP(mat<T, R, C>& lhs, typename mat<T, R, C>::value_type const& rhs) { \
|
||||
for(int i = 0; i < C * R; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
|
||||
MAT_IMPLEMENT_MACRO(+=)
|
||||
MAT_IMPLEMENT_MACRO(-=)
|
||||
MAT_IMPLEMENT_MACRO(*=)
|
||||
MAT_IMPLEMENT_MACRO(/=)
|
||||
|
||||
#undef MAT_IMPLEMENT_MACRO
|
||||
|
||||
//operator + (mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator + (mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) + rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator - (mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator - (mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) - rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (mat, POD)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator * (mat<T1, R, C> const& lhs, T2 const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) * rhs;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (POD, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator * (T1 const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs * rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator / (mat, POD)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
operator / (mat<T1, R, C> const& lhs, T2 const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) / rhs;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_prod(mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
element_prod(mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) * rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_div(mat, mat)
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C>
|
||||
element_div(mat<T1, R, C> const& lhs, mat<T2, R, C> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = lhs(i, j) / rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//unary operator -(mat)
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<T, R, C>
|
||||
operator -(mat<T, R, C> const& rhs) {
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = -rhs(i, j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix transpose
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
mat<T, R, C>
|
||||
trans(mat<T, R, C> const& rhs) {
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R ; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = rhs(j, i);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//identity matrix
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
mat<T, Sz, Sz>
|
||||
identity() {
|
||||
mat<T, Sz, Sz> res;
|
||||
for(int i = 0; i < Sz ; ++i) {
|
||||
for(int j = 0; j < Sz; ++j) {
|
||||
res(i, j) = i == j ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix diagonal as vector (for square matrices)
|
||||
template<typename T, std::size_t N>
|
||||
inline
|
||||
vec<T, N>
|
||||
diag(mat<T, N, N> const& rhs) {
|
||||
vec<T, N> res;
|
||||
for(int i = 0; i < N; ++i) {
|
||||
res[i] = rhs(i, i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix row as vector
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<T, C>
|
||||
row(mat<T, R, C> const& rhs, std::size_t r) {
|
||||
vec<T, C> res;
|
||||
for(int i = 0; i < C; ++i) {
|
||||
res[i] = rhs(r, i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix column as vector
|
||||
template<typename T, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<T, R>
|
||||
col(mat<T, R, C> const& rhs, std::size_t c) {
|
||||
vec<T, R> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
res[i] = rhs(i, c);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//matrix-matrix product
|
||||
template<typename T1, typename T2, std::size_t R1, std::size_t C1, std::size_t C2>
|
||||
inline
|
||||
mat<typename promote_traits<T1, T2>::value_type, R1, C2>
|
||||
prod(mat<T1, R1, C1> const& lhs, mat<T2, C1, C2> const& rhs) {
|
||||
mat<typename promote_traits<T1, T2>::value_type, R1, C2> res;
|
||||
for(int i = 0; i < R1; ++i) {
|
||||
for(int j = 0; j < C2; ++j) {
|
||||
res(i, j) = 0;
|
||||
for(int k = 0; k < C1; ++k) {
|
||||
res(i, j) += lhs(i, k) * rhs(k, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//matrix - column vector product
|
||||
template<typename T1, typename T2, std::size_t R, std::size_t C>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, R>
|
||||
prod(mat<T1, R, C> const& lhs, vec<T2, C> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, R> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
res(i) = 0;
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i) += lhs(i, j) * rhs(j);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,279 +1,279 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//quat.h
|
||||
|
||||
#ifndef MVL_QUAT_H
|
||||
#define MVL_QUAT_H
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "vec.h"
|
||||
#include "mat.h"
|
||||
|
||||
//quaternions are vectors of size 4
|
||||
// it's assumed that the layout is in the form (w, (x, y, z)),
|
||||
// so that the identity quaternion is (1, 0, 0, 0)
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//quaternion conjugate
|
||||
template<typename T>
|
||||
inline vec<T, 4>
|
||||
qconj(vec<T, 4> const& rhs) {
|
||||
return vec<T, 4>(-rhs[0], rhs[1], rhs[2], rhs[3]);
|
||||
}
|
||||
|
||||
//quaternion identity
|
||||
template<typename T>
|
||||
inline
|
||||
vec<T, 4>
|
||||
qidentity() {
|
||||
return vec<T, 4>(1, 0, 0, 0);
|
||||
}
|
||||
|
||||
//quaternion - quaternion product
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
qprod(vec<T1, 4> const& lhs, vec<T2, 4> const& rhs) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
return vec<value_type, 4>((lhs(0)*rhs(0)) - (lhs(1)*rhs(1)) - (lhs(2)*rhs(2)) - (lhs(3)*rhs(3)),
|
||||
(lhs(0)*rhs(1)) + (lhs(1)*rhs(0)) + (lhs(2)*rhs(3)) - (lhs(3)*rhs(2)),
|
||||
(lhs(0)*rhs(2)) - (lhs(1)*rhs(3)) + (lhs(2)*rhs(0)) + (lhs(3)*rhs(1)),
|
||||
(lhs(0)*rhs(3)) + (lhs(1)*rhs(2)) - (lhs(2)*rhs(1)) + (lhs(3)*rhs(0)));
|
||||
}
|
||||
|
||||
//quanternion - vector product (rotation)
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 3>
|
||||
qprod(vec<T1, 4> const& q, vec<T2, 3> const& v) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
vec<value_type, 4> tmp = qprod(qprod(q, vec<value_type, 4>(0, v[0], v[1], v[2])), qconj(q));
|
||||
return vec<value_type, 3>(tmp[0], tmp[1], tmp[2]);
|
||||
}
|
||||
|
||||
//spherical interpolation between q0 and q1
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
qslerp(vec<T1, 4> const& q1, vec<T2, 4> const& q2, T3 t) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
value_type omega, cosom, sinom, scale0, scale1;
|
||||
vec<value_type, 4> tmp;
|
||||
|
||||
cosom = dot(q1, q2);
|
||||
|
||||
if (cosom < static_cast<value_type>(0.0)) {
|
||||
cosom = -cosom;
|
||||
tmp = -q2;
|
||||
} else {
|
||||
tmp = q2;
|
||||
}
|
||||
|
||||
if ((static_cast<value_type>(1.0) - cosom) > std::numeric_limits<value_type>::epsilon()) {
|
||||
omega = (value_type) acos(cosom);
|
||||
sinom = sin(omega);
|
||||
scale0 = sin((static_cast<value_type>(1.0) - t) * omega) / sinom;
|
||||
scale1 = sin(t * omega) / sinom;
|
||||
} else {
|
||||
scale0 = static_cast<value_type>(1.0) - t;
|
||||
scale1 = t;
|
||||
}
|
||||
|
||||
return scale0 * q1 + scale1 * tmp;
|
||||
}
|
||||
|
||||
//init quaternion from axis-angle
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
q_from_axis_angle(vec<T1, 3> const& axis, T2 theta) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
value_type sin_theta = sin(static_cast<value_type>(static_cast<value_type>(0.5)) * theta);
|
||||
return vec<value_type, 4>(cos(static_cast<value_type>(static_cast<value_type>(0.5)) * theta),
|
||||
sin_theta * axis[0],
|
||||
sin_theta * axis[1],
|
||||
sin_theta * axis[2]);
|
||||
}
|
||||
|
||||
//get the axis/angle from quaternion
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline
|
||||
void
|
||||
q_to_axis_angle(vec<T1, 4> const& q, vec<T2, 3>& axis, T3& theta)
|
||||
{
|
||||
T3 half_theta= acos(q[0]);
|
||||
|
||||
if(half_theta > 10 * std::numeric_limits<T3>::epsilon()) {
|
||||
T3 oost = 1 / sin(half_theta);
|
||||
|
||||
axis[0] = oost * q[1];
|
||||
axis[1] = oost * q[2];
|
||||
axis[2] = oost * q[3];
|
||||
theta = 2 * half_theta;
|
||||
} else {
|
||||
axis[0] = axis[1] = axis[2] = 0;
|
||||
theta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//init quaternion from rotation matrix
|
||||
template<typename T1>
|
||||
inline
|
||||
vec<T1, 4>
|
||||
q_from_mat(mat<T1, 3, 3> const& m) {
|
||||
T1 trace, s, hos;
|
||||
trace = m(0, 0) + m(1, 1) + m(2, 2);
|
||||
if (trace > static_cast<T1>(0.0)) {
|
||||
s = sqrt(trace + static_cast<T1>(1.0));
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>(s * static_cast<T1>(0.5), (m(2, 1) - m(1, 2)) * hos, (m(0, 2) - m(2, 0)) * hos, (m(1, 0) - m(0, 1)) * hos);
|
||||
} else {
|
||||
int biggest;
|
||||
enum {A,T,I};
|
||||
if (m(0, 0) > m(1, 1)) {
|
||||
if (m(2, 2) > m(0, 0)) biggest = I;
|
||||
else biggest = A;
|
||||
} else {
|
||||
if (m(2, 2) > m(0, 0)) biggest = I;
|
||||
else biggest = T;
|
||||
}
|
||||
switch (biggest) {
|
||||
case A:
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
// I
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// T
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
break;
|
||||
case T:
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
// I
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// A
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
break;
|
||||
case I:
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// A
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
// T
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get rotation matrix from quaternion
|
||||
template<typename T>
|
||||
inline
|
||||
void
|
||||
q_to_mat(vec<T, 4> const& q, mat<T, 3, 3>& m) {
|
||||
T X2,Y2,Z2; //2*QX, 2*QY, 2*QZ
|
||||
T XX2,YY2,ZZ2; //2*QX*QX, 2*QY*QY, 2*QZ*QZ
|
||||
T XY2,XZ2,XW2; //2*QX*QY, 2*QX*QZ, 2*QX*QW
|
||||
T YZ2,YW2,ZW2; // ...
|
||||
|
||||
X2 = 2 * q[1];
|
||||
XX2 = X2 * q[1];
|
||||
XY2 = X2 * q[2];
|
||||
XZ2 = X2 * q[3];
|
||||
XW2 = X2 * q[0];
|
||||
|
||||
Y2 = 2 * q[2];
|
||||
YY2 = Y2 * q[2];
|
||||
YZ2 = Y2 * q[3];
|
||||
YW2 = Y2 * q[0];
|
||||
|
||||
Z2 = 2 * q[3];
|
||||
ZZ2 = Z2 * q[3];
|
||||
ZW2 = Z2 * q[0];
|
||||
|
||||
m(0, 0) = 1 - YY2 - ZZ2;
|
||||
m(0, 1) = XY2 - ZW2;
|
||||
m(0, 2) = XZ2 + YW2;
|
||||
|
||||
m(1, 0) = XY2 + ZW2;
|
||||
m(1, 1) = 1 - XX2 - ZZ2;
|
||||
m(1, 2) = YZ2 - XW2;
|
||||
|
||||
m(2, 0) = XZ2 - YW2;
|
||||
m(2, 1) = YZ2 + XW2;
|
||||
m(2, 2) = 1 - XX2 - YY2;
|
||||
|
||||
}
|
||||
|
||||
template<typename T, size_t R, size_t C>
|
||||
mat<T, R, C>
|
||||
cmat(T const* m)
|
||||
{
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = m[i * C + j];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//quat.h
|
||||
|
||||
#ifndef MVL_QUAT_H
|
||||
#define MVL_QUAT_H
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "vec.h"
|
||||
#include "mat.h"
|
||||
|
||||
//quaternions are vectors of size 4
|
||||
// it's assumed that the layout is in the form (w, (x, y, z)),
|
||||
// so that the identity quaternion is (1, 0, 0, 0)
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//quaternion conjugate
|
||||
template<typename T>
|
||||
inline vec<T, 4>
|
||||
qconj(vec<T, 4> const& rhs) {
|
||||
return vec<T, 4>(-rhs[0], rhs[1], rhs[2], rhs[3]);
|
||||
}
|
||||
|
||||
//quaternion identity
|
||||
template<typename T>
|
||||
inline
|
||||
vec<T, 4>
|
||||
qidentity() {
|
||||
return vec<T, 4>(1, 0, 0, 0);
|
||||
}
|
||||
|
||||
//quaternion - quaternion product
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
qprod(vec<T1, 4> const& lhs, vec<T2, 4> const& rhs) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
return vec<value_type, 4>((lhs(0)*rhs(0)) - (lhs(1)*rhs(1)) - (lhs(2)*rhs(2)) - (lhs(3)*rhs(3)),
|
||||
(lhs(0)*rhs(1)) + (lhs(1)*rhs(0)) + (lhs(2)*rhs(3)) - (lhs(3)*rhs(2)),
|
||||
(lhs(0)*rhs(2)) - (lhs(1)*rhs(3)) + (lhs(2)*rhs(0)) + (lhs(3)*rhs(1)),
|
||||
(lhs(0)*rhs(3)) + (lhs(1)*rhs(2)) - (lhs(2)*rhs(1)) + (lhs(3)*rhs(0)));
|
||||
}
|
||||
|
||||
//quanternion - vector product (rotation)
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 3>
|
||||
qprod(vec<T1, 4> const& q, vec<T2, 3> const& v) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
vec<value_type, 4> tmp = qprod(qprod(q, vec<value_type, 4>(0, v[0], v[1], v[2])), qconj(q));
|
||||
return vec<value_type, 3>(tmp[0], tmp[1], tmp[2]);
|
||||
}
|
||||
|
||||
//spherical interpolation between q0 and q1
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
qslerp(vec<T1, 4> const& q1, vec<T2, 4> const& q2, T3 t) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
value_type omega, cosom, sinom, scale0, scale1;
|
||||
vec<value_type, 4> tmp;
|
||||
|
||||
cosom = dot(q1, q2);
|
||||
|
||||
if (cosom < static_cast<value_type>(0.0)) {
|
||||
cosom = -cosom;
|
||||
tmp = -q2;
|
||||
} else {
|
||||
tmp = q2;
|
||||
}
|
||||
|
||||
if ((static_cast<value_type>(1.0) - cosom) > std::numeric_limits<value_type>::epsilon()) {
|
||||
omega = (value_type) acos(cosom);
|
||||
sinom = sin(omega);
|
||||
scale0 = sin((static_cast<value_type>(1.0) - t) * omega) / sinom;
|
||||
scale1 = sin(t * omega) / sinom;
|
||||
} else {
|
||||
scale0 = static_cast<value_type>(1.0) - t;
|
||||
scale1 = t;
|
||||
}
|
||||
|
||||
return scale0 * q1 + scale1 * tmp;
|
||||
}
|
||||
|
||||
//init quaternion from axis-angle
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 4>
|
||||
q_from_axis_angle(vec<T1, 3> const& axis, T2 theta) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
value_type sin_theta = sin(static_cast<value_type>(static_cast<value_type>(0.5)) * theta);
|
||||
return vec<value_type, 4>(cos(static_cast<value_type>(static_cast<value_type>(0.5)) * theta),
|
||||
sin_theta * axis[0],
|
||||
sin_theta * axis[1],
|
||||
sin_theta * axis[2]);
|
||||
}
|
||||
|
||||
//get the axis/angle from quaternion
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline
|
||||
void
|
||||
q_to_axis_angle(vec<T1, 4> const& q, vec<T2, 3>& axis, T3& theta)
|
||||
{
|
||||
T3 half_theta= acos(q[0]);
|
||||
|
||||
if(half_theta > 10 * std::numeric_limits<T3>::epsilon()) {
|
||||
T3 oost = 1 / sin(half_theta);
|
||||
|
||||
axis[0] = oost * q[1];
|
||||
axis[1] = oost * q[2];
|
||||
axis[2] = oost * q[3];
|
||||
theta = 2 * half_theta;
|
||||
} else {
|
||||
axis[0] = axis[1] = axis[2] = 0;
|
||||
theta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//init quaternion from rotation matrix
|
||||
template<typename T1>
|
||||
inline
|
||||
vec<T1, 4>
|
||||
q_from_mat(mat<T1, 3, 3> const& m) {
|
||||
T1 trace, s, hos;
|
||||
trace = m(0, 0) + m(1, 1) + m(2, 2);
|
||||
if (trace > static_cast<T1>(0.0)) {
|
||||
s = sqrt(trace + static_cast<T1>(1.0));
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>(s * static_cast<T1>(0.5), (m(2, 1) - m(1, 2)) * hos, (m(0, 2) - m(2, 0)) * hos, (m(1, 0) - m(0, 1)) * hos);
|
||||
} else {
|
||||
int biggest;
|
||||
enum {A,T,I};
|
||||
if (m(0, 0) > m(1, 1)) {
|
||||
if (m(2, 2) > m(0, 0)) biggest = I;
|
||||
else biggest = A;
|
||||
} else {
|
||||
if (m(2, 2) > m(0, 0)) biggest = I;
|
||||
else biggest = T;
|
||||
}
|
||||
switch (biggest) {
|
||||
case A:
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
// I
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// T
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
break;
|
||||
case T:
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
// I
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// A
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
break;
|
||||
case I:
|
||||
s = sqrt( m(2, 2) - (m(0, 0) + m(1, 1)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(1, 0) - m(0, 1)) * hos, (m(2, 0) + m(0, 2)) * hos, (m(2, 1) + m(1, 2)) * hos, s * static_cast<T1>(0.5));
|
||||
}
|
||||
// A
|
||||
s = sqrt( m(0, 0) - (m(1, 1) + m(2, 2)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(2, 1) - m(1, 2)) * hos, s * static_cast<T1>(0.5), (m(0, 1) + m(1, 0)) * hos, (m(0, 2) + m(2, 0)) * hos);
|
||||
}
|
||||
// T
|
||||
s = sqrt( m(1, 1) - (m(2, 2) + m(0, 0)) + static_cast<T1>(1.0));
|
||||
if (s > (100 * std::numeric_limits<T1>::epsilon())) {
|
||||
hos = static_cast<T1>(0.5) / s;
|
||||
return vec<T1, 4>((m(0, 2) - m(2, 0)) * hos, (m(1, 0) + m(0, 1)) * hos, s * static_cast<T1>(0.5), (m(1, 2) + m(2, 1)) * hos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get rotation matrix from quaternion
|
||||
template<typename T>
|
||||
inline
|
||||
void
|
||||
q_to_mat(vec<T, 4> const& q, mat<T, 3, 3>& m) {
|
||||
T X2,Y2,Z2; //2*QX, 2*QY, 2*QZ
|
||||
T XX2,YY2,ZZ2; //2*QX*QX, 2*QY*QY, 2*QZ*QZ
|
||||
T XY2,XZ2,XW2; //2*QX*QY, 2*QX*QZ, 2*QX*QW
|
||||
T YZ2,YW2,ZW2; // ...
|
||||
|
||||
X2 = 2 * q[1];
|
||||
XX2 = X2 * q[1];
|
||||
XY2 = X2 * q[2];
|
||||
XZ2 = X2 * q[3];
|
||||
XW2 = X2 * q[0];
|
||||
|
||||
Y2 = 2 * q[2];
|
||||
YY2 = Y2 * q[2];
|
||||
YZ2 = Y2 * q[3];
|
||||
YW2 = Y2 * q[0];
|
||||
|
||||
Z2 = 2 * q[3];
|
||||
ZZ2 = Z2 * q[3];
|
||||
ZW2 = Z2 * q[0];
|
||||
|
||||
m(0, 0) = 1 - YY2 - ZZ2;
|
||||
m(0, 1) = XY2 - ZW2;
|
||||
m(0, 2) = XZ2 + YW2;
|
||||
|
||||
m(1, 0) = XY2 + ZW2;
|
||||
m(1, 1) = 1 - XX2 - ZZ2;
|
||||
m(1, 2) = YZ2 - XW2;
|
||||
|
||||
m(2, 0) = XZ2 - YW2;
|
||||
m(2, 1) = YZ2 + XW2;
|
||||
m(2, 2) = 1 - XX2 - YY2;
|
||||
|
||||
}
|
||||
|
||||
template<typename T, size_t R, size_t C>
|
||||
mat<T, R, C>
|
||||
cmat(T const* m)
|
||||
{
|
||||
mat<T, R, C> res;
|
||||
for(int i = 0; i < R; ++i) {
|
||||
for(int j = 0; j < C; ++j) {
|
||||
res(i, j) = m[i * C + j];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//traits.h
|
||||
|
||||
#ifndef MVL_TRAITS_H
|
||||
#define MVL_TRAITS_H
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//simple promotion for now
|
||||
|
||||
//check if a type is a POD
|
||||
template<typename T>
|
||||
struct isPOD { enum { value = false }; };
|
||||
template<> struct isPOD<char> { enum { value = true }; };
|
||||
template<> struct isPOD<short> { enum { value = true }; };
|
||||
template<> struct isPOD<int> { enum { value = true }; };
|
||||
template<> struct isPOD<float> { enum { value = true }; };
|
||||
template<> struct isPOD<double> { enum { value = true }; };
|
||||
template<> struct isPOD<long double> { enum { value = true }; };
|
||||
|
||||
//
|
||||
template<bool Condition, typename T1, typename T2> struct ifThenElse { typedef T2 value_type; };
|
||||
template<typename T1, typename T2> struct ifThenElse<true, T1, T2> { typedef T1 value_type; };
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct promote_traits
|
||||
{
|
||||
typedef typename ifThenElse<isPOD<T1>::value, T2, T1>::value_type value_type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct promote_traits<T, T>
|
||||
{
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
#define TRAITS_DEFINE_MACRO(T1, T2, TP) \
|
||||
template<> \
|
||||
struct promote_traits<T1, T2> \
|
||||
{ \
|
||||
typedef TP value_type; \
|
||||
}; \
|
||||
template<> \
|
||||
struct promote_traits<T2, T1> \
|
||||
{ \
|
||||
typedef TP value_type; \
|
||||
};
|
||||
|
||||
TRAITS_DEFINE_MACRO(int, float, float)
|
||||
TRAITS_DEFINE_MACRO(int, double, double)
|
||||
TRAITS_DEFINE_MACRO(int, long double, long double)
|
||||
|
||||
TRAITS_DEFINE_MACRO(float, double, double)
|
||||
TRAITS_DEFINE_MACRO(float, long double, long double)
|
||||
|
||||
TRAITS_DEFINE_MACRO(double, long double, long double)
|
||||
|
||||
#undef TRAITS_DEFINE_MACRO
|
||||
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//traits.h
|
||||
|
||||
#ifndef MVL_TRAITS_H
|
||||
#define MVL_TRAITS_H
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//simple promotion for now
|
||||
|
||||
//check if a type is a POD
|
||||
template<typename T>
|
||||
struct isPOD { enum { value = false }; };
|
||||
template<> struct isPOD<char> { enum { value = true }; };
|
||||
template<> struct isPOD<short> { enum { value = true }; };
|
||||
template<> struct isPOD<int> { enum { value = true }; };
|
||||
template<> struct isPOD<float> { enum { value = true }; };
|
||||
template<> struct isPOD<double> { enum { value = true }; };
|
||||
template<> struct isPOD<long double> { enum { value = true }; };
|
||||
|
||||
//
|
||||
template<bool Condition, typename T1, typename T2> struct ifThenElse { typedef T2 value_type; };
|
||||
template<typename T1, typename T2> struct ifThenElse<true, T1, T2> { typedef T1 value_type; };
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct promote_traits
|
||||
{
|
||||
typedef typename ifThenElse<isPOD<T1>::value, T2, T1>::value_type value_type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct promote_traits<T, T>
|
||||
{
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
#define TRAITS_DEFINE_MACRO(T1, T2, TP) \
|
||||
template<> \
|
||||
struct promote_traits<T1, T2> \
|
||||
{ \
|
||||
typedef TP value_type; \
|
||||
}; \
|
||||
template<> \
|
||||
struct promote_traits<T2, T1> \
|
||||
{ \
|
||||
typedef TP value_type; \
|
||||
};
|
||||
|
||||
TRAITS_DEFINE_MACRO(int, float, float)
|
||||
TRAITS_DEFINE_MACRO(int, double, double)
|
||||
TRAITS_DEFINE_MACRO(int, long double, long double)
|
||||
|
||||
TRAITS_DEFINE_MACRO(float, double, double)
|
||||
TRAITS_DEFINE_MACRO(float, long double, long double)
|
||||
|
||||
TRAITS_DEFINE_MACRO(double, long double, long double)
|
||||
|
||||
#undef TRAITS_DEFINE_MACRO
|
||||
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//util.h
|
||||
|
||||
#ifndef MVL_UTIL_H
|
||||
#define MVL_UTIL_H
|
||||
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
#include "vec.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//translation
|
||||
template<typename T>
|
||||
inline
|
||||
mat<T, 4, 4> translation(vec<T, 3> const& v)
|
||||
{
|
||||
return mat<T, 4, 4>(1, 0, 0, v(0),
|
||||
0, 1, 0, v(1),
|
||||
0, 0, 1, v(2),
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
//scale
|
||||
template<typename T>
|
||||
inline
|
||||
mat<T, 4, 4> scale(vec<T, 3> const& v)
|
||||
{
|
||||
return mat<T, 4, 4> (v(0), 0, 0, 0,
|
||||
0, v(1), 0, 0,
|
||||
0, 0, v(2), 0,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//util.h
|
||||
|
||||
#ifndef MVL_UTIL_H
|
||||
#define MVL_UTIL_H
|
||||
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
#include "vec.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
//translation
|
||||
template<typename T>
|
||||
inline
|
||||
mat<T, 4, 4> translation(vec<T, 3> const& v)
|
||||
{
|
||||
return mat<T, 4, 4>(1, 0, 0, v(0),
|
||||
0, 1, 0, v(1),
|
||||
0, 0, 1, v(2),
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
//scale
|
||||
template<typename T>
|
||||
inline
|
||||
mat<T, 4, 4> scale(vec<T, 3> const& v)
|
||||
{
|
||||
return mat<T, 4, 4> (v(0), 0, 0, 0,
|
||||
0, v(1), 0, 0,
|
||||
0, 0, v(2), 0,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
} // namespace mvl
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,347 +1,347 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//vec.h
|
||||
|
||||
#ifndef MVL_VEC_H
|
||||
#define MVL_VEC_H
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
template<typename T, std::size_t Sz>
|
||||
class vec
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef T* iterator;
|
||||
typedef T const* const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
public:
|
||||
enum {
|
||||
Size = Sz,
|
||||
};
|
||||
|
||||
public:
|
||||
//constructors
|
||||
explicit vec() {}
|
||||
|
||||
template<typename T2>
|
||||
vec(vec<T2, Size> const& v)
|
||||
{
|
||||
*this = v;
|
||||
}
|
||||
|
||||
explicit vec(value_type val)
|
||||
{
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3, value_type x4)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3, value_type x4, value_type x5)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4; m_data[5] = x5;
|
||||
}
|
||||
|
||||
public:
|
||||
//data access
|
||||
value_type operator[](std::size_t i) const { return m_data[i]; }
|
||||
reference operator[](std::size_t i) { return m_data[i]; }
|
||||
|
||||
value_type operator()(std::size_t i) const { return m_data[i]; }
|
||||
reference operator()(std::size_t i) { return m_data[i]; }
|
||||
|
||||
public:
|
||||
//stl
|
||||
static std::size_t size() { return Size; }
|
||||
static std::size_t max_size() { return Size; }
|
||||
static bool empty() { return false; }
|
||||
|
||||
iterator begin() { return m_data; }
|
||||
iterator end() { return m_data + Size; }
|
||||
const_iterator begin() const { return m_data; }
|
||||
const_iterator end() const { return m_data + Size; }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
value_type front() { return m_data[0]; }
|
||||
value_type back() { return m_data[Size - 1]; }
|
||||
const_reference front() const { return m_data[0]; }
|
||||
const_reference back() const { return m_data[Size - 1]; }
|
||||
|
||||
friend std::ostream& operator << (std::ostream& out, vec const& v) {
|
||||
out << "(";
|
||||
for(size_t i = 0; i < Size - 1; i++) {
|
||||
out << v(i) << ", ";
|
||||
}
|
||||
out << v(Size - 1) << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
public:
|
||||
//assignment
|
||||
vec& operator=(vec const& rhs) {
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = rhs[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2>
|
||||
vec& operator=(vec<T2, Size> const& rhs) {
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = rhs[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_data[Size];
|
||||
};
|
||||
|
||||
|
||||
//assignment operators
|
||||
// OP(vec<T1>, vec<T2>)
|
||||
// OP(vec<T>, T)
|
||||
|
||||
#define VEC_IMPLEMENT_MACRO(OP) \
|
||||
template<typename T1, typename T2, std::size_t Sz> \
|
||||
inline \
|
||||
vec<T1, Sz>& \
|
||||
operator OP(vec<T1, Sz>& lhs, vec<T2, Sz> const& rhs) { \
|
||||
for(int i = 0; i < Sz; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
template<typename T, std::size_t Sz> \
|
||||
inline \
|
||||
vec<T, Sz>& \
|
||||
operator OP(vec<T, Sz>& lhs, T const& rhs) { \
|
||||
for(int i = 0; i < Sz; ++i) { \
|
||||
lhs[i] OP rhs; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
|
||||
VEC_IMPLEMENT_MACRO(+=)
|
||||
VEC_IMPLEMENT_MACRO(-=)
|
||||
VEC_IMPLEMENT_MACRO(*=)
|
||||
VEC_IMPLEMENT_MACRO(/=)
|
||||
|
||||
#undef VEC_IMPLEMENT_MACRO
|
||||
|
||||
//operator + (vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator + (vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] + rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator - (vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator - (vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] - rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (vec, POD)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator * (vec<T1, Sz> const& lhs, T2 const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] * rhs;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (POD, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator * (T1 const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs * rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator / (vec, POD)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator / (vec<T1, Sz> const& lhs, T2 const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] / rhs;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_prod(vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
element_prod(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] * rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_div(vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
element_div(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] / rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//unary operator -(expr_vec)
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
vec<T, Sz>
|
||||
operator -(vec<T, Sz> const& rhs) {
|
||||
vec<T, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = -rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//dot product
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
typename promote_traits<T1, T2>::value_type
|
||||
dot(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
typename promote_traits<T1, T2>::value_type res(0);
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res += rhs[i] * lhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//cross product
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 3>
|
||||
cross(vec<T1, 3> const& lhs, vec<T2, 3> const& rhs) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
return vec<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2),
|
||||
rhs(0)*lhs(2) - lhs(0)*rhs(2),
|
||||
lhs(0)*rhs(1) - rhs(0)*lhs(1));
|
||||
}
|
||||
|
||||
//length of the vector
|
||||
template<typename T, std::size_t Sz>
|
||||
inline T
|
||||
norm2(vec<T, Sz> const& rhs)
|
||||
{
|
||||
return static_cast<T>(sqrt(dot(rhs, rhs)));
|
||||
}
|
||||
|
||||
//length of the vector squared
|
||||
template<typename T, std::size_t Sz>
|
||||
inline T
|
||||
norm_squared(vec<T, Sz> const& rhs)
|
||||
{
|
||||
return dot(rhs, rhs);
|
||||
}
|
||||
|
||||
//normalize the vector
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
vec<T, Sz>
|
||||
normalize(vec<T, Sz> const& v) {
|
||||
typedef T value_type;
|
||||
T tmp = norm2(v);
|
||||
if(tmp == value_type(0)) {
|
||||
tmp = value_type(0);
|
||||
} else {
|
||||
tmp = value_type(1) / tmp;
|
||||
}
|
||||
vec<T, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = v[i] * tmp;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//vec.h
|
||||
|
||||
#ifndef MVL_VEC_H
|
||||
#define MVL_VEC_H
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "base.h"
|
||||
#include "traits.h"
|
||||
|
||||
namespace mvl {
|
||||
|
||||
template<typename T, std::size_t Sz>
|
||||
class vec
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef T* iterator;
|
||||
typedef T const* const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
public:
|
||||
enum {
|
||||
Size = Sz,
|
||||
};
|
||||
|
||||
public:
|
||||
//constructors
|
||||
explicit vec() {}
|
||||
|
||||
template<typename T2>
|
||||
vec(vec<T2, Size> const& v)
|
||||
{
|
||||
*this = v;
|
||||
}
|
||||
|
||||
explicit vec(value_type val)
|
||||
{
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3, value_type x4)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||
}
|
||||
|
||||
explicit vec(value_type x0, value_type x1, value_type x2, value_type x3, value_type x4, value_type x5)
|
||||
{
|
||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4; m_data[5] = x5;
|
||||
}
|
||||
|
||||
public:
|
||||
//data access
|
||||
value_type operator[](std::size_t i) const { return m_data[i]; }
|
||||
reference operator[](std::size_t i) { return m_data[i]; }
|
||||
|
||||
value_type operator()(std::size_t i) const { return m_data[i]; }
|
||||
reference operator()(std::size_t i) { return m_data[i]; }
|
||||
|
||||
public:
|
||||
//stl
|
||||
static std::size_t size() { return Size; }
|
||||
static std::size_t max_size() { return Size; }
|
||||
static bool empty() { return false; }
|
||||
|
||||
iterator begin() { return m_data; }
|
||||
iterator end() { return m_data + Size; }
|
||||
const_iterator begin() const { return m_data; }
|
||||
const_iterator end() const { return m_data + Size; }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
value_type front() { return m_data[0]; }
|
||||
value_type back() { return m_data[Size - 1]; }
|
||||
const_reference front() const { return m_data[0]; }
|
||||
const_reference back() const { return m_data[Size - 1]; }
|
||||
|
||||
friend std::ostream& operator << (std::ostream& out, vec const& v) {
|
||||
out << "(";
|
||||
for(size_t i = 0; i < Size - 1; i++) {
|
||||
out << v(i) << ", ";
|
||||
}
|
||||
out << v(Size - 1) << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
public:
|
||||
//assignment
|
||||
vec& operator=(vec const& rhs) {
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = rhs[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2>
|
||||
vec& operator=(vec<T2, Size> const& rhs) {
|
||||
for(int i = 0; i < Size; ++i) {
|
||||
m_data[i] = rhs[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_data[Size];
|
||||
};
|
||||
|
||||
|
||||
//assignment operators
|
||||
// OP(vec<T1>, vec<T2>)
|
||||
// OP(vec<T>, T)
|
||||
|
||||
#define VEC_IMPLEMENT_MACRO(OP) \
|
||||
template<typename T1, typename T2, std::size_t Sz> \
|
||||
inline \
|
||||
vec<T1, Sz>& \
|
||||
operator OP(vec<T1, Sz>& lhs, vec<T2, Sz> const& rhs) { \
|
||||
for(int i = 0; i < Sz; ++i) { \
|
||||
lhs[i] OP rhs[i]; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
template<typename T, std::size_t Sz> \
|
||||
inline \
|
||||
vec<T, Sz>& \
|
||||
operator OP(vec<T, Sz>& lhs, T const& rhs) { \
|
||||
for(int i = 0; i < Sz; ++i) { \
|
||||
lhs[i] OP rhs; \
|
||||
} \
|
||||
return lhs; \
|
||||
} \
|
||||
|
||||
VEC_IMPLEMENT_MACRO(+=)
|
||||
VEC_IMPLEMENT_MACRO(-=)
|
||||
VEC_IMPLEMENT_MACRO(*=)
|
||||
VEC_IMPLEMENT_MACRO(/=)
|
||||
|
||||
#undef VEC_IMPLEMENT_MACRO
|
||||
|
||||
//operator + (vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator + (vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] + rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator - (vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator - (vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] - rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (vec, POD)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator * (vec<T1, Sz> const& lhs, T2 const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] * rhs;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator * (POD, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator * (T1 const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs * rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//operator / (vec, POD)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
operator / (vec<T1, Sz> const& lhs, T2 const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] / rhs;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_prod(vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
element_prod(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] * rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//element_div(vec, vec)
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz>
|
||||
element_div(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs) {
|
||||
vec<typename promote_traits<T1, T2>::value_type, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = lhs[i] / rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//unary operator -(expr_vec)
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
vec<T, Sz>
|
||||
operator -(vec<T, Sz> const& rhs) {
|
||||
vec<T, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = -rhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//dot product
|
||||
template<typename T1, typename T2, std::size_t Sz>
|
||||
inline
|
||||
typename promote_traits<T1, T2>::value_type
|
||||
dot(vec<T1, Sz> const& lhs, vec<T2, Sz> const& rhs)
|
||||
{
|
||||
typename promote_traits<T1, T2>::value_type res(0);
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res += rhs[i] * lhs[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//cross product
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
vec<typename promote_traits<T1, T2>::value_type, 3>
|
||||
cross(vec<T1, 3> const& lhs, vec<T2, 3> const& rhs) {
|
||||
typedef typename promote_traits<T1, T2>::value_type value_type;
|
||||
return vec<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2),
|
||||
rhs(0)*lhs(2) - lhs(0)*rhs(2),
|
||||
lhs(0)*rhs(1) - rhs(0)*lhs(1));
|
||||
}
|
||||
|
||||
//length of the vector
|
||||
template<typename T, std::size_t Sz>
|
||||
inline T
|
||||
norm2(vec<T, Sz> const& rhs)
|
||||
{
|
||||
return static_cast<T>(sqrt(dot(rhs, rhs)));
|
||||
}
|
||||
|
||||
//length of the vector squared
|
||||
template<typename T, std::size_t Sz>
|
||||
inline T
|
||||
norm_squared(vec<T, Sz> const& rhs)
|
||||
{
|
||||
return dot(rhs, rhs);
|
||||
}
|
||||
|
||||
//normalize the vector
|
||||
template<typename T, std::size_t Sz>
|
||||
inline
|
||||
vec<T, Sz>
|
||||
normalize(vec<T, Sz> const& v) {
|
||||
typedef T value_type;
|
||||
T tmp = norm2(v);
|
||||
if(tmp == value_type(0)) {
|
||||
tmp = value_type(0);
|
||||
} else {
|
||||
tmp = value_type(1) / tmp;
|
||||
}
|
||||
vec<T, Sz> res;
|
||||
for(int i = 0; i < Sz; ++i) {
|
||||
res[i] = v[i] * tmp;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
} //namespace mvl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user