directpython-general Mailing List for DirectPython
Status: Inactive
Brought to you by:
hsalo
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(3) |
Jun
(2) |
Jul
(5) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(2) |
Feb
(7) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(5) |
Aug
(11) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(4) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(1) |
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
(1) |
20
|
21
(1) |
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
31
|
|
|
From: Heikki S. <ho...@gm...> - 2006-08-21 07:44:53
|
> -----Original Message----- > From: dir...@li... > [mailto:dir...@li...] > On Behalf Of Gert > Sent: 19. elokuuta 2006 23:43 > To: dir...@li... > Subject: [DirectPython] setMatrix not working for World objects ? > > I am trying to check the possibilities of DirectPython by > converting the DirectX tutorials to Python. > Can you tell me what's wrong with the following example ? > The sprite rotates but the triangle stays in place. > > I have downloaded the source-code but could not find a way to > compile it. > Am I missing some makefiles or is there a trick to compile > the sources ? > > Regards, > Gert > ---- It can be little tricky to built DirectPython if you are not familiar with DirectX SDK. You need a relatively new platform SDK, the DirectX SDK and of course Python libraries. Put everything together as a new project and built it with Visual Studio 7.1 (you can use some other compilers too, but it requires some tweaking). I might add some more help files to explain things, but I think that very many people can or are interested in making their own builts. But then again, I might be wrong. >[Code snipped] Vertices that are pretransformed (FVF.XYZRHW) are not affected by transformations. You need to apply your own calculations to them before you render them. Use FVF.XYZ-vertices if you want to use transformation matrices. However, it is possible to squeese them (XYZ) through shaders to arhieve the same results as with XYZRHW-vertices. -- Heikki Salo |
From: Gert <ge...@el...> - 2006-08-19 20:58:04
|
I am trying to check the possibilities of DirectPython by converting the DirectX tutorials to Python. Can you tell me what's wrong with the following example ? The sprite rotates but the triangle stays in place. I have downloaded the source-code but could not find a way to compile it. Am I missing some makefiles or is there a trick to compile the sources ? Regards, Gert ---- import math import array import d3d import d3dx from d3dc import * use_framework = False vertices = ( ( 150, 50 , 0.5, 1, 0xffffff00 ), ( 250, 250, 0.5, 1, 0xffff00ff ), ( 50, 250, 0.5, 1, 0xff00ff00 ) ) class CreateDevice( d3dx.Frame ): def __init__(self, *args, **kwargs): d3dx.Frame.__init__(self, *args, **kwargs) self.angle = 0 def onCreate( self ): self.vbuffer = d3d.VertexBuffer( FVF.XYZRHW | FVF.DIFFUSE, len( vertices ) ) self.vbuffer.extend( vertices ) def setupMatrices( self ): self.angle += 0.01 matrix = array.array("f", ( math.cos(self.angle), 0.0, -math.sin(self.angle), 0.0, 0.0, 1.0, 0.0, 0.0, math.sin(self.angle), 0.0, math.cos(self.angle), 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)) d3d.setMatrix(matrix, MATRIX.WORLD) d3d.setView( ( 0.0, 3.0, -5.0 ), ( 0.0, 1.0, 0.0 ), 100, math.pi / 4 ) def onRender( self ): d3d.clear( 0x00000000 ) self.setupMatrices() d3d.setState( RS.FVF, FVF.XYZRHW | FVF.DIFFUSE ) d3d.drawVertices( TYPE.TRIANGLELIST, self.vbuffer ) def mainloop(): #Create a windowed device. This sample does not #support real fullscreen mode, see the other samples #and d3dx.Frame if you want fullscreen. window = ( 200, 200, 800, 600 ) title = u"D3D Tutorial 1: CreateDevice" d3d.createDevice( title, u'', window[2], window[3], False, CREATE.HARDWARE | CREATE.NOVSYNC ) vbuffer = d3d.VertexBuffer( FVF.XYZRHW | FVF.DIFFUSE, len( vertices ) ) vbuffer.extend( vertices ) texture = d3d.Texture("textures/tree.dds") d3d.setWindow( *window ) angle = 0 while True: #Handle messages. This very basic sample #only checks for QUIT or escape key being pressed for m in d3d.getMessages(): if m[0] == WM.QUIT: return if m[0] == WM.KEY: if m[1] == 27: # 'Escape key' return #Clear the buffer and begin the scene. d3d.clear( 0x00ff0000 ) # 0xAARRGGBB d3d.beginScene() matrix = array.array("f", ( math.cos(angle), math.sin(angle), 0.0, 0.0, -math.sin(angle), math.cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, )) angle += 0.01 d3d.setState( RS.FVF, FVF.XYZRHW | FVF.DIFFUSE ) d3d.setMatrix(matrix, MATRIX.WORLD) d3d.drawVertices( TYPE.TRIANGLELIST, vbuffer ) d3d.setMatrix(matrix, MATRIX.SPRITE) d3d.drawSprites(texture, [(-50, -50, 0.5, -1, -1, -1, -1, 0x80ffffff)]) #End the scene and present the drawing. d3d.endScene() d3d.present() if __name__ == "__main__": if use_framework: frm = CreateDevice( u'D3D Tutorial 2: Vertices' ) frm.mainloop() else: mainloop() |
From: Heikki S. <ho...@gm...> - 2006-08-01 12:53:34
|
I just uploaded a new version and it should now be available in the SourceForge (with release notes, too). If you have any questions, suggestions or bug reports, feel free to report or post them. -- Heikki Salo |