Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for structured noise (perlin) fuzzy skin #7678

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_subdirectory(libigl)
add_subdirectory(hints)
add_subdirectory(mcut)
add_subdirectory(qoi)
add_subdirectory(libnoise)

# Adding libnest2d project for bin packing...
add_subdirectory(libnest2d)
Expand Down
38 changes: 38 additions & 0 deletions src/libnoise/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
project(libnoise)
cmake_minimum_required(VERSION 3.0)

add_library(libnoise INTERFACE)

# Define the source directory
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")

file(GLOB NOISE_SOURCES_LIST
"${SOURCE_DIR}/*.cpp"
"${SOURCE_DIR}/model/*.cpp"
"${SOURCE_DIR}/module/*.cpp")

file(GLOB NOISE_HEADERS_LIST
"${SOURCE_DIR}/*.h"
"${SOURCE_DIR}/model/*.h"
"${SOURCE_DIR}/module/*.h")

# Conditionally include win32 files if compiling on Windows
if(WIN32)
set(WIN32_DIR "${SOURCE_DIR}/win32")
file(GLOB WIN32_SOURCES "${WIN32_DIR}/*.cpp")
file(GLOB WIN32_HEADERS "${WIN32_DIR}/*.h")
list(APPEND NOISE_SOURCES_LIST ${WIN32_SOURCES})
list(APPEND NOISE_HEADERS_LIST ${WIN32_HEADERS})
endif()

# Add the static library
add_library(libnoise_static STATIC ${NOISE_SOURCES_LIST} ${NOISE_HEADERS_LIST})

if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
target_compile_definitions(libnoise_static PRIVATE _GNU_SOURCE)
endif()

target_link_libraries(libnoise INTERFACE libnoise_static)
target_include_directories(libnoise INTERFACE ${SOURCE_DIR})

message(STATUS "libnoise using bundled version...")
34 changes: 34 additions & 0 deletions src/libnoise/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Installing libnoise:

1. Make!

CXXFLAGS='-O3 -fomit-frame-pointer ...options of choice...' make

Using compiler optimizations for libnoise is *strongly recommended*. Using the
unoptimized library is roughly a fifth as fast as using -O3 on my test
computer.

2. Install!

The 'include' directory should be copied to your software include directory,
usually /usr/local/include, with an appropriate name. I use

cp -R include /usr/local/include/noise

Similarly, the *contents* of the 'lib' directory should go into your library
directory (usually /usr/local/lib). Once you've done that, run 'ldconfig',
then make a symlink from LIBDIR/libnoise.so to LIBDIR/libnoise.so.0. I use:

cp lib/* /usr/local/lib
ldconfig
ln -s /usr/local/lib/libnoise.so.0 /usr/local/lib/libnoise.so

At this point, you should be able to include libnoise in your projects using

#include <noise/noise.h>

and

g++ ...options... -lnoise

At some point we'll automate this process.
23 changes: 23 additions & 0 deletions src/libnoise/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: all doc src include
all: doc src include lib
clean: cleandoc cleansrc cleaninclude cleanlib
install: installinclude installlib

doc src include lib:
$(MAKE) -C $@

lib: include

cleandoc:
$(MAKE) -C doc clean
cleansrc:
$(MAKE) -C src clean
cleaninclude:
$(MAKE) -C include clean
cleanlib:
$(MAKE) -C lib clean

installinclude:
$(MAKE) -C include include
installlib:
$(MAKE) -C lib include
8 changes: 8 additions & 0 deletions src/libnoise/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This distribution of noise library is only meant for interfacing noise with OrcaSlicer.

The noise source file was acquired from https://sourceforge.net/projects/libnoise/ version 1.0.

No changes to the noise library were made except for deleting the 'doc' directory.

Nick Johnson <[email protected]>
2 December 2024
14 changes: 14 additions & 0 deletions src/libnoise/include/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: all here clean
all: here model module

here:
cp ../src/*.h .
model:
(mkdir $@ && cp ../src/model/*.h $@)
module:
(mkdir $@ && cp ../src/$@/*.h $@)

clean:
-rm *.h
-rm -rf model
-rm -rf module
8 changes: 8 additions & 0 deletions src/libnoise/lib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
VPATH=../src/

.PHONY: all clean
all: libnoise.a libnoise.la libnoise.so.0.3
-cp $? .

clean:
-rm libnoise.*
Loading