help blitzmovie createcube3d with avi

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

 

blitzprog

Betreff: help blitzmovie createcube3d with avi

BeitragDi, Mai 05, 2009 12:58
Antworten mit Zitat
Benutzer-Profile anzeigen
hello all


help blitzmovie createcube3d with avi


really a nice forum

I hope I helped


original code link with plug-in
http://www.blitzmax.com/Commun...opic=76773

blitzmovie plug in userlib tested ok download link http://utenti.lycos.it/domydar...ted_ok.zip
mycode
blitzmovie 2d mode help create in 3d mode in a cube3d
Code: [AUSKLAPPEN]

AppTitle "BlitzMovie Decode To Blitz3D Image Demo (C) 2005 Harriman Software"
; www.harrimansoftware.com/blitzmovie

Graphics3D 1024, 768, 32, 1
gr_w = GraphicsWidth()
gr_h = GraphicsHeight()

SetBuffer BackBuffer()

; init myResizeImage(img,w,h)
Global myResizeCamera=CreateCamera()
CameraClsMode myResizeCamera,0,1
Global myResizeQuad = CreateQuad()
Global myResizeTex = CreateTexture(1024,1024,256 Or 16 Or 32)
EntityTexture myResizeQuad, myResizeTex
EntityFX myResizeQuad,1
CameraRange myResizeCamera,0.01,100
TranslateEntity myResizeCamera,(1.0/1024.0),-(1.0/1024.0),-1.0
EntityParent myResizeQuad,myResizeCamera,1
; end of init myResizeImage(img,w,h)

movie_to_play$="backfire.avi"
.inizio
dummy=BLITZMOVIE_Open(movie_to_play$)
m_width=BLITZMOVIE_GetWidth()
m_height=BLITZMOVIE_GetHeight()
BLITZMOVIE_Close()

Global image = CreateImage(m_width,m_height) ; create an image that we'll be decoding the movie to

; Open the movie in decode to Blitz3D dx7 surface mode
result = BLITZMOVIE_OpenDecodeToImage( movie_to_play$, image, True)
If Not result
   BLITZMOVIE_Close()
   RuntimeError "Error loading movie! Quitting..."
EndIf

; play the movie
result = BLITZMOVIE_Play()
If Not result
   BLITZMOVIE_Close()
   RuntimeError "Error playing movie! Quitting..."
EndIf

Global width = BLITZMOVIE_GetWidth()
Global height = BLITZMOVIE_GetHeight()

While BLITZMOVIE_IsPlaying() And (Not KeyHit(1))
    Delay 5
    dummy=myProjectImage(image,gr_w, gr_h)
   ;scanlines(gr_h) ; gives a scanline type TV Effect (rem it out to disable it)
   Flip 1
   
   If KeyDown(30) Then BLITZMOVIE_Stop()
   If KeyDown(31) Then BLITZMOVIE_Play()
   If KeyDown(16) Then Goto avicambio
   
Wend

BLITZMOVIE_Stop()
BLITZMOVIE_Close()
FreeImage(image)
End

Function scanlines(h)
   Color 0,0,0
   w=GraphicsWidth()-1
   For i=0 To h Step 4
      Rect 0,i,w,3,0
   Next
End Function

