Page 3 of 22

Posted: Mon Dec 05, 2005 12:21 am
by Emil_halim
Hi ALL

Magic2d Library ver 0.4 for irrlicht0.14.0 has been released,so you can download it from here
http://www.freewebs.com/bcxgl/download.htm

here is some screen shots

Image

Image

Image

Enjoy It.

Posted: Mon Dec 05, 2005 9:38 am
by GueZt
Hi EMIL,

Any chance "Magic 2d Library" under Direct X ?
its a wonderfull work.

Keep it up!

Posted: Mon Dec 05, 2005 5:26 pm
by Emil_halim
the problem is ,OpenGl allows you to make some thing that could not be
done by DricetX,such as transparent & Blending Operation ,OpenGl allows
you to do it in the same time but DX not.

any way may be i will do it but it will not be completed as OpenGl one

Posted: Tue Dec 06, 2005 5:56 am
by GueZt
Hi Again, EMIL

I Downloaded the demo and it's really great, specially
the the movie.

"I can't wait to see that in action under DX, thanks for
considering doin it under DX."

Pls release a demo under DX.

Thanks.

Posted: Tue Dec 06, 2005 10:44 am
by jam
Even if only half of the features work under DirectX I would still use the library. 8)

Posted: Tue Dec 06, 2005 3:55 pm
by Emil_halim
ok i will do it.

Posted: Thu Dec 08, 2005 10:00 am
by BlindSide
Nice program! I will try it when I have the time, can it render text in 3D world? Also, when you say it supports BASIC, etc, do you mean it has scripting or something like that for effects? If so this is very nice!

Posted: Thu Dec 08, 2005 2:42 pm
by Emil_halim
thanks for your nice words.

yes you can render text in 3D world but it always render at 0 in z direction,so i recommend useing billboard for that job.

no it has not a scripting of basic language,it has some c++ functions those act just like a BlitzMax basic functions ,such as setBlend,SetColor,SetAlpha....

Posted: Fri Dec 09, 2005 4:22 pm
by Emil_halim
Hi All

Finally i have successfuly made DxMagic2d Library that works under Directx9 driver.

it has 80% of functos that will allow you to go with Magic2d Library, check up the DxMagic2d.h for allowed functions.
you can download it from here

http://www.freewebs.com/bcxgl/download.htm

please do not forget to tell me your FPS in your system.

remark:
i have found a bad thing,under Irrelicht 0.12.0 it is faster than Irrlicht 0.14.0 !!!!!!!!!!!!!!?????????????
is the changes went the wrong direction or what?

here is ascreen shot

Image

Enjoy it.

Posted: Sat Dec 10, 2005 3:46 am
by krama757
Emil this is awesome!

I can already see some things that could be implemented using it.

Using your blending of images, we could implement a day/night cycle for skybox textures.

Using your clipping/making new textures we could make a circular minimap.

Thanks a bunch!

Posted: Sat Dec 10, 2005 4:59 am
by Emil_halim
krama757: thank you.

great idea, go a head and make some demo ,if you want i could include
your demos with my work and credit for you.

Posted: Sat Dec 10, 2005 5:45 am
by GueZt
Great Job EMIL! :D releasing for DIRECTX.

BTW: Initialy i thought it was open source but its only incudes LIB.

Posted: Sat Dec 10, 2005 12:49 pm
by Emil_halim
GueZt wrote:Great Job EMIL! :D releasing for DIRECTX.

BTW: Initialy i thought it was open source but its only incudes LIB.
thanks.

yes it's include & Lib , but the effects and examples are open source.
download the OpenGl version it has many examples and effects,and try
them with Dx version.

day/night cycle for skybox Demo

Posted: Sun Dec 11, 2005 5:19 pm
by Emil_halim
Hi All

here is a "day/night cycle skybox" class,thanks krama757 for his great idea.
works with OpneGl only by now.

Code: Select all

/************************************
           Magic library

   day/night cycle for skybox Demo
        it is krama757 Idea
       works only for OpenGl
*************************************/


#include <irrlicht.h>

#include <Magic2d.hpp>

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

// global declration of Irrlicht interfaces
IrrlichtDevice* device;
IVideoDriver*   driver;
ISceneManager*  smgr;
IGUIEnvironment* guienv;

//! day/night cycle skybox class
class TSkyBoxSceneNode : public ISceneNode
	{
	public:

		//! constructor
		TSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, video::ITexture* left,
			video::ITexture* right, video::ITexture* front, video::ITexture* back,
			ISceneNode* parent, ISceneManager* mgr, s32 id): ISceneNode(parent, mgr, id)
		{
		    AutomaticCullingEnabled = false;

	        // create material

	        video::SMaterial mat;
	        mat.Lighting = false;
	        mat.ZBuffer = false;
	        mat.ZWriteEnable = false;
	        mat.BilinearFilter = true;
	        Material[0] = mat;
	        Material[0].Texture1 = front;
	        Material[1] = mat;
	        Material[1].Texture1 = left;
	        Material[2] = mat;
	        Material[2].Texture1 = back;
            Material[3] = mat;
	        Material[3].Texture1 = right;
	        Material[4] = mat;
	        Material[4].Texture1 = top;
	        Material[5] = mat;
	        Material[5].Texture1 = bottom;

	        Fade = new TFadeInOut();
        }

		//! destructor
		virtual ~TSkyBoxSceneNode(){};

		virtual void OnPreRender()
		 {
		   	if (IsVisible)
		       SceneManager->registerNodeForRendering(this, ESNRP_SKY_BOX);
      	    ISceneNode::OnPreRender();
         }

		//! renders the node.
		virtual void render()
		 {
		     video::IVideoDriver* driver = SceneManager->getVideoDriver();
	         scene::ICameraSceneNode* camera = SceneManager->getActiveCamera();

	         if (!camera || !driver) return;

	         core::matrix4 mat;
	         mat.setTranslation(camera->getAbsolutePosition());
	         driver->setTransform(video::ETS_WORLD, mat);

		     SetBlend(ALPHABLEND);
		     SetColor(255,255,255);

		     // SetAlpha(0.9);
		     Fade->FadeInOut(4000,1000,4000,true);

		     //! Front Face
	         driver->setMaterial(Material[0]);
	         glBegin(GL_QUADS);
		     glNormal3f( 0.0f, 0.0f, 1.0f);
		     glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
             glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
             glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
		     glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
		     glEnd();

		     //! Back Face
             driver->setMaterial(Material[2]);
             glBegin(GL_QUADS);
 		     glNormal3f( 0.0f, 0.0f,-1.0f);
		     glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
		     glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
             glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
		     glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
             glEnd();

             //! Right face
		     driver->setMaterial(Material[1]);
             glBegin(GL_QUADS);
		     glNormal3f( 1.0f, 0.0f, 0.0f);
		     glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
             glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
             glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
		     glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
             glEnd();

		     //! Left Face
		     driver->setMaterial(Material[3]);
             glBegin(GL_QUADS);
		     glNormal3f(-1.0f, 0.0f, 0.0f);
		     glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
             glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
             glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
		     glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
 	         glEnd();

		     //! Top Face
		     driver->setMaterial(Material[4]);
             glBegin(GL_QUADS);
		     glNormal3f( 0.0f, 1.0f, 0.0f);
		     glTexCoord2f(0.0f, 1.0f); glVertex3f( -1.0f,  1.0f, -1.0f);
             glTexCoord2f(0.0f, 0.0f); glVertex3f(  1.0f,  1.0f, -1.0f);
             glTexCoord2f(1.0f, 0.0f); glVertex3f(  1.0f,  1.0f,  1.0f);
		     glTexCoord2f(1.0f, 1.0f); glVertex3f( -1.0f,  1.0f,  1.0f);
             glEnd();


		     //! Bottom Face
		     driver->setMaterial(Material[5]);
             glBegin(GL_QUADS);
		     glNormal3f( 0.0f,-1.0f, 0.0f);
		     glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
             glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
             glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
		     glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
             glEnd();

	         SetBlend(SOLIDBLEND);
          }

		//! returns the axis aligned bounding box of this node
		virtual const core::aabbox3d<f32>& getBoundingBox() const
		 {
            return Box;
         }

		virtual video::SMaterial& getMaterial(s32 i)
		 {
              return Material[i];
         }

		//! returns amount of materials used by this scene node.
		virtual s32 getMaterialCount()
		 {
 	          return 6;
         }

	private:
        core::aabbox3d<f32> Box;
		video::SMaterial Material[6];
		TFadeInOut* Fade;
};


int main()
{

    device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 32);
    bool rslt = InitMagic(device);
    if(rslt == false)
          printf("Magic Library will only work with OpenGL driver");

	device->setWindowCaption(L"Hello World! - Magic 2d library for Irrlicht");

	driver = device->getVideoDriver();
	smgr = device->getSceneManager();
	guienv = device->getGUIEnvironment();

    scene::ICameraSceneNode* camera =
		smgr->addCameraSceneNodeFPS(0,100.0f,1200.0f);

    // create skybox
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);

    TSkyBoxSceneNode* myNode=new TSkyBoxSceneNode(
                          driver->getTexture("../../media/irrlicht2_up.jpg"),
		                  driver->getTexture("../../media/irrlicht2_dn.jpg"),
		                  driver->getTexture("../../media/irrlicht2_lf.jpg"),
		                  driver->getTexture("../../media/irrlicht2_rt.jpg"),
		                  driver->getTexture("../../media/irrlicht2_ft.jpg"),
		                  driver->getTexture("../../media/irrlicht2_bk.jpg"),
		                  smgr->getRootSceneNode(),smgr,0);

	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

    int lastFPS = -1;

	while(device->run())
	{

		driver->beginScene(true, true, SColor(0,0,0,0));

                 smgr->drawAll();
		         guienv->drawAll();

		driver->endScene();
		int fps = driver->getFPS();
         if (lastFPS != fps)
         {
            wchar_t tmp[1024];
            swprintf(tmp, 1024, L"Hello World! - Magic 2d library for Irrlicht (%s)(fps:%d)",driver->getName(), fps);
            device->setWindowCaption(tmp);
            lastFPS = fps;
         }
	}

	device->drop();

	return 0;
}
here is ascreen shot

Image

Posted: Sun Dec 11, 2005 6:58 pm
by Xaron
Really nice work, I just want to say: Thank you Emil_halim! :)

Regards - Xaron