Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nhippenmeyer committed Jun 1, 2012
0 parents commit 365ac38
Show file tree
Hide file tree
Showing 301 changed files with 56,545 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/*
objs/*
339 changes: 339 additions & 0 deletions COPYING.txt

Large diffs are not rendered by default.

191 changes: 191 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
###########################################################################
# user-configurable section
###########################################################################

# common locations for the OpenEXR libraries; may need to be updated
# for unusual installation locations
HAVE_EXR=1
EXR_INCLUDES=-I/usr/local/include/OpenEXR -I/usr/include/OpenEXR -I/opt/local/include/OpenEXR
EXR_LIBDIR=-L/usr/local/lib -L/opt/local/lib

HAVE_LIBTIFF=1
TIFF_INCLUDES=-I/usr/local/include -I/opt/local/include
TIFF_LIBDIR=-L/usr/local/lib -L/opt/local/lib

HAVE_DTRACE=0

# remove -DPBRT_HAS_OPENEXR to build without OpenEXR support
DEFS=-DPBRT_HAS_OPENEXR

# 32 bit
#MARCH=-m32 -msse2 -mfpmath=sse

# 64 bit
MARCH=-m64

# change this to -g3 for debug builds
OPT=-O2
# comment out this line to enable assertions at runtime
DEFS += -DNDEBUG

#########################################################################
# nothing below this line should need to be changed (usually)
#########################################################################

ARCH = $(shell uname)

LEX=flex
YACC=bison -d -v -t
LEXLIB = -lfl

ifeq ($(HAVE_DTRACE),1)
DEFS += -DPBRT_PROBES_DTRACE
else
DEFS += -DPBRT_PROBES_NONE
endif

EXRLIBS=$(EXR_LIBDIR) -Bstatic -lIex -lIlmImf -lIlmThread -lImath -lIex -lHalf -Bdynamic
ifeq ($(ARCH),Linux)
EXRLIBS += -lpthread
endif
ifeq ($(ARCH),OpenBSD)
EXRLIBS += -lpthread
endif
ifeq ($(ARCH),Darwin)
EXRLIBS += -lz
endif

CC=gcc
CXX=g++
LD=$(CXX) $(OPT) $(MARCH)
INCLUDE=-I. -Icore $(EXR_INCLUDES) $(TIFF_INCLUDES)
WARN=-Wall
CWD=$(shell pwd)
CXXFLAGS=$(OPT) $(MARCH) $(INCLUDE) $(WARN) $(DEFS)
CCFLAGS=$(CXXFLAGS)
LIBS=$(LEXLIB) $(EXR_LIBDIR) $(EXRLIBS) -lm

LIBSRCS=$(wildcard core/*.cpp) core/pbrtlex.cpp core/pbrtparse.cpp
LIBSRCS += $(wildcard accelerators/*.cpp cameras/*.cpp film/*.cpp filters/*.cpp )
LIBSRCS += $(wildcard integrators/*.cpp lights/*.cpp materials/*.cpp renderers/*.cpp )
LIBSRCS += $(wildcard samplers/*.cpp shapes/*.cpp textures/*.cpp volumes/*.cpp)

LIBOBJS=$(addprefix objs/, $(subst /,_,$(LIBSRCS:.cpp=.o)))

HEADERS = $(wildcard */*.h)

TOOLS = bin/bsdftest bin/exravg bin/exrdiff
ifeq ($(HAVE_LIBTIFF),1)
TOOLS += bin/exrtotiff
endif

default: dirs bin/pbrt $(TOOLS)

bin/%: dirs

pbrt: bin/pbrt

dirs:
/bin/mkdir -p bin objs

$(LIBOBJS): $(HEADERS)

.PHONY: dirs tools

objs/libpbrt.a: $(LIBOBJS)
@echo "Building the core rendering library (libpbrt.a)"
@ar rcs $@ $(LIBOBJS)

objs/accelerators_%.o: accelerators/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/cameras_%.o: cameras/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/core_%.o: core/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/film_%.o: film/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/filters_%.o: filters/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/integrators_%.o: integrators/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/lights_%.o: lights/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/main_%.o: main/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/materials_%.o: materials/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/renderers_%.o: renderers/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/samplers_%.o: samplers/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/shapes_%.o: shapes/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/textures_%.o: textures/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/volumes_%.o: volumes/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/pbrt.o: main/pbrt.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: tools/%.cpp
@echo "Building object $@"
@$(CXX) $(CXXFLAGS) -o $@ -c $<

bin/%: objs/%.o objs/libpbrt.a
@echo "Linking $@"
@$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)

bin/exrtotiff: objs/exrtotiff.o
@echo "Linking $@"
@$(CXX) $(CXXFLAGS) -o $@ $^ $(TIFF_LIBDIR) -ltiff $(LIBS)

