Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
143 user(s) are online (129 user(s) are browsing Forums)

Members: 0
Guests: 143

more...

Support us!

Headlines

 
  Register To Post  

AmiDARK 2D Engine WIP 0.8 : FX2D "Fake Rasters"
Quite a regular
Quite a regular


See User information
Hi,

As I'm working on the release 0.8 with two major need :
- Fix the PlaySound audio playback.
- Fix Sprites stability issue.

I had an idea ... for a special plugin for the AmiDARK Engine.
This plugin is called : FX2D.
Why ? Simply because it'll contain some special 2D effects.

And, the First of these is the so called "Fake Rasters"...
You said ... What ? You emulate old Amiga Copper lists and colors effects ?
Hum ... I'll answer ... "not exactly".

In fact, I wanted to find a way to "fastly" add colors gradients like we did on our old Amiga 68k computers...

And I got it !!!
I have created some new commands :
- Added commands FXCreateFakeRaster, FXCreateFakeRasterEx & FXCreateFakeRasterEx2.
- Added commands FXDeleteRaster & FXUpdateRaster.
- Added commands FXSetRasterLine, FXSetRasterGradient and function FXGetRasterLine.
- Added commands FXSetRasterFromMemblock & FXMakeMemblockFromRaster.
- Added command FXSetRasterY & function FXGetRasterY.
- Added functions FXRasterExist & FXGetRasterHeight.
- Added commands FXHideRaster, FXShowRaster & function FXIsRasterHidden.
- Added commands FXEnableRasters, FXDisableRasters & function FXIsRasterDisabled.
- Added function FXIsRasterUpdated.
These commands and functions will allow you to create lines gradients like in the old Amiga 68k classics computers.

It's quite easy, just look this :
Quote:
int kMode = 1; // Default mode display Rasters.
int mKey = 0;

#include "libamidark.h"
void DarkLoop( void ){
// Setup the display mode
DESetDisplayMode( 640, 480, 32 );
DESyncOn();
DESyncRate( 60 );
// Load the image we'll use as environment.
DELoadImageEx( "Medias/Environment.png", 1, 1 );
// Create the raster and it's color gradients.
FXCreateFakeRaster( 1, 256 );
FXSetRasterGradient( 1, 0, DERgb( 32, 32, 64 ), 128, DERgb( 128, 64, 128 ) );
FXSetRasterGradient( 1, 128, DERgb( 128, 64, 128 ), 255, DERgb( 255, 255, 255 ) );
FXUpdateRaster( 1 ); // Don't forget this otherwise it will not work!
// Main demo loop
while( !DELoop() ){
DECls(); // Clear the screen
mKey = DEScanCode(); // Get keyboard input
if ( mKey == 2 ){ FXHideRaster( 1 ); kMode = 0; } // Key 1 turn raster off
if ( mKey == 3 ){ FXShowRaster( 1 ); kMode = 1; } // Key 2 turn raster on
DEPasteImageEx( 1, 0, 0, 1 ); // Paste the image above raster
DESetCursor( 0, 0 ); // Display info. text
DEPrint( "Press 1 to Hide Background Raster, 2 to Show it again." );
if ( kMode == 1 ){
DEPrint( "Currently : Raster = On" );
}else{
DEPrint( "Currently : Raster = Off" );
}
DESync(); // Refresh display.
}
}

This simple demonstration gives this result Without raster :
Resized Image
And with raster on :
Resized Image

You'll tell me "but ... it's not really ... impressive" ...
I can tell you .. "ok, I understand, but it's just the "example source code to show you how the system work"...

Effectively, I have done more impressive tests...
I have made a technical demonstration showing you how rasters work and mixing 2D, Rasters and 3D... It gives this amazing result :
Resized Image
And of course ... the demonstration can be downloaded for your pleasure to test it.
Here is the link :
http://files.amidark-engine.com/Rel0.8/RasterDemo.lha"" rel="external" title="">RasterDemo.lha

So ... we have detailled, you can create rasters, they are drawn before image and you can paste image over them using transparency and alpha to mix them with the image ...

It's interesting but ... I though "I can go further and make something more interesting!" and I did it !

I was thinking that in the "old ages" Raster/Copper can be put in any of the color register we wanted from the color palette ... unfortunately, I didn't find any way to make a raster being visible on 1 RGB color but ... I managed to make Raster effect being visible within 1 texture...

And I heard some telling "What ? what do you exactly mean ?"
I want to say that, when we paste an image in the screen, we can directly draw it with the raster in it ! And All black/transparent pixels will not be drawn! Raster is only on used pixels of the texture !!!