Function myProjectImage(img,w#,h#)
; copies an image To a texture of a quad that is placed in front of a cam and then scaled to w,h
   img_w#=ImageWidth(img)
   img_h#=ImageHeight(img)
   If img_w>1024 Then img_w=1024
   If img_h>1024 Then img_h=1024
   If img_w<1 Then img_w=1
   If img_h<1 Then img_h=1
   
   If w>1024 Then w=1024
   If h>1024 Then h=1024
   If w<1 Then w=1
   If h<1 Then h=1
   
   w_rel#=w#/img_w#
   h_rel#=h#/img_h#
   g_rel#=1024.0/GraphicsWidth()
   
   CopyRect 0,0,img_w,img_h,512-(img_w/2.0),512-(img_h/2.0),ImageBuffer(img),TextureBuffer(myResizeTex)
   ScaleEntity myResizeQuad,w_rel*g_rel,h_rel*g_rel,0.0001
   RenderWorld()
End Function

Function CreateQuad()
  ; creates a quad, facing to the right side
   mesh=CreateMesh()
   surf=CreateSurface(mesh)
   v0=AddVertex(surf, -1.0,   1.0,0, 0,0 )
   v1=AddVertex(surf,  1.0,   1.0,0, 1,0 )
   v2=AddVertex(surf,  1.0,  -1.0,0, 1,1 )
   v3=AddVertex(surf, -1.0,  -1.0,0, 0,1 )
   AddTriangle(surf,v0,v1,v2)
   AddTriangle(surf,v0,v2,v3)
   UpdateNormals mesh
   Return mesh
End Function

.avicambio
movie_to_play$="Dragon Blaze.avi"
Goto inizio
 

aletes

BeitragDi, Mai 05, 2009 13:38
Antworten mit Zitat
Benutzer-Profile anzeigen
really nice, but this is a german forum
and:
Code: [AUSKLAPPEN]

...
Goto inizio
...

why Goto?
i hate Goto Mad

ys, aletes
 

blitzprog

BeitragDi, Mai 05, 2009 13:47
Antworten mit Zitat
Benutzer-Profile anzeigen
aletes hat Folgendes geschrieben:
really nice, but this is a german forum
and:
Code: [AUSKLAPPEN]

...
Goto inizio
...

why Goto?
i hate Goto Mad

ys, aletes


because foreigners are not welcome?

Italian like me?

but I hope I can stay on this board!

Smily

BeitragDi, Mai 05, 2009 14:05
Antworten mit Zitat
Benutzer-Profile anzeigen
no, some people here don't like goto.
that's like a religion. Wink

however, welcome.

But if you want to speak english, you better write to the community at http://blitzbasic.com/ .
Lesestoff:
gegen Softwarepatente | Netzzensur | brain.exe | Unabhängigkeitserklärung des Internets

"Wir müssen die Rechte der Andersdenkenden selbst dann beachten, wenn sie Idioten oder schädlich sind. Wir müssen aufpassen. Wachsamkeit ist der Preis der Freiheit --- Keine Zensur!"
stummi.org
  • Zuletzt bearbeitet von Smily am Di, Mai 05, 2009 14:22, insgesamt einmal bearbeitet
 

blitzprog

BeitragDi, Mai 05, 2009 14:14
Antworten mit Zitat
Benutzer-Profile anzeigen
like what then?

Perhaps you prefer the functions?

but expect more news soon

thanks welcome!

I like this forum because more and more functional!

if not all understand English with google translate from english to german

Dice of Darkness

BeitragDi, Mai 05, 2009 17:30
Antworten mit Zitat
Benutzer-Profile anzeigen
lol Smile

Yes, many users prefer the functions (me too Wink), but that's just because I've never worked with "goto" or "gosub".
Gratis Spiele, Musik, Tools
 

aletes

BeitragDi, Mai 05, 2009 17:42
Antworten mit Zitat
Benutzer-Profile anzeigen
no Gosub?
i can't imagined that
i always work with Gosub
 

da_poller

BeitragDi, Mai 05, 2009 17:49
Antworten mit Zitat
Benutzer-Profile anzeigen
if u take function and smart using of select-case u never need goto/gosub and have nice formated code..

what ide u use?
(using IDEal?)

NightPhoenix

BeitragDi, Mai 05, 2009 17:57
Antworten mit Zitat
Benutzer-Profile anzeigen
I must agree, functions are much better to handle, believe us blitzprog, pleaseee Wink

And welcome in our smart (and nice) Forum =)


Zitat:
I like this forum because more and more functional!

Das war ein super Lob an die Mods Smile

Chester

BeitragDi, Mai 05, 2009 19:11
Antworten mit Zitat
Benutzer-Profile anzeigen
@blitzprog:
The problem with 'goto' is that for many people it's difficult to understand how the code works, if you're jumping around too much.

For sure, functions are easier to handle but in my opinion 'goto' is more logical to comprehend from the technical point of view. So i'd say, if one is aware of what he's actually doing why shouldn't he use it?
 

blitzprog

