Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Emil_halim

Pages: [1] 2 3 4 5 6 7 8 ... 13
1
General chat / Re: Happy Birthday Nino!
« on: December 22, 2007 »

Happy Birthday Nino ,  :cheers:

Emil.

2
Freebasic / Re: S!P Gears full source code.
« on: September 24, 2007 »
:) shocky , there is no word that represent our thanks for your posting.

Yes there is, people here make me glad every time they release something into this community!
Because of this, it's always a  pleasure to post source :)

 :) hehe ... you are so kind , as usual.

3
Freebasic / Re: S!P Gears full source code.
« on: September 24, 2007 »

 :) shocky , there is no word that represent our thanks for your posting.

4
Purebasic / Re: OgreMagic for PureBasic
« on: August 26, 2007 »
thanks shocky for your karma .  :)

Hope to port it to BlitzMax too.

5
Purebasic / Re: OgreMagic for PureBasic
« on: August 26, 2007 »

Oh , sorry , Here is the link.

http://www.freewebs.com/ogremagic/index.htm

6
Purebasic / OgreMagic for PureBasic
« on: August 26, 2007 »
Hi PureBasic users

Just want to tell that , OgreMagic is supporting PureBasic now. So you can easlly use OgreMagic Library with your favorite basic language.
 
Here is a small test programe.
Code: [Select]

;**********************************************
;
;
;  OgreMagic Library with PureBasic Test
;
;             By Emil Halim
;
;               22/8/2007
;
;**********************************************

XIncludeFile #PB_Compiler_Home + "Includes\Imports\Dx9.pbi"
XIncludeFile #PB_Compiler_Home + "Includes\Imports\OgreMagic.pbi"

Global D3DDevice.IDirect3DDevice9  
  
OpenWindow(1,0,0,640,480,"OgreMagic with PureBasic",#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget )

SetWindowPos_(WindowID(1),#HWND_TOPMOST,0,0,0,0,#SWP_NOSIZE|#SWP_NOMOVE)
 
D3DDevice = D3D_OpenWindowedScreen(WindowID(1),640,480)

InitialMagicLibrary(D3DDevice,640,480)

If(ML_FileExist("MagicMedia.cfg"))
   ML_SetMediaDirectoryFromFile("MagicMedia.cfg")
Else
   ML_SetMediaDirectory("../OgreMagic/MagicMedia/")
EndIf

Tweety.l = ML_LoadStaticSprite("Tweety.bmp",0)
ML_SetSpriteColorKeyFromPoint(Tweety,0,0)

Repeat
  
  D3DDevice\Clear(0,0,#D3DCLEAR_TARGET,0,0,0)  
  D3DDevice\BeginScene()
  
  ML_UseOrthogonalView()
  ML_SetAlpha(1.0,#AllPoints)
  ML_SetColor(255,255,255,#AllPoints)
  ML_SetBlendMode(#ALPHABLEND)
  
  ML_SetSpriteTexture(ML_GetDefualtFont(),0)
  ML_SetColor(255,255,0,#AllPoints)
  ML_DrawString("Welcome To OgreMagic World",200,350)
  
  ML_SetSpriteTexture(Tweety,0)
  ML_DrawSprite(Tweety,320,240)
    
  ML_DrawLogo(0.8,75,60)
  
  ML_UsePerspectiveView()
  
  D3DDevice\EndScene()
  D3DDevice\Present(0,0,0,0)
  EventID = WindowEvent()
  
Until EventID = #PB_Event_CloseWindow  


D3D_Release(D3DDevice)
End


7
Freebasic / Re: SDL question
« on: July 17, 2007 »

my best and dear friend shocky. :)

Just I am wonder , why he still concentrate  all the time on software rendering stuff  and you do always ignore directX. I know you have a laptop which has no much hardware acceleration , but even if so DirectX still offer you a lot.

So my best advice for you to use DirectX or using OpeGL.

By the way if you want me to make some simple functions such as my OgreMagic for you , I will do it for you.

8
Freebasic / Re: software rotation question.
« on: July 16, 2007 »
thanks again shocky for your example.  :)

I have found the selution and it works ok.

again thank you.

9
Freebasic / Re: software rotation question.
« on: July 16, 2007 »
Thanks shocky very much for your explaination.  :)  , it is really helpful , but i am still stuck.

i will show you my code , hope you can help me.

1- have a Box structure which holds a 4 points represinting the rectangle and halfWidth , halfHeight.
2- given a center coordinate of the rectangle (CX ,CY) and the rotation angle THETA.

here is my function that calculte the final 4 point of the rectabgle. but it does not work as expected.

Code: [Select]

struct Tcoord
 {
     float x,y;
 };

 struct BoundBox
  {
      float halfWidth;
      float halfHeight;
      Tcoord point1;
      Tcoord point2;
      Tcoord point3;
      Tcoord point4;
  };

void UpdateBoundBox(BoundBox* bBox,float Cx,float Cy,float THETA )
     {
        float cosw = cos(THETA);
        float sinw  = sin(THETA);
        float x1 = Cx - bBox->halfWidth;
        float x2 = Cx + bBox->halfWidth;
        float x3 = Cx + bBox->halfWidth;
        float x4 = Cx - bBox->halfWidth;
        float y1 = Cy + bBox->halfHeight;
        float y2 = Cy + bBox->halfHeight;
        float y3 = Cy - bBox->halfHeight;
        float y4 = Cy - bBox->halfHeight;
        bBox->point1.x = x1 * cosw - y1 * sinw;
        bBox->point1.y = x1 * cosw + y1 * sinw;
        bBox->point2.x = x2 * cosw - y2 * sinw;
        bBox->point2.y = x2 * cosw + y2 * sinw;
        bBox->point3.x = x3 * cosw - y3 * sinw;
        bBox->point3.y = x3 * cosw + y3 * sinw;
        bBox->point4.x = x4 * cosw - y4 * sinw;
        bBox->point4.y = x4 * cosw + y4 * sinw;

     }


10
Freebasic / software rotation question.
« on: July 16, 2007 »

Hi all

Suppos I have a rectangle which has coordinates P1,P2,P3,P4. I want to rotate it by angle a. how to calculate the new coordinate of the rectangle ?

11
General chat / Happy Birthday slippy!
« on: July 14, 2007 »


 Happy Birthday  slippy! :cheers:

12
Freebasic / Re: good spline tutorial
« on: July 12, 2007 »
Ok, I have made it with C++  :) , big thanks must go to Relsoft and P01.

Here are my OgreMagic functions , may be it useful for someone else.

Code: [Select]

/**********************************************************
        2 D  p a t h  s t u f f
***********************************************************/

  struct Tcoord
   {
        float x,y;
   };

  struct Path2D
   {
       float   m_x;
       float   m_y;
       float   m_t;
       float   m_speed;
       int     m_index;
       int     m_maxindex;
       Tcoord* p_coords;
       float   m_old_x;
       float   m_old_y;
       double  m_angle;
       double  m_RotOffset;
   };


  DLL_EXPORT Path2D* ML_Create2DPath(int MaxPoints,float Speed,float RotOffset)
   {
       Path2D* path = new Path2D;
       path->m_maxindex = MaxPoints;
       path->p_coords = new Tcoord[MaxPoints];
       path->m_speed = Speed;
       path->m_x = path->m_y = path->m_t =
       path->m_index = path->m_old_x = path->m_old_y =
       path->m_angle = 0;
       path->m_RotOffset = RotOffset;
       return  path;
   }

  DLL_EXPORT void ML_AddpointTo2DPath(Path2D* path,float x,float y)
   {
       if(path->m_maxindex>path->m_index && path->m_index>=0)
        {
          path->p_coords[path->m_index].x = x;
          path->p_coords[path->m_index].y = y;
          path->m_index++;
        }
   }

  DLL_EXPORT void ML_AddpointTo2DPathByIndex(Path2D* path,int index,float x,float y)
   {
       if(path->m_maxindex>index && path->m_index>=0)
        {
          path->p_coords[index].x = x;
          path->p_coords[index].y = y;
        }
   }

  DLL_EXPORT void ML_SetPathSpeed(Path2D* path,float speed)
   {
       path->m_speed = speed;
   }

  // big thanks to Relsoft for catmull
  DLL_EXPORT void ML_Update2DPath(Path2D* path)
   {
       float  t1 = path->m_t;
   float  t2 = t1 * t1;
   float  t3 = t2 * t1;
   Tcoord p0, p1, p2, p3;

       p0.x = path->p_coords[path->m_index].x;
       p0.y = path->p_coords[path->m_index].y;
       p1.x = path->p_coords[(path->m_index + 1) % path->m_maxindex].x;
       p1.y = path->p_coords[(path->m_index + 1) % path->m_maxindex].y;
       p2.x = path->p_coords[(path->m_index + 2) % path->m_maxindex].x;
       p2.y = path->p_coords[(path->m_index + 2) % path->m_maxindex].y;
       p3.x = path->p_coords[(path->m_index + 3) % path->m_maxindex].x;
       p3.y = path->p_coords[(path->m_index + 3) % path->m_maxindex].y;

   path->m_x = 0.5 * ( ( 2.0 * p1.x ) + ( -p0.x + p2.x ) * t1 +
( 2.0 * p0.x - 5.0 * p1.x + 4 * p2.x - p3.x ) * t2 +
( -p0.x + 3.0 * p1.x - 3.0 * p2.x + p3.x ) * t3 );

   path->m_y = 0.5 * ( ( 2.0 * p1.y ) + ( -p0.y + p2.y ) * t1 +
( 2.0 * p0.y - 5.0 * p1.y + 4 * p2.y - p3.y ) * t2 +
( -p0.y + 3.0 * p1.y - 3.0 * p2.y + p3.y ) * t3 );

       path->m_t += path->m_speed;
       if(path->m_t > 1.0)
        {
       path->m_t -= 1.0;
       path->m_index = (path->m_index + 1) % path->m_maxindex;
        }

        path->m_angle = atan2(path->m_x - path->m_old_x , path->m_y - path->m_old_y)- path->m_RotOffset;
        path->m_old_x = path->m_x;
        path->m_old_y = path->m_y;

   }


13
Freebasic / Re: good spline tutorial
« on: July 12, 2007 »
Nice p01.

It is really easy , and you open my mind for new idea , which is you did not have to interpolate the angle instead you calculate the angle between each interpolated point and the previous one.

14
Freebasic / Re: good spline tutorial
« on: July 11, 2007 »
Relsoft:

Your spline code is very helpful and very close to my coding style. So thank you very much for your help.

Just I want an other thing , suppose you have a ship space that follows this spline ,so how to control the rotation of the ship to insure that it face the next point, I.E if our ship face to left hand and the next point is in the right direction so can you adjust your update routine to allow the ship smoothly change the rotation to face to next point?   

15
Freebasic / Re: New thing I am making.
« on: July 07, 2007 »
All it takes is a little magic dust and it can look quite different...

Exe attached :)

yes , it is deffernce now , waiting the final demo, good luck . :)

16
Freebasic / Re: New thing I am making.
« on: July 07, 2007 »
Hi shocky

Nice effect   :) , but is not that chessfield scrolling that same as that one in IROSP4.bas except that it is vertically here ?

