Page 3 of 4

Posted: Mon Jan 10, 2011 10:41 pm
by devsh
Today i've overcome a major hurdle. Python docs dont say how to allocate and returna new custom object i.e. IXMLReader.... The functions are caled but they dont quite work because of the beyond repair python unicode. However i am implementing the utf-8 reader tomorrow in whole and then getting back onto this.

Posted: Tue Jan 11, 2011 9:18 am
by serengeor
devsh wrote:Today i've overcome a major hurdle. Python docs dont say how to allocate and returna new custom object i.e. IXMLReader.... The functions are caled but they dont quite work because of the beyond repair python unicode. However i am implementing the utf-8 reader tomorrow in whole and then getting back onto this.
Try to have a look on how pyBindGen does it. Its entirely written in python so it is very easy to install and use. It can create wrappers for functions, classes, structures, moreover the code that pyBindGen creates is clean and clear :)

http://code.google.com/p/pybindgen/
Theres also online documentation.

I had successfully wrapped a few classes using it, so I think you should give it a try.

Posted: Tue Jan 11, 2011 3:28 pm
by macron12388
Note to devsh: I was having some issues with the Python unicode when building your engine on the Windows platform, I got it to compile, but it was a bit of a dirty fix. I'll try and see what I can do to clean that up today.

Posted: Tue Jan 11, 2011 5:20 pm
by devsh
Yeh gently caress the python Unicode... gotta convert it anyways

Posted: Tue Jan 11, 2011 6:27 pm
by macron12388
Alright, cool, not to sound like I'm pressuring you or something,just curious but when will that be done?

Posted: Tue Jan 11, 2011 7:25 pm
by devsh
umm done... right now comitting the SVN... why are you not on msn?

Posted: Tue Jan 11, 2011 9:28 pm
by roelor
devsh wrote:Right looking for someone relatively new who might want to get more familiar with irrlicht and developing frameworks.
If I'd only had the time :cry:

A thing I can do is to cheer you on!
Good luck on your (not so) little project :)

Posted: Tue Jan 11, 2011 10:13 pm
by devsh
yeah we met our outline of 10 revisions a day from both of us joined. WE fixed all issues (except windows binary of the first demo - hehe), the lib compiles in windows, the XMLReader works in python with (now) correct enums. I implemented the rest of the functions and the XMLReader type is complete both UTF32 and UTF8 types!

This is what we can execute so far

Code: Select all

import irrlicht
import io
import irrFileSystem
import irrVideoDriver
import video
import irrSceneManager
import irrGUIEnvironment


print "This is a python script initializing the editor.\n"

Caption = u"Blooddrunk Game Editor"
irrlicht.setWindowCaption(Caption)
irrFileSystem.addFolderFileArchive("../editorData/")

irrVideoDriver.setTextureCreationFlag(video.ETCF_ALWAYS_32_BIT, 1)

irrSceneManager.setAmbientLight(0.3,0.3,0.3);

xml = irrFileSystem.createXMLReader("config.xml")
MessageText = Caption
StartUpModelFile = u""

a = 0
while xml.read():
	nodeType = xml.getNodeType()
	if nodeType==io.EXN_TEXT:
		print xml.getNodeData()
		print nodeType
		MessageText = xml.getNodeData()
	elif nodeType==io.EXN_ELEMENT:
		nodeName = xml.getNodeName()
		if "startUpModel"==nodeName:
			StartUpModelFile = xml.getAttributeValue(u"file")
		elif "messageText"==nodeName:
			Caption = xml.getAttributeValue(u"caption")

xml.drop() # don't forget to delete the xml reader

irrGUIEnvironment.addMessageBox(Caption,MessageText)

skin = irrGUIEnvironment.getSkin();
font = irrGUIEnvironment.getFont("fonthaettenschweiler.bmp");
skin.setFont(font);

print "End of Initialization. \n"
We will be rewriting all irrlicht's examples to help us with the direction of python interpreter's development, of course all blooddrunk functions will be exposed by the end of this week :)

