├── .github └── workflows │ └── ci-build.yml ├── CMake ├── CMakeLists.txt ├── Packages │ ├── FindFreetype.cmake │ ├── FindOGITOR.cmake │ └── FindOgreProcedural.cmake ├── Templates │ ├── ProceduralPlatform.h.in │ ├── SDK_CMakeLists.txt.in │ ├── SDK_Samples_CMakeLists.txt.in │ ├── VisualStudioUserFile.vcproj.user.in │ ├── VisualStudioUserFile.vcxproj.user.in │ ├── a2x.cfg.in │ ├── html.cfg.in │ ├── resources.cfg │ └── version.txt.in └── Utils │ ├── FindPkgMacros.cmake │ ├── PrecompiledHeader.cmake │ ├── PreprocessorUtils.cmake │ ├── ProceduralAddTargets.cmake │ ├── ProceduralConfigTargets.cmake │ └── ProceduralMacros.cmake ├── CMakeLists.txt ├── Contributors.txt ├── LICENSE ├── ReadMe.md ├── SDK ├── buildsdk.bat ├── buildsdkcodeblocks.bat └── removeabsolutepaths.vbs ├── docs ├── CMakeLists.txt ├── ReadMe.txt ├── illustrations │ ├── extrusion │ │ ├── extruder_generic.lua │ │ ├── extruder_multishape.lua │ │ ├── extruder_rotationtrack.lua │ │ ├── extruder_scaletrack.lua │ │ ├── extruder_texturetrack.lua │ │ ├── lathe_anglerange.lua │ │ └── lathe_generic.lua │ ├── meshmodifiers │ │ ├── BoxUVModifier.lua │ │ ├── CalculateNormalsTriangle.lua │ │ └── CalculateNormalsVertex.lua │ ├── primitives │ │ ├── primitive_box.lua │ │ ├── primitive_capsule.lua │ │ ├── primitive_cone.lua │ │ ├── primitive_cylinder.lua │ │ ├── primitive_icosphere.lua │ │ ├── primitive_plane.lua │ │ ├── primitive_roundedbox.lua │ │ ├── primitive_sphere.lua │ │ ├── primitive_spring.lua │ │ ├── primitive_torus.lua │ │ ├── primitive_torusknot.lua │ │ └── primitive_tube.lua │ ├── shapes │ │ ├── shape_booleandifference.lua │ │ ├── shape_booleanintersection.lua │ │ ├── shape_booleansetup.lua │ │ ├── shape_booleanunion.lua │ │ ├── shape_circle.lua │ │ ├── shape_ellipse.lua │ │ ├── shape_geometricmirror_point.lua │ │ ├── shape_geometricmirror_yaxis.lua │ │ ├── shape_geometricrotate.lua │ │ ├── shape_geometricscale.lua │ │ ├── shape_geometricsetup.lua │ │ ├── shape_geometrictranslate.lua │ │ ├── shape_rectangle.lua │ │ ├── shape_thick1.lua │ │ ├── shape_thick2.lua │ │ ├── shape_triangle.lua │ │ ├── shape_triangulation.lua │ │ ├── spline_beziercurve.lua │ │ ├── spline_catmull.lua │ │ ├── spline_cubichermite.lua │ │ ├── spline_helix.lua │ │ ├── spline_kochanekbartels.lua │ │ └── spline_roundedcorner.lua │ └── texture │ │ ├── texture_alpha.lua │ │ ├── texture_alphamask.lua │ │ ├── texture_blit.lua │ │ ├── texture_blur_1.lua │ │ ├── texture_blur_2.lua │ │ ├── texture_cell_chess.lua │ │ ├── texture_cell_default.lua │ │ ├── texture_cell_grid.lua │ │ ├── texture_cell_smooth.lua │ │ ├── texture_channel_1.lua │ │ ├── texture_channel_2.lua │ │ ├── texture_circle.lua │ │ ├── texture_cloud.lua │ │ ├── texture_colours.lua │ │ ├── texture_combine.lua │ │ ├── texture_convolution.lua │ │ ├── texture_crack.lua │ │ ├── texture_cycloid_epicycloid.lua │ │ ├── texture_cycloid_epitrochoid.lua │ │ ├── texture_cycloid_hypocycloid.lua │ │ ├── texture_cycloid_hypotrochoid.lua │ │ ├── texture_cycloid_lissajous.lua │ │ ├── texture_cycloid_rose.lua │ │ ├── texture_dilate.lua │ │ ├── texture_distort.lua │ │ ├── texture_edgedetection.lua │ │ ├── texture_ellipse.lua │ │ ├── texture_flip_1.lua │ │ ├── texture_flip_2.lua │ │ ├── texture_flip_3.lua │ │ ├── texture_glow.lua │ │ ├── texture_gradient.lua │ │ ├── texture_image.lua │ │ ├── texture_invert.lua │ │ ├── texture_jitter.lua │ │ ├── texture_labyrinth.lua │ │ ├── texture_lerp.lua │ │ ├── texture_light.lua │ │ ├── texture_lookup.lua │ │ ├── texture_marble.lua │ │ ├── texture_noise_perlin.lua │ │ ├── texture_noise_white.lua │ │ ├── texture_normals.lua │ │ ├── texture_normals_tip.lua │ │ ├── texture_oilpaint.lua │ │ ├── texture_randompixels.lua │ │ ├── texture_rectangle.lua │ │ ├── texture_rotationzoom.lua │ │ ├── texture_segment.lua │ │ ├── texture_sharpen_1.lua │ │ ├── texture_sharpen_2.lua │ │ ├── texture_solid.lua │ │ ├── texture_text.lua │ │ ├── texture_textile.lua │ │ ├── texture_threshold.lua │ │ ├── texture_vortex.lua │ │ └── texture_wood.lua ├── images │ └── Extrusion.jpg └── manual │ ├── extruder.md │ ├── howto.md │ ├── illustrations │ ├── CMakeLists.txt │ ├── include │ │ └── Illustrations.h │ └── src │ │ └── Illustrations.cpp │ ├── manual.md │ ├── primitives.md │ ├── shapepath.md │ └── texture.md ├── library ├── CMakeLists.txt ├── include │ ├── Procedural.h │ ├── ProceduralBoolean.h │ ├── ProceduralBoxGenerator.h │ ├── ProceduralCapsuleGenerator.h │ ├── ProceduralConeGenerator.h │ ├── ProceduralCylinderGenerator.h │ ├── ProceduralDebugRendering.h │ ├── ProceduralExtruder.h │ ├── ProceduralGeometryHelpers.h │ ├── ProceduralIcoSphereGenerator.h │ ├── ProceduralLathe.h │ ├── ProceduralMeshGenerator.h │ ├── ProceduralMeshModifiers.h │ ├── ProceduralMultiShape.h │ ├── ProceduralMultiShapeGenerators.h │ ├── ProceduralNoise.h │ ├── ProceduralPath.h │ ├── ProceduralPathGenerators.h │ ├── ProceduralPathGeneratorsBase.h │ ├── ProceduralPlaneGenerator.h │ ├── ProceduralPrismGenerator.h │ ├── ProceduralRoundedBoxGenerator.h │ ├── ProceduralSVG.h │ ├── ProceduralShape.h │ ├── ProceduralShapeGenerators.h │ ├── ProceduralShapeGeneratorsBase.h │ ├── ProceduralSphereGenerator.h │ ├── ProceduralSplines.h │ ├── ProceduralSpringGenerator.h │ ├── ProceduralStableHeaders.h │ ├── ProceduralTextureBuffer.h │ ├── ProceduralTextureGenerator.h │ ├── ProceduralTextureModifiers.h │ ├── ProceduralTorusGenerator.h │ ├── ProceduralTorusKnotGenerator.h │ ├── ProceduralTrack.h │ ├── ProceduralTriangleBuffer.h │ ├── ProceduralTriangulator.h │ ├── ProceduralTubeGenerator.h │ ├── ProceduralUtils.h │ └── rapidxml │ │ └── rapidxml.hpp └── src │ ├── ProceduralBoolean.cpp │ ├── ProceduralBoxGenerator.cpp │ ├── ProceduralCapsuleGenerator.cpp │ ├── ProceduralConeGenerator.cpp │ ├── ProceduralCylinderGenerator.cpp │ ├── ProceduralDebugRendering.cpp │ ├── ProceduralExtruder.cpp │ ├── ProceduralGeometryHelpers.cpp │ ├── ProceduralIcoSphereGenerator.cpp │ ├── ProceduralLathe.cpp │ ├── ProceduralMeshModifiers.cpp │ ├── ProceduralMultiShape.cpp │ ├── ProceduralMultiShapeGenerators.cpp │ ├── ProceduralNoise.cpp │ ├── ProceduralPath.cpp │ ├── ProceduralPathGenerators.cpp │ ├── ProceduralPlaneGenerator.cpp │ ├── ProceduralPrecompiledHeaders.cpp │ ├── ProceduralPrismGenerator.cpp │ ├── ProceduralRoundedBoxGenerator.cpp │ ├── ProceduralSVG.cpp │ ├── ProceduralShape.cpp │ ├── ProceduralShapeGenerators.cpp │ ├── ProceduralSphereGenerator.cpp │ ├── ProceduralSpringGenerator.cpp │ ├── ProceduralTextureBuffer.cpp │ ├── ProceduralTextureGenerator.cpp │ ├── ProceduralTextureModifiers.cpp │ ├── ProceduralTorusGenerator.cpp │ ├── ProceduralTorusKnotGenerator.cpp │ ├── ProceduralTrack.cpp │ ├── ProceduralTriangleBuffer.cpp │ ├── ProceduralTriangulator.cpp │ ├── ProceduralTubeGenerator.cpp │ └── ProceduralUtils.cpp ├── samples ├── CMakeLists.txt ├── common │ ├── include │ │ └── BaseApplication.h │ └── src │ │ └── BaseApplication.cpp ├── extrusion │ ├── CMakeLists.txt │ ├── include │ │ └── Extrusion.h │ └── src │ │ └── Extrusion.cpp ├── material │ ├── CMakeLists.txt │ ├── include │ │ └── Material.h │ └── src │ │ └── Material.cpp ├── media │ ├── Box.lua │ ├── Examples.material │ ├── luaTest.lua │ ├── marble.jpg │ ├── old_fence.jpg │ ├── red_brick.jpg │ ├── road.png │ └── test.svg ├── primitives │ ├── CMakeLists.txt │ ├── include │ │ └── Primitives.h │ └── src │ │ └── Primitives.cpp └── svg │ ├── CMakeLists.txt │ ├── include │ └── Svg.h │ └── src │ └── Svg.cpp ├── tests ├── CMakeLists.txt ├── include │ └── Tests.h ├── scripts │ └── primitives │ │ └── Box.lua └── src │ └── Tests.cpp └── tools ├── CMakeLists.txt ├── ScriptInterpreter ├── CMakeLists.txt ├── include │ └── ScriptInterpreter.h ├── ogre.i ├── procedural.i └── src │ └── ScriptInterpreter.cpp └── ogitorPlugin ├── CMakeLists.txt ├── include └── Plugin.h └── src └── Plugin.cpp /.github/workflows/ci-build.yml: -------------------------------------------------------------------------------- 1 | name: CI Build 2 | on: 3 | push: 4 | branches: [master] 5 | pull_request: 6 | branches: [master] 7 | jobs: 8 | linux: 9 | runs-on: ubuntu-22.04 10 | steps: 11 | - name: Install Dependencies 12 | run: | 13 | sudo apt update 14 | sudo apt install -y cmake g++ libogre-1.12-dev 15 | - uses: actions/checkout@v2 16 | - name: Test 17 | run: | 18 | cmake -Bbuild . 19 | cmake --build build -- -j 2 20 | -------------------------------------------------------------------------------- /CMake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WIN32 OR APPLE) 2 | set(OgreProcedural_CMAKE_DIR "CMake") 3 | else() 4 | set(OgreProcedural_CMAKE_DIR "${OgreProcedural_LIB_DIRECTORY}/OgreProcedural/cmake") 5 | endif() 6 | 7 | set(INST_FILES 8 | Packages/FindOgreProcedural.cmake 9 | Utils/FindPkgMacros.cmake 10 | Utils/PreprocessorUtils.cmake 11 | Utils/ProceduralConfigTargets.cmake 12 | Utils/ProceduralMacros.cmake 13 | ) 14 | 15 | if (OgreProcedural_INSTALL_SAMPLES_SOURCE) 16 | set(INST_FILES ${INST_FILES} 17 | Templates/resources.cfg 18 | Templates/resources_d.cfg 19 | ) 20 | endif() 21 | 22 | if (WIN32) 23 | set(INST_FILES ${INST_FILES} 24 | Templates/VisualStudioUserFile.vcproj.user.in 25 | Templates/VisualStudioUserFile.vcxproj.user.in 26 | ) 27 | endif () 28 | 29 | if (APPLE) 30 | set(INST_FILES ${INST_FILES} 31 | Packages/FindIOKit.cmake 32 | ) 33 | set(STATIC_INST_FILES ${STATIC_INST_FILES} 34 | Packages/FindCarbon.cmake 35 | Packages/FindCocoa.cmake 36 | Packages/FindiPhoneSDK.cmake 37 | ) 38 | endif () 39 | 40 | install(FILES ${INST_FILES} DESTINATION ${OgreProcedural_CMAKE_DIR}) 41 | -------------------------------------------------------------------------------- /CMake/Packages/FindFreetype.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------- 2 | # This file is part of the CMake build system for OGRE 3 | # (Object-oriented Graphics Rendering Engine) 4 | # For the latest info, see http://www.ogre3d.org/ 5 | # 6 | # The contents of this file are placed in the public domain. Feel 7 | # free to make use of it in any way you like. 8 | #------------------------------------------------------------------- 9 | 10 | # - Try to find FreeType 11 | # Once done, this will define 12 | # 13 | # FREETYPE_FOUND - system has FreeType 14 | # FREETYPE_INCLUDE_DIRS - the FreeType include directories 15 | # FREETYPE_LIBRARIES - link these to use FreeType 16 | 17 | include(FindPkgMacros) 18 | findpkg_begin(FREETYPE) 19 | 20 | # Get path, convert backslashes as ${ENV_${var}} 21 | getenv_path(FREETYPE_HOME) 22 | 23 | # construct search paths 24 | set(FREETYPE_PREFIX_PATH ${FREETYPE_HOME} ${ENV_FREETYPE_HOME}) 25 | create_search_paths(FREETYPE) 26 | # redo search if prefix path changed 27 | clear_if_changed(FREETYPE_PREFIX_PATH 28 | FREETYPE_LIBRARY_FWK 29 | FREETYPE_LIBRARY_REL 30 | FREETYPE_LIBRARY_DBG 31 | FREETYPE_INCLUDE_DIR 32 | ) 33 | 34 | set(FREETYPE_LIBRARY_NAMES freetype253 freetype252 freetype251 freetype2501 freetype250 freetype2412 freetype2411 freetype2410 freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype) 35 | get_debug_names(FREETYPE_LIBRARY_NAMES) 36 | 37 | use_pkgconfig(FREETYPE_PKGC freetype2) 38 | 39 | # prefer static library over framework 40 | set(CMAKE_FIND_FRAMEWORK "LAST") 41 | 42 | message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") 43 | findpkg_framework(FREETYPE) 44 | message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") 45 | 46 | find_path(FREETYPE_INCLUDE_DIR NAMES freetype.h freetype/freetype.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES freetype2) 47 | find_path(FREETYPE_FT2BUILD_INCLUDE_DIR NAMES ft2build.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES freetype2) 48 | 49 | find_library(FREETYPE_LIBRARY_REL NAMES ${FREETYPE_LIBRARY_NAMES} HINTS ${FREETYPE_LIB_SEARCH_PATH} ${FREETYPE_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel) 50 | find_library(FREETYPE_LIBRARY_DBG NAMES ${FREETYPE_LIBRARY_NAMES_DBG} HINTS ${FREETYPE_LIB_SEARCH_PATH} ${FREETYPE_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug) 51 | 52 | make_library_set(FREETYPE_LIBRARY) 53 | 54 | findpkg_finish(FREETYPE) 55 | mark_as_advanced(FREETYPE_FT2BUILD_INCLUDE_DIR) 56 | if (NOT FREETYPE_FT2BUILD_INCLUDE_DIR STREQUAL FREETYPE_INCLUDE_DIR) 57 | set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_FT2BUILD_INCLUDE_DIR}) 58 | endif () 59 | 60 | # Reset framework finding 61 | set(CMAKE_FIND_FRAMEWORK "FIRST") 62 | -------------------------------------------------------------------------------- /CMake/Packages/FindOGITOR.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # OGITOR BUILD SYSTEM 3 | # Welcome to the CMake build system for OGITOR. 4 | # This is the main file where we prepare the general build environment 5 | # and provide build configuration options. 6 | ###################################################################### 7 | 8 | # - Try to find Ogitor 9 | # Once done, this will define 10 | # 11 | # OGITOR_FOUND - system has Ogitor 12 | # OGITOR_INCLUDE_DIRS - the Ogitor include directories 13 | # OGITOR_LIBRARIES - link these to use Ogitor 14 | 15 | include(FindPkgMacros) 16 | include(PreprocessorUtils) 17 | findpkg_begin(OGITOR) 18 | 19 | # Get path, convert backslashes as ${ENV_${var}} 20 | getenv_path(OGITOR_HOME) 21 | 22 | # construct search paths 23 | set(OGITOR_PREFIX_PATH ${OGITOR_HOME} ${ENV_OGITOR_HOME} /usr/local /usr/local/include /usr/local/lib /usr/include /usr/lib /usr/local/include/ogitor /usr/include/ogitor /usr/lib/ogitor /usr/local/lib/ogitor) 24 | create_search_paths(OGITOR) 25 | # redo search if prefix path changed 26 | clear_if_changed(OGITOR_PREFIX_PATH 27 | OGITOR_LIBRARY_REL 28 | OGITOR_LIBRARY_DBG 29 | OGITOR_INCLUDE_DIR 30 | OGITOR_LIBRARIES 31 | ) 32 | 33 | set(OGITOR_LIBRARY_NAMES Ogitor) 34 | get_debug_names(OGITOR_LIBRARY_NAMES) 35 | 36 | use_pkgconfig(OGITOR_PKGC OGITOR) 37 | 38 | findpkg_framework(OGITOR) 39 | 40 | find_path(OGITOR_INCLUDE_DIR NAMES Ogitors.h HINTS ${OGITOR_INC_SEARCH_PATH} ${OGITOR_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Ogitor) 41 | find_library(OGITOR_LIBRARY_REL NAMES ${OGITOR_LIBRARY_NAMES} HINTS ${OGITOR_LIB_SEARCH_PATH} ${OGITOR_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) 42 | find_library(OGITOR_LIBRARY_DBG NAMES ${OGITOR_LIBRARY_NAMES_DBG} HINTS ${OGITOR_LIB_SEARCH_PATH} ${OGITOR_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) 43 | make_library_set(OGITOR_LIBRARY) 44 | 45 | if(OGITOR_INCLUDE_DIR AND OGITOR_LIBRARY_REL AND OGITOR_LIBRARY_DBG) 46 | set(OGITOR_FOUND TRUE) 47 | endif(OGITOR_INCLUDE_DIR AND OGITOR_LIBRARY_REL AND OGITOR_LIBRARY_DBG) 48 | set(OGITOR_LIBRARIES optimized ${OGITOR_LIBRARY_REL} debug ${OGITOR_LIBRARY_DBG}) 49 | set(OGITOR_LIBRARIES ${OGITOR_LIBRARIES} CACHE STRING "Ogitor libraries") 50 | set(OGITOR_INCLUDE_DIRS ${OGITOR_INCLUDE_DIR}) 51 | 52 | findpkg_finish(OGITOR) 53 | 54 | add_parent_dir(OGITOR_INCLUDE_DIRS OGITOR_INCLUDE_DIR) 55 | set(OGITOR_DEPENDENCY_INCLUDE_DIR "${OGITOR_INCLUDE_DIRS}/dependencies/include" CACHE STRING "Ogitor dependency include dir") 56 | set(OGITOR_DEPENDENCY_LIB_DIR "${OGITOR_INCLUDE_DIRS}/dependencies/lib" CACHE STRING "Ogitor dependency library dir") 57 | 58 | # Dependencies 59 | set(OGITOR_DEPENDENCIES_INCLUDES 60 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/PagedGeometry" 61 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Caelum-0.5.0/main" 62 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/HYDRAX/Hydrax/src/Hydrax" 63 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/SkyX" 64 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/MeshMagick" 65 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript" 66 | #"${OGITOR_DEPENDENCY_INCLUDE_DIR}/lua/src" 67 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/autowrapper" 68 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptbuilder" 69 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptstdstring" 70 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptmath" 71 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptarray" 72 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/quaternion" 73 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/vector3" 74 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/debugger" 75 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/OFS" 76 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/GenericTextEditor" 77 | "${OGITOR_DEPENDENCY_INCLUDE_DIR}/GenericImageEditor" 78 | ) 79 | set(OGITOR_DEPENDENCIES_INCLUDES ${OGITOR_DEPENDENCIES_INCLUDES} CACHE STRING "Ogitor dependency includes") 80 | message(STATUS "${OGITOR_DEPENDENCIES_INCLUDES} OGITOR_DEPENDENCIES_INCLUDES.") 81 | message(STATUS "${OGITOR_DEPENDENCY_INCLUDE_DIR} OGITOR_DEPENDENCY_INCLUDE_DIR.") 82 | message(STATUS "${OGITOR_DEPENDENCY_LIB_DIR} OGITOR_DEPENDENCY_LIB_DIR.") 83 | -------------------------------------------------------------------------------- /CMake/Packages/FindOgreProcedural.cmake: -------------------------------------------------------------------------------- 1 | # Tries to find OgreProcedural 2 | # Will look for OgreProcedural_HOME, as well as usual suspects 3 | # 4 | # Once found, the following variables will be defined : 5 | # OgreProcedural_FOUND - system has OgreProcedural 6 | # OgreProcedural_INCLUDE_DIR - the OgreProcedural include directory 7 | # OgreProcedural_LIBRARIES - link these to use OgreProcedural 8 | # OgreProcedural_BINARY_REL / OgreProcedural_BINARY_DBG - DLL names (windows only) 9 | 10 | include(FindPkgMacros) 11 | include(PreprocessorUtils) 12 | 13 | findpkg_begin(OgreProcedural) 14 | 15 | getenv_path(OgreProcedural_HOME) 16 | getenv_path(PROGRAMFILES) 17 | 18 | # construct search paths from environmental hints and 19 | # OS specific guesses 20 | if (WIN32) 21 | set(OgreProcedural_PREFIX_GUESSES 22 | ${ENV_PROGRAMFILES}/OgreProcedural 23 | C:/OgreProceduralSDK 24 | ) 25 | elseif (UNIX) 26 | set(OgreProcedural_PREFIX_GUESSES 27 | /opt/OgreProcedural 28 | /opt/OgreProcedural 29 | /usr/lib${LIB_SUFFIX}/OgreProcedural 30 | /usr/lib${LIB_SUFFIX}/OgreProcedural 31 | /usr/local/lib${LIB_SUFFIX}/OgreProcedural 32 | /usr/local/lib${LIB_SUFFIX}/OgreProcedural 33 | $ENV{HOME}/OgreProcedural 34 | $ENV{HOME}/OgreProcedural 35 | ) 36 | endif () 37 | 38 | set(OgreProcedural_PREFIX_PATH 39 | ${OgreProcedural_HOME} ${OgreProcedural_SDK} ${ENV_OgreProcedural_HOME} ${ENV_OgreProcedural_SDK} 40 | ${OgreProcedural_PREFIX_GUESSES} 41 | ) 42 | create_search_paths(OgreProcedural) 43 | 44 | set(OgreProcedural_LIBRARY_NAMES "OgreProcedural") 45 | get_debug_names(OgreProcedural_LIBRARY_NAMES) 46 | 47 | find_path(OgreProcedural_INCLUDE_DIR NAMES Procedural.h HINTS ${OgreProcedural_CONFIG_INCLUDE_DIR} ${OgreProcedural_INC_SEARCH_PATH} ${OgreProcedural_FRAMEWORK_INCLUDES} ${OgreProcedural_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OgreProcedural") 48 | 49 | find_library(OgreProcedural_LIBRARY_REL NAMES ${OgreProcedural_LIBRARY_NAMES} HINTS ${OgreProcedural_LIB_SEARCH_PATH} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel") 50 | find_library(OgreProcedural_LIBRARY_DBG NAMES ${OgreProcedural_LIBRARY_NAMES_DBG} HINTS ${OgreProcedural_LIB_SEARCH_PATH} PATH_SUFFIXES "" "debug") 51 | 52 | if (WIN32) 53 | set(OgreProcedural_BIN_SEARCH_PATH "${OgreProcedural_HOME}/bin" "${ENV_OgreProcedural}/bin") 54 | find_file(OgreProcedural_BINARY_REL NAMES "OgreProcedural.dll" HINTS ${OgreProcedural_BIN_SEARCH_PATH} 55 | PATH_SUFFIXES "" release relwithdebinfo minsizerel) 56 | find_file(OgreProcedural_BINARY_DBG NAMES "OgreProcedural_d.dll" HINTS ${OgreProcedural_BIN_SEARCH_PATH} 57 | PATH_SUFFIXES "" debug ) 58 | endif() 59 | mark_as_advanced(OgreProcedural_BINARY_REL OgreProcedural_BINARY_DBG) 60 | 61 | make_library_set(OgreProcedural_LIBRARY) 62 | 63 | findpkg_finish(OgreProcedural) 64 | -------------------------------------------------------------------------------- /CMake/Templates/ProceduralPlatform.h.in: -------------------------------------------------------------------------------- 1 | #ifndef PROCEDURAL_PLATFORM_INCLUDED 2 | #define PROCEDURAL_PLATFORM_INCLUDED 3 | 4 | #define @OgreProcedural_CONFIG_FREETYPE@ 5 | 6 | #define PROCEDURAL_VERSION_MAJOR @OgreProcedural_VERSION_MAJOR@ 7 | #define PROCEDURAL_VERSION_MINOR @OgreProcedural_VERSION_MINOR@ 8 | #define PROCEDURAL_VERSION_PATCH @OgreProcedural_VERSION_PATCH@ 9 | #define PROCEDURAL_VERSION_DASH_SEPARATED "@OgreProcedural_VERSION_DASH_SEPARATED@" 10 | 11 | #define PROCEDURAL_VERSION ((PROCEDURAL_VERSION_MAJOR << 16) | (PROCEDURAL_VERSION_MINOR << 8) | PROCEDURAL_VERSION_PATCH) 12 | 13 | #define PROCEDURAL_PLATFORM_WIN32 1 14 | #define PROCEDURAL_PLATFORM_LINUX 2 15 | #define PROCEDURAL_PLATFORM_APPLE 3 16 | #define PROCEDURAL_PLATFORM_SYMBIAN 4 17 | #define PROCEDURAL_PLATFORM_APPLE_IOS 5 18 | #define PROCEDURAL_PLATFORM_ANDROID 6 19 | #define PROCEDURAL_PLATFORM_TEGRA2 7 20 | #define PROCEDURAL_PLATFORM_NACL 8 21 | 22 | #if defined( __SYMBIAN32__ ) 23 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_SYMBIAN 24 | #elif defined( __WIN32__ ) || defined( _WIN32 ) 25 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_WIN32 26 | #elif defined( __APPLE_CC__) 27 | # if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 28 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_IPHONE 29 | # else 30 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_APPLE 31 | # endif 32 | #elif defined(linux) && defined(__arm__) 33 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_TEGRA2 34 | #elif defined(__ANDROID__) 35 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_ANDROID 36 | #else 37 | # define PROCEDURAL_PLATFORM PROCEDURAL_PLATFORM_LINUX 38 | #endif 39 | 40 | #if PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_LINUX || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_APPLE || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_APPLE_IOS || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_IPHONE || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_ANDROID || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_TEGRA2 41 | # define _ProceduralExport 42 | #elif PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32 && defined(PROCEDURAL_SHARED) 43 | # if defined( OgreProcedural_EXPORTS ) 44 | # define _ProceduralExport __declspec( dllexport ) 45 | # else 46 | # if defined( __MINGW32__ ) 47 | # define _ProceduralExport 48 | # else 49 | # define _ProceduralExport __declspec( dllimport ) 50 | # endif 51 | # endif 52 | #else 53 | # define _ProceduralExport 54 | #endif 55 | 56 | # if (!defined(NDEBUG)) 57 | # define PROCEDURAL_DEBUG_MODE 1 58 | # else 59 | # define PROCEDURAL_DEBUG_MODE 0 60 | # endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /CMake/Templates/SDK_CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | # Just debug / release since that's all that's included in SDK 4 | set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) 5 | 6 | 7 | project(OgreProcedural) 8 | 9 | # Find actual Procedural root 10 | if (WIN32 OR APPLE) 11 | get_filename_component(OgreProcedural_ROOT_DIR "${OgreProcedural_SOURCE_DIR}" ABSOLUTE) 12 | set(OgreProcedural_TEMPLATES_DIR "${OgreProcedural_ROOT_DIR}/cmake") 13 | set(OgreProcedural_WORK_DIR "${OgreProcedural_ROOT_DIR}") 14 | set(CMAKE_MODULE_PATH "${OgreProcedural_ROOT_DIR}/cmake") 15 | elseif (UNIX) 16 | get_filename_component(OgreProcedural_ROOT_DIR "${OgreProcedural_SOURCE_DIR}/../.." ABSOLUTE) 17 | set(OgreProcedural_TEMPLATES_DIR "${OgreProcedural_ROOT_DIR}/lib/OgreProcedural/cmake") 18 | set(OgreProcedural_WORK_DIR "${OgreProcedural_ROOT_DIR}") 19 | set(CMAKE_MODULE_PATH "${OGRE_ROOT_DIR}/lib/OGRE/cmake") 20 | endif () 21 | 22 | # Set a default build type for mingw, as it doesn't like it being empty 23 | if (MINGW) 24 | set(CMAKE_BUILD_TYPE "Release") 25 | endif() 26 | 27 | set(OgreProcedural_VERSION_DASH_SEPARATED "0.2") 28 | 29 | set(CMAKE_PREFIX_PATH "${OgreProcedural_ROOT_DIR}") 30 | 31 | set(CMAKE_DEBUG_POSTFIX "_d") 32 | 33 | if (WIN32 OR APPLE) 34 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 35 | set(CMAKE_INSTALL_PREFIX 36 | "${OgreProcedural_BINARY_DIR}/sdk" CACHE PATH "OgreProcedural install prefix" FORCE 37 | ) 38 | endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 39 | endif(WIN32 OR APPLE) 40 | 41 | 42 | get_filename_component(OgreProcedural_HOME "${OgreProcedural_SOURCE_DIR}" ABSOLUTE) 43 | 44 | find_package(OGRE REQUIRED) 45 | find_package(OIS REQUIRED) 46 | find_package(OgreProcedural REQUIRED) 47 | 48 | if (NOT DEFINED BOOST_ROOT) 49 | message(STATUS "BOOST_ROOT not defined. Searching for it in ogre subdir") 50 | file(GLOB BOOST_POSSIBLE_PATH "${OGRE_HOME}/boost*") 51 | if (EXISTS "${BOOST_POSSIBLE_PATH}") 52 | message(STATUS "setting BOOST_ROOT=${BOOST_POSSIBLE_PATH}") 53 | set (BOOST_ROOT "${BOOST_POSSIBLE_PATH}" CACHE PATH "boost root") 54 | endif() 55 | endif() 56 | 57 | find_package(Boost) 58 | 59 | if (Boost_FOUND) 60 | include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) 61 | link_directories(${Boost_LIBRARY_DIRS}) 62 | endif () 63 | 64 | option(OgreProcedural_BUILD_SAMPLES "Build OgreProcedural samples." TRUE) 65 | 66 | # Specify build paths 67 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/lib") 68 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/lib") 69 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/bin") 70 | 71 | set(OgreProcedural_TEMPLATES_DIR "${OgreProcedural_SOURCE_DIR}/CMake") 72 | set(OgreProcedural_WORK_DIR ${OgreProcedural_BINARY_DIR}) 73 | 74 | include_directories( 75 | ${OgreProcedural_INCLUDE_DIRS} 76 | ) 77 | 78 | include(ProceduralMacros) 79 | include(ProceduralConfigTargets) 80 | 81 | add_subdirectory(samples) -------------------------------------------------------------------------------- /CMake/Templates/SDK_Samples_CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | find_package(OIS REQUIRED) 2 | 3 | if(NOT OIS_FOUND) 4 | message(SEND_ERROR "Failed to find OIS.") 5 | endif() 6 | 7 | # if win32, copy the Ogre DLLs and media over 8 | if(WIN32) 9 | copy_release_dir(OgreProcedural.dll ${OgreProcedural_ROOT_DIR}/bin/Release) 10 | copy_debug_dir(OgreProcedural_d.dll ${OgreProcedural_ROOT_DIR}/bin/Debug) 11 | 12 | copy_release(OgreMain.dll) 13 | copy_debug(OgreMain_d.dll) 14 | 15 | copy_release(RenderSystem_Direct3D9.dll) 16 | copy_debug(RenderSystem_Direct3D9_d.dll) 17 | 18 | copy_release(RenderSystem_GL.dll) 19 | copy_debug(RenderSystem_GL_d.dll) 20 | 21 | copy_release(OIS.dll) 22 | copy_debug(OIS_d.dll) 23 | 24 | set(OgreProcedural_PLUGIN_DIR_REL ".") 25 | set(OgreProcedural_PLUGIN_DIR_DBG ".") 26 | 27 | set(OGRE_PLUGIN_DIR_REL ".") 28 | set(OGRE_PLUGIN_DIR_DBG ".") 29 | 30 | endif(WIN32) 31 | 32 | # if Linux, copy the Ogre configuration files over 33 | if(UNIX AND NOT APPLE) 34 | 35 | set(OgreProcedural_PLUGIN_DIR_REL ".") 36 | set(OgreProcedural_PLUGIN_DIR_DBG ".") 37 | set(OgreProcedural_COMMENT_RENDERSYSTEM_D3D9 "#") 38 | 39 | #comes from findOgre.cmake (don't know why it doesn't work there...) 40 | get_filename_component(OGRE_PLUGIN_DIR_REL ${OGRE_RenderSystem_GL_LIBRARY_REL} PATH) 41 | get_filename_component(OGRE_PLUGIN_DIR_DBG ${OGRE_RenderSystem_GL_LIBRARY_DBG} PATH) 42 | 43 | endif(UNIX AND NOT APPLE) 44 | 45 | set(OgreProcedural_MEDIA_DIR "${OgreProcedural_SOURCE_DIR}/samples/media") 46 | 47 | configure_release_dir(resources.cfg ${OgreProcedural_TEMPLATES_DIR}) 48 | configure_debug_dir(resources_d.cfg ${OgreProcedural_TEMPLATES_DIR}) 49 | 50 | configure_release_dir(plugins.cfg ${OgreProcedural_TEMPLATES_DIR}) 51 | configure_debug_dir(plugins_d.cfg ${OgreProcedural_TEMPLATES_DIR}) 52 | 53 | # Configure Samples build 54 | add_subdirectory(primitives) 55 | add_subdirectory(extrusion) -------------------------------------------------------------------------------- /CMake/Templates/VisualStudioUserFile.vcproj.user.in: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 67 | 91 | 92 | 95 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /CMake/Templates/VisualStudioUserFile.vcxproj.user.in: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(TargetPath) 5 | @OgreProcedural_WORK_DIR@/bin/$(Configuration) 6 | WindowsLocalDebugger 7 | 8 | 9 | $(TargetPath) 10 | @OgreProcedural_WORK_DIR@/bin/$(Configuration) 11 | WindowsLocalDebugger 12 | 13 | 14 | $(TargetPath) 15 | @OgreProcedural_WORK_DIR@/bin/$(Configuration) 16 | WindowsLocalDebugger 17 | 18 | 19 | $(TargetPath) 20 | @OgreProcedural_WORK_DIR@/bin/$(Configuration) 21 | WindowsLocalDebugger 22 | 23 | -------------------------------------------------------------------------------- /CMake/Templates/a2x.cfg.in: -------------------------------------------------------------------------------- 1 | XSLTPROC = '${ASCIIDOC_DIR}/xsltproc' -------------------------------------------------------------------------------- /CMake/Templates/resources.cfg: -------------------------------------------------------------------------------- 1 | [General] 2 | FileSystem=@OGRE_MEDIA_DIR@ 3 | [Essential] 4 | Zip=@OGRE_MEDIA_DIR@/packs/SdkTrays.zip 5 | [Scripts] 6 | FileSystem=@OgreProcedural_MEDIA_DIR@ 7 | -------------------------------------------------------------------------------- /CMake/Templates/version.txt.in: -------------------------------------------------------------------------------- 1 | @OgreProcedural_VERSION_DASH_SEPARATED@ -------------------------------------------------------------------------------- /CMake/Utils/PrecompiledHeader.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------- 2 | # This file is part of the CMake build system for OGRE 3 | # (Object-oriented Graphics Rendering Engine) 4 | # For the latest info, see http://www.ogre3d.org/ 5 | # 6 | # The contents of this file are placed in the public domain. Feel 7 | # free to make use of it in any way you like. 8 | #------------------------------------------------------------------- 9 | 10 | ################################################################## 11 | # Support macro to use a precompiled header 12 | # Usage: 13 | # use_precompiled_header(TARGET HEADER_FILE SRC_FILE) 14 | ################################################################## 15 | 16 | macro(use_precompiled_header TARGET HEADER_FILE SRC_FILE) 17 | get_filename_component(HEADER ${HEADER_FILE} NAME) 18 | 19 | if (MSVC AND NOT NMAKE AND NOT OgreProcedural_UNITY_BUILD) 20 | add_definitions(/Yu"${HEADER}") 21 | set_source_files_properties(${SRC_FILE} 22 | PPROPERTIES COMPILE_FLAGS /Yc"${HEADER}" 23 | ) 24 | 25 | elseif (CMAKE_COMPILER_IS_GNUCXX) 26 | # disabled because it seems to increase compile time 27 | ## this is some serious hack... we definitely need native 28 | ## support in CMake for this! 29 | ## we will generate the precompiled header via a workaround 30 | ## first give the header a new name with the proper extension 31 | #set(PRECOMP_HEADER ${CMAKE_CURRENT_BINARY_DIR}/hacked/${HEADER}.gch) 32 | #configure_file(${HEADER_FILE} ${PRECOMP_HEADER} COPYONLY) 33 | ## retrieve some info about the target's build settings 34 | #get_target_property(${TARGET} PRECOMP_TYPE TYPE) 35 | #if (PRECOMP_TYPE STREQUAL "SHARED_LIBRARY") 36 | # set(PRECOMP_LIBTYPE "SHARED") 37 | #else () 38 | # set(PRECOMP_LIBTYPE "STATIC") 39 | #endif () 40 | #get_target_property(${TARGET} PRECOMP_DEFINITIONS COMPILE_DEFINITIONS) 41 | #get_target_property(${TARGET} PRECOMP_FLAGS COMPILE_FLAGS) 42 | # 43 | ## add a new target which compiles the header 44 | #add_library(__precomp_header ${PRECOMP_LIBTYPE} ${PRECOMP_HEADER}) 45 | #add_dependencies(${TARGET} __precomp_header) 46 | #set_target_properties(__precomp_header PROPERTIES 47 | # COMPILE_DEFINITIONS ${PRECOMP_DEFINITIONS} 48 | # COMPILE_FLAGS ${PRECOMP_FLAGS} 49 | # HAS_CXX TRUE 50 | #) 51 | #set_source_files_properties(${PRECOMP_HEADER} PROPERTIES 52 | # HEADER_FILE_ONLY FALSE 53 | # KEEP_EXTENSION TRUE 54 | # COMPILE_FLAGS "-x c++-header" 55 | # LANGUAGE CXX 56 | #) 57 | # 58 | ## finally, we need to ensure that gcc can find the precompiled header 59 | ## this is another dirty hack 60 | #include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/__precomp_header.dir/hacked") 61 | 62 | endif () 63 | endmacro(use_precompiled_header) 64 | -------------------------------------------------------------------------------- /CMake/Utils/PreprocessorUtils.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------- 2 | # This file is part of the CMake build system for OGRE 3 | # (Object-oriented Graphics Rendering Engine) 4 | # For the latest info, see http://www.ogre3d.org/ 5 | # 6 | # The contents of this file are placed in the public domain. Feel 7 | # free to make use of it in any way you like. 8 | #------------------------------------------------------------------- 9 | 10 | macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE) 11 | string(REGEX MATCH 12 | "# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))" 13 | PREPROC_TEMP_VAR 14 | ${${CONTENTS}} 15 | ) 16 | if (CMAKE_MATCH_3) 17 | set(${VARIABLE} ${CMAKE_MATCH_3}) 18 | else () 19 | set(${VARIABLE} ${CMAKE_MATCH_4}) 20 | endif () 21 | endmacro() 22 | 23 | macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE) 24 | string(REGEX MATCH 25 | "\n *# *define +(${KEYWORD})" 26 | PREPROC_TEMP_VAR 27 | ${${CONTENTS}} 28 | ) 29 | if (CMAKE_MATCH_1) 30 | set(${VARIABLE} TRUE) 31 | else () 32 | set(${VARIABLE} FALSE) 33 | endif () 34 | endmacro() 35 | 36 | macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE) 37 | string(REGEX REPLACE 38 | "(// *)?# *define +${KEYWORD} +[^ \n]*" 39 | "#define ${KEYWORD} ${NEW_VALUE}" 40 | ${VARIABLE}_TEMP 41 | ${${VARIABLE}} 42 | ) 43 | set(${VARIABLE} ${${VARIABLE}_TEMP}) 44 | endmacro() 45 | 46 | macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE) 47 | if (${ENABLE}) 48 | set(TMP_REPLACE_STR "#define ${KEYWORD}") 49 | else () 50 | set(TMP_REPLACE_STR "// #define ${KEYWORD}") 51 | endif () 52 | string(REGEX REPLACE 53 | "(// *)?# *define +${KEYWORD} *\n" 54 | ${TMP_REPLACE_STR} 55 | ${VARIABLE}_TEMP 56 | ${${VARIABLE}} 57 | ) 58 | set(${VARIABLE} ${${VARIABLE}_TEMP}) 59 | endmacro() 60 | 61 | -------------------------------------------------------------------------------- /CMake/Utils/ProceduralConfigTargets.cmake: -------------------------------------------------------------------------------- 1 | if (WIN32) 2 | set(OgreProcedural_RELEASE_PATH "/Release") 3 | set(OgreProcedural_RELWDBG_PATH "/RelWithDebInfo") 4 | set(OgreProcedural_MINSIZE_PATH "/MinSizeRel") 5 | set(OgreProcedural_DEBUG_PATH "/Debug") 6 | set(OgreProcedural_LIB_RELEASE_PATH "/Release") 7 | set(OgreProcedural_LIB_RELWDBG_PATH "/RelWithDebInfo") 8 | set(OgreProcedural_LIB_MINSIZE_PATH "/MinSizeRel") 9 | set(OgreProcedural_LIB_DEBUG_PATH "/Debug") 10 | set(OgreProcedural_PLUGIN_PATH "/opt") 11 | set(OgreProcedural_SAMPLE_PATH "/opt/samples") 12 | elseif (UNIX) 13 | set(OgreProcedural_RELEASE_PATH "") 14 | set(OgreProcedural_RELWDBG_PATH "") 15 | set(OgreProcedural_MINSIZE_PATH "") 16 | set(OgreProcedural_DEBUG_PATH "/debug") 17 | if (NOT APPLE) 18 | set(OgreProcedural_DEBUG_PATH "") 19 | endif () 20 | set(OgreProcedural_LIB_RELEASE_PATH "") 21 | set(OgreProcedural_LIB_RELWDBG_PATH "") 22 | set(OgreProcedural_LIB_MINSIZE_PATH "") 23 | set(OgreProcedural_LIB_DEBUG_PATH "") 24 | if(APPLE AND OgreProcedural_BUILD_PLATFORM_IPHONE) 25 | set(OgreProcedural_LIB_RELEASE_PATH "/Release") 26 | endif(APPLE AND OgreProcedural_BUILD_PLATFORM_IPHONE) 27 | if (APPLE) 28 | set(OgreProcedural_PLUGIN_PATH "/") 29 | else() 30 | set(OgreProcedural_PLUGIN_PATH "/PROCEDURAL") 31 | endif(APPLE) 32 | set(OgreProcedural_SAMPLE_PATH "/PROCEDURAL/Samples") 33 | endif () 34 | 35 | # create vcproj.user file for Visual Studio to set debug working directory 36 | function(procedural_create_vcproj_userfile TARGETNAME) 37 | if (MSVC) 38 | configure_file( 39 | ${OgreProcedural_TEMPLATES_DIR}/VisualStudioUserFile.vcproj.user.in 40 | ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}.vcproj.user 41 | @ONLY 42 | ) 43 | configure_file( 44 | ${OgreProcedural_TEMPLATES_DIR}/VisualStudioUserFile.vcxproj.user.in 45 | ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}.vcxproj.user 46 | @ONLY 47 | ) 48 | endif () 49 | endfunction(procedural_create_vcproj_userfile) 50 | 51 | # install targets according to current build type 52 | function(procedural_install_target TARGETNAME) 53 | install(TARGETS ${TARGETNAME} 54 | BUNDLE DESTINATION "bin${OgreProcedural_RELEASE_PATH}" CONFIGURATIONS Release None "" 55 | RUNTIME DESTINATION "bin${OgreProcedural_RELEASE_PATH}" CONFIGURATIONS Release None "" 56 | LIBRARY DESTINATION "lib${OgreProcedural_LIB_RELEASE_PATH}" CONFIGURATIONS Release None "" 57 | ARCHIVE DESTINATION "lib${OgreProcedural_LIB_RELEASE_PATH}" CONFIGURATIONS Release None "" 58 | FRAMEWORK DESTINATION "lib${OgreProcedural_RELEASE_PATH}/Release" CONFIGURATIONS Release None "" 59 | ) 60 | install(TARGETS ${TARGETNAME} 61 | BUNDLE DESTINATION "bin${OgreProcedural_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo 62 | RUNTIME DESTINATION "bin${OgreProcedural_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo 63 | LIBRARY DESTINATION "lib${OgreProcedural_LIB_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo 64 | ARCHIVE DESTINATION "lib${OgreProcedural_LIB_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo 65 | FRAMEWORK DESTINATION "lib${OgreProcedural_RELWDBG_PATH}/RelWithDebInfo" CONFIGURATIONS RelWithDebInfo 66 | ) 67 | install(TARGETS ${TARGETNAME} 68 | BUNDLE DESTINATION "bin${OgreProcedural_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel 69 | RUNTIME DESTINATION "bin${OgreProcedural_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel 70 | LIBRARY DESTINATION "lib${OgreProcedural_LIB_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel 71 | ARCHIVE DESTINATION "lib${OgreProcedural_LIB_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel 72 | FRAMEWORK DESTINATION "lib${OgreProcedural_MINSIZE_PATH}/MinSizeRel" CONFIGURATIONS MinSizeRel 73 | ) 74 | install(TARGETS ${TARGETNAME} 75 | BUNDLE DESTINATION "bin${OgreProcedural_DEBUG_PATH}" CONFIGURATIONS Debug 76 | RUNTIME DESTINATION "bin${OgreProcedural_DEBUG_PATH}" CONFIGURATIONS Debug 77 | LIBRARY DESTINATION "lib${OgreProcedural_LIB_DEBUG_PATH}" CONFIGURATIONS Debug 78 | ARCHIVE DESTINATION "lib${OgreProcedural_LIB_DEBUG_PATH}" CONFIGURATIONS Debug 79 | FRAMEWORK DESTINATION "lib${OgreProcedural_DEBUG_PATH}/Debug" CONFIGURATIONS Debug 80 | ) 81 | endfunction(procedural_install_target) -------------------------------------------------------------------------------- /Contributors.txt: -------------------------------------------------------------------------------- 1 | This file keeps track of contributors on OgreProcedural. 2 | Contributors are identified by their username on the ogre forum. 3 | 4 | Maintainers: 5 | Michael Broutin ( mikachu ): Original maintainer. 6 | 7 | Contributors: 8 | Thomas Fischer ( tdev ) 9 | ( svenstaro ) 10 | ( Transporter ) 11 | Joel Lamotte( Klaim) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2010 Michael Broutin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | Ogre Procedural 2 | --------------- 3 | 4 | Ogre Procedural is a C++ library which aims to produce procedural geometry for Ogre3D. 5 | 6 | It is licensed under the MIT license, which basically means you can do anything you want with it, including using it in a commercial, closed source program. 7 | Although not compulsory, it is also considered to be nice if you provide a link to ogre-procedural in your product's credits. -------------------------------------------------------------------------------- /SDK/buildsdk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if "%1" == "" goto paramErr 3 | if "%VSINSTALLDIR%" == "" goto envErr 4 | if "%OGRE_HOME%" == "" goto envErr 5 | 6 | set COMPILER=%1 7 | 8 | rem Determine CMake generator 9 | if "%COMPILER%" == "vc71" set GENERATOR="Visual Studio 7 .NET 2003" 10 | if "%COMPILER%" == "vc8" set GENERATOR="Visual Studio 8 2005" 11 | if "%COMPILER%" == "vc8_x64" set GENERATOR="Visual Studio 8 2005 Win64" 12 | if "%COMPILER%" == "vc9" set GENERATOR="Visual Studio 9 2008" 13 | if "%COMPILER%" == "vc9_x64" set GENERATOR="Visual Studio 9 2008 Win64" 14 | if "%COMPILER%" == "vc10" set GENERATOR="Visual Studio 10" 15 | if "%COMPILER%" == "vc10_x64" set GENERATOR="Visual Studio 10 Win64" 16 | 17 | if %GENERATOR% == "" goto paramErr 18 | 19 | rem check 7z and dot 20 | 7z > NUL 21 | if errorlevel 1 goto 7zerror 22 | 23 | set BUILD_DIR=%COMPILER% 24 | 25 | if "%2" == "clean" rmdir /Q/S %BUILD_DIR% 26 | mkdir %BUILD_DIR% 27 | pushd %BUILD_DIR% 28 | rem call CMake 29 | cmake -DOgreProcedural_INSTALL_SAMPLES_SOURCE:BOOL=TRUE -DOgreProcedural_INSTALL_DOCS:BOOL=TRUE -G%GENERATOR% ..\.. 30 | if errorlevel 1 goto cmakeerror 31 | 32 | rem Read OgreProcedural version 33 | set /p PROCEDURALVERSION= NUL 37 | 38 | if errorlevel 1 goto tryexpress 39 | set DEVENV=devenv 40 | goto detecteddevenv 41 | :tryexpress 42 | set DEVENV=VCExpress 43 | :detecteddevenv 44 | 45 | rem build docs explicitly since INSTALL doesn't include it 46 | %DEVENV% OgreProcedural.sln /build "Release" /project "doc" 47 | 48 | if errorlevel 1 goto msvcerror 49 | 50 | rem Delete unnecessary doc files 51 | pushd docs\api\html 52 | del /Q/F *.hhk *.hhc *.map *.md5 *.dot *.hhp *.plist 53 | popd 54 | 55 | echo %cd% 56 | 57 | rem Build main binaries 58 | %DEVENV% OgreProcedural.sln /build "Debug" /project "INSTALL" 59 | %DEVENV% OgreProcedural.sln /build "Release" /project "INSTALL" 60 | 61 | popd 62 | 63 | rem Package up 64 | set SDKNAME=ProceduralSDK_%COMPILER%_v%PROCEDURALVERSION% 65 | rmdir /S/Q %SDKNAME% 66 | move %BUILD_DIR%\sdk %SDKNAME% 67 | del /Q/F %SDKNAME%.exe 68 | rem create self-extracting 7zip archive 69 | 7z a -r -y -sfx7z.sfx %SDKNAME%.exe %SDKNAME% 70 | 71 | echo Done! Test %SDKNAME%.exe and then release 72 | goto end 73 | 74 | :paramErr 75 | echo Required: Build tool (vc71, vc8, vc8x64, vc9, vc9x64, vc10, vc10x64) 76 | set errorlevel=1 77 | goto end 78 | 79 | :envErr 80 | echo You need to run this script after running vcvars32.bat 81 | echo You also need to set OGRE_HOME environnement variable to your Ogre SDK's directory 82 | set errorlevel=1 83 | goto end 84 | 85 | :cmakeerror 86 | popd 87 | echo CMake not found on your path or CMake error - see above and correct 88 | goto end 89 | 90 | :7zerror 91 | echo 7z.exe not found on your path, please add 92 | goto end 93 | 94 | :msvcerror 95 | popd 96 | echo Neither devenv.exe nor VCExpress are on your path, use vcvars32.bat 97 | goto end 98 | 99 | :end 100 | 101 | -------------------------------------------------------------------------------- /SDK/buildsdkcodeblocks.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set GENERATOR="CodeBlocks - MinGW Makefiles" 3 | 4 | rem check 7z and dot 5 | 7z > NUL 6 | if errorlevel 1 goto 7zerror 7 | 8 | set BUILD_DIR=codeblocks 9 | 10 | mkdir %BUILD_DIR% 11 | pushd %BUILD_DIR% 12 | rem call CMake 13 | cmake -DOgreProcedural_INSTALL_SAMPLES_SOURCE:BOOL=TRUE -DOgreProcedural_INSTALL_DOCS:BOOL=TRUE -DOGRE_HOME:PATH=%OGRE_SDK_RELEASE% -DCMAKE_BUILD_TYPE=Release -G%GENERATOR% ..\.. 14 | if errorlevel 1 goto cmakeerror 15 | 16 | rem Read OgreProcedural version 17 | set /p PROCEDURALVERSION= FileContents Then WriteFile FileName, dFileContents 16 | 17 | 'Read text file 18 | function GetFile(FileName) 19 | If FileName<>"" Then 20 | Dim FS, FileStream 21 | Set FS = CreateObject("Scripting.FileSystemObject") 22 | on error resume Next 23 | Set FileStream = FS.OpenTextFile(FileName) 24 | GetFile = FileStream.ReadAll 25 | End If 26 | End Function 27 | 28 | 'Write string As a text file. 29 | function WriteFile(FileName, Contents) 30 | Dim OutStream, FS 31 | 32 | on error resume Next 33 | Set FS = CreateObject("Scripting.FileSystemObject") 34 | Set OutStream = FS.OpenTextFile(FileName, 2, True) 35 | OutStream.Write Contents 36 | End Function -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ############################################################### 2 | # Install documentation 3 | # Build API docs, if doxygen is available 4 | ############################################################### 5 | 6 | if(DOXYGEN_FOUND) 7 | add_subdirectory(manual/illustrations) 8 | endif() 9 | 10 | # Build and install API documentation if doxygen is available 11 | if(DOXYGEN_FOUND) 12 | configure_file(${OgreProcedural_TEMPLATES_DIR}/html.cfg.in ${OgreProcedural_BINARY_DIR}/html.cfg) 13 | add_custom_target(OgreProceduralDoc 14 | COMMAND ${DOXYGEN_EXECUTABLE} ${OgreProcedural_BINARY_DIR}/html.cfg 15 | WORKING_DIRECTORY ${OgreProcedural_SOURCE_DIR}/docs 16 | DEPENDS OgreProceduralIllustrations 17 | COMMENT "Building documentation" VERBATIM) 18 | file(WRITE ${OgreProcedural_SOURCE_DIR}/docs/api/temp.txt "This file should be deleted before installation. It is only here to force the creation of the api folder") 19 | file(REMOVE ${OgreProcedural_SOURCE_DIR}/docs/api/temp.txt) 20 | if (OgreProcedural_INSTALL_DOCS) 21 | install(DIRECTORY ${OgreProcedural_BINARY_DIR}/docs/api DESTINATION ${OgreProcedural_DOCS_PATH}) 22 | endif() 23 | 24 | # cleanup $OgreProcedural_DOCS_PATH on "make clean" 25 | set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${OgreProcedural_DOCS_PATH}) 26 | 27 | # add doxygen as dependency to OgreProceduralDoc-target 28 | get_target_property(DOC_TARGET OgreProceduralDoc TYPE) 29 | if(NOT DOC_TARGET) 30 | add_custom_target(OgreProceduralDoc) 31 | endif() 32 | endif() -------------------------------------------------------------------------------- /docs/ReadMe.txt: -------------------------------------------------------------------------------- 1 | How to build the docs 2 | --------------------- 3 | 4 | 1. Install doxygen and graphviz and add their bin directory to the system PATH 5 | 2. Build the doc target to create the doxygen api docs, illustrations, and manual at the same time -------------------------------------------------------------------------------- /docs/illustrations/extrusion/extruder_generic.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(-1,-1):addPoint(1,-1):addPoint(1,1):addPoint(0,0):addPoint(-1,1):close() 2 | p = Procedural.RoundedCornerSpline3():addPoint(-6,2.5,-2.5):addPoint(-5,0,-2.5):addPoint(0,0,2.5):addPoint(5,0,-2.5):setRadius(1.):realizePath() 3 | tb = Procedural.Extruder():setShapeToExtrude(s):setExtrusionPath(p):buildTriangleBuffer() 4 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/extrusion/extruder_multishape.lua: -------------------------------------------------------------------------------- 1 | s3 = Procedural.CircleShape():setNumSeg(16):realizeShape() 2 | ms = Procedural.MultiShape():addShape(Procedural.Shape(s3):scale(1.1)):addShape(s3:switchSide()) 3 | p3 = Procedural.CatmullRomSpline3():addPoint(0,0,-5):addPoint(0,0,0):addPoint(1,-1,5):realizePath() 4 | tb = Procedural.Extruder():setMultiShapeToExtrude(ms):setExtrusionPath(p3):buildTriangleBuffer() 5 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/extrusion/extruder_rotationtrack.lua: -------------------------------------------------------------------------------- 1 | s2 = Procedural.RectangleShape():setHeight(.5):realizeShape() 2 | t = Procedural.Track(Procedural.Track_AM_RELATIVE_LINEIC):addKeyFrame(0,0):addKeyFrame(1.0,-1.0) 3 | p2 = Procedural.LinePath():betweenPoints(Procedural.Vector3(-5,0,0),Procedural.Vector3(5,0,0)):setNumSeg(10):realizePath() 4 | tb = Procedural.Extruder():setShapeToExtrude(s2):setExtrusionPath(p2):setRotationTrack(t):buildTriangleBuffer() 5 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/extrusion/extruder_scaletrack.lua: -------------------------------------------------------------------------------- 1 | s2 = Procedural.RectangleShape():setHeight(.5):realizeShape() 2 | p2 = Procedural.LinePath():betweenPoints(Procedural.Vector3(-5,0,0),Procedural.Vector3(5,0,0)):setNumSeg(10):realizePath() 3 | t = Procedural.Track(Procedural.Track_AM_RELATIVE_LINEIC):addKeyFrame(0,.5):addKeyFrame(.4,.5):addKeyFrame(.5,1.2):addKeyFrame(.8,1):addKeyFrame(1.0,1) 4 | tb = Procedural.Extruder():setShapeToExtrude(s2):setExtrusionPath(p2):setScaleTrack(t):buildTriangleBuffer() 5 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/extrusion/extruder_texturetrack.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/docs/illustrations/extrusion/extruder_texturetrack.lua -------------------------------------------------------------------------------- /docs/illustrations/extrusion/lathe_anglerange.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0,-3):addPoint(1,-3):addPoint(1,0):addPoint(.8,1):addPoint(.8,2):addPoint(1.5,3):addPoint(0,4) 2 | tb = Procedural.Lathe():setShapeToExtrude(s):setAngleBegin(Procedural.Radian(2)):setAngleEnd(Procedural.Radian(0)):buildTriangleBuffer() 3 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/extrusion/lathe_generic.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0,-3):addPoint(1,-3):addPoint(1,0):addPoint(.8,1):addPoint(.8,2):addPoint(1.5,3):addPoint(0,4) 2 | tb = Procedural.Lathe():setShapeToExtrude(s):buildTriangleBuffer() 3 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/meshmodifiers/BoxUVModifier.lua: -------------------------------------------------------------------------------- 1 | tb = Procedural.BoxGenerator():setSize(Procedural.Vector3(10,10,10)):buildTriangleBuffer() 2 | Procedural.BoxUVModifier():setInputTriangleBuffer(tb):setBoxSize(Procedural.Vector3(10,10,10)):setMappingType(Procedural.BoxUVModifier_MT_PACKED):modify() 3 | tests:addTriangleBufferTexture(tb,"test.png") -------------------------------------------------------------------------------- /docs/illustrations/meshmodifiers/CalculateNormalsTriangle.lua: -------------------------------------------------------------------------------- 1 | tb = Procedural.SphereGenerator():setNumRings(6):setNumSegments(12):buildTriangleBuffer() 2 | Procedural.CalculateNormalsModifier():setInputTriangleBuffer(tb):setComputeMode(Procedural.CalculateNormalsModifier_NCM_TRIANGLE):modify() 3 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/meshmodifiers/CalculateNormalsVertex.lua: -------------------------------------------------------------------------------- 1 | tb = Procedural.BoxGenerator():buildTriangleBuffer() 2 | Procedural.CalculateNormalsModifier():setInputTriangleBuffer(tb):setComputeMode(Procedural.CalculateNormalsModifier_NCM_VERTEX):modify() 3 | --Procedural.WeldVerticesModifier():setInputTriangleBuffer(tb):modify() 4 | tests:addTriangleBuffer(tb) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_box.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.BoxGenerator():setSizeX(1):buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_capsule.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.CapsuleGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_cone.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.ConeGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_cylinder.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.CylinderGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_icosphere.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.IcoSphereGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_plane.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.PlaneGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_roundedbox.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.RoundedBoxGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_sphere.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.SphereGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_spring.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.SpringGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_torus.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.TorusGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_torusknot.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.TorusKnotGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/primitives/primitive_tube.lua: -------------------------------------------------------------------------------- 1 | mesh = Procedural.TubeGenerator():buildTriangleBuffer() 2 | tests:addTriangleBuffer(mesh) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_booleandifference.lua: -------------------------------------------------------------------------------- 1 | s1 = Procedural.RectangleShape():realizeShape() 2 | s2 = Procedural.RectangleShape():realizeShape() 3 | s2:translate(0.5,0.5) 4 | s = s1:booleanDifference(s2):getShape(0) 5 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_booleanintersection.lua: -------------------------------------------------------------------------------- 1 | s1 = Procedural.RectangleShape():realizeShape() 2 | s2 = Procedural.RectangleShape():realizeShape() 3 | s2:translate(0.5,0.5) 4 | s = s1:booleanIntersect(s2):getShape(0) 5 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_booleansetup.lua: -------------------------------------------------------------------------------- 1 | s1 = Procedural.RectangleShape():realizeShape() 2 | s2 = Procedural.RectangleShape():realizeShape() 3 | s2:translate(0.5,0.5) 4 | tests:addShape(s1) 5 | tests:addShape(s2) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_booleanunion.lua: -------------------------------------------------------------------------------- 1 | s1 = Procedural.RectangleShape():realizeShape() 2 | s2 = Procedural.RectangleShape():realizeShape() 3 | s2:translate(0.5,0.5) 4 | s = s1:booleanUnion(s2):getShape(0) 5 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_circle.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.CircleShape():setNumSeg(64):setRadius(2):realizeShape() 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_ellipse.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.EllipseShape():setNumSeg(64):setRadiusX(2.25):setRadiusY(1.25):realizeShape() 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometricmirror_point.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | s:mirror(0.5, 0.5) 3 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometricmirror_yaxis.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | s:mirrorAroundAxis(Procedural.Vector2_UNIT_Y) 3 | s:close() 4 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometricrotate.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | s:rotate(Procedural.Radian(Procedural.Math_HALF_PI/2)) 3 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometricscale.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | s:scale(2.0, 2.0) 3 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometricsetup.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_geometrictranslate.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(0, 0):addPoint(-0.5, -1.0):addPoint(-0.75, 1):addPoint(0, 0.5) 2 | s:translate(0.5, 1.0) 3 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_rectangle.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.RectangleShape():setHeight(2):setWidth(4):realizeShape() 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_thick1.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(-1,-1):addPoint(0.5,0):addPoint(-0.5,0):addPoint(1,1) 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_thick2.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.Shape():addPoint(-1,-1):addPoint(0.5,0):addPoint(-0.5,0):addPoint(1,1) 2 | s = s:thicken(.2):getShape(0) 3 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_triangle.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.TriangleShape():setLength(3):realizeShape() 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/shape_triangulation.lua: -------------------------------------------------------------------------------- 1 | cs = Procedural.CircleShape() 2 | ms = Procedural.MultiShape() 3 | ms:addShape(cs:setRadius(2):realizeShape()) 4 | ms:addShape(cs:setRadius(.3):realizeShape():translate(-1,.3):switchSide()) 5 | ms:addShape(cs:realizeShape():translate(1,.3):switchSide()) 6 | ms:addShape(cs:realizeShape():switchSide()) 7 | ms:addShape(cs:realizeShape():scale(2,1):translate(0,-1):switchSide()) 8 | Procedural.Triangulator():setMultiShapeToTriangulate(ms):realizeMesh("test") 9 | tests:addMesh("test") -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_beziercurve.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.BezierCurve2():addPoint(Procedural.Vector2(0,0)) 2 | :addPoint(Procedural.Vector2(1,0)) 3 | :addPoint(Procedural.Vector2(1,1)) 4 | :addPoint(Procedural.Vector2(2,1)) 5 | :addPoint(Procedural.Vector2(2,0)) 6 | :addPoint(Procedural.Vector2(3,0)) 7 | :addPoint(Procedural.Vector2(3,1)) 8 | :addPoint(Procedural.Vector2(4,1)) 9 | :addPoint(Procedural.Vector2(4,0)) 10 | :realizeShape() 11 | :translate(-2,0) 12 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_catmull.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.CatmullRomSpline2():addPoint(0,0):addPoint(1,0):addPoint(1,1):addPoint(2,1):addPoint(2,0):addPoint(3,0):addPoint(3,1):addPoint(4,1):realizeShape():translate(-2, 0) 2 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_cubichermite.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.CubicHermiteSpline2():addPoint(Procedural.Vector2(0,0), Procedural.AT_CATMULL) 2 | :addPoint(Procedural.Vector2(1,0), Procedural.AT_CATMULL) 3 | :addPoint(Procedural.Vector2(1,1), Procedural.Vector2(0,2), Procedural.Vector2(0,-2)) 4 | :addPoint(Procedural.Vector2(2,1), Procedural.AT_CATMULL) 5 | :addPoint(2,0) 6 | :addPoint(3,0) 7 | :addPoint(3,1) 8 | :addPoint(4,1) 9 | :setNumSeg(16):realizeShape():translate(-2,0) 10 | tests:addShape(s) 11 | -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_helix.lua: -------------------------------------------------------------------------------- 1 | p = Procedural.HelixPath():setNumSegPath(64):setNumRound(3):setHeight(1.5):realizePath():translate(0, -2.2, 0.0) 2 | tests:addPath(p) -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_kochanekbartels.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.KochanekBartelsSpline2():addPoint(0,0) 2 | :addPoint(Procedural.Vector2(1,0),1,0,0) 3 | :addPoint(Procedural.Vector2(1,1),-1,0,0) 4 | :addPoint(Procedural.Vector2(2,1),0,1,0) 5 | :addPoint(Procedural.Vector2(2,0),0,-1,0) 6 | :addPoint(Procedural.Vector2(3,0),0,0,1) 7 | :addPoint(Procedural.Vector2(3,1),0,0,-1) 8 | :addPoint(Procedural.Vector2(4,1)) 9 | :addPoint(Procedural.Vector2(4,0)) 10 | :realizeShape():translate(-2,0) 11 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/shapes/spline_roundedcorner.lua: -------------------------------------------------------------------------------- 1 | s = Procedural.RoundedCornerSpline2():addPoint(0,0) 2 | :addPoint(1,0) 3 | :addPoint(1,1) 4 | :addPoint(2,1) 5 | :addPoint(2,0) 6 | :addPoint(3,0) 7 | :addPoint(3,1) 8 | :addPoint(4,1) 9 | :addPoint(4,0) 10 | :setRadius(0.3):realizeShape():translate(-2,0) 11 | tests:addShape(s) -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_alpha.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Alpha(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_03", "Alpha_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Alpha", "texture_alpha") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_alphamask.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 3 | Procedural.AlphaMask(buffer):setParameterImage(bufferCellNormal):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_04", "AlphaMask_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Gradient", "texture_gradient", "AlphaMask", "texture_alphamask") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_blit.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Blit(buffer):setInputBuffer(bufferGradient):setInputRect(0.0, 0.0, 0.5, 0.5):setOutputRect(0.25, 0.25, 0.75, 0.75):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_31", "Blit_Demo") 6 | dotfile:set("Image", "texture_image", "Gradient", "texture_gradient", "Blit", "texture_blit") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_blur_1.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Blur(buffer):setType(Procedural.Blur_BLUR_MEAN):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_05a", "Blur_Mean_Demo") 6 | dotfile:set("Image", "texture_image", "Blur", "texture_blur_1") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_blur_2.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Blur(buffer):setType(Procedural.Blur_BLUR_GAUSSIAN):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_05b", "Blur_Gaussian_Demo") 6 | dotfile:set("Image", "texture_image", "Blur", "texture_blur_2") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cell_chess.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setMode(Procedural.Cell_MODE_CHESSBOARD):setPattern(Procedural.Cell_PATTERN_CONE):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cell_default.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cell_grid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setMode(Procedural.Cell_MODE_GRID):setPattern(Procedural.Cell_PATTERN_CROSS):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cell_smooth.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | bufferCellNormal = Procedural.TextureBuffer(128) 3 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 4 | Procedural.Cell(bufferCellNormal):setDensity(4):setRegularity(234):process() 5 | tests:addTextureBuffer(buffer) 6 | tests:addTextureBuffer(bufferCellNormal) 7 | Procedural.Abnormals(buffer):setParameterImage(bufferCellNormal):process() 8 | tests:addTextureBuffer(buffer) 9 | tests:addTextureBuffer(buffer) 10 | dotfile = tests:getDotFile("texture_02", "Abnormals_Demo") 11 | dotfile:set("Gradient", "texture_gradient", "Cell", "texture_cell_smooth", "Abnormals", "texture_abnormals") 12 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_channel_1.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Channel(buffer):setSelection(Procedural.Channel_SELECT_BLUE):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_06a", "Channel_blue_Demo") 6 | dotfile:set("Image", "texture_image", "Channel", "texture_channel_1") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_channel_2.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Channel(buffer):setSelection(Procedural.Channel_SELECT_GRAY):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_06b", "Channel_gray_Demo") 6 | dotfile:set("Image", "texture_image", "Channel", "texture_channel_2") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_circle.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.CircleTexture(buffer):setColour(Procedural.ColourValue_Red):setRadius(0.3):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_32", "Circle_Demo") 6 | dotfile:set("Solid", "texture_solid", "Circle", "texture_circle") -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cloud.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cloud(buffer):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_colours.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 3 | Procedural.Colours(buffer):setColourBase(Procedural.ColourValue_Red):setColourPercent(Procedural.ColourValue_Blue):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_07", "Colours_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "Colours", "texture_colours") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_combine.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cloud(buffer):process() 3 | Procedural.Combine(buffer):addImage(bufferGradient, Procedural.Combine_METHOD_ADD_CLAMP):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_08", "Combine_Demo") 6 | dotfile:set("Cloud", "texture_cloud", "Gradient", "texture_gradient", "Combine", "texture_combine") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_convolution.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Convolution(buffer):setKernel(Procedural.Matrix3(10.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -10.0)):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_09", "Convolution_Demo") 6 | dotfile:set("Image", "texture_image", "Kernel matrix", "", "Convolution", "texture_convolution") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_crack.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cloud(buffer):process() 3 | Procedural.Crack(buffer):setParameterImage(bufferGradient):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_10", "Crack_Demo") 6 | dotfile:set("Cloud", "texture_cloud", "Gradient", "texture_gradient", "Crack", "texture_crack") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_epicycloid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_EPICYCLOID):process() 4 | tests:addTextureBuffer(buffer) 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_epitrochoid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_EPITROCHOID):process() 4 | tests:addTextureBuffer(buffer) 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_hypocycloid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_HYPOCYCLOID):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_30", "Cycloid_Demo") 6 | dotfile:set("Solid", "texture_solid", "Hypocycloid", "texture_cycloid_hypocycloid") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_hypotrochoid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_HYPOTROCHOID):process() 4 | tests:addTextureBuffer(buffer) 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_lissajous.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_LISSAJOUS_CURVE):process() 4 | tests:addTextureBuffer(buffer) 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_cycloid_rose.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.Cycloid(buffer):setColour(Procedural.ColourValue_Red):setPenSize(2):setType(Procedural.Cycloid_ROSE_CURVE):process() 4 | tests:addTextureBuffer(buffer) 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_dilate.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cloud(buffer):process() 3 | Procedural.Dilate(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_11", "Dilate_Demo") 6 | dotfile:set("Cloud", "texture_cloud", "Dilate", "texture_dilate") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_distort.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 3 | Procedural.Distort(buffer):setParameterImage(bufferCellNormal):setPower(255):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_12", "Distort_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "Cell", "texture_cell_smooth", "Distort", "texture_distort") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_edgedetection.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.EdgeDetection(buffer):setType(Procedural.EdgeDetection_DETECTION_SOBEL):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_13", "EdgeDetection_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "EdgeDetection", "texture_edgedetection") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_ellipse.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.EllipseTexture(buffer):setColour(Procedural.ColourValue_Red):setRadiusX(0.4):setRadiusY(0.2):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_33", "Ellipse_Demo") 6 | dotfile:set("Solid", "texture_solid", "Ellipse", "texture_ellipse") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_flip_1.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Flip(buffer):setAxis(Procedural.Flip_FLIP_POINT):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_14a", "Flip_point_Demo") 6 | dotfile:set("Image", "texture_image", "Flip", "texture_flip_1") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_flip_2.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Flip(buffer):setAxis(Procedural.Flip_FLIP_VERTICAL):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_14b", "Flip_vertical_Demo") 6 | dotfile:set("Image", "texture_image", "Flip", "texture_flip_2") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_flip_3.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Flip(buffer):setAxis(Procedural.Flip_FLIP_HORIZONTAL):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_14c", "Flip_horizontal_Demo") 6 | dotfile:set("Image", "texture_image", "Flip", "texture_flip_3") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_glow.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):process() 3 | Procedural.Glow(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_15", "Glow_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "Glow", "texture_glow") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_gradient.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 3 | tests:addTextureBuffer(buffer) 4 | 5 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_image.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_invert.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):process() 3 | Procedural.Invert(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_16", "Invert_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "Invert", "texture_invert") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_jitter.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Jitter(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_17", "Jitter_Demo") 6 | dotfile:set("Image", "texture_image", "Jitter", "texture_jitter") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_labyrinth.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Labyrinth(buffer):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_lerp.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cloud(buffer):process() 3 | Procedural.Lerp(buffer):setImageA(bufferGradient):setImageB(bufferCellNormal):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_18", "Lerp_Demo") 6 | dotfile:set("Cloud", "texture_cloud", "Gradient", "texture_gradient", "Lerp", "texture_lerp") 7 | dotfile:add("Cell", "texture_cell_smooth") 8 | dotfile:bind(4, 3) 9 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_light.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Light(buffer):setColourAmbient(0.5, 0.2, 0, 0):setColourDiffuse(0.2, 0.1, 0, 0):setBumpPower(255):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_19a", "Light_1_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Normals", "texture_normals", "Light", "texture_light", dotFile_ROW) 7 | dotfile:bind(1, 3) 8 | dotfile = tests:getDotFile("texture_19b", "Light_2_Demo") 9 | dotfile:set("Cell", "texture_cell_smooth", "Light", "texture_light") 10 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_lookup.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):process() 3 | Procedural.Lookup(buffer):setParameterImage(bufferCellNormal):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_20", "Lookup_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "Cell", "texture_cell_smooth", "Lookup", "texture_lookup") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_marble.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Marble(buffer):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_noise_perlin.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Noise(buffer):setType(Procedural.Noise_NOISE_PERLIN):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_noise_white.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Noise(buffer):setType(Procedural.Noise_NOISE_WHITE):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_normals.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Normals(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_21a", "Normals_1_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Normals", "texture_normals") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_normals_tip.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Colours(buffer):setColourBase(Procedural.ColourValue_Red):setColourPercent(Procedural.ColourValue_Blue):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_21b", "Normals_2_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Normals", "texture_normals", "Colours", "texture_normals_tip", dotFile_SPLIT) 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_oilpaint.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.OilPaint(buffer):setRadius(5):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_22", "OilPaint_Demo") 6 | dotfile:set("Image", "texture_image", "OilPaint", "texture_oilpaint") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_randompixels.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 3 | Procedural.RandomPixels(buffer):setColour(Procedural.ColourValue_Red):setCount(200):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_23", "RandomPixels_Demo") 6 | dotfile:set("Solid", "texture_solid", "RandomPixels", "texture_randompixels") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_rectangle.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | 3 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1.0, 1.0)):process() 4 | Procedural.RectangleTexture(buffer):setColour(Procedural.ColourValue_Red):setRectangle(0.25, 0.25, 0.75, 0.75):process() 5 | tests:addTextureBuffer(buffer) 6 | dotfile = tests:getDotFile("texture_24", "Rectangle_Demo") 7 | dotfile:set("Solid", "texture_solid", "Rectangle", "texture_rectangle") 8 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_rotationzoom.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Gradient(buffer):setColours(Procedural.ColourValue_Black, Procedural.ColourValue_Red, Procedural.ColourValue_Green, Procedural.ColourValue_Blue):process() 3 | Procedural.RotationZoom(buffer):setRotation(0.125):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_25", "RotationZoom_Demo") 6 | dotfile:set("Gradient", "texture_gradient", "RotationZoom", "texture_rotationzoom") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_segment.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Segment(buffer):setColourSource(bufferGradient):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_26", "Segment_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Gradient", "texture_gradient", "Segment", "texture_segment") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_sharpen_1.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Sharpen(buffer):setType(Procedural.Sharpen_SHARP_BASIC):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_27a", "Sharpen_basic_Demo") 6 | dotfile:set("Image", "texture_image", "Sharpen", "texture_sharpen_1") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_sharpen_2.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Image(buffer):setFile("red_brick.jpg"):process() 3 | Procedural.Sharpen(buffer):setType(Procedural.Sharpen_SHARP_GAUSSIAN):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_27b", "Sharpen_gaussian_Demo") 6 | dotfile:set("Image", "texture_image", "Sharpen", "texture_sharpen_2") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_solid.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Solid(buffer):setColour(Procedural.ColourValue(0.0, 0.5, 1, 1)):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_text.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.TextTexture(buffer):setFont("Arial", 30):setColour(Procedural.ColourValue_Red):setPosition((size_t)20, (size_t)20):setText("OGRE"):process() 4 | Procedural.TextTexture(buffer):setFont("Arial", 20):setColour(Procedural.ColourValue_Green):setPosition((size_t)10, (size_t)60):setText("Procedural"):process() 5 | tests:addTextureBuffer(buffer) 6 | dotfile = tests:getDotFile("texture_34", "Text_Demo") 7 | dotfile:set("Cell", "texture_cell_smooth", "Text", "texture_text") 8 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_textile.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Textile(buffer):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_threshold.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Threshold(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_28", "Threshold_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Threshold", "texture_threshold") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_vortex.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Cell(buffer):setDensity(4):setRegularity(234):process() 3 | Procedural.Vortex(buffer):process() 4 | tests:addTextureBuffer(buffer) 5 | dotfile = tests:getDotFile("texture_29", "Vortex_Demo") 6 | dotfile:set("Cell", "texture_cell_smooth", "Vortex", "texture_vortex") 7 | -------------------------------------------------------------------------------- /docs/illustrations/texture/texture_wood.lua: -------------------------------------------------------------------------------- 1 | buffer = Procedural.TextureBuffer(128) 2 | Procedural.Wood(buffer):process() 3 | tests:addTextureBuffer(buffer) 4 | -------------------------------------------------------------------------------- /docs/images/Extrusion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/docs/images/Extrusion.jpg -------------------------------------------------------------------------------- /docs/manual/extruder.md: -------------------------------------------------------------------------------- 1 | Extrusion operations {#extruder} 2 | ==================== 3 | 4 | [TOC] 5 | 6 | ## Extruder 7 | 8 | Extrusion is an operation that consists in creating a mesh from a shape moved along a path. 9 | 10 | That operation is particularly well suited for roads, pipelines, pillars... 11 | 12 | ![Figure 1. Generic extrusion](extruder_generic.png) 13 | 14 | Extrusion can also be applied to a multishape. 15 | 16 | ![Figure 2. Extrusion of a multishape](extruder_multishape.png) 17 | 18 | Special options are available to influence the way the mesh is created : 19 | 20 | * Rotation Track 21 | 22 | ![Figure 3a. Rotation Track](extruder_rotationtrack.png) 23 | 24 | * Scale Track 25 | 26 | ![Figure 3b. Scale Track](extruder_scaletrack.png) 27 | 28 | * Shape Texture Track 29 | 30 | ![Figure 3c. Shape Texture Track](extruder_texturetrack.png) 31 | 32 | ## Lathe 33 | 34 | Lathe is an operation that takes a shape and rotates it around Y-axis to produce a mesh. 35 | 36 | ![Figure 4. Generic Lathe](lathe_generic.png) 37 | 38 | Lathe can also be restricted to a given angle range. 39 | 40 | ![Figure 5. Lathe by a given angle range](lathe_anglerange.png) 41 | 42 | ## Example 43 | 44 | The `Sample_Extrusion` project demonstrates how to extrude various shapes. -------------------------------------------------------------------------------- /docs/manual/howto.md: -------------------------------------------------------------------------------- 1 | How to build {#procedural-howto} 2 | ============ 3 | 4 | These are the detailed steps in order to build the SDK : 5 | 6 | - Make sure CMake and the Ogre3d SDK are present on your system. 7 | - Open CMake, set the source directory as the root directory of Ogre %Procedural, choose anything you want for the build directory. 8 | - Click 'Add Entry'. Add the 'OGRE_HOME' variable (type=PATH), its value being the root folder of Ogre3d SDK. 9 | - Click 'configure', then 'generate' 10 | - Your project file is now ready to be used. Build the target 'INSTALL' in order to get a working SDK, which will be in the 'sdk' subfolder. 11 | 12 | ## Configuring your project 13 | 14 | ### If you don't use CMake in your project 15 | 16 | - Setup your IDE to use OgreProcedural's 'include' and 'lib' subdirectories. 17 | - Copy the dynamic libraries OgreProcedural and OgreProcedural_d to a directory where they can be seen by your main executable. 18 | 19 | ### If you use CMake in your project 20 | 21 | - Copy FindOgreProcedural.cmake to a location where your CMake can use it. 22 | - Setup OgreProcedural_HOME (either as system environnement variable or CMake variable) to point to OgreProcedural's SDK folder. 23 | - When OgreProcedural is found, OgreProcedural_INCLUDE_DIRS and OgreProcedural_LIBRARIES are defined as CMake variables. 24 | 25 | ## Basic usage sample 26 | 27 | ```cpp 28 | #include "Procedural.h" 29 | // ... 30 | Procedural::BoxGenerator().setSizeX(2.0).realizeMesh("myBox"); 31 | ``` 32 | 33 | That's it. 34 | 35 | It's the minimal use case of OgreProcedural, and it produces a box mesh. 36 | You can then instantiate an entity from this mesh, and add it to your scene. 37 | 38 | ## MeshGenerators, TriangleBuffers and Ogre Meshes 39 | 40 | In OgreProcedural, all the classes deriving from Procedural::MeshGenerator are made to produce Ogre Meshes. 41 | 42 | There are two ways of creating a Mesh from a Procedural::MeshGenerator : 43 | * Call _realizeMesh() if you want to directly produce Ogre::Mesh. 44 | * Create a Procedural::TriangleBuffer and fill it using _MeshGenerator::addToTriangleBuffer()_. When it's ready to be used, call to _TriangleBuffer::transformToMesh()_ will get you an Ogre Mesh with every geometry accumulated from various Procedural::MeshGenerator as a single batch. 45 | 46 | Procedural::MeshGenerator also have some utility functions to transform produced triangles. This is especially useful if you have several Procedural::MeshGenerator for one Procedural::TriangleBuffer. 47 | 48 | For example : 49 | ```cpp 50 | // Two boxes in one batch 51 | Procedural::TriangleBuffer tb; 52 | BoxGenerator b; 53 | b.setPosition(2,0,0).addToTriangleBuffer(tb); 54 | b.setPosition(-2,0,0).addToTriangleBuffer(tb); 55 | tb.transformToMesh("twoBoxes"); 56 | ``` -------------------------------------------------------------------------------- /docs/manual/illustrations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(OgreProceduralIllustrations) 2 | 3 | set( HDRS 4 | ${CMAKE_SOURCE_DIR}/library/include/ProceduralStableHeaders.h 5 | include/Illustrations.h 6 | ) 7 | 8 | set( SRCS 9 | ${CMAKE_SOURCE_DIR}/library/src/ProceduralPrecompiledHeaders.cpp 10 | src/Illustrations.cpp 11 | ) 12 | 13 | include_directories( 14 | ${OGRE_INCLUDE_DIRS} 15 | ${CMAKE_CURRENT_SOURCE_DIR}/include 16 | ) 17 | 18 | if(FREETYPE_FOUND) 19 | if(OgreProcedural_STATIC) 20 | target_link_libraries(OgreProcedural ${FREETYPE_LIBRARIES}) 21 | endif() 22 | endif () 23 | 24 | procedural_add_executable(OgreProceduralIllustrations WIN32 ${HDRS} ${SRCS}) 25 | 26 | file(MAKE_DIRECTORY ${OgreProcedural_ILLUSTRATIONS_PATH}) 27 | 28 | set_target_properties(OgreProceduralIllustrations PROPERTIES DEBUG_POSTFIX _d) 29 | 30 | target_link_libraries(OgreProceduralIllustrations ${OGRE_LIBRARIES} ${OgreProcedural_LIBRARIES}) 31 | 32 | procedural_create_vcproj_userfile(OgreProceduralIllustrations) 33 | 34 | # specify a precompiled header to use 35 | use_precompiled_header(OgreProceduralIllustrations 36 | "${CMAKE_SOURCE_DIR}/library/include/ProceduralStableHeaders.h" 37 | "${CMAKE_SOURCE_DIR}/library/src/ProceduralPrecompiledHeaders.cpp" 38 | ) 39 | 40 | add_custom_command(TARGET OgreProceduralIllustrations POST_BUILD 41 | COMMAND OgreProceduralIllustrations ARGS "${OgreProcedural_ILLUSTRATIONS_PATH}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 42 | -------------------------------------------------------------------------------- /docs/manual/manual.md: -------------------------------------------------------------------------------- 1 | %Ogre %Procedural Manual {#mainpage} 2 | ====================== 3 | 4 | %Ogre %Procedural is a C++ library which aims to produce procedural geometry for Ogre. 5 | 6 | ![](Extrusion.jpg) all objects are procedurally generated 7 | 8 | This manual aims to give an overview of what is possible with %Ogre %Procedural. 9 | 10 | * [How to use](@ref procedural-howto) 11 | * [Primitives](@ref primitives) 12 | * [Shapes and paths](@ref shapepath) 13 | * [Extruder](@ref extruder) 14 | * [Textures](@ref textures) -------------------------------------------------------------------------------- /docs/manual/primitives.md: -------------------------------------------------------------------------------- 1 | Mesh primitives {#primitives} 2 | =============== 3 | 4 | There are a few mesh primitives generators. 5 | 6 | [TOC] 7 | 8 | ## Box 9 | 10 | ![Figure 1. Box](primitive_box.png) 11 | 12 | See Procedural::BoxGenerator 13 | 14 | ## Rounded RoundedBox 15 | 16 | ![Figure 2. Rounded Box](primitive_roundedbox.png) 17 | 18 | See Procedural::RoundedBoxGenerator 19 | 20 | ## Sphere 21 | 22 | ![Figure 3. Sphere](primitive_sphere.png) 23 | 24 | See Procedural::SphereGenerator 25 | 26 | ## IcoSphere 27 | 28 | ![Figure 4. Ico Sphere](primitive_icosphere.png) 29 | 30 | Icosphere is visually quite close from Sphere, but has a quite different repartition of the triangles. 31 | 32 | See Procedural::IcoSphereGenerator 33 | 34 | ## Torus 35 | 36 | ![Figure 5. Torus](primitive_torus.png) 37 | 38 | See Procedural::TorusGenerator 39 | 40 | ## TorusKnot 41 | 42 | ![Figure 6.TorusKnot](primitive_torusknot.png) 43 | 44 | See Procedural::TorusKnotGenerator 45 | 46 | ## Cylinder 47 | 48 | ![Figure 7.Cylinder](primitive_cylinder.png) 49 | 50 | See Procedural::CylinderGenerator 51 | 52 | ## Cone 53 | 54 | ![Figure 8. Cone](primitive_cone.png) 55 | 56 | See Procedural::ConeGenerator 57 | 58 | ## Tube 59 | 60 | ![Figure 9. Tube](primitive_tube.png) 61 | 62 | See Procedural::TubeGenerator 63 | 64 | ## Capsule 65 | 66 | ![Figure 10. Capsule](primitive_capsule.png) 67 | 68 | See Procedural::CapsuleGenerator 69 | 70 | ## Spring 71 | 72 | ![Figure 11. Spring](primitive_spring.png) 73 | 74 | See Procedural::SpringGenerator 75 | 76 | ## Plane 77 | 78 | ![Figure 12. Plane](primitive_plane.png) 79 | 80 | See Procedural::PlaneGenerator 81 | 82 | ## Prism 83 | 84 | ![Figure 13a. Prism {3}](primitive_prism3.png) 85 | ![Figure 13b. Prism {5}](primitive_prism5.png) 86 | ![Figure 13c. Prism {6}](primitive_prism6.png) 87 | 88 | See Procedural::PrismGenerator 89 | -------------------------------------------------------------------------------- /library/include/Procedural.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_H_INCLUDED 29 | #define PROCEDURAL_H_INCLUDED 30 | 31 | #include "ProceduralPlatform.h" 32 | #include "ProceduralBoxGenerator.h" 33 | #include "ProceduralCapsuleGenerator.h" 34 | #include "ProceduralConeGenerator.h" 35 | #include "ProceduralCylinderGenerator.h" 36 | #include "ProceduralIcoSphereGenerator.h" 37 | #include "ProceduralRoundedBoxGenerator.h" 38 | #include "ProceduralSphereGenerator.h" 39 | #include "ProceduralTorusGenerator.h" 40 | #include "ProceduralTorusKnotGenerator.h" 41 | #include "ProceduralTubeGenerator.h" 42 | #include "ProceduralPlaneGenerator.h" 43 | #include "ProceduralExtruder.h" 44 | #include "ProceduralLathe.h" 45 | #include "ProceduralShape.h" 46 | #include "ProceduralShapeGenerators.h" 47 | #include "ProceduralMultiShape.h" 48 | #include "ProceduralMultiShapeGenerators.h" 49 | #include "ProceduralPath.h" 50 | #include "ProceduralPathGenerators.h" 51 | #include "ProceduralTriangulator.h" 52 | #include "ProceduralTriangleBuffer.h" 53 | #include "ProceduralTrack.h" 54 | #include "ProceduralBoolean.h" 55 | #include "ProceduralSpringGenerator.h" 56 | #include "ProceduralSVG.h" 57 | #include "ProceduralDebugRendering.h" 58 | #include "ProceduralTextureGenerator.h" 59 | #include "ProceduralTextureModifiers.h" 60 | #include "ProceduralNoise.h" 61 | #include "ProceduralMeshModifiers.h" 62 | #include "ProceduralTextureBuffer.h" 63 | #include "ProceduralPrismGenerator.h" 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /library/include/ProceduralBoolean.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "Ogre.h" 29 | #include "ProceduralPlatform.h" 30 | #include "ProceduralMeshGenerator.h" 31 | 32 | namespace Procedural 33 | { 34 | 35 | class _ProceduralExport Boolean : public MeshGenerator 36 | { 37 | public: 38 | enum BooleanOperation 39 | { 40 | BT_UNION, BT_INTERSECTION, BT_DIFFERENCE 41 | }; 42 | private: 43 | BooleanOperation mBooleanOperation; 44 | TriangleBuffer* mMesh1; 45 | TriangleBuffer* mMesh2; 46 | public: 47 | 48 | Boolean() : mMesh1(0), mMesh2(0), mBooleanOperation(BT_UNION) {} 49 | 50 | Boolean& setMesh1(TriangleBuffer* tb) 51 | { 52 | mMesh1 = tb; 53 | return *this; 54 | } 55 | 56 | Boolean& setMesh2(TriangleBuffer* tb) 57 | { 58 | mMesh2 = tb; 59 | return *this; 60 | } 61 | 62 | Boolean& setBooleanOperation(BooleanOperation op) 63 | { 64 | mBooleanOperation = op; 65 | return *this; 66 | } 67 | 68 | void addToTriangleBuffer(TriangleBuffer& buffer) const; 69 | }; 70 | } -------------------------------------------------------------------------------- /library/include/ProceduralConeGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_CONE_GENERATOR_INCLUDED 29 | #define PROCEDURAL_CONE_GENERATOR_INCLUDED 30 | 31 | #include "ProceduralMeshGenerator.h" 32 | #include "ProceduralPlatform.h" 33 | 34 | namespace Procedural 35 | { 36 | /** 37 | * \ingroup objgengrp 38 | * Generates a cone mesh along Y-axis 39 | * \image html primitive_cone.png 40 | */ 41 | class _ProceduralExport ConeGenerator : public MeshGenerator 42 | { 43 | unsigned int mNumSegBase; 44 | unsigned int mNumSegHeight; 45 | Ogre::Real mRadius; 46 | Ogre::Real mHeight; 47 | public: 48 | /// Contructor with arguments 49 | ConeGenerator(Ogre::Real radius = 1.f, Ogre::Real height = 1.f, unsigned int numSegBase = 16, unsigned int numSegHeight = 1) : 50 | mNumSegBase(numSegBase), 51 | mNumSegHeight(numSegHeight), 52 | mRadius(radius), 53 | mHeight(height) 54 | {} 55 | 56 | /** 57 | * Builds the mesh into the given TriangleBuffer 58 | * @param buffer The TriangleBuffer on where to append the mesh. 59 | */ 60 | void addToTriangleBuffer(TriangleBuffer& buffer) const; 61 | 62 | /** 63 | Sets the number of segments on the side of the base (default=16) 64 | \exception Ogre::InvalidParametersException Minimum of numSegBase is 1 65 | */ 66 | inline ConeGenerator& setNumSegBase(unsigned int numSegBase) 67 | { 68 | if (numSegBase == 0) 69 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::ConeGenerator::setNumSegBase(unsigned int)"); 70 | mNumSegBase = numSegBase; 71 | return *this; 72 | } 73 | 74 | /** 75 | Sets the number of segments on the height (default=1) 76 | \exception Ogre::InvalidParametersException Minimum of numSegHeight is 1 77 | */ 78 | inline ConeGenerator& setNumSegHeight(unsigned int numSegHeight) 79 | { 80 | if (numSegHeight == 0) 81 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::ConeGenerator::setNumSegHeight(unsigned int)"); 82 | mNumSegHeight = numSegHeight; 83 | return *this; 84 | } 85 | 86 | /** 87 | Sets the base radius (default=1) 88 | \exception Ogre::InvalidParametersException Radius must be larger than 0! 89 | */ 90 | inline ConeGenerator& setRadius(Ogre::Real radius) 91 | { 92 | if (radius <= 0.0f) 93 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Radius must be larger than 0!", "Procedural::ConeGenerator::setRadius(Ogre::Real)"); 94 | mRadius = radius; 95 | return *this; 96 | } 97 | 98 | /** 99 | Sets the height of the cone (default=1) 100 | \exception Ogre::InvalidParametersException Height must be larger than 0! 101 | */ 102 | inline ConeGenerator& setHeight(Ogre::Real height) 103 | { 104 | if (height <= 0.0f) 105 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Height must be larger than 0!", "Procedural::ConeGenerator::setHeight(Ogre::Real)"); 106 | mHeight = height; 107 | return *this; 108 | } 109 | 110 | 111 | }; 112 | } 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /library/include/ProceduralDebugRendering.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_DEBUG_RENDERING_INCLUDED 29 | #define PROCEDURAL_DEBUG_RENDERING_INCLUDED 30 | 31 | #include "ProceduralPlatform.h" 32 | #include "ProceduralTriangleBuffer.h" 33 | #include "OgreManualObject.h" 34 | 35 | namespace Procedural 36 | { 37 | /// This class creates a visualisation of the normals of a TriangleBuffer 38 | class _ProceduralExport ShowNormalsGenerator 39 | { 40 | public: 41 | enum VisualStyle 42 | { 43 | VS_LINE, VS_ARROW 44 | }; 45 | 46 | private: 47 | VisualStyle mVisualStyle; 48 | 49 | TriangleBuffer* mTriangleBuffer; 50 | 51 | Ogre::Real mSize; 52 | public: 53 | ShowNormalsGenerator() : mTriangleBuffer(0), mSize(1.0), mVisualStyle(VS_LINE) {} 54 | 55 | /// Sets the input Triangle Buffer 56 | ShowNormalsGenerator& setTriangleBuffer(TriangleBuffer* triangleBuffer) 57 | { 58 | mTriangleBuffer = triangleBuffer; 59 | return *this; 60 | } 61 | 62 | /// Sets the size of the normals representation (default = 1.0) 63 | ShowNormalsGenerator& setSize(Ogre::Real size) 64 | { 65 | mSize = size; 66 | return *this; 67 | } 68 | 69 | 70 | /// Sets the visual style, line or arrow (default = line) 71 | ShowNormalsGenerator& setVisualStyle(VisualStyle visualStyle) 72 | { 73 | mVisualStyle = visualStyle; 74 | return *this; 75 | } 76 | 77 | 78 | /// Builds the normals representation as a manual object 79 | /// \exception Ogre::InvalidStateException The input triangle buffer must not be null 80 | /// \exception Ogre::InvalidStateException Scene Manager is not set in OGRE root object 81 | Ogre::SharedPtr buildManualObject() const; 82 | 83 | /// Builds the normals representation as a mesh 84 | Ogre::MeshPtr buildMesh(const std::string& name = "", 85 | const Ogre::String& group = "General") const; 86 | }; 87 | } 88 | 89 | #endif -------------------------------------------------------------------------------- /library/include/ProceduralIcoSphereGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_ICOSPHERE_GENERATOR_INCLUDED 29 | #define PROCEDURAL_ICOSPHERE_GENERATOR_INCLUDED 30 | 31 | #include "ProceduralMeshGenerator.h" 32 | #include "ProceduralPlatform.h" 33 | 34 | namespace Procedural 35 | { 36 | /** 37 | * \ingroup objgengrp 38 | * Builds an icosphere mesh, ie a sphere built with equally sized triangles 39 | * \image html primitive_icosphere.png 40 | */ 41 | class _ProceduralExport IcoSphereGenerator : public MeshGenerator 42 | { 43 | Ogre::Real mRadius; 44 | unsigned int mNumIterations; 45 | 46 | public: 47 | /// Contructor with arguments 48 | IcoSphereGenerator(Ogre::Real radius = 1.f, unsigned int numIterations = 2) : 49 | mRadius(radius), 50 | mNumIterations(numIterations) 51 | {} 52 | 53 | /** 54 | * Builds the mesh into the given TriangleBuffer 55 | * @param buffer The TriangleBuffer on where to append the mesh. 56 | */ 57 | void addToTriangleBuffer(TriangleBuffer& buffer) const; 58 | 59 | /** 60 | Sets the radius of the sphere (default=1) 61 | \exception Ogre::InvalidParametersException Radius must be larger than 0! 62 | */ 63 | inline IcoSphereGenerator& setRadius(Ogre::Real radius) 64 | { 65 | if (radius <= 0.0f) 66 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Radius must be larger than 0!", "Procedural::IcoSphereGenerator::setRadius(Ogre::Real)"); 67 | mRadius = radius; 68 | return *this; 69 | } 70 | 71 | /** Sets the number of iterations needed to build the sphere mesh. 72 | First iteration corresponds to a 20 face sphere. 73 | Each iteration has 3 more faces than the previous. 74 | (default=2) 75 | \exception Ogre::InvalidParametersException Minimum of numIterations is 1 76 | */ 77 | inline IcoSphereGenerator& setNumIterations(unsigned int numIterations) 78 | { 79 | if (numIterations == 0) 80 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 iterations", "Procedural::IcoSphereGenerator::setNumRings(unsigned int)"); 81 | mNumIterations = numIterations; 82 | return *this; 83 | } 84 | 85 | }; 86 | } 87 | #endif 88 | -------------------------------------------------------------------------------- /library/include/ProceduralMultiShape.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_MULTISHAPE_INCLUDED 29 | #define PROCEDURAL_MULTISHAPE_INCLUDED 30 | 31 | #include "ProceduralGeometryHelpers.h" 32 | 33 | namespace Procedural 34 | { 35 | class Shape; 36 | 37 | /** 38 | * \ingroup shapegrp 39 | * Holds a bunch of shapes. 40 | * There are a number of assumptions that are made and are not checked 41 | * against : the shapes must not cross each other 42 | * 43 | */ 44 | class _ProceduralExport MultiShape 45 | { 46 | std::vector mShapes; 47 | 48 | public: 49 | /// Default constructor 50 | MultiShape() 51 | {} 52 | 53 | /// Constructor from a single shape 54 | MultiShape(const Shape& shape) 55 | { 56 | mShapes.push_back(shape); 57 | } 58 | 59 | /// Constructor from a variable number of shapes 60 | /// @param count the number of shapes to add 61 | /// @param ... pointer to the shapes to add 62 | MultiShape(int count, ...); 63 | 64 | /// Adds a shape to the list of shapes 65 | MultiShape& addShape(const Shape& shape) 66 | { 67 | mShapes.push_back(shape); 68 | return *this; 69 | } 70 | 71 | /// Clears all the content 72 | void clear() 73 | { 74 | mShapes.clear(); 75 | } 76 | 77 | /// Returns the i-th shape 78 | const Shape& getShape(unsigned int i) const 79 | { 80 | return mShapes[i]; 81 | } 82 | 83 | /// Returns the i-th shape 84 | Shape& getShape(unsigned int i) 85 | { 86 | return mShapes[i]; 87 | } 88 | 89 | /// Builds an aggregated list of all points contained in all shapes 90 | std::vector getPoints() const; 91 | 92 | /// Returns the number of shapes in that MultiShape 93 | unsigned int getShapeCount() const 94 | { 95 | return (unsigned int)mShapes.size(); 96 | } 97 | 98 | /// Append every shape of an other multishape to the current multiShape 99 | void addMultiShape(const MultiShape& other); 100 | 101 | /// Outputs the Multi Shape to a Mesh, mostly for visualisation or debugging purposes 102 | Ogre::MeshPtr realizeMesh(const std::string& name=""); 103 | 104 | /// Tells whether a point is located inside that multishape 105 | /// It assumes that all of the shapes in that multishape are closed, 106 | /// and that they don't contradict each other, 107 | /// ie a point cannot be outside and inside at the same time 108 | bool isPointInside(const Ogre::Vector2& point) const; 109 | 110 | /** 111 | * Tells whether multishape is "closed" or not. 112 | * MultiShape is considered to be closed if and only if all shapes are closed 113 | */ 114 | bool isClosed() const; 115 | 116 | /** 117 | * Closes all shapes included in this multiShape 118 | */ 119 | void close(); 120 | 121 | /** 122 | * Determines whether the outside as defined by user equals "real" outside 123 | */ 124 | bool isOutsideRealOutside() const; 125 | 126 | void buildFromSegmentSoup(const std::vector& segList); 127 | 128 | }; 129 | } 130 | #endif 131 | -------------------------------------------------------------------------------- /library/include/ProceduralMultiShapeGenerators.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_MULTISHAPE_GENERATORS_INCLUDED 29 | #define PROCEDURAL_MULTISHAPE_GENERATORS_INCLUDED 30 | 31 | #include "ProceduralMultiShape.h" 32 | 33 | namespace Procedural 34 | { 35 | /** 36 | * \ingroup shapegrp 37 | * @{ 38 | */ 39 | #ifdef PROCEDURAL_USE_FREETYPE 40 | //----------------------------------------------------------------------- 41 | /** 42 | * Produces a multishape from a given text 43 | * \image html shape_text.png 44 | */ 45 | class _ProceduralExport TextShape 46 | { 47 | private: 48 | Ogre::String mText; 49 | Ogre::String mFontName; 50 | Ogre::uchar mFontSize; 51 | 52 | public: 53 | /** 54 | Default constructor. 55 | */ 56 | TextShape() 57 | : mText("OgreProcedural"), mFontName("Arial"), mFontSize(12) 58 | { 59 | } 60 | 61 | /** 62 | Set the text content. 63 | \param text New text for processing (default "OgreProcedural") 64 | \exception Ogre::InvalidParametersException Empty text 65 | */ 66 | inline TextShape& setText(Ogre::String text) 67 | { 68 | if (text.empty()) 69 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 characters in text", "Procedural::TextShape::setText(Ogre::String text)"); 70 | 71 | mText = text; 72 | return *this; 73 | } 74 | 75 | /** 76 | Set the font for the text. 77 | \param fontName Filenpath of a font or name of font (only on windows desktops) 78 | \param fontSize Size of font [px] (default 12) 79 | \exception Ogre::InvalidParametersException Empty font name 80 | \exception Ogre::InvalidParametersException Font size is below 4 81 | \todo Add search for font names on non windows systems. 82 | */ 83 | inline TextShape& setFont(Ogre::String fontName, Ogre::uchar fontSize) 84 | { 85 | if (fontName.empty()) 86 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 characters in font name", "Procedural::TextShape::setFont(Ogre::String fontName, Ogre::uchar fontSize)"); 87 | if (fontSize < 4) 88 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Minimum font size is 4", "Procedural::TextShape::setFont(Ogre::String fontName, Ogre::uchar fontSize)"); 89 | 90 | mFontName = fontName; 91 | mFontSize = fontSize; 92 | return *this; 93 | } 94 | 95 | 96 | /** 97 | * Build a MultiShape from chars (one Shape per character) 98 | * \exception Ogre::InternalErrorException Freetype error 99 | * \todo Need to split shapes of multi region chars. For example the letter \c O 100 | * has two shapes, but they are connected to one shape. 101 | */ 102 | MultiShape realizeShapes(); 103 | 104 | private: 105 | Ogre::String getFontFileByName(); 106 | 107 | #if PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32 108 | bool getFontFile(Ogre::String fontName, Ogre::String& displayName, Ogre::String& filePath); 109 | #endif 110 | }; 111 | #endif 112 | 113 | /** @} */ 114 | } 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /library/include/ProceduralPathGeneratorsBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_PATH_GENERATORS_BASE_INCLUDED 29 | #define PROCEDURAL_PATH_GENERATORS_BASE_INCLUDED 30 | 31 | #include "ProceduralPath.h" 32 | #include "ProceduralSplines.h" 33 | 34 | namespace Procedural 35 | { 36 | //----------------------------------------------------------------------- 37 | /** 38 | * \ingroup pathgrp 39 | * Base class for Path generators 40 | */ 41 | template 42 | class BaseSpline3 43 | { 44 | protected: 45 | /// The number of segments between 2 control points 46 | unsigned int mNumSeg; 47 | /// Tells if the spline is closed or not 48 | bool mClosed; 49 | public: 50 | BaseSpline3() : mNumSeg(4), mClosed(false) {} 51 | 52 | /// Sets the number of segments between 2 control points 53 | /// \exception Ogre::InvalidParametersException Minimum of numSeg is 1 54 | inline T& setNumSeg(unsigned int numSeg) 55 | { 56 | if (numSeg == 0) 57 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::BaseSpline3::setNumSeg(unsigned int)"); 58 | mNumSeg = numSeg; 59 | return (T&)*this; 60 | } 61 | 62 | /// Closes the spline 63 | inline T& close() 64 | { 65 | mClosed = true; 66 | return (T&)*this; 67 | } 68 | }; 69 | } 70 | #endif -------------------------------------------------------------------------------- /library/include/ProceduralShapeGeneratorsBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_SHAPE_GENERATORS_BASE_INCLUDED 29 | #define PROCEDURAL_SHAPE_GENERATORS_BASE_INCLUDED 30 | 31 | #include "ProceduralShape.h" 32 | #include "ProceduralSplines.h" 33 | 34 | namespace Procedural 35 | { 36 | //----------------------------------------------------------------------- 37 | /** 38 | \ingroup shapegrp 39 | Base class for Shape generators 40 | */ 41 | template 42 | class BaseSpline2 43 | { 44 | protected: 45 | /// The number of segments between 2 control points 46 | unsigned int mNumSeg; 47 | /// Whether the shape will be closed or not 48 | bool mClosed; 49 | /// The "out" side of the shape 50 | Side mOutSide; 51 | public: 52 | /// Default constructor 53 | BaseSpline2() : mNumSeg(4), mClosed(false), mOutSide(SIDE_RIGHT) {} 54 | 55 | /// Sets the out side of the shape 56 | inline T& setOutSide(Side outSide) 57 | { 58 | mOutSide = outSide; 59 | return (T&)*this; 60 | } 61 | 62 | /// Gets the out side of the shape 63 | inline Side getOutSide() const 64 | { 65 | return mOutSide; 66 | } 67 | 68 | /// Sets the number of segments between 2 control points 69 | /// \exception Ogre::InvalidParametersException Minimum of numSeg is 1 70 | inline T& setNumSeg(unsigned int numSeg) 71 | { 72 | if (numSeg == 0) 73 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::BaseSpline2::setNumSeg(unsigned int)"); 74 | mNumSeg = numSeg; 75 | return (T&)*this; 76 | } 77 | 78 | /// Closes the spline 79 | inline T& close() 80 | { 81 | mClosed = true; 82 | return (T&)*this; 83 | } 84 | }; 85 | } 86 | #endif 87 | -------------------------------------------------------------------------------- /library/include/ProceduralSphereGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_SPHERE_GENERATOR_INCLUDED 29 | #define PROCEDURAL_SPHERE_GENERATOR_INCLUDED 30 | 31 | #include "ProceduralMeshGenerator.h" 32 | #include "ProceduralPlatform.h" 33 | 34 | namespace Procedural 35 | { 36 | /** 37 | * \ingroup objgengrp 38 | * Builds an UV sphere mesh 39 | * \image html primitive_sphere.png 40 | */ 41 | class _ProceduralExport SphereGenerator : public MeshGenerator 42 | { 43 | Ogre::Real mRadius; 44 | unsigned int mNumRings; 45 | unsigned int mNumSegments; 46 | 47 | public: 48 | /// Constructor with arguments 49 | SphereGenerator(Ogre::Real radius = 1.f, unsigned int numRings = 16, unsigned int numSegments = 16) : 50 | mRadius(radius),mNumRings(numRings), mNumSegments(numSegments) 51 | 52 | {} 53 | 54 | /** 55 | Sets the radius of the sphere (default=1) 56 | \exception Ogre::InvalidParametersException Radius must be larger than 0! 57 | */ 58 | inline SphereGenerator& setRadius(Ogre::Real radius) 59 | { 60 | if (radius <= 0.0f) 61 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Radius must be larger than 0!", "Procedural::SphereGenerator::setRadius(Ogre::Real)"); 62 | mRadius = radius; 63 | return *this; 64 | } 65 | 66 | /** 67 | Sets the number of rings (default=16) 68 | \exception Ogre::InvalidParametersException Minimum of numRings is 1 69 | */ 70 | inline SphereGenerator& setNumRings(unsigned int numRings) 71 | { 72 | if (numRings == 0) 73 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 rings", "Procedural::SphereGenerator::setNumRings(unsigned int)"); 74 | mNumRings = numRings; 75 | return *this; 76 | } 77 | 78 | /** 79 | Sets the number of segments (default=16) 80 | \exception Ogre::InvalidParametersException Minimum of numSegments is 1 81 | */ 82 | inline SphereGenerator& setNumSegments(unsigned int numSegments) 83 | { 84 | if (numSegments == 0) 85 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::SphereGenerator::setNumSegments(unsigned int)"); 86 | mNumSegments = numSegments; 87 | return *this; 88 | } 89 | 90 | /** 91 | * Builds the mesh into the given TriangleBuffer 92 | * @param buffer The TriangleBuffer on where to append the mesh. 93 | */ 94 | void addToTriangleBuffer(TriangleBuffer& buffer) const; 95 | 96 | }; 97 | } 98 | #endif 99 | -------------------------------------------------------------------------------- /library/include/ProceduralStableHeaders.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef __OgreProceduralStableHeaders__ 29 | #define __OgreProceduralStableHeaders__ 30 | #include "ProceduralPlatform.h" 31 | 32 | #if (PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32 && !defined(__MINGW32__)) || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WINRT || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_APPLE || PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_APPLE_IOS 33 | #include "Ogre.h" 34 | #endif 35 | #if (PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32 && !defined(__MINGW32__)) 36 | #include 37 | #include 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /library/include/ProceduralTorusGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef PROCEDURAL_TORUS_GENERATOR_INCLUDED 29 | #define PROCEDURAL_TORUS_GENERATOR_INCLUDED 30 | 31 | #include "ProceduralMeshGenerator.h" 32 | #include "ProceduralPlatform.h" 33 | 34 | namespace Procedural 35 | { 36 | /** 37 | * \ingroup objgengrp 38 | * Builds a torus mesh whose axis is Y 39 | * \image html primitive_torus.png 40 | */ 41 | class _ProceduralExport TorusGenerator : public MeshGenerator 42 | { 43 | unsigned int mNumSegSection; 44 | unsigned int mNumSegCircle; 45 | Ogre::Real mRadius; 46 | Ogre::Real mSectionRadius; 47 | public: 48 | /// Constructor with arguments 49 | TorusGenerator(Ogre::Real radius=1.f, Ogre::Real sectionRadius=.2f, unsigned int numSegSection=16, unsigned int numSegCircle=16) : 50 | mNumSegSection(numSegSection), 51 | mNumSegCircle(numSegCircle), 52 | mRadius(radius), 53 | mSectionRadius(sectionRadius) {} 54 | 55 | /** 56 | * Builds the mesh into the given TriangleBuffer 57 | * @param buffer The TriangleBuffer on where to append the mesh. 58 | */ 59 | void addToTriangleBuffer(TriangleBuffer& buffer) const; 60 | 61 | /** 62 | Sets the number of segments on the section circle 63 | \exception Ogre::InvalidParametersException Minimum of numSegSection is 1 64 | */ 65 | inline TorusGenerator& setNumSegSection(unsigned int numSegSection) 66 | { 67 | if (mNumSegSection == 0) 68 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::TorusGenerator::setNumSegSection(unsigned int)"); 69 | mNumSegSection = numSegSection; 70 | return *this; 71 | } 72 | 73 | /** 74 | Sets the number of segments along the guiding circle 75 | \exception Ogre::InvalidParametersException Minimum of numSegCircle is 1 76 | */ 77 | inline TorusGenerator& setNumSegCircle(unsigned int numSegCircle) 78 | { 79 | if (numSegCircle == 0) 80 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "There must be more than 0 segments", "Procedural::TorusGenerator::setNumSegCircle(unsigned int)"); 81 | mNumSegCircle = numSegCircle; 82 | return *this; 83 | } 84 | 85 | /** 86 | Sets the radius of the guiding circle 87 | \exception Ogre::InvalidParametersException Radius must be larger than 0! 88 | */ 89 | inline TorusGenerator& setRadius(Ogre::Real radius) 90 | { 91 | if (radius <= 0.0f) 92 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Radius must be larger than 0!", "Procedural::TorusGenerator::setRadius(Ogre::Real)"); 93 | mRadius = radius; 94 | return *this; 95 | } 96 | 97 | /** 98 | Sets the radius of the section circle 99 | \exception Ogre::InvalidParametersException Radius must be larger than 0! 100 | */ 101 | inline TorusGenerator& setSectionRadius(Ogre::Real sectionRadius) 102 | { 103 | if (sectionRadius <= 0.0f) 104 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Radius must be larger than 0!", "Procedural::TorusGenerator::setSectionRadius(Ogre::Real)"); 105 | mSectionRadius = sectionRadius; 106 | return *this; 107 | } 108 | 109 | }; 110 | } 111 | #endif 112 | -------------------------------------------------------------------------------- /library/src/ProceduralBoxGenerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralBoxGenerator.h" 30 | #include "ProceduralPlaneGenerator.h" 31 | #include "ProceduralUtils.h" 32 | 33 | using namespace Ogre; 34 | 35 | namespace Procedural 36 | { 37 | #define TAG_NEGX "box.negx" 38 | #define TAG_NEGY "box.negy" 39 | #define TAG_NEGZ "box.negz" 40 | #define TAG_X "box.x" 41 | #define TAG_Y "box.y" 42 | #define TAG_Z "box.z" 43 | 44 | void BoxGenerator::addToTriangleBuffer(TriangleBuffer& buffer) const 45 | { 46 | PlaneGenerator pg; 47 | pg.setUTile(mUTile).setVTile(mVTile); 48 | if (mTransform) 49 | { 50 | pg.setScale(mScale); 51 | pg.setOrientation(mOrientation); 52 | } 53 | TriangleBuffer::Section section = buffer.beginSection(TAG_NEGZ); 54 | pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX) 55 | .setNormal(Vector3::NEGATIVE_UNIT_Z) 56 | .setPosition(mScale*(mPosition+.5f*mSizeZ*(mOrientation*Vector3::NEGATIVE_UNIT_Z))) 57 | .addToTriangleBuffer(buffer); 58 | buffer.endSection(section); 59 | 60 | section = buffer.beginSection(TAG_Z); 61 | pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX) 62 | .setNormal(Vector3::UNIT_Z) 63 | .setPosition(mScale*(mPosition+.5f*mSizeZ*(mOrientation*Vector3::UNIT_Z))) 64 | .addToTriangleBuffer(buffer); 65 | buffer.endSection(section); 66 | 67 | section = buffer.beginSection(TAG_NEGY); 68 | pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX) 69 | .setNormal(Vector3::NEGATIVE_UNIT_Y) 70 | .setPosition(mScale*(mPosition+.5f*mSizeY*(mOrientation*Vector3::NEGATIVE_UNIT_Y))) 71 | .addToTriangleBuffer(buffer); 72 | buffer.endSection(section); 73 | 74 | section = buffer.beginSection(TAG_Y); 75 | pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX) 76 | .setNormal(Vector3::UNIT_Y) 77 | .setPosition(mScale*(mPosition+.5f*mSizeY*(mOrientation*Vector3::UNIT_Y))) 78 | .addToTriangleBuffer(buffer); 79 | buffer.endSection(section); 80 | 81 | section = buffer.beginSection(TAG_NEGX); 82 | pg.setNumSegX(mNumSegY).setNumSegY(mNumSegZ).setSizeX(mSizeY).setSizeY(mSizeZ) 83 | .setNormal(Vector3::NEGATIVE_UNIT_X) 84 | .setPosition(mScale*(mPosition+.5f*mSizeX*(mOrientation*Vector3::NEGATIVE_UNIT_X))) 85 | .addToTriangleBuffer(buffer); 86 | buffer.endSection(section); 87 | 88 | section = buffer.beginSection(TAG_X); 89 | pg.setNumSegX(mNumSegY).setNumSegY(mNumSegZ).setSizeX(mSizeY).setSizeY(mSizeZ) 90 | .setNormal(Vector3::UNIT_X) 91 | .setPosition(mScale*(mPosition+.5f*mSizeX*(mOrientation*Vector3::UNIT_X))) 92 | .addToTriangleBuffer(buffer); 93 | buffer.endSection(section); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /library/src/ProceduralConeGenerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralConeGenerator.h" 30 | #include "ProceduralUtils.h" 31 | 32 | using namespace Ogre; 33 | 34 | namespace Procedural 35 | { 36 | void ConeGenerator::addToTriangleBuffer(TriangleBuffer& buffer) const 37 | { 38 | buffer.rebaseOffset(); 39 | buffer.estimateVertexCount((mNumSegHeight+1)*(mNumSegBase+1)+mNumSegBase+2); 40 | buffer.estimateIndexCount(mNumSegHeight*mNumSegBase*6+3*mNumSegBase); 41 | 42 | Real deltaAngle = (Math::TWO_PI / mNumSegBase); 43 | Real deltaHeight = mHeight/(Real)mNumSegHeight; 44 | int offset = 0; 45 | 46 | Vector3 refNormal = Vector3(mRadius, mHeight, 0.f).normalisedCopy(); 47 | Quaternion q; 48 | 49 | for (unsigned int i = 0; i <=mNumSegHeight; i++) 50 | { 51 | Real r0 = mRadius * (1 - i / (Real)mNumSegHeight); 52 | for (unsigned int j = 0; j<=mNumSegBase; j++) 53 | { 54 | Real x0 = r0* cosf(j*deltaAngle); 55 | Real z0 = r0 * sinf(j*deltaAngle); 56 | 57 | q.FromAngleAxis(Radian(-deltaAngle*j), Vector3::UNIT_Y); 58 | 59 | addPoint(buffer, Vector3(x0, i*deltaHeight, z0), 60 | q*refNormal, 61 | Vector2(j/(Real)mNumSegBase, i/(Real)mNumSegHeight)); 62 | 63 | if (i != mNumSegHeight&& j != mNumSegBase) 64 | { 65 | buffer.index(offset + mNumSegBase + 2); 66 | buffer.index(offset); 67 | buffer.index(offset + mNumSegBase+1); 68 | buffer.index(offset + mNumSegBase + +2); 69 | buffer.index(offset + 1); 70 | buffer.index(offset); 71 | } 72 | 73 | offset ++; 74 | } 75 | } 76 | 77 | //low cap 78 | int centerIndex = offset; 79 | addPoint(buffer, Vector3::ZERO, 80 | Vector3::NEGATIVE_UNIT_Y, 81 | Vector2::UNIT_Y); 82 | offset++; 83 | for (unsigned int j=0; j<=mNumSegBase; j++) 84 | { 85 | Real x0 = mRadius * cosf(j*deltaAngle); 86 | Real z0 = mRadius * sinf(j*deltaAngle); 87 | 88 | addPoint(buffer, Vector3(x0, 0.0f, z0), 89 | Vector3::NEGATIVE_UNIT_Y, 90 | Vector2(j/(Real)mNumSegBase,0.0)); 91 | 92 | if (j!=mNumSegBase) 93 | { 94 | buffer.index(centerIndex); 95 | buffer.index(offset); 96 | buffer.index(offset+1); 97 | } 98 | offset++; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /library/src/ProceduralCylinderGenerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralCylinderGenerator.h" 30 | #include "ProceduralUtils.h" 31 | 32 | using namespace Ogre; 33 | 34 | namespace Procedural 35 | { 36 | 37 | void CylinderGenerator::addToTriangleBuffer(TriangleBuffer& buffer) const 38 | { 39 | buffer.rebaseOffset(); 40 | if (mCapped) 41 | { 42 | buffer.estimateVertexCount((mNumSegHeight+1)*(mNumSegBase+1)+2*(mNumSegBase+1)+2); 43 | buffer.estimateIndexCount(mNumSegHeight*(mNumSegBase+1)*6+6*mNumSegBase); 44 | } 45 | else 46 | { 47 | buffer.estimateVertexCount((mNumSegHeight+1)*(mNumSegBase+1)); 48 | buffer.estimateIndexCount(mNumSegHeight*(mNumSegBase+1)*6); 49 | } 50 | 51 | 52 | Real deltaAngle = (Math::TWO_PI / mNumSegBase); 53 | Real deltaHeight = mHeight/(Real)mNumSegHeight; 54 | int offset = 0; 55 | 56 | for (unsigned int i = 0; i <=mNumSegHeight; i++) 57 | for (unsigned int j = 0; j<=mNumSegBase; j++) 58 | { 59 | Real x0 = mRadius * cosf(j*deltaAngle); 60 | Real z0 = mRadius * sinf(j*deltaAngle); 61 | 62 | addPoint(buffer, Vector3(x0, i*deltaHeight, z0), 63 | Vector3(x0,0,z0).normalisedCopy(), 64 | Vector2(j/(Real)mNumSegBase, i/(Real)mNumSegHeight)); 65 | 66 | if (i != mNumSegHeight) 67 | { 68 | buffer.index(offset + mNumSegBase + 1); 69 | buffer.index(offset); 70 | buffer.index(offset + mNumSegBase); 71 | buffer.index(offset + mNumSegBase + 1); 72 | buffer.index(offset + 1); 73 | buffer.index(offset); 74 | } 75 | offset ++; 76 | } 77 | if (mCapped) 78 | { 79 | //low cap 80 | int centerIndex = offset; 81 | addPoint(buffer, Vector3::ZERO, 82 | Vector3::NEGATIVE_UNIT_Y, 83 | Vector2::ZERO); 84 | offset++; 85 | for (unsigned int j=0; j<=mNumSegBase; j++) 86 | { 87 | Real x0 = cosf(j*deltaAngle); 88 | Real z0 = sinf(j*deltaAngle); 89 | 90 | addPoint(buffer, Vector3(mRadius*x0, 0.0f, mRadius*z0), 91 | Vector3::NEGATIVE_UNIT_Y, 92 | Vector2(x0, z0)); 93 | if (j!=mNumSegBase) 94 | { 95 | buffer.index(centerIndex); 96 | buffer.index(offset); 97 | buffer.index(offset+1); 98 | } 99 | offset++; 100 | } 101 | // high cap 102 | centerIndex = offset; 103 | addPoint(buffer, Vector3(0,mHeight,0), 104 | Vector3::UNIT_Y, 105 | Vector2::ZERO); 106 | offset++; 107 | for (unsigned int j=0; j<=mNumSegBase; j++) 108 | { 109 | Real x0 = cosf(j*deltaAngle); 110 | Real z0 = sinf(j*deltaAngle); 111 | 112 | addPoint(buffer, Vector3(x0 * mRadius, mHeight, mRadius * z0), 113 | Vector3::UNIT_Y, 114 | Vector2(x0, z0)); 115 | if (j!=mNumSegBase) 116 | { 117 | buffer.index(centerIndex); 118 | buffer.index(offset+1); 119 | buffer.index(offset); 120 | } 121 | offset++; 122 | } 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /library/src/ProceduralDebugRendering.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralDebugRendering.h" 30 | #include "OgreRoot.h" 31 | 32 | using namespace Ogre; 33 | 34 | namespace Procedural 35 | { 36 | SharedPtr ShowNormalsGenerator::buildManualObject() const 37 | { 38 | if (mTriangleBuffer == NULL) 39 | OGRE_EXCEPT(Ogre::Exception::ERR_INVALID_STATE, "The input triangle buffer must not be null", "Procedural::ShowNormalsGenerator::buildManualObject()"); 40 | auto manual = std::make_shared("TMP"); 41 | manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST); 42 | const std::vector& vertices = mTriangleBuffer->getVertices(); 43 | for (std::vector::const_iterator it = vertices.begin(); it!= vertices.end(); ++it) 44 | { 45 | manual->position(it->mPosition); 46 | manual->position(it->mPosition + it->mNormal * mSize); 47 | 48 | if (mVisualStyle == VS_ARROW) 49 | { 50 | Vector3 axis2 = it->mNormal.perpendicular(); 51 | Vector3 axis3 = it->mNormal.crossProduct(axis2); 52 | 53 | manual->position(it->mPosition + it->mNormal * mSize); 54 | manual->position(it->mPosition + (.8f * it->mNormal + .1f * axis2) * mSize); 55 | 56 | manual->position(it->mPosition + it->mNormal * mSize); 57 | manual->position(it->mPosition + .8f * (it->mNormal - .1f * axis2) * mSize); 58 | 59 | manual->position(it->mPosition + it->mNormal * mSize); 60 | manual->position(it->mPosition + .8f * ( it->mNormal + .1f * axis3)* mSize); 61 | 62 | manual->position(it->mPosition + it->mNormal * mSize); 63 | manual->position(it->mPosition + .8f * (it->mNormal - .1f * axis3)* mSize); 64 | } 65 | } 66 | manual->end(); 67 | 68 | return manual; 69 | } 70 | 71 | MeshPtr ShowNormalsGenerator::buildMesh(const std::string& name, const String& group) const 72 | { 73 | auto mo = buildManualObject(); 74 | Ogre::MeshPtr mesh = mo->convertToMesh(name, group); 75 | return mesh; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /library/src/ProceduralNoise.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralNoise.h" 30 | 31 | namespace Procedural 32 | { 33 | 34 | PerlinNoise::PerlinNoise(Ogre::uint octaves, Ogre::Real persistence, Ogre::Real frequency, Ogre::Real amplitude) 35 | : mFrequency(frequency), mAmplitude(amplitude), mPersistance(persistence), mOctaves(octaves) 36 | { 37 | if (mOctaves < 1) mOctaves = 1; 38 | if (mOctaves > 32) mOctaves = 32; 39 | } 40 | 41 | void PerlinNoise::setFrequency(Ogre::Real frequency) 42 | { 43 | mFrequency = frequency; 44 | } 45 | 46 | void PerlinNoise::setAmplitude(Ogre::Real amplitude) 47 | { 48 | mAmplitude = amplitude; 49 | } 50 | 51 | void PerlinNoise::setPersistence(Ogre::Real persistence) 52 | { 53 | mPersistance = persistence; 54 | } 55 | 56 | void PerlinNoise::setOctaves(Ogre::uint octaves) 57 | { 58 | mOctaves = octaves; 59 | if (mOctaves < 1) mOctaves = 1; 60 | if (mOctaves > 32) mOctaves = 32; 61 | } 62 | 63 | Ogre::Real PerlinNoise::function1D(size_t x) 64 | { 65 | double freq = mFrequency; 66 | double amp = mAmplitude; 67 | double sum = 0.0; 68 | 69 | for (size_t i = 0; i < mOctaves; i++) 70 | { 71 | sum += smoothedNoise((double)x * freq) * amp; 72 | 73 | amp *= mPersistance; 74 | freq *= 2; 75 | } 76 | 77 | return (Ogre::Real)sum; 78 | } 79 | 80 | Ogre::Real PerlinNoise::function2D(size_t x, size_t y) 81 | { 82 | double freq = mFrequency; 83 | double amp = mAmplitude; 84 | double sum = 0.0; 85 | 86 | for (size_t i = 0; i < mOctaves; i++) 87 | { 88 | sum += smoothedNoise((double)x * freq, (double)y * freq) * amp; 89 | 90 | amp *= mPersistance; 91 | freq *= 2; 92 | } 93 | 94 | return (Ogre::Real)sum; 95 | } 96 | 97 | double PerlinNoise::noise(double x) 98 | { 99 | int n = ((int)x << 13) ^ (int)x; 100 | return 1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0; 101 | } 102 | 103 | double PerlinNoise::noise(double x, double y) 104 | { 105 | int n = (int)(x + y * 57.0); 106 | n = (n << 13) ^ n; 107 | return 1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0; 108 | } 109 | 110 | double PerlinNoise::smoothedNoise(double x) 111 | { 112 | int XInt = (int)x; 113 | double XFrac = x - (double)XInt; 114 | 115 | return interpolate(noise(XInt), noise(XInt + 1), XFrac); 116 | } 117 | 118 | double PerlinNoise::smoothedNoise(double x, double y) 119 | { 120 | int XInt = (int)x; 121 | int YInt = (int)y; 122 | double XFrac = x - XInt; 123 | double YFrac = y - YInt; 124 | 125 | double n00 = noise(XInt , YInt ); 126 | double n10 = noise(XInt + 1, YInt ); 127 | double n01 = noise(XInt , YInt + 1); 128 | double n11 = noise(XInt + 1, YInt + 1); 129 | 130 | double i1 = interpolate(n00, n10, XFrac); 131 | double i2 = interpolate(n01, n11, XFrac); 132 | 133 | return interpolate(i1, i2, YFrac); 134 | } 135 | 136 | double PerlinNoise::interpolate(double x1, double x2, double a) 137 | { 138 | double f = (1 - Ogre::Math::Cos((Ogre::Real)a * Ogre::Math::PI)) * 0.5; 139 | return x1 * (1 - f) + x2 * f; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /library/src/ProceduralPlaneGenerator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralPlaneGenerator.h" 30 | #include "ProceduralUtils.h" 31 | 32 | using namespace Ogre; 33 | 34 | namespace Procedural 35 | { 36 | void PlaneGenerator::addToTriangleBuffer(TriangleBuffer& buffer) const 37 | { 38 | buffer.rebaseOffset(); 39 | buffer.estimateVertexCount((mNumSegX+1)*(mNumSegY+1)); 40 | buffer.estimateIndexCount(mNumSegX*mNumSegY*6); 41 | int offset = 0; 42 | 43 | Vector3 vX = mNormal.perpendicular(); 44 | Vector3 vY = mNormal.crossProduct(vX); 45 | Vector3 delta1 = mSizeX / (Real)mNumSegX * vX; 46 | Vector3 delta2 = mSizeY / (Real)mNumSegY * vY; 47 | // build one corner of the square 48 | Vector3 orig = -0.5f*mSizeX*vX - 0.5f*mSizeY*vY; 49 | 50 | for (unsigned short i1 = 0; i1<=mNumSegX; i1++) 51 | for (unsigned short i2 = 0; i2<=mNumSegY; i2++) 52 | { 53 | addPoint(buffer, orig+i1*delta1+i2*delta2, 54 | mNormal, 55 | Vector2(i1/(Real)mNumSegX, i2/(Real)mNumSegY)); 56 | } 57 | 58 | bool reverse = false; 59 | if (delta1.crossProduct(delta2).dotProduct(mNormal)>0) 60 | reverse= true; 61 | for (unsigned short n1 = 0; n1(mNumSegPath); 45 | Real heightStep = mHeight / static_cast(mNumSegPath); 46 | 47 | for (size_t i=0; i::const_iterator itAfter = _getKeyValueAfter(pos); 38 | std::map::const_iterator itBefore = _getKeyValueBefore(pos); 39 | 40 | if (itAfter==itBefore) 41 | return itBefore->second; 42 | if (itAfter==mKeyFrames.begin()) 43 | return itAfter->second; 44 | 45 | Real x1 = itBefore->first; 46 | Real y1 = itBefore->second; 47 | Real x2 = itAfter->first; 48 | Real y2 = itAfter->second; 49 | return (pos-x1)/(x2-x1)*(y2-y1)+y1; 50 | } 51 | 52 | std::map::const_iterator Track::_getKeyValueBefore(Real pos) const 53 | { 54 | std::map::const_iterator it = mKeyFrames.upper_bound(pos); 55 | if (it==mKeyFrames.begin()) 56 | return it; 57 | else 58 | return --it; 59 | } 60 | 61 | std::map::const_iterator Track::_getKeyValueAfter(Real pos) const 62 | { 63 | std::map::const_iterator it = mKeyFrames.upper_bound(pos); 64 | if (it==mKeyFrames.end()) 65 | return --it; 66 | else 67 | return it; 68 | } 69 | 70 | Real Track::getValue(Real absPos, Real relPos, unsigned int index) const 71 | { 72 | if (mAddressingMode == AM_ABSOLUTE_LINEIC) 73 | return getValue(absPos); 74 | if (mAddressingMode == AM_RELATIVE_LINEIC) 75 | return getValue(relPos); 76 | return getValue((Real)index); 77 | } 78 | 79 | std::map::const_iterator Track::_getKeyValueBefore(Real absPos, Real relPos, unsigned int index) const 80 | { 81 | if (mAddressingMode == AM_ABSOLUTE_LINEIC) 82 | return _getKeyValueBefore(absPos); 83 | if (mAddressingMode == AM_RELATIVE_LINEIC) 84 | return _getKeyValueBefore(relPos); 85 | return _getKeyValueBefore((Real)index); 86 | } 87 | 88 | std::map::const_iterator Track::_getKeyValueAfter(Real absPos, Real relPos, unsigned int index) const 89 | { 90 | if (mAddressingMode == AM_ABSOLUTE_LINEIC) 91 | return _getKeyValueAfter(absPos); 92 | if (mAddressingMode == AM_RELATIVE_LINEIC) 93 | return _getKeyValueAfter(relPos); 94 | return _getKeyValueAfter((Real)index); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /library/src/ProceduralUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "ProceduralUtils.h" 30 | #include "OgreResourceGroupManager.h" 31 | 32 | int Procedural::Utils::counter = 0; 33 | 34 | namespace Procedural 35 | { 36 | using namespace Ogre; 37 | 38 | void Utils::log(const Ogre::String& st) 39 | { 40 | Ogre::LogManager::getSingleton().logMessage("[PROCEDURAL] " + st); 41 | } 42 | 43 | std::string Utils::getName(const std::string& prefix) 44 | { 45 | counter++; 46 | return prefix + Ogre::StringConverter::toString(counter); 47 | } 48 | 49 | //----------------------------------------------------------------------- 50 | Quaternion Utils::_computeQuaternion(const Ogre::Vector3& direction, const Ogre::Vector3& upVector) 51 | { 52 | Quaternion q; 53 | Vector3 zVec = direction; 54 | zVec.normalise(); 55 | Vector3 xVec = upVector.crossProduct( zVec ); 56 | if (xVec.isZeroLength()) 57 | xVec = Ogre::Vector3::UNIT_X; 58 | xVec.normalise(); 59 | Vector3 yVec = zVec.crossProduct( xVec ); 60 | yVec.normalise(); 61 | q.FromAxes( xVec, yVec, zVec); 62 | return q; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(primitives) 2 | 3 | add_subdirectory(extrusion) 4 | 5 | add_subdirectory(svg) 6 | 7 | add_subdirectory(material) 8 | 9 | # Install sample sources 10 | if (OgreProcedural_INSTALL_SAMPLES_SOURCE) 11 | if (WIN32 OR APPLE) 12 | set(OgreProcedural_SAMPLES_DIR Samples) 13 | elseif (UNIX) 14 | set(OgreProcedural_SAMPLES_DIR share/PROCEDURAL/Samples) 15 | endif () 16 | install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${OgreProcedural_SAMPLES_DIR} 17 | REGEX "^CMakeLists.txt$" EXCLUDE 18 | PATTERN "Makefile.am" EXCLUDE 19 | #PATTERN "Media" EXCLUDE 20 | PATTERN "bin" EXCLUDE 21 | PATTERN "setup" EXCLUDE 22 | PATTERN "obj" EXCLUDE 23 | PATTERN "scripts" EXCLUDE 24 | ) 25 | # install a new CMakeLists.txt file to allow building of samples 26 | configure_file(${OgreProcedural_TEMPLATES_DIR}/SDK_CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/../CMakeLists.txt @ONLY) 27 | configure_file(${OgreProcedural_TEMPLATES_DIR}/SDK_Samples_CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) 28 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../CMakeLists.txt DESTINATION ${OgreProcedural_SAMPLES_DIR}/../) 29 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt DESTINATION ${OgreProcedural_SAMPLES_DIR}) 30 | endif () 31 | -------------------------------------------------------------------------------- /samples/common/include/BaseApplication.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | Filename: BaseApplication.h 4 | ----------------------------------------------------------------------------- 5 | 6 | This source file is part of the 7 | ___ __ __ _ _ _ 8 | /___\__ _ _ __ ___ / / /\ \ (_) | _(_) 9 | // // _` | '__/ _ \ \ \/ \/ / | |/ / | 10 | / \_// (_| | | | __/ \ /\ /| | <| | 11 | \___/ \__, |_| \___| \/ \/ |_|_|\_\_| 12 | |___/ 13 | Tutorial Framework 14 | http://www.ogre3d.org/tikiwiki/ 15 | ----------------------------------------------------------------------------- 16 | */ 17 | #ifndef __BaseApplication_h_ 18 | #define __BaseApplication_h_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | class BaseApplication : public OgreBites::ApplicationContext, public OgreBites::InputListener, OgreBites::TrayListener 40 | { 41 | public: 42 | BaseApplication(void); 43 | 44 | virtual void shutdown(void); 45 | 46 | virtual void go(void); 47 | 48 | protected: 49 | virtual void setup(); 50 | virtual void chooseSceneManager(void); 51 | virtual void createCamera(void); 52 | virtual void createFrameListener(void); 53 | virtual void createScene(void) = 0; // Override me! 54 | virtual void destroyScene(void); 55 | #if OGRE_VERSION_MAJOR != 2 56 | virtual void createViewports(void); 57 | #else 58 | virtual void createCompositor(void); 59 | #endif 60 | virtual void createLogManager(void); 61 | 62 | // OIS::KeyListener 63 | virtual bool keyPressed( const OgreBites::KeyboardEvent& arg ); 64 | 65 | void putMeshMat(const std::string& meshName, const std::string& matName, const Ogre::Vector3& position = Ogre::Vector3::ZERO, bool castShadows=true); 66 | void putMesh(const std::string& meshName, const Ogre::Vector3& position = Ogre::Vector3::ZERO); 67 | void putMesh2(const std::string& meshName, const Ogre::Vector3& position = Ogre::Vector3::ZERO); 68 | void putMesh3(const std::string& meshName, const Ogre::Vector3& position = Ogre::Vector3::ZERO); 69 | 70 | 71 | Ogre::Camera* mCam; 72 | Ogre::SceneNode* mCamera; 73 | Ogre::Light* movingLight; 74 | Ogre::SceneManager* mSceneMgr; 75 | 76 | // OgreBites 77 | OgreBites::TrayManager* mTrayMgr; 78 | OgreBites::CameraMan* mCameraMan; // basic camera controller 79 | OgreBites::AdvancedRenderControls* mAdvancedControls; // sample details panel 80 | }; 81 | 82 | #endif // #ifndef __BaseApplication_h_ 83 | -------------------------------------------------------------------------------- /samples/extrusion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(Sample_Extrusion) 4 | 5 | set( HDRS 6 | ../common/include/BaseApplication.h 7 | include/Extrusion.h 8 | ) 9 | 10 | set( SRCS 11 | ../common/src/BaseApplication.cpp 12 | src/Extrusion.cpp 13 | ) 14 | 15 | include_directories( ${OIS_INCLUDE_DIRS} 16 | ${OGRE_INCLUDE_DIRS} 17 | ../common/include 18 | ${CMAKE_CURRENT_SOURCE_DIR}/include 19 | ) 20 | 21 | procedural_add_executable(Sample_Extrusion WIN32 ${HDRS} ${SRCS}) 22 | 23 | set_target_properties(Sample_Extrusion PROPERTIES DEBUG_POSTFIX _d) 24 | 25 | target_link_libraries(Sample_Extrusion ${OgreProcedural_LIBRARIES} ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ) 26 | 27 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 28 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 29 | target_link_libraries(Sample_Extrusion ${OGRE_Overlay_LIBRARIES}) 30 | endif() 31 | 32 | procedural_create_vcproj_userfile(Sample_Extrusion) -------------------------------------------------------------------------------- /samples/extrusion/include/Extrusion.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef __Sample_Primitives_h_ 29 | #define __Sample_Primitives_h_ 30 | 31 | #include "BaseApplication.h" 32 | using namespace Ogre; 33 | 34 | class Sample_Extrusion : public BaseApplication 35 | { 36 | virtual bool frameStarted(const FrameEvent& evt); 37 | protected: 38 | virtual void createScene(void); 39 | virtual void createCamera(void); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /samples/material/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(Sample_Material) 4 | 5 | set( HDRS 6 | ../common/include/BaseApplication.h 7 | include/Material.h 8 | ) 9 | 10 | set( SRCS 11 | ../common/src/BaseApplication.cpp 12 | src/Material.cpp 13 | ) 14 | 15 | include_directories( ${OIS_INCLUDE_DIRS} 16 | ${OGRE_INCLUDE_DIRS} 17 | ../common/include 18 | ${CMAKE_CURRENT_SOURCE_DIR}/include 19 | ) 20 | 21 | procedural_add_executable(Sample_Material WIN32 ${HDRS} ${SRCS}) 22 | 23 | set_target_properties(Sample_Material PROPERTIES DEBUG_POSTFIX _d) 24 | 25 | target_link_libraries(Sample_Material ${OgreProcedural_LIBRARIES} ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${OGRE_RTShaderSystem_LIBRARY}) 26 | 27 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 28 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 29 | target_link_libraries(Sample_Material ${OGRE_Overlay_LIBRARIES}) 30 | endif() 31 | 32 | procedural_create_vcproj_userfile(Sample_Material) -------------------------------------------------------------------------------- /samples/material/include/Material.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef __Sample_Svg_h_ 29 | #define __Sample_Svg_h_ 30 | 31 | #include "BaseApplication.h" 32 | using namespace Ogre; 33 | 34 | class Sample_Material : public BaseApplication 35 | { 36 | virtual bool frameStarted(const FrameEvent& evt); 37 | protected: 38 | virtual void createScene(void); 39 | virtual void createCamera(void); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /samples/media/Box.lua: -------------------------------------------------------------------------------- 1 | tests:addTriangleBuffer(Procedural.BoxGenerator():setSizeX(10):buildTriangleBuffer()) -------------------------------------------------------------------------------- /samples/media/Examples.material: -------------------------------------------------------------------------------- 1 | material Examples/Rockwall 2 | { 3 | technique 4 | { 5 | pass 6 | { 7 | ambient 0.4 0.4 0.4 8 | diffuse 1.0 1.0 1.0 9 | texture_unit 10 | { 11 | texture old_fence.jpg 12 | } 13 | } 14 | } 15 | } 16 | 17 | material Examples/BeachStones 18 | { 19 | technique 20 | { 21 | pass 22 | { 23 | ambient 0.5 0.5 0.5 24 | diffuse 1.0 1.0 1.0 25 | specular 0.2 0.2 0.2 1.0 30.0 26 | 27 | texture_unit 28 | { 29 | texture red_brick.jpg 30 | } 31 | } 32 | } 33 | } 34 | 35 | material Examples/Road 36 | { 37 | technique 38 | { 39 | pass 40 | { 41 | texture_unit 42 | { 43 | texture road.png 44 | } 45 | } 46 | } 47 | } 48 | 49 | material Examples/Marble 50 | { 51 | technique 52 | { 53 | pass 54 | { 55 | diffuse 1.0 1.0 1.0 56 | 57 | texture_unit 58 | { 59 | texture marble.jpg 60 | } 61 | } 62 | } 63 | } 64 | 65 | material HiddenLine 66 | { 67 | technique 68 | { 69 | pass 70 | { 71 | ambient 1.0 1.0 1.0 72 | diffuse 1.0 1.0 1.0 73 | shading flat 74 | } 75 | 76 | pass 77 | { 78 | ambient 0.0 0.0 0.0 79 | diffuse 0.0 0.0 0.0 80 | polygon_mode wireframe 81 | depth_bias 10 82 | } 83 | } 84 | } 85 | 86 | material RedLine 87 | { 88 | technique 89 | { 90 | pass 91 | { 92 | emissive 1.0 0.0 0.0 93 | ambient 1.0 0.0 0.0 94 | diffuse 1.0 0.0 0.0 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /samples/media/luaTest.lua: -------------------------------------------------------------------------------- 1 | tb = Procedural.TextureBuffer(1024) 2 | Procedural.Cell(tb):setRegularity(233):setDensity(10):process() 3 | mesh = Procedural.SphereGenerator():setNumRings(8):setRadius(4.0):buildTriangleBuffer() 4 | tests:addTriangleTextureBuffer(mesh, tb) -------------------------------------------------------------------------------- /samples/media/marble.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/samples/media/marble.jpg -------------------------------------------------------------------------------- /samples/media/old_fence.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/samples/media/old_fence.jpg -------------------------------------------------------------------------------- /samples/media/red_brick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/samples/media/red_brick.jpg -------------------------------------------------------------------------------- /samples/media/road.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/ogre-procedural/4ca681bf88de5c05b863555cf0a34cd0c44ad794/samples/media/road.png -------------------------------------------------------------------------------- /samples/media/test.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 38 | 40 | 41 | 43 | image/svg+xml 44 | 46 | 47 | 48 | 49 | 53 | 61 | 72 | 84 | 88 | 106 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /samples/primitives/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(Sample_Primitives) 4 | 5 | set( HDRS 6 | ../common/include/BaseApplication.h 7 | include/Primitives.h 8 | ) 9 | 10 | set( SRCS 11 | ../common/src/BaseApplication.cpp 12 | src/Primitives.cpp 13 | ) 14 | 15 | include_directories( ${OIS_INCLUDE_DIRS} 16 | ${OGRE_INCLUDE_DIRS} 17 | ../common/include 18 | ${CMAKE_CURRENT_SOURCE_DIR}/include 19 | ) 20 | 21 | procedural_add_executable(Sample_Primitives WIN32 ${HDRS} ${SRCS}) 22 | 23 | set_target_properties(Sample_Primitives PROPERTIES DEBUG_POSTFIX _d) 24 | 25 | target_link_libraries(Sample_Primitives ${OgreProcedural_LIBRARIES} ${OGRE_LIBRARIES} ${OIS_LIBRARIES}) 26 | 27 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 28 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 29 | target_link_libraries(Sample_Primitives ${OGRE_Overlay_LIBRARIES}) 30 | endif() 31 | 32 | procedural_create_vcproj_userfile(Sample_Primitives) -------------------------------------------------------------------------------- /samples/primitives/include/Primitives.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef __Sample_Primitives_h_ 29 | #define __Sample_Primitives_h_ 30 | 31 | #include "BaseApplication.h" 32 | using namespace Ogre; 33 | 34 | class Sample_Primitives : public BaseApplication 35 | { 36 | virtual bool frameStarted(const FrameEvent& evt); 37 | protected: 38 | virtual void createScene(void); 39 | virtual void createCamera(void); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /samples/svg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(Sample_SVG) 4 | 5 | set( HDRS 6 | ../common/include/BaseApplication.h 7 | include/Svg.h 8 | ) 9 | 10 | set( SRCS 11 | ../common/src/BaseApplication.cpp 12 | src/Svg.cpp 13 | ) 14 | 15 | include_directories( ${OIS_INCLUDE_DIRS} 16 | ${OGRE_INCLUDE_DIRS} 17 | ../common/include 18 | ${CMAKE_CURRENT_SOURCE_DIR}/include 19 | ) 20 | 21 | procedural_add_executable(Sample_SVG WIN32 ${HDRS} ${SRCS}) 22 | 23 | set_target_properties(Sample_SVG PROPERTIES DEBUG_POSTFIX _d) 24 | 25 | target_link_libraries(Sample_SVG ${OgreProcedural_LIBRARIES} ${OGRE_LIBRARIES} ${OIS_LIBRARIES}) 26 | 27 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 28 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 29 | target_link_libraries(Sample_SVG ${OGRE_Overlay_LIBRARIES}) 30 | endif() 31 | 32 | procedural_create_vcproj_userfile(Sample_SVG) -------------------------------------------------------------------------------- /samples/svg/include/Svg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://code.google.com/p/ogre-procedural/ 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #ifndef __Sample_Svg_h_ 29 | #define __Sample_Svg_h_ 30 | 31 | #include "BaseApplication.h" 32 | using namespace Ogre; 33 | 34 | class Sample_Svg : public BaseApplication 35 | { 36 | virtual bool frameStarted(const FrameEvent& evt); 37 | protected: 38 | virtual void createScene(void); 39 | virtual void createCamera(void); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /samples/svg/src/Svg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ----------------------------------------------------------------------------- 3 | This source file is part of ogre-procedural 4 | 5 | For the latest info, see http://www.ogreprocedural.org 6 | 7 | Copyright (c) 2010-2013 Michael Broutin 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ----------------------------------------------------------------------------- 27 | */ 28 | #include "ProceduralStableHeaders.h" 29 | #include "Svg.h" 30 | #include "Procedural.h" 31 | #include "ProceduralUtils.h" 32 | #include 33 | 34 | //------------------------------------------------------------------------------------- 35 | void Sample_Svg::createScene(void) 36 | { 37 | // -- Extrude SVG primitive shapes 38 | Procedural::Path p; 39 | p.addPoint(0, 0, 0); 40 | p.addPoint(0, 10, 0); 41 | 42 | Procedural::MultiShape out; 43 | Procedural::SvgLoader svg; 44 | svg.parseSvgFile(out, "test.svg", "Scripts", 16); 45 | Procedural::Extruder().setMultiShapeToExtrude(&out).setExtrusionPath(&p).setScale(.05f).realizeMesh("svg"); 46 | putMesh2("svg"); 47 | } 48 | //------------------------------------------------------------------------------------- 49 | void Sample_Svg::createCamera(void) 50 | { 51 | BaseApplication::createCamera(); 52 | mCameraMan->setYawPitchDist(Degree(90), Degree(45), 2000); 53 | } 54 | //------------------------------------------------------------------------------------- 55 | bool Sample_Svg::frameStarted(const FrameEvent& evt) 56 | { 57 | BaseApplication::frameStarted(evt); 58 | movingLight->getParentSceneNode()->setPosition(mCamera->getPosition()); 59 | return true; 60 | } 61 | //------------------------------------------------------------------------------------- 62 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 63 | #define WIN32_LEAN_AND_MEAN 64 | #include "windows.h" 65 | #endif 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | 71 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 72 | INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) 73 | #else 74 | int main(int argc, char* argv[]) 75 | #endif 76 | { 77 | // Create application object 78 | Sample_Svg app; 79 | 80 | try 81 | { 82 | app.go(); 83 | } 84 | catch ( Ogre::Exception& e ) 85 | { 86 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 87 | MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); 88 | #else 89 | std::cerr << "An exception has occured: " << 90 | e.getFullDescription().c_str() << std::endl; 91 | #endif 92 | } 93 | 94 | return 0; 95 | } 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Unit_Tests) 2 | 3 | set( HDRS 4 | ../library/include/ProceduralStableHeaders.h 5 | ../samples/common/include/BaseApplication.h 6 | include/Tests.h 7 | ) 8 | 9 | set( SRCS 10 | ../library/src/ProceduralPrecompiledHeaders.cpp 11 | ../samples/common/src/BaseApplication.cpp 12 | src/Tests.cpp 13 | ) 14 | 15 | include_directories( ${OIS_INCLUDE_DIRS} 16 | ${OGRE_INCLUDE_DIRS} 17 | ../samples/common/include 18 | ${CMAKE_CURRENT_SOURCE_DIR}/include 19 | ) 20 | 21 | procedural_add_executable(Unit_Tests WIN32 ${HDRS} ${SRCS}) 22 | 23 | set_target_properties(Unit_Tests PROPERTIES DEBUG_POSTFIX _d) 24 | 25 | target_link_libraries(Unit_Tests ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${OgreProcedural_LIBRARIES}) 26 | 27 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 28 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 29 | target_link_libraries(Unit_Tests ${OGRE_Overlay_LIBRARIES}) 30 | endif() 31 | 32 | procedural_create_vcproj_userfile(Unit_Tests) 33 | 34 | # specify a precompiled header to use 35 | use_precompiled_header(Unit_Tests 36 | "../library/include/ProceduralStableHeaders.h" 37 | "../library/src/ProceduralPrecompiledHeaders.cpp" 38 | ) -------------------------------------------------------------------------------- /tests/scripts/primitives/Box.lua: -------------------------------------------------------------------------------- 1 | tests:addTriangleBuffer(Procedural.BoxGenerator():buildTriangleBuffer()) -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (OgreProcedural_BUILD_OGITOR_PLUGIN) 2 | add_subdirectory(ogitorPlugin) 3 | endif() 4 | 5 | add_subdirectory(scriptInterpreter) -------------------------------------------------------------------------------- /tools/ScriptInterpreter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Lua REQUIRED) 2 | find_package(SWIG REQUIRED) 3 | 4 | set( HDRS 5 | ../../samples/common/include/BaseApplication.h 6 | include/ScriptInterpreter.h 7 | ) 8 | 9 | set( SRCS 10 | ../../samples/common/src/BaseApplication.cpp 11 | src/ScriptInterpreter.cpp 12 | ) 13 | set( SRCS2 14 | "${OgreProcedural_BINARY_DIR}/procedural_wrap.cxx" 15 | ) 16 | 17 | 18 | set( EXTRA 19 | procedural.i 20 | ogre.i 21 | ) 22 | 23 | include_directories( 24 | ${OGRE_INCLUDE_DIRS} 25 | ../../samples/common/include 26 | ${CMAKE_CURRENT_SOURCE_DIR}/include 27 | ${LUA_INCLUDE_DIR} 28 | ) 29 | 30 | list(GET OGRE_INCLUDE_DIRS 0 OGRE_INCLUDE_DIR) 31 | set(SWIG_ARGS -c++ -lua -v -DOGRE_DEPRECATED -I"${OGRE_INCLUDE_DIR}" -I"${CMAKE_CURRENT_SOURCE_DIR}/../../library/include" -I"${CMAKE_CURRENT_SOURCE_DIR}/include" -I"${OgreProcedural_BINARY_DIR}/include" -o "${OgreProcedural_BINARY_DIR}/procedural_wrap.cxx") 32 | if(MSVC) 33 | set(SWIG_ARGS ${SWIG_ARGS} -Fmicrosoft) 34 | endif() 35 | if(FREETYPE_FOUND) 36 | set(SWIG_ARGS ${SWIG_ARGS} -DPROCEDURAL_USE_FREETYPE) 37 | else() 38 | set(SWIG_ARGS ${SWIG_ARGS} -DPROCEDURAL_NO_FREETYPE) 39 | endif() 40 | add_custom_command(OUTPUT "${OgreProcedural_BINARY_DIR}/procedural_wrap.cxx" 41 | COMMAND ${SWIG_EXECUTABLE} ARGS ${SWIG_ARGS} procedural.i 42 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" 43 | DEPENDS procedural.i ogre.i) 44 | 45 | procedural_add_executable(ScriptInterpreter ${HDRS} ${SRCS} ${EXTRA} SEPARATE ${SRCS2}) 46 | 47 | set_target_properties(ScriptInterpreter PROPERTIES DEBUG_POSTFIX _d) 48 | 49 | target_link_libraries(ScriptInterpreter ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${OgreProcedural_LIBRARIES} ${LUA_LIBRARIES}) 50 | 51 | if ((${OGRE_VERSION} VERSION_EQUAL "1.9.0") OR (${OGRE_VERSION} VERSION_GREATER "1.9.0")) 52 | include_directories(${OGRE_Overlay_INCLUDE_DIR}) 53 | target_link_libraries(ScriptInterpreter ${OGRE_Overlay_LIBRARIES}) 54 | endif() 55 | 56 | procedural_create_vcproj_userfile(ScriptInterpreter) 57 | -------------------------------------------------------------------------------- /tools/ScriptInterpreter/ogre.i: -------------------------------------------------------------------------------- 1 | %module Ogre 2 | %include "std_map.i" 3 | %include "std_string.i" 4 | %include "std_vector.i" 5 | %{ 6 | #include "Ogre.h" 7 | #include 8 | %} 9 | 10 | #define _OgreExport 11 | 12 | %include "OgreBuildSettings.h" 13 | %include "OgrePlatform.h" 14 | %include "OgrePrerequisites.h" 15 | %include "OgreVector2.h" 16 | %include "OgreVector3.h" 17 | %include "OgreVector4.h" 18 | %include "OgreQuaternion.h" 19 | %include "OgreMath.h" 20 | %include "OgreCommon.h" 21 | %template(Rect) Ogre::TRect; 22 | %template(RealRect) Ogre::TRect; 23 | %include "OgreColourValue.h" 24 | -------------------------------------------------------------------------------- /tools/ScriptInterpreter/procedural.i: -------------------------------------------------------------------------------- 1 | %module Procedural 2 | %include "std_map.i" 3 | %include "std_string.i" 4 | %include "std_vector.i" 5 | %include "ogre.i" 6 | %{ 7 | #include "Procedural.h" 8 | #include "ScriptInterpreter.h" 9 | using namespace Procedural; 10 | %} 11 | %include "ProceduralPlatform.h" 12 | %copyctor TriangleBuffer; 13 | %copyctor TextureBuffer; 14 | %copyctor Shape; 15 | %copyctor Path; 16 | %copyctor Track; 17 | %include "ProceduralTriangleBuffer.h" 18 | %include "ProceduralMeshGenerator.h" 19 | %include "ScriptInterpreter.h" 20 | %include "ProceduralSplines.h" 21 | %include "ProceduralShapeGeneratorsBase.h" 22 | %include "ProceduralPathGeneratorsBase.h" 23 | %template(bs1) Procedural::BaseSpline2< Procedural::CubicHermiteSpline2>; 24 | %template(bs2) Procedural::BaseSpline2< Procedural::CatmullRomSpline2>; 25 | %template(bs3) Procedural::BaseSpline2< Procedural::KochanekBartelsSpline2>; 26 | %template(bs4) Procedural::BaseSpline2< Procedural::RoundedCornerSpline2>; 27 | %template(bs5) Procedural::BaseSpline2< Procedural::BezierCurve2>; 28 | %template(bs6) Procedural::BaseSpline3< Procedural::CubicHermiteSpline3>; 29 | %template(bs7) Procedural::BaseSpline3< Procedural::CatmullRomSpline3>; 30 | %template(bs8) Procedural::BaseSpline3< Procedural::RoundedCornerSpline3>; 31 | %template(bs9) Procedural::BaseSpline3< Procedural::BezierCurve3>; 32 | %include "ProceduralShapeGenerators.h" 33 | %include "ProceduralPathGenerators.h" 34 | %template (mg1) Procedural::MeshGenerator; 35 | %template (mg2) Procedural::MeshGenerator; 36 | %template (mg3) Procedural::MeshGenerator; 37 | %template (mg4) Procedural::MeshGenerator; 38 | %template (mg5) Procedural::MeshGenerator; 39 | %template (mg6) Procedural::MeshGenerator; 40 | %template (mg7) Procedural::MeshGenerator; 41 | %template (mg8) Procedural::MeshGenerator; 42 | %template (mg9) Procedural::MeshGenerator; 43 | %template (mg10) Procedural::MeshGenerator; 44 | %template (mg11) Procedural::MeshGenerator; 45 | %template (mg12) Procedural::MeshGenerator; 46 | %template (mg13) Procedural::MeshGenerator; 47 | %template (mg14) Procedural::MeshGenerator; 48 | %template (mg15) Procedural::MeshGenerator; 49 | %template (mg16) Procedural::MeshGenerator; 50 | %template (mg17) Procedural::MeshGenerator; 51 | %include "ProceduralSphereGenerator.h" 52 | %include "ProceduralBoxGenerator.h" 53 | %include "ProceduralCapsuleGenerator.h" 54 | %include "ProceduralConeGenerator.h" 55 | %include "ProceduralCylinderGenerator.h" 56 | %include "ProceduralIcoSphereGenerator.h" 57 | %include "ProceduralRoundedBoxGenerator.h" 58 | %include "ProceduralTorusGenerator.h" 59 | %include "ProceduralTorusKnotGenerator.h" 60 | %include "ProceduralTubeGenerator.h" 61 | %include "ProceduralPlaneGenerator.h" 62 | %include "ProceduralExtruder.h" 63 | %include "ProceduralLathe.h" 64 | %include "ProceduralShape.h" 65 | %include "ProceduralMultiShape.h" 66 | %include "ProceduralPath.h" 67 | %include "ProceduralTriangulator.h" 68 | %include "ProceduralTrack.h" 69 | %include "ProceduralBoolean.h" 70 | %include "ProceduralSpringGenerator.h" 71 | %include "ProceduralSVG.h" 72 | %include "ProceduralDebugRendering.h" 73 | %template(vectorSeg2) std::vector< Procedural::Segment2D>; 74 | %include "ProceduralGeometryHelpers.h" 75 | %include "ProceduralMeshModifiers.h" 76 | %include "ProceduralNoise.h" 77 | %include "ProceduralTextureBuffer.h" 78 | %include "ProceduralTextureGenerator.h" 79 | %include "ProceduralTextureModifiers.h" 80 | %include "ProceduralPrismGenerator.h" 81 | -------------------------------------------------------------------------------- /tools/ogitorPlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(OGITOR REQUIRED) 2 | 3 | set( HDRS 4 | include/Plugin.h 5 | ) 6 | 7 | set( SRCS 8 | src/Plugin.cpp 9 | ) 10 | 11 | include_directories( ${OIS_INCLUDE_DIRS} 12 | ${OGRE_INCLUDE_DIRS} 13 | ${OGRE_Paging_INCLUDE_DIR} 14 | ${CMAKE_CURRENT_SOURCE_DIR}/include 15 | ${OGITOR_INCLUDE_DIRS} 16 | ) 17 | 18 | procedural_add_library(OgProcedural SHARED ${HDRS} ${SRCS}) 19 | 20 | set_target_properties(OgProcedural PROPERTIES DEBUG_POSTFIX _d) 21 | 22 | target_link_libraries(OgProcedural ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${OgreProcedural_LIBRARIES} ${OGITOR_LIBRARIES}) -------------------------------------------------------------------------------- /tools/ogitorPlugin/include/Plugin.h: -------------------------------------------------------------------------------- 1 | #include "Ogre.h" 2 | #include "Procedural.h" 3 | #include "Ogitors.h" 4 | 5 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 6 | #ifdef PLUGIN_EXPORT 7 | #define PluginExport __declspec (dllexport) 8 | #else 9 | #define PluginExport __declspec (dllimport) 10 | #endif 11 | #else 12 | #define PluginExport 13 | #endif 14 | 15 | extern "C" bool PluginExport dllStopPlugin(); 16 | 17 | extern "C" bool PluginExport dllGetPluginName(Ogre::String& name); 18 | 19 | extern "C" bool PluginExport dllStartPlugin(void* identifier, Ogre::String& name); -------------------------------------------------------------------------------- /tools/ogitorPlugin/src/Plugin.cpp: -------------------------------------------------------------------------------- 1 | #include "Plugin.h" 2 | 3 | //---------------------------------------------------------------------------- 4 | bool dllStartPlugin(void* identifier, Ogre::String& name) 5 | { 6 | name = "OgreProcedural Plugin"; 7 | return true; 8 | } 9 | //---------------------------------------------------------------------------- 10 | bool dllStopPlugin(void) 11 | { 12 | return true; 13 | } 14 | 15 | bool dllGetPluginName(Ogre::String& name) 16 | { 17 | name = "OgreProcedural Plugin"; 18 | return true; 19 | } --------------------------------------------------------------------------------