Hum ... that Seem interesting ... and it work really easily with 1 command. So I have also added these extra FX2D commands :
- Added commands DEFxImageRastered, DEFxImageRasteredEx, DEFxStretchedImageRastered & DEFXStretchedImageRasteredEx
To paste image with raster in them.

technically, imagine I use 5 images :
1. The first for the sky and stars we'll rasterize.
2. The second for a graphics "sun"
3. The third for an horizontal bar graphics we'll rasterize too.
4. The fourth for the main "text" logo wel'll rasterize too.
5. The fifth for a "light halo" around the main text logo.
The combined images should give this result :
Resized Image
"Wow ... nice picture!" ... yes, but we can make it more impressive when we activate some raster on the 3 mentionned images :
Resized Image

of course, source code is more complex, but it's now a "technical demonstration" too :)

This plugin is currently available in the "beta" version of the AmiDARK 2D engine but, I don't know if it will be part of an "extra" plugin or ... if it will be integrated directly in the main engine ...

With all these, here are the current changes for the upcoming Rel 0.8 :
AMIGAOS4
- Updated makefile.aos4 files to compile correctly with latest changes.
- Added missing Makefile.aos4 files so all samples can be compiled on AmigaOS4 with these makefile.
- Removed gstabs & wall flags from all Makefile.aos4 so, compiled demonstration should run faster.
- Updated "default project" files to work with the latest changes.
- Updated HELP "Using The Language" to work with the latest changes.
MORPHOS
- Added samples that were missing under MorphOS. MorphOS now have exactly the same samples than AmigaOS4 release.
- Added Makefile.mos files so, all samples may be compiled directly under MorphOS with these makefile (untested).
- Updated "default project" files to work with the latest changes.
- Updated HELP "Using The Language" to work with the latest changes.
GENERAL
- Removed some old printf debug outputs and replaced them with the default DebugMessage function.
- Added more commands & functions documentation. Nearly all commands & functions are now documented.
- Added a new *special* command set called FX2D that does not exist in DarkBASIC Professional. It will contain various 2D effects.
- Status of FX2D additional command set is not yet defined. It will be a separate plugin or maybe integrated in the main engine core. Not yet decided.
- Fixed display sizes that were 1 pixel less than sizes specified in DESetDisplayMode command.
BASIC2D
- Fixed a bug that prevented DEInk to be used for text outputs.
BASIC3D
- Added internal support for Anisotropic filtering
- Modified DESetObjectFilter, when activating Anisotropic filtering, that function can't set extra value so, it will be set to 1 per default.
- Added function DESetObjectFilterEx function to handle Anisotropic on/off and extra value for anisotropic filtering value.
- Warning : These DESetObjectFilter(Ex) functions is available but it will not work until both Warp3D & MiniGL will include changes to handle Anisotropic filtering.
CORE
- Added support for FX2D Fake Raster special effect in the Synchro refresh process.
- Fixed DEPrint function now correctly handle font height for horizontal alignment drawing.
FX2D
- Added commands FXCreateFakeRaster, FXCreateFakeRasterEx & FXCreateFakeRasterEx2.
- Added commands FXDeleteRaster & FXUpdateRaster.
- Added commands FXSetRasterLine, FXSetRasterGradient and function FXGetRasterLine.
- Added commands FXSetRasterFromMemblock & FXMakeMemblockFromRaster.
- Added command FXSetRasterY & function FXGetRasterY.
- Added functions FXRasterExist & FXGetRasterHeight.
- Added commands FXHideRaster, FXShowRaster & function FXIsRasterHidden.
- Added commands FXEnableRasters, FXDisableRasters & function FXIsRasterDisabled.
- Added function FXIsRasterUpdated.
- Added commands DEFxImageRastered, DEFxImageRasteredEx, DEFxStretchedImageRastered & DEFXStretchedImageRasteredEx
- Added internal function to display rasters on screen.
- Added internal function to display raster within an image.
- Added 2 demonstrations samples to show the use of FXRaster commands.
- Added 1 technical demonstration with FX raster and some other stuffs.
IMAGE
- Added support for rasterized images in the refresh process.
- Fixed a bug preventing image from using linear filtering.
SPRITE
- Fixed sprite backdrop restore process.
SETUP
- Added 2 special commands : DERefreshDoubleBufferOn & DERefreshDoubleBufferOff
TEXT
- Now text output uses color from DEInk command.
- Fixed font size support.

Soonly ...

Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project