Author Topic: MagicProTest1  (Read 7164 times)

0 Members and 2 Guests are viewing this topic.

Emil_halim

  • Guest
MagicProTest1
« on: April 23, 2013, 07:29:23 AM »
Hi all,

Here is my first test of my MagicPro Library.

the demo will Open a screen 800*600 , then register a callback function that will run in the background of
window { it start 2d mode then set GPU shader program that draw things in back&white , then playing the movie in a background ,stop shader program ,return to 3D mode}

it set a Zip file and Media folder for holding our graphic Media , so MagicPro will search them when loading
any resource.

the doem will play my favoret song "Sandra - Infinite Kiss 2012" 

here is the source code
Code: [Select]
//****************************************//
//           ************                 //
//      ***MagicPro library***            //
//           ************                 //
//****************************************//

//includepath "$/inc/"
$ filename "MagicProTest2.exe"
#include "..\..\inc\RTL32.inc"

#include "MagicPro.inc"

sys cam,ogrehead,light,SPrg,Movie

void QueueStarted() , callback
{
Screen_Use2DView()
ML_StartShaderPrg(SPrg)
DrawMovieToScreen(Movie,0,0,800,600) 
ML_StopShaderPrg()
Screen_Stop2DView()
}

    Init("MagicPro Test #2")
    Graphics3D(800,600)
   
    defineQueueStarted(@QueueStarted)

    setMediaDir("ZipMedia.zip")
    setMediaDir("media")
   
    setAmbientLight(30.0,30.0,50.0)

    cam = CreateCamera   
    //CameraClsColor(cam,90.0,128.0,255.0)
    CameraRange(cam,1.0,1000.0)
   
    ogrehead = LoadMesh("ogrehead.mesh",0,"")
    PositionEntity(ogrehead,0.0,0.0,-150.0)
       
    light = CreateLight()
    PositionEntity(light,-200.0,200.0,50.0)
    LightColor(light,255.0,200.0,150.0)
   
    Movie = LoadMovie("Sandra - Infinite Kiss ( 2012 ).mpg")
    LoopMovie(Movie,true)
    RunMovie(Movie)
   
    SPrg = ML_CreateHLSLPrg()
    ML_EditPixelPrg(SPrg)
    ML_AddToPrg("sampler2D tex0;                                          ")
    ML_AddToPrg("float4   main(  float2 TexCoord : TEXCOORD0) : COLOR0    ")
    ML_AddToPrg("{                                                        ")
    ML_AddToPrg("       float4 col = tex2D( tex0, TexCoord );             ")
    ML_AddToPrg("       float  gry = col.r*0.299+col.g*0.587+col.b*0.184; ")
    ML_AddToPrg("       return float4(gry,gry,gry,col.a);                 ")
    ML_AddToPrg("}                                                        ")
    ML_CompilePixelPrg(SPrg,"main")
 
    while not OIS_isKeyDown(KC_ESCAPE)
     {
        DoEvents
       
        UpdateMovie(Movie)
     
        RenderWorld() 

    Sync()
     }
     
    DeleteMovie(Movie)
    EndGraphics()
   


X

Peter

  • Guest
Re: MagicProTest1
« Reply #1 on: April 24, 2013, 10:41:18 AM »
Hi Emil,

This image looks good. Unfortunately I do not have the magicpro.inc.
I can not see how it runs in action! 

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #2 on: April 24, 2013, 11:25:49 AM »
Hi Peter,

MagicPro Library is a huge project. the only MagicPro.dll size is 6.927 MB.

any way the size of Zip working example is 46.8 Mb , i will try to upload and give you the link.

Peter

  • Guest
Re: MagicProTest1
« Reply #3 on: April 24, 2013, 11:43:25 AM »
Quote
the size of Zip working example is 46.8 Mb

What, so much, is everything by you ?

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #4 on: April 24, 2013, 12:44:00 PM »

ofcourse not ,

here is the link http://www.4shared.com/zip/PXQJTXrM/MPtest2.html

BTW MagicPro.inc is not completed yet , and MagicPro is still under development.

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #5 on: April 24, 2013, 09:57:54 PM »

Hi Peter ,

have you successfully downloaded it , or should i upload it to an other one?

JRS

  • Guest
Re: MagicProTest1
« Reply #6 on: April 24, 2013, 10:59:45 PM »
It would be nice to upload it somewhere that doesn't install a new web search toolbar or becomes malware.


Peter

  • Guest
Re: MagicProTest1
« Reply #7 on: April 25, 2013, 01:21:47 AM »
Hi Emil,

Quote
have you successfully downloaded it

No, I wanted no iLivid application or what it is.

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #8 on: April 25, 2013, 08:52:13 AM »

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #9 on: April 25, 2013, 09:02:24 AM »
Hi all,

here is second demo, it uses an other shader program called MskPrg , that will draw the movie in normal
color but with a mask that taken from red component of an other image. that movie will draw in Mouse
x & y coordinates. and over the black& white movie.

with MagicPro there is no end of your imagination. just imagine and let MagicPro does it. 

here is the code   
Code: [Select]
//****************************************//
//           ************                 //
//      ***MagicPro library***            //
//           ************                 //
//****************************************//

//includepath "$/inc/"
$ filename "MagicProTest4.exe"
#include "..\..\inc\RTL32.inc"

#include "MagicPro.inc"

sys cam,ogrehead,light,SPrg,MskPrg,mskId,Movie,hgeSprite,MousX,MousY

void QueueStarted() , callback
{
Screen_Use2DView()
ML_StartShaderPrg(SPrg)
DrawMovieToScreen(Movie,0,0,800,600) 
ML_StartShaderPrg(MskPrg)
ML_SetTexture(Image_GetPointer(mskId),1)
hgeSprite_Render(hgeSprite,MousX,MousY)
ML_StopShaderPrg()
Screen_Stop2DView()
}

    Init("MagicPro Test #4")
    Graphics3D(800,600)
   
    defineQueueStarted(@QueueStarted)

    setMediaDir("ZipMedia.zip")
    setMediaDir("media")
   
    setAmbientLight(30.0,30.0,50.0)

    cam = CreateCamera   
    CameraRange(cam,1.0,1000.0)
   
    ogrehead = LoadMesh("ogrehead.mesh",0,"")
    PositionEntity(ogrehead,0.0,0.0,-150.0)
       
    light = CreateLight()
    PositionEntity(light,-200.0,200.0,50.0)
    LightColor(light,255.0,200.0,150.0)
   
    Movie = LoadMovie("Sandra - Infinite Kiss ( 2012 ).mpg")
    LoopMovie(Movie,true)
    RunMovie(Movie)
   
    SPrg = ML_CreateHLSLPrg()
    ML_EditPixelPrg(SPrg)
    ML_AddToPrg("sampler2D tex0;                                          ")
    ML_AddToPrg("float4   main(  float2 TexCoord : TEXCOORD0) : COLOR0    ")
    ML_AddToPrg("{                                                        ")
    ML_AddToPrg("       float4 col = tex2D( tex0, TexCoord );             ")
    ML_AddToPrg("       float  gry = col.r*0.299+col.g*0.587+col.b*0.184; ")
    ML_AddToPrg("       return float4(gry,gry,gry,col.a);                 ")
    ML_AddToPrg("}                                                        ")
    ML_CompilePixelPrg(SPrg,"main")
   
    sys id = GetImageIDOfMovie(Movie)
    single imgh = Image_GetHeight id 
    single imgw = Image_GetWidth id 
    hgeSprite = make_hgeSprite(id,0.0,0.0,imgw,imgh)
   
    mskId = Image_GetFreeID()
    Image_load ( mskId , "irr_media/lightFalloff.png")
    MskPrg = ML_CreateHLSLPrg()
    ML_EditPixelPrg(MskPrg)
    ML_AddToPrg("sampler2D tex0;                                          ")
    ML_AddToPrg("sampler2D tex1;                                          ")
    ML_AddToPrg("float4   main(  float2 TexCoord : TEXCOORD0) : COLOR0    ")
    ML_AddToPrg("{                                                        ")
    ML_AddToPrg("       float4 c1 = tex2D( tex0, TexCoord );              ")
    ML_AddToPrg("       float4 c2 = tex2D( tex1, TexCoord );              ")
    ML_AddToPrg("       return float4(c1.r,c1.g,c1.b,c2.r);               ")
    ML_AddToPrg("}                                                        ")
    ML_CompilePixelPrg(MskPrg,"main")
   
    while not OIS_isKeyDown(KC_ESCAPE)
     {
        DoEvents
       
        MousX = OIS_mouseX()
       
        MousY = OIS_mouseY()
       
        UpdateMovie(Movie)
     
        RenderWorld() 

    Sync()
     }
     
    DeleteMovie(Movie)
    EndGraphics()
 

X

JRS

  • Guest
Re: MagicProTest1
« Reply #10 on: April 25, 2013, 09:03:55 AM »
Quote
Ok , here is an other link

Thanks!

It seems everything you click on these days comes with junk in the trunk.

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #11 on: April 25, 2013, 09:09:49 AM »

Hi John,

did it download and worked with you?

JRS

  • Guest
Re: MagicProTest1
« Reply #12 on: April 25, 2013, 09:11:47 AM »
Yes to the first part of your question and working on the second part.  :D

JRS

  • Guest
Re: MagicProTest1
« Reply #13 on: April 25, 2013, 10:26:51 AM »
I'm getting a DLL mismatch error when you have provided a more current version than what the error dialog is asking for.



X

Emil_halim

  • Guest
Re: MagicProTest1
« Reply #14 on: April 25, 2013, 10:33:04 AM »
John,

I see that your system uses and required an older version of D3DX9.

you have 2 solutions , 1- download this dll form net  D3DX9_35.dll
2- rename D3DX9_42.dll that in zip to  D3DX9_35.dll