BeitragMi, Mai 06, 2009 10:51
Antworten mit Zitat
Benutzer-Profile anzeigen
sorry but no one could help me?
code original



Code: [AUSKLAPPEN]

AppTitle "BlitzMovie Decode To Blitz3D Image Demo (C) 2005 Harriman Software"
; www.harrimansoftware.com/blitzmovie

Graphics3D 1024, 768, 32, 1
gr_w = GraphicsWidth()
gr_h = GraphicsHeight()

SetBuffer BackBuffer()

; init myResizeImage(img,w,h)
Global myResizeCamera=CreateCamera()
CameraClsMode myResizeCamera,0,1
Global myResizeQuad = CreateQuad()
Global myResizeTex = CreateTexture(1024,1024,256 Or 16 Or 32)
EntityTexture myResizeQuad, myResizeTex
EntityFX myResizeQuad,1
CameraRange myResizeCamera,0.01,100
TranslateEntity myResizeCamera,(1.0/1024.0),-(1.0/1024.0),-1.0
EntityParent myResizeQuad,myResizeCamera,1
; end of init myResizeImage(img,w,h)

movie_to_play$="liebing.avi"

dummy=BLITZMOVIE_Open(movie_to_play$)
m_width=BLITZMOVIE_GetWidth()
m_height=BLITZMOVIE_GetHeight()
BLITZMOVIE_Close()

Global image = CreateImage(m_width,m_height) ; create an image that we'll be decoding the movie to

; Open the movie in decode to Blitz3D dx7 surface mode
result = BLITZMOVIE_OpenDecodeToImage( movie_to_play$, image, True)
If Not result
   BLITZMOVIE_Close()
   RuntimeError "Error loading movie! Quitting..."
EndIf

; play the movie
result = BLITZMOVIE_Play()
If Not result
   BLITZMOVIE_Close()
   RuntimeError "Error playing movie! Quitting..."
EndIf

Global width = BLITZMOVIE_GetWidth()
Global height = BLITZMOVIE_GetHeight()

While BLITZMOVIE_IsPlaying() And (Not KeyHit(1))
    Delay 5
    dummy=myProjectImage(image,gr_w, gr_h)
   scanlines(gr_h) ; gives a scanline type TV Effect (rem it out to disable it)
   Flip 1
Wend

BLITZMOVIE_Stop()
BLITZMOVIE_Close()
FreeImage(image)
End

Function scanlines(h)
 Color 0,0,0
 w=GraphicsWidth()-1
 For i=0 To h Step 4
  Rect 0,i,w,3,0
 Next
End Function

Function myProjectImage(img,w#,h#)
; copies an image To a texture of a quad that is placed in front of a cam and then scaled to w,h
 img_w#=ImageWidth(img)
 img_h#=ImageHeight(img)
 If img_w>1024 Then img_w=1024
 If img_h>1024 Then img_h=1024
 If img_w<1 Then img_w=1
 If img_h<1 Then img_h=1

 If w>1024 Then w=1024
 If h>1024 Then h=1024
 If w<1 Then w=1
 If h<1 Then h=1

 w_rel#=w#/img_w#
 h_rel#=h#/img_h#
 g_rel#=1024.0/GraphicsWidth()

 CopyRect 0,0,img_w,img_h,512-(img_w/2.0),512-(img_h/2.0),ImageBuffer(img),TextureBuffer(myResizeTex)
 ScaleEntity myResizeQuad,w_rel*g_rel,h_rel*g_rel,0.0001
 RenderWorld()
End Function

Function CreateQuad()
  ; creates a quad, facing to the right side
  mesh=CreateMesh()
  surf=CreateSurface(mesh)
  v0=AddVertex(surf, -1.0,   1.0,0, 0,0 )
  v1=AddVertex(surf,  1.0,   1.0,0, 1,0 )
  v2=AddVertex(surf,  1.0,  -1.0,0, 1,1 )
  v3=AddVertex(surf, -1.0,  -1.0,0, 0,1 )
  AddTriangle(surf,v0,v1,v2)
  AddTriangle(surf,v0,v2,v3)
  UpdateNormals mesh
  Return mesh
End Function

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group