Extension to DotScene format for binding to viewports in XML

What it says on the tin: a place to discuss proposed new features.
Post Reply
Kodachi_Garou
Kobold
Posts: 34
Joined: Wed Jul 05, 2006 6:07 pm

Extension to DotScene format for binding to viewports in XML

Post by Kodachi_Garou »

Hi all,

I've been using DotScene for a while now and have been quite successful in producing data-driven applications using it via the exporters.

However, there are some useful features which have been missing from DotScene and Ogre is more than ready to implement them.

Namely they relate to RenderTargets declaration and Viewport binding. Often I have to create these and bind their viewports to existing cameras in code, but you could easily do it directly from the XML.

Seeing that this was missing, I extended the DotScene DTD to support it for our data-driven framework, and I thought of contributing the extension to the community, if anyone finds it interesting. It doesn't break any of the existing specification, as it is independent of existing definition.

Here is the extension:

Code: Select all

<!ELEMENT renderTargets (renderWindow*, renderTexture*, multiRenderTarget*)>

<!ELEMENT renderWindow (miscParams?)>
<!ATTLIST renderWindow
	name		  CDATA #REQUIRED
	width		 CDATA #REQUIRED
	height		CDATA #REQUIRED
	fullscreen	(true | false) "false"
>

<!ELEMENT renderTexture (miscParams?)>
<!ATTLIST renderTexture
	name		  CDATA #REQUIRED
	width		 CDATA #REQUIRED
	height		CDATA #REQUIRED
	textureType (1d | 2d | 3d | cubeMap) "2d"
	pixelFormat (unknown | L8 | byteL | shortL | L16 | byteA | A8 | A4L4 | byteLA | R5G6B5 |
				 B5G6R5 | A4R4G4B4 | A1R5G5B5 | byteBGR | R8G8B8 | B8G8R8 | byteRGB | byteBGRA |
				 A8R8G8B8 | byteRGBA | A8B8G8R8 | B8G8R8A8 | A2R10G10B10 | A2B10G10R10 | dxt1 |
				 dxt2 | dxt3 | dxt4 | dxt5 | float16RGB | float16RGBA | float32RGB | float32RGBA |
				 X8R8G8B8 | X8B8G8R8 | R8G8B8A8 | depth | shortRGBA | R3G3B2 | float16R | float32R |
				 shortGR | float16GR | float32GR | shortRGB)
				 "X8R8G8B8"
>

<!ELEMENT miscParams (param*)>

<!ELEMENT multiRenderTarget (renderTargetAttachment*)>
<!ATTLIST multiRenderTarget
	name	CDATA #REQUIRED
>

<!ELEMENT renderTargetAttachment (renderTexture)>
<!ATTLIST renderTargetAttachment
	attachment	CDATA #REQUIRED
>

<!ELEMENT param EMPTY>
<!ATTLIST param
	key    CDATA #REQUIRED
	value  CDATA #REQUIRED
>

<!ELEMENT viewports (viewport*)>

<!ELEMENT viewport (colourBackground?)>
<!ATTLIST viewport
	renderTargetName	CDATA #REQUIRED
	cameraName			CDATA #REQUIRED
	zOrder				 CDATA #DEFAULT "0"
	left				   CDATA #DEFAULT "0"
	top					 CDATA #DEFAULT "0"
	width				  CDATA #DEFAULT "1"
	height				 CDATA #DEFAULT "1"
>
Also, if you want to include this in the scene description, it's possible to add this to the "scene" node DTD:

Code: Select all

<!ELEMENT scene (nodes?, externals?, environment?, renderTargets?, viewports? terrain?, userDataReference?, octree?, light?, camera?)>
Suggestions and feedback are of course appreciated. Some features could be added, for instance, a parameter to indicate that automatic computation of aspect ratio should be done for some viewports, but I left them out at this stage for maximum generality and simplicity.

Best regards,

Gonçalo
Post Reply