17
Freebasic / Re: good spline tutorial
« on: July 07, 2007 »
Yes shocky , I want that the pass is a strait line and at the same time at the control points the change in path is smooth.

But I think this is impossible , so I will use relsoft Catmull-Rom Spline.

I want that routine to allow my Library users to define a path that control the translation and rotation and scaling and may be the color of sprite in the animation scene. So first I was searching for good translation spline then I will modify it suit my needs.

18
Freebasic / Re: good spline tutorial
« on: July 07, 2007 »

Ok Jim, i have tested the Catmull-Rom Spline that posted by relsoft and found that it is very useful, and did not see any Cubic splines.

Only the Littile thing about  the Catmull-Rom Spline is that the path is a curve not a strait line between each points.

19
Freebasic / Re: good spline tutorial
« on: July 06, 2007 »

thanks  relsoft for your code.

I will study it.

20
Freebasic / Re: good spline tutorial
« on: July 06, 2007 »

ok , I have changed my mind , so I will use a Linear interpolated instead of spline , but still have a small problem , I want my Object to smooth move when it reachs to control points.

For Example. suppose you have 10 points , p1,p2,p3 .......... so on.

first we will interpolat btween P1 and p2 and when object reachs to p2 we will interpolat btween P2 and p3 , and so on.

the problem is when the object reachs to p2 it will change the path from P1-p2 to P2-P3 in non smooth change .

any idea to solve this problem please ?

Pages: [1] 2 3 4 5 6 7 8 ... 13