Mercurial > projects > ldc
comparison demos/ray.d @ 100:5071469303d4 trunk
[svn r104] TONS OF FIXES.
Split up declaration, constant initializer gen and definition for globals, structs, classes and functions.
Improved ClassInfo support (not complete), not in vtable yet.
Fixed a bunch of forward reference problems.
Much more. Major commit! :)
author | lindquist |
---|---|
date | Fri, 16 Nov 2007 08:21:47 +0100 |
parents | ce7ed8f59b99 |
children | 9922b9982552 |
comparison
equal
deleted
inserted
replaced
99:a676a7743642 | 100:5071469303d4 |
---|---|
1 //import std.stdio, std.math, std.string; | 1 import std.stdio; |
2 //import tools.base; | |
3 | 2 |
4 int atoi(char[] s) { | 3 int atoi(char[] s) { |
5 int i, fac=1; | 4 int i, fac=1; |
6 bool neg = (s.length) && (s[0] == '-'); | 5 bool neg = (s.length) && (s[0] == '-'); |
7 char[] a = neg ? s[1..$] : s; | 6 char[] a = neg ? s[1..$] : s; |
103 void main(string[] args) { | 102 void main(string[] args) { |
104 int level = (args.length==3 ? args[1].atoi() : 9), | 103 int level = (args.length==3 ? args[1].atoi() : 9), |
105 n = (args.length==3 ? args[2].atoi() : 512), ss = 4; | 104 n = (args.length==3 ? args[2].atoi() : 512), ss = 4; |
106 auto light = Vec(-1, -3, 2).unitise(); | 105 auto light = Vec(-1, -3, 2).unitise(); |
107 auto s=create(level, Vec(0, -1, 0), 1); | 106 auto s=create(level, Vec(0, -1, 0), 1); |
108 printf("P5\n%d %d\n255", n, n); | 107 writefln("P5\n", n, " ", n, "\n255"); |
109 for (int y=n-1; y>=0; --y) | 108 for (int y=n-1; y>=0; --y) |
110 for (int x=0; x<n; ++x) { | 109 for (int x=0; x<n; ++x) { |
111 double g=0; | 110 double g=0; |
112 for (int d=0; d<ss*ss; ++d) { | 111 for (int d=0; d<ss*ss; ++d) { |
113 auto dir=Vec(x+(d%ss)*1.0/ss-n/2.0, y+(d/ss)*1.0/ss-n/2.0, n).unitise(); | 112 auto dir=Vec(x+(d%ss)*1.0/ss-n/2.0, y+(d/ss)*1.0/ss-n/2.0, n).unitise(); |