core/pbrtlex.cpp: core/pbrtlex.ll core/pbrtparse.cpp
@echo "Lex'ing pbrtlex.ll"
@$(LEX) -o$@ core/pbrtlex.ll

core/pbrtparse.cpp: core/pbrtparse.yy
@echo "YACC'ing pbrtparse.yy"
@$(YACC) -o $@ core/pbrtparse.yy
@if [ -e core/pbrtparse.cpp.h ]; then /bin/mv core/pbrtparse.cpp.h core/pbrtparse.hpp; fi
@if [ -e core/pbrtparse.hh ]; then /bin/mv core/pbrtparse.hh core/pbrtparse.hpp; fi

ifeq ($(HAVE_DTRACE),1)
core/dtrace.h: core/dtrace.d
/usr/sbin/dtrace -h -s $^ -o $@

$(LIBOBJS): core/dtrace.h
endif

$(RENDERER_BINARY): $(RENDERER_OBJS) $(CORE_LIB)

clean:
rm -f objs/* bin/* core/pbrtlex.[ch]* core/pbrtparse.[ch]*
90 changes: 90 additions & 0 deletions README_BUILDING.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

pbrt is designed to be easily ported to various platforms; the authors
regularly compile it on Mac OS X, Windows, and a variety of Linux variants.
pbrt users have sent patches to ensure that it compiles cleanly on FreeBSD,
OpenBSD, and other systems. We will happily incorporate patches to make
the system build on other platforms! (Please send patches or other notes
about issues with building pbrt to [email protected].)

=== Building The System ===

--- Windows ---

Please see the file README_BUILDING_MSVC2008.txt or
README_BUILDING_MSVC2010.txt, as appropriate for the version of Visual
Studio you're using.

There is not currently support for building pbrt with the Cygwin gcc
compiler, but patches would be happily accepted.

--- Linux ---

On Linux and other Unix platforms, pbrt can be compiled with either the
provided Makefile or the provided SCons build files (see http://scons.org
for information about SCons). Please see the notes below about installing
OpenEXR libraries on your system before building pbrt.

The SCons build files build both debug and release configurations of the
system, while the Makefile only builds a release build. See comment at the
top of the Makefile for how to modify it to do a debug build instead.

--- Mac OS X ---

Please see the notes below about installing OpenEXR libraries on your
system before building pbrt.

In addition to the Makefile and SCons files described in the "Linux"
section, there is also is also an XCode project file for Mac OS X,
pbrt.xcodeproj.


=== Build Options and Configuration ===

The remainder of this document has notes about the two main build
configuration options: using the OpenEXR and TIFF image formats or not, and
how pbrt collects and reports statistics. It then has sections about each
of the main target platforms (Linux, Mac OS X, and Windows).

--- OpenEXR ---

If you have the OpenEXR image library installed (see http://openexr.com),
then pbrt will read and write OpenEXR format images. A number of the
example scenes use OpenEXR image files. If you do have OpenEXR installed,
then PBRT_HAS_OPENEXR should be #defined and the paths to the OpenEXR
headers and libraries should be set in the build rules as appropriate.

On Mac OS X and Linux, OpenEXR compiles easily from the distribution from
the OpenEXR website. Alternatively, most package or "ports" systems
provide an OpenEXR installation.

--- TIFF ---

We provide a utility program to convert from high dynamic range EXR images
to low dynamic range TIFF images, exrtotiff. This program includes a
rudimentary tone mapping pipeline and support for image bloom and gamma
correction. To build this program, modify the user configuration section
appropriately in either Makefile or SCons file (depending on how you're
building the system.) There is not currently any support for building this
from the MSVC solution file on Windows.

More comprehensive sets of programs to work with EXR images are available
from http://scanline.ca/exrtools/ and http://pfstools.sourceforge.net/.

--- Probes and Statistics ---

pbrt no longer collects runtime rendering statistics by default. (Updating
shared statistics counters can cause a substantial performance impact with
multi-threaded execution.) To override this, change the definition of the
PBRT_PROBES_NONE preprocessor #define to either PBRT_PROBES_DTRACE or
PBRT_PROBES_COUNTERS.

If your system supports dtrace (OSX, FreeBSD, and Solaris, currently--see
http://en.wikipedia.org/wiki/DTrace for more information), then pbrt is
instrumented to provide a large number of dtrace probes that can be
analyzed with dtrace scripts; building with dtrace support is supported if
you set the PBRT_PROBES_DTRACE preprocessor #define. See the dtrace/
directory for a number of example dtrace scripts to use with pbrt.

Alternatively, PBRT_PROBES_COUNTERS can be set to compile the system to
gather a number of statistics with shared counters, incurring the
corresponding performance penalty.
Loading

0 comments on commit 365ac38

Please sign in to comment.