initial commit
This commit is contained in:
BIN
engine/data/DejaVuSans.ttf
Normal file
BIN
engine/data/DejaVuSans.ttf
Normal file
Binary file not shown.
10
engine/data/ambient_color_emissive.frag
Normal file
10
engine/data/ambient_color_emissive.frag
Normal file
@ -0,0 +1,10 @@
|
||||
uniform sampler2D color_emissive_texture;
|
||||
|
||||
varying vec4 vertex_ambient;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texel = texture2D( color_emissive_texture, gl_TexCoord[0].xy );
|
||||
gl_FragColor = (texel * vertex_ambient) + (texel * texel.a);
|
||||
gl_FragColor.a = 1.0;
|
||||
}
|
2
engine/data/ambient_color_emissive.prog
Normal file
2
engine/data/ambient_color_emissive.prog
Normal file
@ -0,0 +1,2 @@
|
||||
vertex_shaders = ambient_color_emissive
|
||||
fragment_shaders = ambient_color_emissive
|
10
engine/data/ambient_color_emissive.vert
Normal file
10
engine/data/ambient_color_emissive.vert
Normal file
@ -0,0 +1,10 @@
|
||||
varying vec4 vertex_ambient;
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Compute the diffuse, ambient and globalAmbient terms */
|
||||
vertex_ambient = gl_LightModel.ambient * gl_FrontMaterial.ambient;
|
||||
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
}
|
BIN
engine/data/combat.zip
Normal file
BIN
engine/data/combat.zip
Normal file
Binary file not shown.
BIN
engine/data/image.png
Normal file
BIN
engine/data/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
114
engine/data/main.nut
Normal file
114
engine/data/main.nut
Normal file
@ -0,0 +1,114 @@
|
||||
EntityList <- [];
|
||||
|
||||
class Entity
|
||||
{
|
||||
function tick (time)
|
||||
{
|
||||
}
|
||||
|
||||
function step (time)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function onFrame (time)
|
||||
{
|
||||
for(local i = 0; i < EntityList.len();)
|
||||
{
|
||||
if( EntityList[i].tick( time ) == 1 )
|
||||
{
|
||||
EntityList.remove(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onStep (time)
|
||||
{
|
||||
for(local i = 0; i < EntityList.len(); ++i )
|
||||
{
|
||||
EntityList[i].step( time )
|
||||
}
|
||||
}
|
||||
|
||||
class Asteroid extends Entity
|
||||
{
|
||||
rigidbody = null;
|
||||
trafonode = null;
|
||||
modelnode = null;
|
||||
|
||||
constructor()
|
||||
{
|
||||
rigidbody = RigidBody (this);
|
||||
rigidbody.addCollisionMesh ("asteroid.collision", 1000.0);
|
||||
|
||||
model = Model ("asteroid");
|
||||
|
||||
node = Node();
|
||||
node.setPositionProvider (rigidbody);
|
||||
node.setRenderProvider (model);
|
||||
|
||||
sprite = Sprite ("name");
|
||||
spritenode = Node (node);
|
||||
spritenode.setRenderProvider (sprite);
|
||||
spritenode.setRelativePosition (Vector(10.0, 0.0, 0.0));
|
||||
//pg = ParticleGenerator ("comettail");
|
||||
}
|
||||
|
||||
function setPosition( position )
|
||||
{
|
||||
rigidbody.setPosition( position );
|
||||
}
|
||||
}
|
||||
|
||||
font <- null;
|
||||
logo <- null;
|
||||
lastFPS <- 0;
|
||||
frameCount <- 0;
|
||||
FPS <- 1;
|
||||
body <- null;
|
||||
|
||||
function Initialize()
|
||||
{
|
||||
::font = Font ("DejaVuSans.ttf", 24, 1 );
|
||||
::logo = Image ("image.png", 0.0, 0.0, 1.0, 1.0);
|
||||
::body = RigidBody();
|
||||
|
||||
}
|
||||
|
||||
function OnFrame( delta )
|
||||
{
|
||||
::frameCount += 1
|
||||
::lastFPS += delta;
|
||||
|
||||
if (::lastFPS > 0.1)
|
||||
{
|
||||
::FPS = ::frameCount * 10;
|
||||
::frameCount = 0;
|
||||
::lastFPS -= 0.1;
|
||||
}
|
||||
|
||||
if (::FPS > 0)
|
||||
{
|
||||
local fps = "FPS: " + FPS + " / " + (1.0/::FPS)*1000.0 + " ms";
|
||||
::font.print( 10, 10, fps, 1, 1 );
|
||||
}
|
||||
// ::logo.draw (0.5, 0.5);
|
||||
|
||||
v <- ::body.getPosition();
|
||||
::font.print(10, 40, "Position: " + v.x + ", " + v.y + ", " + v.z, 1, 1 );
|
||||
}
|
||||
|
||||
function OnStep( delte )
|
||||
{
|
||||
::body.applyLocalForce( Vector(0.0, 0.0, 1.0) );
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user