DreiDe - 3D Engine

BlitzMax Forums/BlitzMax Programming/DreiDe - 3D Engine

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Wow, it's realy cool stuff Fredborg!

http://vertex.art-fx.org/dreide240.zip
http://vertex.art-fx.org/dreide_examples.zip

Whats new?
Fredborg:
- Fixed Multitexturing error (it was in TSurface.Render)
- Fixed DDD_TEXTURE_BLEND error in TTexture.Render()
- Added TTexture.SetCoordSet() and TTexture.GetCoordSet()

- TDreiDe.Flip() -> Flip()
- TDreiDe.EndGraphics() -> EndGraphics()
- Added TDreiDe.UseMax2D()

Vertex:
- New TVertexProgram Module
- Added some commands to TSurface for VertexAttributes to use in a VP
- Added SetVertexProgram(), GetVertexProgram() to TMaterial
- Just see the example in dreide_examples.zip

Toonshading:
!!ARBvp1.0

# Toonshader by Oliver Skawronek

# Matrices
PARAM ModelViewInv[4]        = { state.matrix.modelview.invtrans };
PARAM ModelViewProjection[4] = { state.matrix.mvp };

# Temporary variable
TEMP Position, EyeNormal, UVCoords, Cond, Result;

# Transform VertexPosition
DP4 Position.x, ModelViewProjection[0], vertex.position;
DP4 Position.y, ModelViewProjection[1], vertex.position;
DP4 Position.z, ModelViewProjection[2], vertex.position;
DP4 Position.w, ModelViewProjection[3], vertex.position;

# Transform VertexNormal
DP3 EyeNormal.x, ModelViewInv[0], vertex.normal;
DP3 EyeNormal.y, ModelViewInv[1], vertex.normal;
DP3 EyeNormal.z, ModelViewInv[2], vertex.normal;

# Copy VertexTexCoords in to UVCoords
MOV UVCoords, vertex.texcoord;

# U-Coord of Vertex = Dot Product between EyeNormal und LightDirection
DP3 UVCoords.x, EyeNormal, program.local[0];

# If UVCoord.x < 0.0 Then UVCoord.x = 0.0
MOV Cond.x, 0.0;
MOV Cond.y, UVCoords.y;
MOV Cond.z, UVCoords.z;
MOV Cond.w, UVCoords.w;

SGE Result, UVCoords, Cond;
MUL UVCoords, UVCoords, Result;

# Output the result
MOV result.position, Position;
MOV result.texcoord, UVCoords;
MOV result.color, vertex.color;
MOV result.color.w, 1.0;

END


Local Program Parameter 0 is the LightDirection see VertexProgram.SetLocalParameter().

Screenshot:


http://delphigl.com/script/do_show.php?name=gl_vertex_program_arb&action=2 <- german tutorial for VPs

Errors:
- Cubemapping does not work yet becouse Max2D(don't know why)

Bumpmap-VP and FragmentProgram-Support comming soon...

cu olli