:R4

May 31, 2009

Demasiados lenguajes

Filed under: Distribucion — pablo @ 11:21 pm

un lenguaje para hablar: castellano le decian antes, ahora español porque asi esta en la lista

otro para la logica: basic y r4 si tengo que elegir ahora… mucho tiempo pensaba que c..ahora no

otro para la vista: los shaders..se simplifico el motor y se complico el pintador

otro para la memoria: SQL  pero muchos otros antes.

otro para la comunicacion: XML, no hay nada mejor para complicar una lista de numeros que una estructura recursiva, dolor de huevos es el termino tecnico correcto.

mas de 2500 lenguajes de programacion y yo pretendo programar en otro.

lo unico que puedo decir es

y bue

May 20, 2009

Ayer lei a McLuhan

Filed under: Distribucion — pablo @ 3:49 pm

Por recomendacion del blog de Jeff Fox, busque y lei algunas cosas.

Me dio tranquilidad saber hacerca de los medios, las percepciones y el cambio que se produce. Ya lo habia vivido cada vez que aparecia un programa nuevo y dejaba obsoleto a su antecesor.

Los videojuegos como medio me quedo dando vueltas en la cabeza.

May 12, 2009

Las palabras no estan quietas

Filed under: Distribucion — pablo @ 11:37 pm

Tomando de IQ (Iñigo Quilez) un raytracer muy simple… 4K

la interseccion de un esfera.

bool intSphere( in vec4 sp, in vec3 ro, in vec3 rd, in float tm, out float t )
{
    bool  r = false;
    vec3  d = ro - sp.xyz;
    float b = dot(rd,d);
    float c = dot(d,d) - sp.w*sp.w;
    t = b*b-c;
    if( t > 0.0 )
    {
        t = -b-sqrt(t);
        r = (t > 0.0) && (t < tm);
    }

    return r;
}

A ver…defino palabra, comento los parametros, borro los tipos de datos

:intSphere |( in vec4 sp, in vec3 ro, in vec3 rd, in float tm, out float t )
    bool  r = false;
    vec3  d = ro - sp.xyz;
    float b = dot(rd,d);
    float c = dot(d,d) - sp.w*sp.w;
    t = b*b-c;
    if( t > 0.0 )
    {
        t = -b-sqrt(t);
        r = (t > 0.0) && (t < tm);
    }
    return r
 ;

Elegir una buena forma para los parametros, quitar el booleano, para una decision no hay nada mejor que un numero, los booleanos dicen poco, solo si o no.

rehacer los IF. cambiar el orden, ordenar las condiciones de corte por cantidad de calculos, las menores primero.

|( in vec4 sp, in vec3 ro, in vec3 rd, in float tm, out float t )
:intSphere | sp ro rd tm -- sp ro rd tm t
    vec3  d = ro - sp.xyz;
    float b = dot(rd,d);
    float c = dot(d,d) - sp.w*sp.w;
    t = b*b-c;
-? ( drop 0 ; )   | revisar..
-b-sqrt(t)
over >=? ( drop 0 ; )
 ;

Factorizo los parameros, que lo calcule otro… convertir a postfijo, quitar cosas.

| solo logica y calculo
:intSphere | tm b c -- tm b c t d
    over dup * over - | tm b c t =b*b-c;
|    -? ( drop 0 ; )   que lo corte otro (homero rule)
    pick2 neg over distfast - | tm  b c t d=-b-sqrt(t)
|over >=? ( drop 0 ; ) | mm Hr tambien
 ;

puff, ahora hay que agregarle todo lo que le saque, conviene elegir un nombre feo, para cambiarlo despues, cuando entendamos que estamos haciendo

:calculabc | sp ro rd tm --  sp ro rd tm b c
    vec3  d = ro - sp.xyz
    float b = dot(rd,d)
    float c = dot(d,d) - sp.w*sp.w
  ;

mmmmmm lo dejo para otro post…

April 26, 2009

Deformacion del plano

Filed under: Distribucion — pablo @ 11:56 pm

Termine el programa traducido a :r4 usando la tecnica de la “vieja escuela” de hacer doble indireccion, aqui una pantalla y lo encuentran en la ultima distribucion como planedef.txt

r4

| planedef.txt

^libgui.txt

#textura )( $100000

:llenatext
	'textura >r
	512 ( 1? )(
		512 ( 1? )(
			2dup xor
			dup 16 << or
			r!+
			1- ) drop
		1- ) drop
	rdrop
	;

:llenalut
	mem >r
	0 ( sh <? )(
		0 ( sw <? )(
		2dup sw  - * 8 >> r!+
		over sh  - over * 7 >> r!+
		1+ ) drop
	1+ ) drop
	rdrop ;

