Page 7 of 10 FirstFirst ... 56789 ... LastLast
Results 61 to 70 of 92

Thread: Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    [quote="lordzero"]hello can you share the ]

    from my 2d engine


    procedure Div_Image_DrawRotateRect(var imageivImageest,Src:TRECT;Color:dword; Angle : Single;Blendeffect2DEffect);
    //'This sub sets up the vertices for a sprite, taking into account
    //width, height, vertex color, and rotation angle
    //NOTE: R, G, and B dictate the color that the sprite will be -
    //1, 1, 1 is normal, lower values will colorize the vertices

    //' * v1 * v3
    //' |\ |
    //' | \ |
    //' | \ |
    //' | \ |
    //' | \|
    //' * v0 * v2
    var
    Verts:array[0..3]of TDivVertex;

    SurfW,
    SurfH,
    XCenter ,
    YCenter,
    XCor ,
    YCor:single;
    begin
    if image.Texture=nil then exit;
    //Width of the surface
    SurfW := image.Width;
    //Height of the surface
    SurfH := image.Height;
    //Center coordinates on screen of the sprite;
    XCenter := Dest.Left + (Dest.Right - Dest.Left - 1) / 2;
    YCenter := Dest.Top + (Dest.Bottom - Dest.Top - 1) / 2;

    //Calculate screen coordinates of sprite, and only rotate if necessary
    If Angle = 0 Then
    begin
    XCor := Dest.Left;
    YCor := Dest.Bottom;
    end Else
    begin
    XCor := XCenter + (Dest.Left - XCenter) * Div_Math_Sin(round(Angle*afac)) + (Dest.Bottom - YCenter) * Div_Math_Cos(round(Angle*afac));
    YCor := YCenter + (Dest.Bottom - YCenter) * Div_Math_Sin(round(Angle*afac)) - (Dest.Left - XCenter) * Div_Math_Cos(round(Angle*afac));
    End;

    //0 - Bottom left vertex
    Verts[0]:=CreateD3DTLVertex (
    XCor,
    YCor,
    0,
    1.0,
    color,
    Src.Left / SurfW,
    (Src.Bottom + 1) / SurfH,
    );

    //Calculate screen coordinates of sprite, and only rotate if necessary
    If Angle = 0 Then
    begin
    XCor := Dest.Left;
    YCor := Dest.Top;
    end Else
    begin

    XCor := XCenter + (Dest.Left - XCenter) * Div_Math_Sin(round(Angle*afac)) + (Dest.Top - YCenter) * Div_Math_Cos(round(Angle*afac));
    YCor := YCenter + (Dest.Top - YCenter) * Div_Math_Sin(round(Angle*afac)) - (Dest.Left - XCenter) * Div_Math_Cos(round(Angle*afac));
    End;

    //1 - Top left vertex
    Verts[1]:=CreateD3DTLVertex (
    XCor,
    YCor,
    0,
    1.0,
    color,
    Src.Left / SurfW,
    Src.Top / SurfH,
    );

    //Calculate screen coordinates of sprite, and only rotate if necessary
    If Angle = 0 Then
    begin
    XCor := Dest.Right;
    YCor := Dest.Bottom;
    end Else
    begin
    XCor := XCenter + (Dest.Right - XCenter) * Div_Math_Sin(round(Angle*afac)) + (Dest.Bottom - YCenter) * Div_Math_Cos(round(Angle*afac)) ;
    YCor := YCenter + (Dest.Bottom - YCenter) * Div_Math_Sin(round(Angle*afac)) - (Dest.Right - XCenter) * Div_Math_Cos(round(Angle*afac));
    End;

    //2 - Bottom right vertex
    Verts[2]:=CreateD3DTLVertex(
    XCor,
    YCor,
    0,
    1.0,
    color,
    (Src.Right + 1) / SurfW,
    (Src.Bottom + 1) / SurfH,
    );

    //Calculate screen coordinates of sprite, and only rotate if necessary
    If Angle = 0 Then
    begin
    XCor := Dest.Right;
    YCor := Dest.Top;
    end Else
    begin
    XCor := XCenter + (Dest.Right - XCenter) * Div_Math_Sin(round(Angle*afac)) + (Dest.Top - YCenter) * Div_Math_Cos(round(Angle*afac));
    YCor := YCenter + (Dest.Top - YCenter) * Div_Math_Sin(round(Angle*afac)) - (Dest.Right - XCenter) * Div_Math_Cos(round(Angle*afac));
    End;

    //3 - Top right vertex
    Verts[3]:=CreateD3DTLVertex (
    XCor,
    YCor,
    0,
    1.0,
    color,

    (Src.Right + 1) / SurfW,
    Src.Top / SurfH,
    );


    d3ddevice.SetTexture(0, image.texture);
    case Blendeffect of
    DEffectSolid2DEffectSolid;
    DEffectBlend2DEffectBlend;
    DEffectAdd2DEffectAdd;
    DEffectSub2DEffectSub;
    DEffectONE2DEffectoNE;
    DEffectAdd2X2DEffectAdd2X;
    DEffectLight2DEffectLight;
    DEffectLightAdd2DEffectLightAdd;
    end;




    d3ddevice.SetVertexShader(VertexDef);
    d3ddevice.DrawPrimitiveUp(D3DPT_TRIANGLESTRIP, 2,@verts,sizeof(TDivVertex));
    d3ddevice.SetRenderState(D3DRS_ALPHABLENDENABLE, 0);
    d3ddevice.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
    d3ddevice.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);



    end;
    Never underestimate the power of Delphi.
    <br />There's those who play games,...and then there's who make games...

  2. #2

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...
    Knowledge is power.

  3. #3

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Hello DJoker,


    have you a sample for irr4delphi to move and rotate a object with the keys?

    (like 3rd person..):idea:









    sorry for my english. ops:

  4. #4

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    Never underestimate the power of Delphi.
    <br />There's those who play games,...and then there's who make games...

  5. #5

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by detvog
    Hello DJoker,


    have you a sample for irr4delphi to move and rotate a object with the keys?

    (like 3rd person..):idea:








    sorry for my english. ops:
    new procedure
    Camera_FollowingNode(Camera,TargetNode:ISceneNodeistance,AltitudeCamera,AngleUp:single);
    Never underestimate the power of Delphi.
    <br />There's those who play games,...and then there's who make games...

  6. #6

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    muito obrigado, parece perfeito para os meus estudos, valeu

    s?? uma pergunta.. estou usando directx9 com os headers do clootie...

    vc desenvolvou seus pr??prios headers?
    Knowledge is power.

  7. #7

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    muito obrigado, parece perfeito para os meus estudos, valeu

    s?? uma pergunta.. estou usando directx9 com os headers do clootie...

    vc desenvolvou seus pr??prios headers?
    nao loool

    olha isto ?ゥ de 1 dll k vem no directx para visual basic eu importei por activex
    e mudei algumas partes
    assim ne tens k andar com dlls do directx
    Never underestimate the power of Delphi.
    <br />There's those who play games,...and then there's who make games...

  8. #8

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    muito obrigado, parece perfeito para os meus estudos, valeu

    s?? uma pergunta.. estou usando directx9 com os headers do clootie...

    vc desenvolvou seus pr??prios headers?
    nao loool

    olha isto ?ゥ de 1 dll k vem no directx para visual basic eu importei por activex
    e mudei algumas partes
    assim ne tens k andar com dlls do directx
    legal sua ideia de descartar a dll do directx...

    no caso se eu for usar pra uma engine 2D eu teria q descartar a fun?゚?」o D3DXCreateTextureFromFile,

    existiria alguma maneira de carregar uma textura sem ser com essa fun?゚?」o?
    Knowledge is power.

  9. #9

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    muito obrigado, parece perfeito para os meus estudos, valeu

    s?? uma pergunta.. estou usando directx9 com os headers do clootie...

    vc desenvolvou seus pr??prios headers?
    nao loool

    olha isto ?ゥ de 1 dll k vem no directx para visual basic eu importei por activex
    e mudei algumas partes
    assim ne tens k andar com dlls do directx
    legal sua ideia de descartar a dll do directx...

    no caso se eu for usar pra uma engine 2D eu teria q descartar a fun?゚?」o D3DXCreateTextureFromFile,

    existiria alguma maneira de carregar uma textura sem ser com essa fun?゚?」o?
    sim claro mas leva muito codigo de directx puro...
    aki no forum axo k tens uma lib de imagens k carrega logo pa dx
    Never underestimate the power of Delphi.
    <br />There's those who play games,...and then there's who make games...

  10. #10

    Irr4Delphi (update - 18/12/08) Irrlicht with vBO's

    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    Quote Originally Posted by djoker
    Quote Originally Posted by lordzero
    falae djoker

    obrigado adiantado pelo seu codigo,

    te mandei uma private se puder checar e responder depois eu te agrade?゚o

    falou amigo lusitano...

    codei este demo pra ti ?ゥ simples mas axo k da pa po k keres

    http://depositfiles.com/files/4404935
    muito obrigado, parece perfeito para os meus estudos, valeu

    s?? uma pergunta.. estou usando directx9 com os headers do clootie...

    vc desenvolvou seus pr??prios headers?
    nao loool

    olha isto ?ゥ de 1 dll k vem no directx para visual basic eu importei por activex
    e mudei algumas partes
    assim ne tens k andar com dlls do directx
    legal sua ideia de descartar a dll do directx...

    no caso se eu for usar pra uma engine 2D eu teria q descartar a fun?゚?」o D3DXCreateTextureFromFile,

    existiria alguma maneira de carregar uma textura sem ser com essa fun?゚?」o?
    sim claro mas leva muito codigo de directx puro...
    aki no forum axo k tens uma lib de imagens k carrega logo pa dx
    vc saberia dizer o nome dela? outra coisa daria erro no lostdevice com isso.. teria como armazen?ー-la no managed pool? ou teria q recriar sempre com este sistema.

    se puder responder essa ficarei satisfeito n?」o vou postar mais off topic nessa thread.

    //----------------------------------------------------------------------------------
    if you can answer this question i'm satisfied and i wont post more off topic questions on this thread.

    thanks in advance
    Knowledge is power.

Page 7 of 10 FirstFirst ... 56789 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •