Shadows on Engine Gear3D.

Started by Yue, October 01, 2017, 03:54:37

Previous topic - Next topic

Rooster


Yue

Script For Lua Engine Gear3D.

--*****************************************
-- Proyecto : Sombras.
-- Scripter : Yue Rexie.
-- Fichero  : Main.lua
-- Notas    : Fichero principal de script.
--*****************************************   

G3D(800,600) -- Comando Obligatorio.
SOMBRAS = Verdadero
function Inicio()
       
camara = CrearCamara()
RotarEntidad ( camara, 30, 0, 0 )
CamaraColor( camara,25, 158, 218)
CamaraSombras( camara )
PosicionEntidad( camara, 0, 0, -10 )
--LuzAmbiente(200, 200, 200 )
sol = CrearSol()
        RotarEntidad ( sol, 45, 45, 0 )
LuzSombra( sol )         

cubo = CrearCubo()
ColorEntidad( cubo,  255, 0, 0 )
PosicionEntidad( cubo, 0, -4, 3.5 )
--AlfaEntidad( cubo, 0.5 )

player = CargarMalla("Modelos/Yue.b3d")
PosicionEntidad( player, 0, -6.5, 0 )
RotarEntidad( player, 0, -180, 0 )

suelo = CrearCubo()
EscalarEntidad( suelo, 5, 0.5, 5 )
PosicionEntidad( suelo, 0, -7, 0 )
       
traSuelo = CargarTextura( "Texturas/Suelo.jpg", BANDERA_MIPMAPA)
EscalarTextura( traSuelo, 0.25, 0.25 )
TexturaEntidad( suelo,traSuelo )
EntidadEmiteSombra( suelo, sol )
SombrasDifusas()  -- Se establecen sombras difumadas.

piramide = CrearCono(4)
PosicionEntidad( piramide, -2, -4, 0 )

ColorEntidad( piramide, 255, 128, 64 )


cilindro = CrearCilindro( 4 )
PosicionEntidad( cilindro, 0, -4, -2 )
EscalarEntidad( cilindro, 0.5, 2, 0.5 )
ColorEntidad( cilindro, 255, 0, 128 )

esfera  = CrearEsfera( 4 )
PosicionEntidad( esfera, 3, -4, 0 )
ColorEntidad( esfera, 255, 255, 0 )


end

-- FunciĆ³n Dibujar.
function Dibujar()

Texto ( EntidadDistancia( camara, player ), 20, 20 )

     
end

-- Se actualiza el juego.
function Actualizar()
   

GirarEntidad(  cubo, 1, -1, 1 )
GirarEntidad(  piramide, -1, 1, 1 )
GirarEntidad(  cilindro, -1, -1, 0 )
GirarEntidad(  esfera, -1, -1, -1 )

if( TeclaPres( TECLA_S)==Verdadero ) then

MoverEntidad( camara, 0, 0, -0.1 )

end

if ( TeclaPres( TECLA_W) == Verdadero ) then


MoverEntidad( camara, 0, 0, 0.1 )
end
   


end



iWasAdam

I'm really impressed by this. Estoy muy,muy bien amigo.
The language is clear and simple and the website the same with simple code for EVERY command (Mark would do good to see this).

The final render also look very nice, especially the shadows ;)

MikeHart

Yes, the site is looking good. As I only speak german and english, I can't understand the content of the site.