Compare commits

..
5 Commits
Author SHA1 Message Date
josh 5b449506cb Add fart.hton module 2023-10-09 19:13:11 -04:00
josh 42e2508766 Add crc32() 2023-10-09 19:06:51 -04:00
josh 9f39cddc24 Add BFile struct 2023-10-09 18:55:51 -04:00
josh 4c57df0774 Update Rsconscript and add main.d 2023-09-30 21:05:12 -04:00
josh c8658e5e00 Remove C sources 2023-09-30 20:45:35 -04:00
30 changed files with 1472 additions and 88 deletions

No files matched your search

+5 -1
View File
@@ -1 +1,5 @@
/target/ /fart
*.bmp
*.png
/.rscons*
/build/
Generated
-7
View File
@@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "fart"
version = "0.1.0"
-6
View File
@@ -1,6 +0,0 @@
[package]
name = "fart"
version = "0.1.0"
edition = "2024"
[dependencies]
+7
View File
@@ -0,0 +1,7 @@
.PHONY: all
all:
@./rscons
.PHONY: clean
clean:
@./rscons clean
+11
View File
@@ -0,0 +1,11 @@
configure do
check_d_compiler
end
env do |env|
env["DFLAGS"] += %w[-Werror -O2]
env["D_IMPORT_PATH"] += %w[src]
sources = glob("src/**/*.d")
env.Program("fart", sources)
end
Vendored Executable
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec ./rscons configure "$@"
-1
View File
@@ -1 +0,0 @@
target/debug/fart
Executable
+46
View File
@@ -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+fPozKZjDElik4OTg/Oou0o/pB0n05jlTpKxtF1kc6TRpq3oo1pUpaDi6SpckV+3h/mk7wQFWVr7cFsNkmHg3maZ22ROxBtyiKmTjo21dpZOtkxGQycqrsjGrbNJdnI/M4Xc+huHIJLQA4XRZFkc9tNGCdtMikF7kaV+WrI7WQwvBTwo8/TzyQXW52207I/2Gmczos0u2iy7CiapFlSCsDTdikwM2/EH7K4FW0+C5bDZvrX6fyyn2aj5BO2CDmtKP3sVMC2IS96wPDA8vnwRUE23kAdidgn6xR0UbuqBp09rzkYiJcbqiEGlUbPFbrK9D+TaDN6tubg3cn1elFdYBUdrTVImPs1BummJJPSxc1w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gJtXC6xshQ2FusaKuI/UpBv50475OjZ2VRTQrtFcUSPgtpmjJ3HAuSqYIQQJrsFwyc+LT07eINNZfB2B9X3Xlr6POqG6HtpHqVcuwjEkLine truncated
+41
View File
@@ -0,0 +1,41 @@
scene
{
options
{
multisample 3
width 800
height 600
ambient_occlusion 5
}
camera
{
position <2, -3, 2>
look_at <0, 0, 1>
up <0, 0, 1>
}
light
{
position <200, -10, 50>
}
define material white
{
color <1, 1, 1>
}
sphere
{
radius 1
material white
translate <0, 0, 1>
}
plane
{
position <0, 0, 1>, 0
material white
}
}
+228
View File
@@ -0,0 +1,228 @@
scene
{
options
{
multisample 3
}
camera
{
position <3, -2.6, 2>
look_at <1.5, -1, 0>
up <0, 0, 1>
}
light
{
position <-2, -5, 6>
}
plane
{
position <1, -1, 1.5>, 3
material
{
color <1, 1, 0>
}
}
define material green
{
color <0, 1, 0>
shininess 3
}
subtract
{
intersect
{
box
{
size <1, 1, 1>
material
{
color <1, 0.4, 0.4>
}
}
sphere
{
radius 0.67
material
{
color <0, 0, 1>
shininess 3
}
}
}
union
{
cyl
{
size <0.35, 0.35, 1.2>
translate <0, 0, -0.6>
material green
}
union
{
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <1, 0, 0>
translate <0, 0, -0.6>
material green
}
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <0, 1, 0>
translate <0, 0, -0.6>
material green
}
}
}
}
scale <0.5, 0.5, 0.5>
{
translate <0, -3, -2>
{
intersect
{
box
{
size <1, 1, 1>
material
{
color <1, 0.4, 0.4>
}
}
sphere
{
radius 0.67
material
{
color <0, 0, 1>
shininess 3
}
}
}
translate <0, -1.5, -1>
{
box
{
size <1, 1, 1>
material
{
color <1, 0.4, 0.4>
}
}
}
translate <1.5, 0, -1>
{
sphere
{
radius 0.67
material
{
color <0, 0, 1>
shininess 3
}
}
}
}
translate <3, 0, -2>
{
union
{
cyl
{
size <0.35, 0.35, 1.2>
translate <0, 0, -0.6>
material green
}
union
{
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <1, 0, 0>
translate <0, 0, -0.6>
material green
}
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <0, 1, 0>
translate <0, 0, -0.6>
material green
}
}
}
translate <0, -1.5, -1>
{
cyl
{
size <0.35, 0.35, 1.2>
translate <0, 0, -0.6>
material green
}
}
translate <1.5, 0, -1>
{
union
{
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <1, 0, 0>
translate <0, 0, -0.6>
material green
}
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <0, 1, 0>
translate <0, 0, -0.6>
material green
}
}
translate <0, -1.5, -1>
{
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <1, 0, 0>
translate <0, 0, -0.6>
material green
}
}
translate <1.5, 0, -1>
{
cyl
{
size <0.35, 0.35, 1.2>
rotate 90, <0, 1, 0>
translate <0, 0, -0.6>
material green
}
}
}
}
}
}
+84
View File
@@ -0,0 +1,84 @@
scene
{
options
{
width 800
height 600
multisample 3
}
camera
{
position <1.0, -2, 1.2>
look_at <0, 0, 0.4>
up <0, 0, 1>
}
light
{
position <10, 0, 10>
}
define material cyan
{
color <0, 1, 1>
}
plane
{
position <0, 0, 1>, 0
material
{
color <1, 1, 0>
reflectance 0.6
}
}
translate <0, 0, 0.7>
{
box
{
size <0.4, 0.4, 0.4>
material
{
color <1.0, 0.6, 0>
}
}
cyl {
size <0.2, 0, 0.3>
translate <0, 0, 0.3>
material cyan
}
cyl {
size <0.2, 0, 0.3>
rotate 90, <1, 0, 0>
translate <0, 0, 0.3>
material cyan
}
cyl {
size <0.2, 0, 0.3>
rotate -90, <1, 0, 0>
translate <0, 0, 0.3>
material cyan
}
cyl {
size <0.2, 0, 0.3>
rotate 180, <1, 0, 0>
translate <0, 0, 0.3>
material cyan
}
cyl {
size <0.2, 0, 0.3>
rotate 90, <0, 1, 0>
translate <0, 0, 0.3>
material cyan
}
cyl {
size <0.2, 0, 0.3>
rotate -90, <0, 1, 0>
translate <0, 0, 0.3>
material cyan
}
}
}
+152
View File
@@ -0,0 +1,152 @@
scene
{
options
{
multisample 3
exposure 1.2
}
camera
{
position <1.2, -2, 1>
look_at <0, 0, 0>
}
light { position <10, -12, 8> }
plane
{
position <0, 0, 1>, 0.501
material
{
color <0.4, 1, 0.4>
reflectance 0.4
}
}
plane
{
position <1, 0, 0>, 1
material
{
color <1, 0.4, 0.4>
reflectance 0.4
}
}
plane
{
position <0, -1, 0>, 1
material
{
color <0.4, 0.4, 1>
reflectance 0.4
}
}
subtract
{
union
{
box { size <1, 0.8, 0.8> }
box { size <0.8, 1, 0.8> }
box { size <0.8, 0.8, 1> }
cyl { size <0.1, 0.1, 0.8> translate <0.4, 0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <0.4, -0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <-0.4, 0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <-0.4, -0.4, -0.4> }
cyl {
size <.1, .1, .8>
translate <.4, -.4, .4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, -.4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <-.4, -.4, .4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <-.4, -.4, -.4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, .4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, -.4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, .4, .4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, .4, -.4>
rotate -90, <0, 1, 0>
}
sphere { radius .1 translate <.4, .4, .4> }
sphere { radius .1 translate <.4, .4, -.4> }
sphere { radius .1 translate <.4, -.4, .4> }
sphere { radius .1 translate <.4, -.4, -.4> }
sphere { radius .1 translate <-.4, .4, .4> }
sphere { radius .1 translate <-.4, .4, -.4> }
sphere { radius .1 translate <-.4, -.4, .4> }
sphere { radius .1 translate <-.4, -.4, -.4> }
material
{
color <1, 0.4, 1>
transparency 0.4
}
}
union
{
sphere { radius .1 translate <0, -.5, 0> }
sphere { radius .1 translate <-.5, .25, -.25> }
sphere { radius .1 translate <-.5, -.25, .25> }
sphere { radius .1 translate <0, 0, -.5> }
sphere { radius .1 translate <.25, -.25, -.5> }
sphere { radius .1 translate <-.25, .25, -.5> }
sphere { radius .1 translate <-.25, -.25, .5> }
sphere { radius .1 translate <-.25, .25, .5> }
sphere { radius .1 translate <.25, -.25, .5> }
sphere { radius .1 translate <.25, .25, .5> }
sphere { radius .1 translate <.5, 0, 0> }
sphere { radius .1 translate <.5, .25, .25> }
sphere { radius .1 translate <.5, .25, -.25> }
sphere { radius .1 translate <.5, -.25, .25> }
sphere { radius .1 translate <.5, -.25, -.25> }
sphere { radius .1 translate <.25, .5, 0> }
sphere { radius .1 translate <.25, .5, -.25> }
sphere { radius .1 translate <.25, .5, .25> }
sphere { radius .1 translate <-.25, .5, 0> }
sphere { radius .1 translate <-.25, .5, -.25> }
sphere { radius .1 translate <-.25, .5, .25> }
material
{
color <1, 1, 1>
}
}
}
}
+134
View File
@@ -0,0 +1,134 @@
scene
{
options
{
ambient <0.2, 0.2, 0.2>
}
define material dw_blue {
color <0.000, 0.520, 0.546>
specular <0.5, 0.5, 0.5>
}
define material dw_brown {
color <0.634, 0.628, 0.126>
specular <0.5, 0.5, 0.5>
}
define material grey_ground {
color <0.3, 0.3, 0.3>
specular <0, 0, 0>
}
define shape dw_logo union {
subtract {
intersect {
cyl {
size <3.055, 3.055, 0.5>
translate <-4.454, 0.074, -0.25>
}
box {
size <6.01, 5.94, 1>
translate <-1.782, 0, 0>
}
}
cyl {
size <0.738, 0.738, 2>
translate <-3.645, 0.041, -1>
}
box {
size <1.96, 0.456, 2>
translate <-2.212, 0.048, 0>
}
material dw_blue
}
cyl {
size <0.307, 0.307, 0.5>
translate <-3.645, 0.041, -0.25>
material dw_brown
}
subtract {
extrude {
offset 0.5
polygon {
<4.787, -2.971>
<4.787, 1.565>
<4.196, 1.565>
<2.756, -2.375>
<1.367, 1.052>
<0.007, -2.40192>
<-0.891, -0.174>
<-3, -0.174>
<-3, -2.971>
}
translate <0, 0, -0.25>
}
cyl {
size <3.488, 3.488, 2>
translate <-4.454, 0.074, -1>
}
material dw_blue
}
subtract {
extrude {
offset 0.5
polygon {
<4.787, 2.025>
<4.787, 2.971>
<-3, 2.971>
<-3, 0.283>
<-0.588, 0.283>
<0.000, -1.179>
<1.368, 2.273>
<2.728, -1.083>
<3.877, 2.025>
}
translate <0, 0, -0.25>
}
cyl {
size <3.488, 3.488, 2>
translate <-4.454, 0.074, -1>
}
material dw_brown
}
scale 0.104
}
camera
{
position <0, 0, 10>
look_at <0, 0, 0>
up <0, 1, 0>
}
light
{
position <100, -100, 100>
}
plane
{
position <0, 0, 1>, 0
material grey_ground
}
for (local $i = 0; $i < 4; $i = $i + 1)
{
local $n_logos = 2 ^ ($i + 2)
for (local $j = 0; $j < $n_logos; $j = $j + 1)
{
shape dw_logo
{
rotate $j * 360 / $n_logos, <0, 0, 1>
translate <1.5 * ($i + 1), 0, 0.4 - 0.1 * $i>
if ($i > 0 && ($j + $i) % 2 == 1)
{
rotate 90, <0, 0, 1>
}
rotate -90, <0, 0, 1>
}
}
}
shape dw_logo { translate <0, 0, 0.5> }
}
+123
View File
@@ -0,0 +1,123 @@
scene {
define material dw_blue {
color <0.000, 0.520, 0.546>
specular <0.5, 0.5, 0.5>
}
define material dw_brown {
color <0.634, 0.628, 0.126>
specular <0.5, 0.5, 0.5>
}
define material grey_ground {
color <0.3, 0.3, 0.3>
shininess 30
}
define shape dw_logo union {
subtract {
intersect {
cyl {
size <3.055, 3.055, 0.5>
translate <-4.454, 0.074, -0.25>
}
box {
size <6.01, 5.94, 1>
translate <-1.782, 0, 0>
}
}
cyl {
size <0.738, 0.738, 2>
translate <-3.645, 0.041, -1>
}
box {
size <1.96, 0.456, 2>
translate <-2.212, 0.048, 0>
}
material dw_blue
}
cyl {
size <0.307, 0.307, 0.5>
translate <-3.645, 0.041, -0.25>
material dw_brown
}
subtract {
extrude {
offset 0.5
polygon {
<4.787, -2.971>
<4.787, 1.565>
<4.196, 1.565>
<2.756, -2.375>
<1.367, 1.052>
<0.007, -2.40192>
<-0.891, -0.174>
<-3, -0.174>
<-3, -2.971>
}
translate <0, 0, -0.25>
}
cyl {
size <3.488, 3.488, 2>
translate <-4.454, 0.074, -1>
}
material dw_blue
}
subtract {
extrude {
offset 0.5
polygon {
<4.787, 2.025>
<4.787, 2.971>
<-3, 2.971>
<-3, 0.283>
<-0.588, 0.283>
<0.000, -1.179>
<1.368, 2.273>
<2.728, -1.083>
<3.877, 2.025>
}
translate <0, 0, -0.25>
}
cyl {
size <3.488, 3.488, 2>
translate <-4.454, 0.074, -1>
}
material dw_brown
}
scale 0.104
}
shape dw_logo {
translate <0, 0.387, 0.309>
rotate 90, <1, 0, 0>
}
subtract {
plane {
position <0, 0, 1>, 0
}
shape dw_logo {
translate <0, 0, -0.025>
}
material grey_ground
}
camera {
position <-0.2, -0.8, 0.4>
look_at <-0.1, 0, 0.2>
up <0, 0, 1>
}
light {
position <10, -12, 5>
radius 0.2
jitter 3
}
options {
ambient_occlusion 5
multisample 3
}
}
+53
View File
@@ -0,0 +1,53 @@
scene
{
options
{
ambient_occlusion 2
multisample 2
exposure 1.2
}
camera
{
position <0, -10, 10>
look_at <0, 0, 2>
}
light { position <10, -12, 8> }
plane
{
position <0, 0, 1>, 0
material
{
color <0, 0.5, 0.1>
}
}
subtract
{
extrude { ngon 5, 6 offset 2 }
extrude { ngon 5, 5 offset 3 translate <0, 0, -0.5> }
material { color <1, 0.7, 0> }
}
union
{
extrude
{
ngon 6, 2
offset 3 { scale 0.5 position <4, 0> }
offset 3
offset 1 { scale 0 }
}
extrude
{
ngon 6, 2
offset 3 { scale 0.5 position <-4, 0> }
offset 3
offset 1 { scale 0 }
}
material { color <0, 0.9, 0.9> }
}
}
+55
View File
@@ -0,0 +1,55 @@
scene
{
camera
{
position <0, -40, 50>
look_at <0, 100, 0>
}
light
{
position <100, -100, 50>
}
define material mat
{
color <0, 0.8, 1>
}
define material glass
{
transparency 1
refraction 1.5
}
plane
{
position <0, 0, 1>, 0
material
{
color <0, 0.7, 0>
}
}
for (local $x = -200; $x <= 200; $x = $x + 40)
{
for (local $y = 0; $y <= 4000; $y = $y + 40)
{
sphere
{
radius 10
translate <$x, $y, 10>
if ($x == 0 && $y == 0)
{
material glass
translate <0, 0, 20>
}
else
{
material mat
}
}
}
}
}
+57
View File
@@ -0,0 +1,57 @@
scene
{
camera
{
position <0, -120, 80>
look_at <0, -40, 5>
}
light
{
position <100, -100, 100>
}
define material mat { color <0, 0.8, 1> }
define material mat2 { color <1, 0.7, 0> }
define material mat3 { transparency 0.5 reflectance 0.7 }
plane
{
position <0, 0, 1>, 0
material
{
color <0, 0.7, 0>
}
}
local $m = 0
for (local $x = -100; $x <= 100; $x = $x + 40)
{
for (local $y = -100; $y <= 100; $y = $y + 40)
{
sphere
{
radius 10
translate <$x, $y, 10>
if ($m % 3 == 0)
{
material mat
}
elsif ($m % 3 == 1)
{
material mat2
}
else
{
material
{
color <1, 0, 0>
transparency abs($x / 120)
}
}
}
$m = $m + 1
}
}
}
+54
View File
@@ -0,0 +1,54 @@
scene
{
options
{
multisample 4
width 1024
height 768
max_depth 15
}
camera
{
position <0.00001, -1.9, -0.000001>
look_at <0, 0, 0>
up <0, 0, 1>
}
define material mirror
{
color <0, 0, 0>
specular <0, 0, 0>
reflectance 1.0
}
plane { position <1, 0, 0>, 2 material mirror }
plane { position <-1, 0, 0>, 2 material mirror }
plane { position <0, 1, 0>, 2 material mirror }
plane { position <0, -1, 0>, 2 material mirror }
plane { position <0, 0, 1>, 2 material mirror }
plane { position <0, 0, -1>, 2 material mirror }
sphere
{
radius 0.5
material
{
reflectance 0.2
ambient <0.5, 0.5, 0.5>
diffuse <0.5, 0.5, 0.5>
shininess 80
}
}
light
{
position <1, -1, 1>
}
light
{
position <-1, 1, -1>
}
}
+151
View File
@@ -0,0 +1,151 @@
scene
{
options
{
ambient_occlusion 3
multisample 3
exposure 1.2
}
camera
{
position <5, -13, 9>
look_at <0, 0, 2>
}
light { position <10, -12, 8> radius 0.2 jitter 4 }
plane
{
position <0, 0, 1>, 0
material
{
color <0, 0.5, 0.1>
}
}
# define a reusable Die type
define shape Die subtract
{
union
{
box { size <1, 0.8, 0.8> }
box { size <0.8, 1, 0.8> }
box { size <0.8, 0.8, 1> }
cyl { size <0.1, 0.1, 0.8> translate <0.4, 0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <0.4, -0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <-0.4, 0.4, -0.4> }
cyl { size <0.1, 0.1, 0.8> translate <-0.4, -0.4, -0.4> }
cyl {
size <.1, .1, .8>
translate <.4, -.4, .4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, -.4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <-.4, -.4, .4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <-.4, -.4, -.4>
rotate -90, <1, 0, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, .4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, -.4, -.4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, .4, .4>
rotate -90, <0, 1, 0>
}
cyl {
size <.1, .1, .8>
translate <.4, .4, -.4>
rotate -90, <0, 1, 0>
}
define shape Corner sphere { radius 0.1 }
translate <.4, .4, .4> { shape Corner }
translate <.4, .4, -.4> { shape Corner }
translate <.4, -.4, .4> { shape Corner }
translate <.4, -.4, -.4> { shape Corner }
translate <-.4, .4, .4> { shape Corner }
translate <-.4, .4, -.4> { shape Corner }
translate <-.4, -.4, .4> { shape Corner }
translate <-.4, -.4, -.4> { shape Corner }
material
{
color <1, 0.4, 1>
transparency 0.4
}
}
union
{
define shape Pip sphere { radius 0.1 }
translate <0, -.5, 0> { shape Pip }
translate <-.5, .25, -.25> { shape Pip }
translate <-.5, -.25, .25> { shape Pip }
translate <0, 0, -.5> { shape Pip }
translate <.25, -.25, -.5> { shape Pip }
translate <-.25, .25, -.5> { shape Pip }
translate <-.25, -.25, .5> { shape Pip }
translate <-.25, .25, .5> { shape Pip }
translate <.25, -.25, .5> { shape Pip }
translate <.25, .25, .5> { shape Pip }
translate <.5, 0, 0> { shape Pip }
translate <.5, .25, .25> { shape Pip }
translate <.5, .25, -.25> { shape Pip }
translate <.5, -.25, .25> { shape Pip }
translate <.5, -.25, -.25> { shape Pip }
translate <.25, .5, 0> { shape Pip }
translate <.25, .5, -.25> { shape Pip }
translate <.25, .5, .25> { shape Pip }
translate <-.25, .5, 0> { shape Pip }
translate <-.25, .5, -.25> { shape Pip }
translate <-.25, .5, .25> { shape Pip }
material
{
color <1, 1, 1>
}
}
}
# Define an individual stack of dies
define shape DieStack union
{
translate <0, 0, 1.5> { scale 3 { shape Die } }
translate <0, 0, 4> { rotate 45, <0, 0, 1> { scale 2 { shape Die } } }
translate <0, 0, 5.5> { rotate 90, <0, 1, 0> { shape Die } }
}
# Instantiate various DieStack objects
translate <-5, 0, 0> { shape DieStack }
translate <5, 0, 0> { rotate 90, <0, 0, 1> { shape DieStack } }
translate <0, 5, 0> { rotate 180, <0, 0, 1> { shape DieStack } }
translate <0, -5, 0> { rotate 270, <0, 0, 1> { shape DieStack } }
}
+27
View File
@@ -0,0 +1,27 @@
scene {
options {
width 400
height 300
}
camera {
position <5, -5, 4>
look_at <0, 0, 1>
}
light {
position <10, -10, 50>
}
plane {
position <0, 0, 1>, 0
material {
color <0, 1, 0.2>
reflectance 0.4
}
}
sphere {
radius 1
translate <0, 0, 1>
material {
color <1, 1, 0>
}
}
}
+55
View File
@@ -0,0 +1,55 @@
scene
{
options
{
multisample 3
ambient <0.2, 0.2, 0.2>
}
camera
{
position <1, -2, 1>
look_at <0, 0, 0>
}
light
{
position <-5, -15, 20>
jitter 5
}
plane
{
position <0, 0, 1>, 1
material
{
color <0, 1, 1>
}
}
subtract
{
box
{
size <1, 1, 1>
material { color <0.2, 0.2, 1> }
}
subtract
{
sphere
{
radius 0.4
material { color <1, 0, 0> }
translate <0, -0.5, 0>
}
box
{
size <1, 1, 0.2>
material { color <0, 1, 0> }
translate <0, -0.5, 0>
}
}
}
}
+46
View File
@@ -0,0 +1,46 @@
scene
{
options
{
width 800
height 600
multisample 3
}
camera
{
position <2, -2.5, 3>
look_at <-0.5, 0, 0>
up <0, 0, 1>
}
light { position <5, 0, 5> }
plane
{
position <0, 0, 1>, 0
material { color <0.8, 0.8, 0.8> }
}
box
{
size <1, 1, 1>
translate <0, -1.5, 0.6>
material { color <0, 0, 1> transparency 0.8 }
}
box
{
size <1, 1, 1>
translate <0, 0, 0.6>
material { color <0, 0, 1> transparency 0.4 }
}
box
{
size <1, 1, 1>
translate <0, 1.5, 0.6>
material { color <0, 0, 1> transparency 0.1 }
}
}
-57
View File
@@ -1,57 +0,0 @@
macro_rules! options {
($($name:ident $sflag:literal $lflag:literal $hasarg:literal),* $(,)?) => {
enum Options {
$($name,)*
}
const SHORT_FLAGS: &[&str] = &[
$($sflag,)*
];
const LONG_FLAGS: &[&str] = &[
$($lflag,)*
];
const HAS_ARG: &[bool] = &[
$($hasarg,)*
];
};
}
options! {
Width "w" "width" true,
Height "h" "height" true,
}
#[derive(Default)]
pub struct Cli {
width: Option<usize>,
height: Option<usize>,
input_file: String,
}
impl Cli {
pub fn new() -> Self {
Cli::default()
}
pub fn run(&mut self) -> Option<()> {
let mut args = std::env::args();
/* Skip program name. */
args.next();
loop {
if let Some(arg) = args.next() {
if arg.starts_with("--") {
let flag = &arg[2..];
} else if arg.starts_with("-") {
let flag = &arg[1..2];
} else {
self.input_file = arg;
}
} else {
break;
}
}
Some(())
}
}
+54
View File
@@ -0,0 +1,54 @@
module fart.bfile;
import std.stdio;
/**
* Struct to handle easily writing data to a binary file.
*/
public struct BFile
{
/**
* Underlying file handle.
*/
private File m_file;
/**
* Create a binary file.
*/
this(string filename)
{
m_file = File(filename, "wb");
}
/**
* Write arbitrary byte data to the file.
*/
public void write(const(void) * data, size_t length)
{
write((cast(const(ubyte) *)data)[0..length]);
}
/**
* Write an array to the file.
*/
public void write(T)(const(T)[] data)
{
m_file.rawWrite(data);
}
/**
* Write an arbitrary object to the file.
*/
public void writeObject(T)(ref const(T) obj)
{
write(&obj, obj.sizeof);
}
/**
* Close the file.
*/
public void close()
{
m_file.close();
}
}
+18
View File
@@ -0,0 +1,18 @@
module fart.crc32;
import std.digest.crc;
/**
* Calculate the CRC32 across the given chunk(s) of data.
*/
public uint crc32(Args...)(Args data)
{
CRC32 crc32;
crc32.start();
static foreach (arg; data)
{
crc32.put(cast(const(ubyte)[])arg);
}
auto crc = crc32.finish();
return crc[0] | (crc[1] << 8) | (crc[2] << 16) | (crc[3] << 24);
}
+35
View File
@@ -0,0 +1,35 @@
/**
* @file
*
* Host to network byte-swapping functions.
*/
module fart.hton;
version (BigEndian)
{
public uint htonl(uint v)
{
return v;
}
public uint ntohl(uint v)
{
return v;
}
}
version (LittleEndian)
{
import core.bitop;
public uint htonl(uint v)
{
return bswap(v);
}
public uint ntohl(uint v)
{
return bswap(v);
}
}
+4
View File
@@ -0,0 +1,4 @@
int main(string[] args)
{
return 0;
}
-16
View File
@@ -1,16 +0,0 @@
mod cli;
use crate::cli::Cli;
use std::process::ExitCode;
fn main() -> ExitCode {
match run() {
Some(_) => ExitCode::SUCCESS,
None => ExitCode::FAILURE,
}
}
fn run() -> Option<()> {
let mut cli = Cli::new();
cli.run()
}
+27
View File
@@ -0,0 +1,27 @@
" Vim syntax file
" Setup
if version >= 600
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
endif
syn case match
syn keyword fartKeywords ambient ambient_occlusion color define diffuse exposure height jitter look_at material max_depth multisample ngon offset polygon position radius reflectance refraction rotate scale shininess size specular texture translate transparency union up vfov width
syn keyword fartObjects box camera cyl extrude intersect light options plane scene shape sphere subtract union
syn keyword fartControl for while if else elsif local
syn match fartNumber "\(^\|\W\)\@<=[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="
syn match fartComment "#.*"
syn match fartIdentifier "\$[a-zA-Z_][a-zA-Z_0-9]*"
hi def link fartKeywords Operator
hi def link fartObjects Type
hi def link fartNumber Number
hi def link fartComment Comment
hi def link fartControl Special
hi def link fartIdentifier Identifier
let b:current_syntax = "fart"
+3
View File
@@ -0,0 +1,3 @@
if has("autocmd")
autocmd BufRead *.fart set syntax=fart
endif " has("autocmd")