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
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
(1) |
19
|
20
|
21
|
22
|
23
|
24
(1) |
25
|
26
|
27
(1) |
28
|
29
|
30
(1) |
|
|
|
|
|
|
From: Heikki S. <ho...@gm...> - 2008-11-30 15:53:08
|
2008/11/27 Aleksandar Kordic <ale...@gm...>: > Hi, > > My project is simple simulation of robot movement on rectangular > board. I used Frame from d3dx and StaticMesh from d3d module. So far > only one model is presented in scene. > Problem is that textures from .x file are not shown in scene. Am I > doing something wrong in onRender() method ? > > def onRender(self): > d3d.setView(self.eye, self.lookat, 6000.0, 0.7853) > d3d.setState(RS.LIGHTING, True) > d3d.setState(RS.AMBIENT, 0xffffffff) > d3d.setState(RS.SPECULARENABLE, True) > > d3d.setLight(0, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (0.0, 100.0, > 0.0), (0.3, -1.0, 0.3), 0.4, 0.4) > d3d.setLight(1, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (200.0, > -300.0, 0.0), (0.5, 0.5, 0.1), 0.4, 0.4) > d3d.setState(RS.FILLMODE, RS.FILL.SOLID) > > d3d.setTransform( element.translation, element.rotation, element.scaling ) > d3d.setState(RS.USEMESHMATERIALS, True) > element.mesh.render() #time_passed) - not for static mesh > > d3d.setState(RS.FILLMODE, RS.FILL.SOLID) > self.manager.render(self.elapsedtime) > > Strange thing is that same model opened with 'MeshViewer.py' sample > does not show textures, while DXViewer.exe (from directx sdk) loads > textures properly. > > Textures in .x file are referenced as files > example : > Material Wood_OSB1{ > 0.392156862745098;1.0;0.392156862745098;1.0;; > 3.2; > 0.000000;0.000000;0.000000;; > 0.000000;0.000000;0.000000;; > TextureFilename { "teren.xWood_OSB.jpg"; } > } > > Is it possible that d3d.StaticMesh does not load properly from '.x' > file ? If so how can I contribute to fix this ? > > Best Regards, > Alex > As you noticed, StaticMesh does not load any textures. Internally the mesh object uses basic D3DX-functions and interfaces which don't support it. The more complex interfaces (ID3DXFile etc.) require much more processing which is not usually needed. Actually, it is almost easier to write a simple .x-parser in Python than to create fully supported C++-loader with those interfaces. They are flexible, but also quite complex. It is quite common to use .x-files to only store geometry (etc.) data and use some other file format to store other information. For example a simple text file could specify information about an object, like it's physical abilities textures and approriate .x-files (if it is a composite shape or something). When you need to load an object you just process this file and load all needed resources. -- Heikki Salo |
From: Aleksandar K. <ale...@gm...> - 2008-11-27 18:55:30
|
Hi, My project is simple simulation of robot movement on rectangular board. I used Frame from d3dx and StaticMesh from d3d module. So far only one model is presented in scene. Problem is that textures from .x file are not shown in scene. Am I doing something wrong in onRender() method ? def onRender(self): d3d.setView(self.eye, self.lookat, 6000.0, 0.7853) d3d.setState(RS.LIGHTING, True) d3d.setState(RS.AMBIENT, 0xffffffff) d3d.setState(RS.SPECULARENABLE, True) d3d.setLight(0, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (0.0, 100.0, 0.0), (0.3, -1.0, 0.3), 0.4, 0.4) d3d.setLight(1, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (200.0, -300.0, 0.0), (0.5, 0.5, 0.1), 0.4, 0.4) d3d.setState(RS.FILLMODE, RS.FILL.SOLID) d3d.setTransform( element.translation, element.rotation, element.scaling ) d3d.setState(RS.USEMESHMATERIALS, True) element.mesh.render() #time_passed) - not for static mesh d3d.setState(RS.FILLMODE, RS.FILL.SOLID) self.manager.render(self.elapsedtime) Strange thing is that same model opened with 'MeshViewer.py' sample does not show textures, while DXViewer.exe (from directx sdk) loads textures properly. Textures in .x file are referenced as files example : Material Wood_OSB1{ 0.392156862745098;1.0;0.392156862745098;1.0;; 3.2; 0.000000;0.000000;0.000000;; 0.000000;0.000000;0.000000;; TextureFilename { "teren.xWood_OSB.jpg"; } } Is it possible that d3d.StaticMesh does not load properly from '.x' file ? If so how can I contribute to fix this ? Best Regards, Alex |
From: Heikki S. <ho...@gm...> - 2008-11-24 18:06:46
|
2008/11/18 Caleb Crome <Cal...@lo...>: > Hello, > I'm working on an application that uses a logitech force feedback steering > wheel. I'm totally new to directpython, so sorry if this is a silly > question. > I was able to get information from the wheel, but I don't see any function > calls to set Force Feedback parameters from the GameController object. > My code so far is simple enough (below). How do I set forces and springs? > Thanks so much, > -Caleb > > #!/c/Python25/python25.exe > import d3d > import d3dx > from d3dc import * > class Turntable(d3dx.Frame): > def onCreate(self): > print "Creating..." > self.joystick = d3dx.GameController(1) > print self.joystick.hasForceFeedback() > return > def onUpdate(self): > pass > frame = Turntable(u"Turntable"); > frame.mainloop() > Unfortunately DirectPython does not support force feedback. Currently you need to interact directly with DirectInput or maybe use some other library to do force feedback. The C/C++-interface is exposed through IDirectInputEffect and .dll's, so it is possible to use it through comtypes, alotough that is not trivial. DirectInput API itself is no longer updated by Microsoft (altough it still works well and is widely supported) so I never really saw much need to add support and testing for it. -- Heikki Salo |
From: Caleb C. <Cal...@lo...> - 2008-11-18 00:17:18
|
Hello, I'm working on an application that uses a logitech force feedback steering wheel. I'm totally new to directpython, so sorry if this is a silly question. I was able to get information from the wheel, but I don't see any function calls to set Force Feedback parameters from the GameController object. My code so far is simple enough (below). How do I set forces and springs? Thanks so much, -Caleb #!/c/Python25/python25.exe import d3d import d3dx from d3dc import * class Turntable(d3dx.Frame): def onCreate(self): print "Creating..." self.joystick = d3dx.GameController(1) print self.joystick.hasForceFeedback() return def onUpdate(self): pass frame = Turntable(u"Turntable"); frame.mainloop() |