Compare commits
10
Commits
waf
...
8f09415b37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f09415b37 | ||
|
|
d1b558a554 | ||
|
|
acfb883f66 | ||
|
|
ede4f6235a | ||
|
|
0003c74f3b | ||
|
|
deb16eeef7 | ||
|
|
49660f6835 | ||
|
|
3b90da8095 | ||
|
|
24b4b48555 | ||
|
|
b5e4655f03 |
No files matched your search
+2
-4
@@ -1,7 +1,5 @@
|
||||
*.dep
|
||||
fart
|
||||
*.bmp
|
||||
*.png
|
||||
parser/parser.tab.cc
|
||||
parser/parser.tab.hh
|
||||
parser/lex.yy.cc
|
||||
/.rscons*
|
||||
/build/
|
||||
@@ -1,10 +1,7 @@
|
||||
export SCONSFLAGS := -Q
|
||||
|
||||
.PHONY: all
|
||||
all:
|
||||
@scons
|
||||
|
||||
install:
|
||||
@scons $@
|
||||
@./rscons
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@scons -c
|
||||
@./rscons clean
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
require "rscons"
|
||||
|
||||
task :default do
|
||||
Rscons::Environment.new do |env|
|
||||
env.build_root = "build"
|
||||
|
||||
lexer_source = "#{env.build_root}/lex.yy.cc"
|
||||
env.CFile(lexer_source, "parser/parser.ll")
|
||||
|
||||
parser_source = "#{env.build_root}/parser.tab.cc"
|
||||
env.CFile(parser_source, "parser/parser.yy")
|
||||
|
||||
sources = Dir["{util,shapes,main,distrib,parser}/**/*.cc"]
|
||||
sources << lexer_source
|
||||
sources << parser_source
|
||||
|
||||
env["CXXFLAGS"] += ["-Wall", "-O2"]
|
||||
env["CPPPATH"] += Dir["{util,shapes,main,distrib,parser}/**/"]
|
||||
env["CPPPATH"] << "."
|
||||
env["LIBS"] += ["fl", "pthread", "freeimage"]
|
||||
|
||||
env.Program("fart", sources)
|
||||
end
|
||||
end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
configure do
|
||||
check_cxx_compiler
|
||||
check_program "flex"
|
||||
check_program "bison"
|
||||
check_lib "pthread"
|
||||
end
|
||||
|
||||
env do |env|
|
||||
env["CCFLAGS"] += %w[-Wall -O2]
|
||||
env["CPPPATH"] += glob("src/**")
|
||||
|
||||
env.CFile("^/parser/lexer.cc", "src/parser/parser.ll")
|
||||
env.CFile("^/parser/parser.cc", "src/parser/parser.yy")
|
||||
env["CPPPATH"] += ["#{env.build_root}/parser"]
|
||||
|
||||
sources = glob("src/**/*.cc")
|
||||
sources += ["^/parser/lexer.cc", "^/parser/parser.cc"]
|
||||
env.Program("fart", sources)
|
||||
end
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
# vim:syntax=python
|
||||
|
||||
import os
|
||||
|
||||
target = 'fart'
|
||||
subdirs = ['util', 'shapes', 'main', 'distrib']
|
||||
parser_sources = Glob('parser/*.cc')
|
||||
sources = map(lambda x: Glob(x + '/*.cc'), subdirs)
|
||||
lexer_source = 'parser/lex.yy.cc'
|
||||
parser_source = 'parser/parser.tab.cc'
|
||||
for f in parser_sources:
|
||||
if str(f) != lexer_source and str(f) != parser_source:
|
||||
sources.append(f)
|
||||
sources += [lexer_source, parser_source]
|
||||
|
||||
env = Environment(CPPFLAGS = '-I.',
|
||||
CXXFLAGS = '-Wall -O2',
|
||||
YACCFLAGS = '-d',
|
||||
LIBS = ['-lfl', '-lpthread', '-lfreeimage'])
|
||||
|
||||
lexer = env.CXXFile(lexer_source, 'parser/parser.ll')
|
||||
parser = env.CXXFile(parser_source, 'parser/parser.yy')
|
||||
env.Depends(lexer, parser_source)
|
||||
|
||||
env.Program(target, sources)
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# Copyright (c) 2013-2022 Josh Holtrop
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
script = File.join(File.dirname(__FILE__), ".rscons-3.1.0-4892f95d56c30bbe9aa0c9964062ec5b.rb")
|
||||
unless File.exist?(script)
|
||||
if File.read(__FILE__, mode: "rb") =~ /^#==>(.*)/
|
||||
require "zlib"
|
||||
require "base64"
|
||||
encoded_compressed = $1
|
||||
unescaped_compressed = Base64.decode64(encoded_compressed)
|
||||
inflated = Zlib::Inflate.inflate(unescaped_compressed)
|
||||
File.open(script, "wb") do |fh|
|
||||
fh.write(inflated)
|
||||
end
|
||||
else
|
||||
raise "Could not decompress."
|
||||
end
|
||||
end
|
||||
load script
|
||||
if __FILE__ == $0
|
||||
Rscons::Cli.new.run(ARGV)
|
||||
end
|
||||
#==>eJztff13GzeS4O/5K9ptJyZlirIzN7PvMVYkW5IT7cmWT5KznqUZDkU2pR6T3dxuUrJW5v7thyp8VQHoJiXbuey+87yJ2PgoAIVCoVAoVD18sLUoi63zNNtKsquoWJzffFck/7FIiySKs2S+dTmfz2KbNEovknIefzfNR4tJEp2Uwzwrv4si9f0iK1PxFUXDyaAso+fPozKZj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EYD8yQU8ZrS7Qyyq/LUEvrQ5lJW8tv213A+ea/DVoedjWYF6cazKNnxKCpDtqkGprt1NrQZtXQBKWuDQ4smIs57qI7jXiTHRdWo7UKzpM7wllzepJQBbl4vNIBfUFx5UmIRNB5wKUOLctUikIo24Uy8MNrqb64lGVmg7TArV/LyVyMEUIhE7HVvciLohjcNHGrhm2aJlKWKGpLOdsVQzhebbkqaSV0PhwtplrEkqJv/3JQXkbbRhKe5/1LvwCe0lAZ1z+/afzQAcukJtOEMM1iv5wXUhusr4Rupuf5pBntyDR5Eo5QZjb1gtZW8KakpUESCyqwI0CNiu4hSm7mjE0MrEJYWPdgJtXC6xshQ2FusaKuI/UpBv50475OjZ2VRTQrtFcUSPgtpmjJ3HAuSqYIQQJrsFwyc+LT07eINNZfB2B9X3Xlr6POqG6HtpHqVcuwjEkLine truncated
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable → Regular
File renamed without changes.
File renamed without changes.
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "Scene.h"
|
||||
#include "Light.h"
|
||||
#include "util/stb_image.h"
|
||||
#include "parser/parser.h"
|
||||
#include "parser/nodes.h"
|
||||
#include "util/Polygon.h"
|
||||
@@ -347,19 +348,23 @@ refptr<Material> Scene::processMaterial(refptr<Node> node)
|
||||
else if ( typeid(**it) == typeid(TextureNode) )
|
||||
{
|
||||
string filename = (*it)->getString();
|
||||
FIBITMAP * fib = NULL;
|
||||
Texture * texture = NULL;
|
||||
if (m_textures.find(filename) != m_textures.end())
|
||||
{
|
||||
/* texture already loaded */
|
||||
fib = m_textures[filename];
|
||||
texture = m_textures[filename];
|
||||
}
|
||||
else
|
||||
{
|
||||
fib = loadTexture((*it)->getString());
|
||||
texture = loadTexture(filename);
|
||||
if (texture != NULL)
|
||||
{
|
||||
m_textures[filename] = texture;
|
||||
}
|
||||
}
|
||||
if (fib != NULL)
|
||||
if (texture != NULL)
|
||||
{
|
||||
material->setTexture(fib);
|
||||
material->setTexture(texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -811,30 +816,24 @@ void Scene::processShapeDefinition(refptr<Node> node)
|
||||
m_transforms.pop();
|
||||
}
|
||||
|
||||
FIBITMAP * Scene::loadTexture(const std::string & filename)
|
||||
Texture * Scene::loadTexture(const std::string & filename)
|
||||
{
|
||||
FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(filename.c_str(), 0);
|
||||
if (fif == FIF_UNKNOWN)
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int channels = 0;
|
||||
/* request 4 channels so the data is always tightly packed RGBA */
|
||||
unsigned char * data = stbi_load(filename.c_str(), &width, &height,
|
||||
&channels, 4);
|
||||
if (data == NULL)
|
||||
{
|
||||
fif = FreeImage_GetFIFFromFilename(filename.c_str());
|
||||
if (fif == FIF_UNKNOWN)
|
||||
{
|
||||
cerr << "Error: couldn't determine image format for \""
|
||||
<< filename << "\"" << endl;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (!FreeImage_FIFSupportsReading(fif))
|
||||
{
|
||||
cerr << "Error: image format of \"" << filename
|
||||
<< "\" does not support reading" << endl;
|
||||
cerr << "Error: image \"" << filename << "\" could not be loaded: "
|
||||
<< stbi_failure_reason() << endl;
|
||||
return NULL;
|
||||
}
|
||||
FIBITMAP * fib = FreeImage_Load(fif, filename.c_str(), 0);
|
||||
if (fib == NULL)
|
||||
{
|
||||
cerr << "Error: image \"" << filename << "\" could not be loaded"
|
||||
<< endl;
|
||||
}
|
||||
return fib;
|
||||
Texture * texture = new Texture;
|
||||
texture->width = width;
|
||||
texture->height = height;
|
||||
texture->channels = 4;
|
||||
texture->data = data;
|
||||
return texture;
|
||||
}
|
||||
@@ -7,11 +7,11 @@
|
||||
#include <utility> /* pair */
|
||||
#include <map>
|
||||
#include <algorithm> /* sort() */
|
||||
#include <functional> /* binary_function */
|
||||
#include <typeinfo> /* typeid operator support */
|
||||
|
||||
#include "Scene.h"
|
||||
#include "BMP.h"
|
||||
#include "util/stb_image.h"
|
||||
#include "util/Color.h"
|
||||
#include "shapes/Shape.h"
|
||||
#include "Light.h"
|
||||
@@ -75,12 +75,13 @@ Scene::Scene(const map<string, const char *> & options,
|
||||
|
||||
Scene::~Scene()
|
||||
{
|
||||
/* clean up any textures loaded with freeimage */
|
||||
for (std::map< std::string, FIBITMAP * >::iterator it = m_textures.begin();
|
||||
/* clean up any textures loaded with stb_image */
|
||||
for (std::map< std::string, Texture * >::iterator it = m_textures.begin();
|
||||
it != m_textures.end();
|
||||
it++)
|
||||
{
|
||||
FreeImage_Unload(it->second);
|
||||
stbi_image_free(it->second->data);
|
||||
delete it->second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <utility>
|
||||
#include <stack>
|
||||
|
||||
#include <FreeImage.h>
|
||||
|
||||
#include "util/refptr.h"
|
||||
#include "util/Ray.h"
|
||||
#include "util/Color.h"
|
||||
@@ -82,7 +80,7 @@ class Scene
|
||||
std::vector<ShapeRef> processForNode(refptr<Node> node);
|
||||
void processMaterialDefinition(refptr<Node> node);
|
||||
void processShapeDefinition(refptr<Node> node);
|
||||
FIBITMAP * loadTexture(const std::string & filename);
|
||||
Texture * loadTexture(const std::string & filename);
|
||||
|
||||
/* rendering parameters */
|
||||
int m_width;
|
||||
@@ -104,7 +102,7 @@ class Scene
|
||||
double m_sample_span;
|
||||
double m_half_sample_span;
|
||||
std::map< std::string, refptr<Material> > m_materials;
|
||||
std::map< std::string, FIBITMAP * > m_textures;
|
||||
std::map< std::string, Texture * > m_textures;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <FreeImage.h>
|
||||
|
||||
#include "Scene.h"
|
||||
#include "distrib/distrib.h"
|
||||
#include "BMP.h"
|
||||
@@ -188,8 +186,6 @@ int main(int argc, char * argv[])
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
FreeImage_Initialise(FALSE);
|
||||
|
||||
const char * filename = argv[optind];
|
||||
client_options.push_back(filename);
|
||||
Scene scene(scene_options, filename);
|
||||
@@ -338,8 +334,6 @@ int main(int argc, char * argv[])
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
FreeImage_DeInitialise();
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,6 @@
|
||||
|
||||
%option nounput
|
||||
%option noyywrap
|
||||
%option bison-locations
|
||||
|
||||
%{
|
||||
@@ -8,7 +9,7 @@
|
||||
|
||||
#include "nodes.h"
|
||||
#include "parser.h"
|
||||
#include "parser.tab.hh"
|
||||
#include "parser.hh"
|
||||
|
||||
#define YY_USER_ACTION yylloc->first_column += yyleng;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "util/Scope.h"
|
||||
#include "nodes.h"
|
||||
#include "parser.h"
|
||||
#include "parser.tab.hh" /* bison-generated header with YY[SL]TYPE */
|
||||
#include "parser.hh" /* bison-generated header with YY[SL]TYPE */
|
||||
using namespace std;
|
||||
|
||||
#define yyerror(msg) errFunc(msg, &yylloc)
|
||||
@@ -19,19 +19,14 @@ extern FILE * yyin;
|
||||
|
||||
void errFunc(const char * str, YYLTYPE * yyllocp);
|
||||
|
||||
int yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static refptr<Node> parsed_scene_node;
|
||||
refptr<Scope> parser_scope;
|
||||
|
||||
%}
|
||||
|
||||
%pure-parser
|
||||
%define api.pure
|
||||
%locations
|
||||
%error-verbose
|
||||
%define parse.error verbose
|
||||
|
||||
%token PLUS;
|
||||
%token MINUS;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable → Regular
-4
@@ -1,7 +1,6 @@
|
||||
|
||||
#include "Shape.h"
|
||||
#include <algorithm> /* sort() */
|
||||
#include <functional> /* binary_function */
|
||||
#include <utility>
|
||||
using namespace std;
|
||||
|
||||
@@ -28,9 +27,6 @@ void Shape::setMaterial(refptr<Material> material)
|
||||
}
|
||||
|
||||
class BoolIntersectionComparator
|
||||
: public std::binary_function<Shape::BoolIntersection,
|
||||
Shape::BoolIntersection,
|
||||
bool>
|
||||
{
|
||||
public:
|
||||
BoolIntersectionComparator(const Vector & refPoint)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,8 +2,7 @@
|
||||
#ifndef MATERIAL_H
|
||||
#define MATERIAL_H MATERIAL_H
|
||||
|
||||
#include <FreeImage.h>
|
||||
|
||||
#include "Texture.h"
|
||||
#include "Color.h"
|
||||
|
||||
class Material
|
||||
@@ -55,8 +54,8 @@ class Material
|
||||
void setTransparency(double t) { m_transparency = t; }
|
||||
double getTransparency() const { return m_transparency; }
|
||||
|
||||
void setTexture(FIBITMAP * fib) { m_texture = fib; }
|
||||
FIBITMAP * getTexture() const { return m_texture; }
|
||||
void setTexture(Texture * texture) { m_texture = texture; }
|
||||
Texture * getTexture() const { return m_texture; }
|
||||
|
||||
protected:
|
||||
Color m_ambient_color;
|
||||
@@ -66,7 +65,7 @@ class Material
|
||||
double m_reflectance;
|
||||
double m_refraction;
|
||||
double m_transparency;
|
||||
FIBITMAP * m_texture;
|
||||
Texture * m_texture;
|
||||
};
|
||||
|
||||
#endif
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,16 @@
|
||||
|
||||
#ifndef TEXTURE_H
|
||||
#define TEXTURE_H TEXTURE_H
|
||||
|
||||
/* A loaded image texture. Pixel data is stored as tightly packed RGBA
|
||||
* bytes (4 channels) and is owned by this struct -- free it with
|
||||
* stbi_image_free(). */
|
||||
struct Texture
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int channels;
|
||||
unsigned char * data;
|
||||
};
|
||||
|
||||
#endif
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,12 +8,12 @@ template <typename T>
|
||||
class refptr
|
||||
{
|
||||
public:
|
||||
refptr<T>();
|
||||
refptr<T>(T * ptr);
|
||||
refptr<T>(const refptr<T> & orig);
|
||||
refptr<T> & operator=(const refptr<T> & orig);
|
||||
refptr<T> & operator=(T * ptr);
|
||||
~refptr<T>();
|
||||
refptr();
|
||||
refptr(T * ptr);
|
||||
refptr(const refptr<T> & orig);
|
||||
refptr & operator=(const refptr<T> & orig);
|
||||
refptr & operator=(T * ptr);
|
||||
~refptr();
|
||||
T & operator*() const;
|
||||
T * operator->() const;
|
||||
bool isNull() const { return m_ptr == NULL; }
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
/* Single translation unit that compiles the stb_image implementation. */
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user