This is a draft for Irrlicht PoC 01.Hello World

Code: Select all

import BSettingsManager
import core
import BEngine
import irrlicht
import irrGUIEnvironment
import irrSceneManager
import irrVideoDriver
import BPythonInterpreter
import bdrunk
import BRenderer

def renderFN():
	BRenderer.render()

settings = BSettingsManager.getSettings()
if (settings.resolution.X!=640)||(settings.resolution.Y!=480):
	print "Bad Resolution Restarting..."
	settings.resolution = core.dimension2d(640,480)
	BSettingsManager.setSettings(settings)
	BSettingsManager.save()
	BEngine.restart()

irrlicht.setWindowCaption(u"Hello World! - Irrlicht Engine Demo")


irrGUIEnvironment.addStaticText(u"Hello World! This is the Irrlicht Software renderer!",rect(10,10,260,22), 1)



mesh = irrSceneManager.getMesh("../../media/sydney.md2")

if mesh.isNull():

	BEngine.Quit()

node = irrSceneManager.addAnimatedMeshSceneNode( mesh );



if !node.isNull():

	node.setMaterialFlag(EMF_LIGHTING, 0)

	node.setMD2Animation(EMAT_STAND)

	node.setMaterialTexture( 0, irrVideoDriver.getTexture("../../media/sydney.bmp") )





irrSceneManager.addCameraSceneNode(0, core.vector3df(0,30,-40), core.vector3df(0,5,0))



BPythonInterpreter.registerFunction(bdrunk.EPIRF_START_OF_FRAME,renderFN)
#BPythonInterpreter.registerModuleFunction(bdrunk.EPIRF_START_OF_FRAME,"renderFN","./path/to/module.py")

#Got to kickstart the engine into the first frame (then it calls the "renderFN" function repeateadly)
BRenderer.render()

Posted: Wed Jan 12, 2011 1:41 am
by sudi
if i understand that snippet correctly. You are calling a registered script function from c++ to call a c++ function every frame? that sounds like a big slow down. try to avoid calling scripts over and over it is not really needed.

Posted: Wed Jan 12, 2011 5:53 pm
by devsh
Yeh I just want to proove its doable in python, the engine demos will keep python in the game loop to a minimum

EDIT: Implemented 40% of all irr::gui enumerations

EDIT2: Implemented a stub of the IGUISkin interface... cannot implement all because it depends on classes&&structs like SColor

Posted: Thu Jan 13, 2011 6:54 pm
by devsh
We figured out how to do inheritance :)

Posted: Fri Jan 14, 2011 2:45 pm
by devsh
Finishing the first demo, starting the 2nd one which will demonstrate hardware skinning and billboards.

Posted: Sat Jan 22, 2011 5:54 pm
by devsh
@Macron: Any chance of you resurfacing?

EDIT: Implemented SettingsManager as a python object (I now need to implement dimension2du and getSettings), I implemented the entire core:: namespace except for typedefs and most classes. Implementing the 2d vectors has a knockon effect(I only need to add operator support) which enables me to easily implement 3d vectors, core::recti, and some more IAttribute functions and review IAttributeWriteFlags and the IAttributeExchangingObject inheritance. I am to finish implmenting ALL classes in the core:: namespace before the end of the month.

Posted: Mon Jan 24, 2011 11:07 pm
by devsh
nearing the release of the first demo (just more monotonous python coding)... also I am doing Irrlicht PoCs (to proove every example is doable in pure python) but...

I am doing XEffects PoCs in Blooddrunk, demonstrating that it can render the exact same scenes in deferred faster than XEffects. Obviously I will make a second set of demos that show what Blooddrunk can do with the spare fps... (instead of 1 point light, 2) or (3 spotlights with shadows + 29 no shadow lights)/(GI instead of SSAO)

Posted: Tue Jan 25, 2011 6:51 am
by Luben
devsh wrote:GI instead of SSAO
SSAO is a global illumination technique.