:render
	0 0 setxy
	mem >r
	msec 4 >>
	0 ( sh <? )(
		0 ( sw <? )( | y x
			r@+ pick3 +
			$1ff and 9 <<
			r@+ pick4 +
			$1ff and or 2 <<
			'textura + @
			px!+
			1+ ) drop
		1+ ) drop
	rdrop drop
	;

:main
	inikey
	scr blanco
	'exit <esc>
	llenatext
	llenalut
	show
		render
		scr	fonti
		dup "%d" print
		cflecha
		;

: 33 main
"main.txt" run ;

April 8, 2009

Material de estudio

Filed under: Distribucion — pablo @ 1:29 am

Junto con Leonardo comenzamos el ciclo lectivo, ya sabia :r4 del año pasado..

1era clase pasar a :r4 unos demos de Iñigo Quilez

http://iquilezles.org/www/articles/deform/deform.htm

el resultado fue este programa, aun sin terminar

| planedef.txt

^libgui.txt

#textura )( $100000
#lutx )( $1000
#luty )( $1000

:render
	0 ( sh <? )(
		0 over setxy
		0 ( sw <? )(
			over $1ff and 9 <<
			over $1ff and + 2 <<
			'textura + @
			px!+
			1+ ) drop
		1+ ) drop
	;

:llenatext
	'textura >r
	512 ( 1? )(
		512 ( 1? )(
			2dup xor r!+ 1- ) drop
		1- ) drop
	rdrop
	;

:llenalut
	'lutx >r
	0 ( 1024 <? )(
		dup r!+ 1+ ) drop rdrop
	'luty >r
	0 ( 1024 <? )(
		dup r!+ 1+ ) drop rdrop
	;

:render2
	0 ( sh <? )(
		0 over setxy
		0 ( sw <? )( | y x
			over | y x y
			2 << 'luty + @ | y x ly
			msec 3 >> +
			$1ff and 9 <<
			over | y x ly x
			2 << 'lutx + @ | y x ly lx
			msec 3 >> +
			$1ff and + 2 <<
			'textura + @
			px!+
			1+ ) drop
		1+ ) drop
	;

:main
	inikey
	scr blanco
	'exit <esc>
	llenatext
	llenalut
	show
		render2 scr	fonti
		dup "%d" print
		cflecha
		;

: 33 main
"main.txt" run ;

February 28, 2009

Google Code

Filed under: Distribucion — pablo @ 4:09 pm

Subi el proyecto a Google Code:

http://code.google.com/p/reda4/

Tiene una distribucion nueva !!

February 18, 2009

Otra version interna

Filed under: Distribucion — pablo @ 6:14 pm

http://www.reda4.org/r4-9218.rar

February 13, 2009

Version interna

Filed under: Distribucion — pablo @ 6:21 pm

http://www.reda4.org/r4-9213.zip

February 12, 2009

Paste2 con GUI nueva (11kb a 2kb el kernel)

Filed under: Distribucion — pablo @ 10:42 pm

Probando una modificacion a la gui

gui2.txt (99 lineas) en Paste2 : http://paste2.org/p/146480

test-gui2.txt (92 lineas) en Paste2 : http://paste2.org/p/146483

nuevo sistema GUI, mucho mas chico, en prueba todavia, tambien estoy probando una libreria de sonido llamada uFMOD: http://ufmod.sourceforge.net/

y haciendo el evaluador/compilador/editor.

February 7, 2009

Que es Forth ?

Filed under: comp.lang.forth — pablo @ 1:55 pm

John Passaniti en el grupo Forth escribio una descripcion esclarecedora:

comp.lang.forth started as a newsgroup for programmers to write angry
screeds about other languages. These “froths” as they were called
became corrupted as “forth” due to a typo, and the name stuck as an
in-joke.

Over time, one man had the bright idea to collect these froths and
design a language to address them. That language was called Forth. The
initial designer of the language, Benjamin Moore combined his love for
programming with paint and came up with “Color Forth.” It remains the
only language that uses colors as opcodes for it’s virtual machine. For
example, “Sea-Foam Green” adds two numbers together.

The Forth language looks unusual but is actually quite conventional in
terms of design. The language is most noted for its use of postfix.
The word “postfix” means “to fix later.” This is a central idea in
Forth– that it is better to fix problems later and instead focus on
things like optimizing a routine that runs 1% of the time to be 1000x
faster. Forth programmers are heavily into powers of ten.

Forth is also known as the interactive language, allowing incremental
code development and testing. This is in direct opposition to every
other programming language on the planet, which use a batch compiler
model and take hours to generate “Hello World” applications that are 300
megabytes long.

There are many examples of real-world uses of Forth. You know those
devices that FedEx uses to track how late and how broken your packages
are? Those devices use Forth to do careful analysis of the package to
find the best angle to crush contents before delivery. This replaced
human guesswork that often resulted in packages arriving intact.

Older Posts »

Powered by WordPress