Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Scene Structure

macroing edited this page Jul 30, 2017 · 9 revisions

At the moment it's not straightforward to define a scene in OpenRC. This shortcoming will be remedied by a library and its scene structure format. They will both be called OpenSL, which is an acronym for Open Scene Library. The filename extension will be .osl.

The following scene structure format is an early draft, so it may be changed at any point.

Note, however, that the size provided as part of a structure does not refer to how many bytes to read. Instead, it refers to how many times a given data type should be read, where the data type depends on the current structure. Some structures use ints, whereas others use floats.

All data types use Big Endian as endianness, which is the default for Java.

Camera:
	float:		Eye_X								---
	float:		Eye_Y								---
	float:		Eye_Z								---
	float:		Up_X								---
	float:		Up_Y								---
	float:		Up_Z								---
	float:		Look_At_X							---
	float:		Look_At_Y							---
	float:		Look_At_Z							---
	float:		View_Plane_Distance					---
	float:		Zoom								---

Light:
	float:		Type								PointLight=1.0
	float:		Size								Represents the entire Light structure.
	float[]:	Data[Size-2]						---

Material:
	float:		Ambient_Color_R						[0.0, 1.0]
	float:		Ambient_Color_G						[0.0, 1.0]
	float:		Ambient_Color_B						[0.0, 1.0]
	float:		Ambient_Intensity					[0.0, 1.0]
	float:		Diffuse_Color_R						[0.0, 1.0]
	float:		Diffuse_Color_G						[0.0, 1.0]
	float:		Diffuse_Color_B						[0.0, 1.0]
	float:		Diffuse_Intensity					[0.0, 1.0]
	float:		Specular_Color_R					[0.0, 1.0]
	float:		Specular_Color_G					[0.0, 1.0]
	float:		Specular_Color_B					[0.0, 1.0]
	float:		Specular_Intensity					[0.0, 1.0]
	float:		Specular_Power						---
	float:		Reflection							---
	float:		Refraction							---
	float:		Texture_Count						---
	float[]:	Texture_Offsets[Texture_Count]		---

Plane:
	float:		Type								2.0
	float:		Size								6.0
	float:		Material_Offset						---
	float:		Surface_Normal_X					[0.0, 1.0]
	float:		Surface_Normal_Y					[0.0, 1.0]
	float:		Surface_Normal_Z					[0.0, 1.0]

PointLight:
	float:		Type								1.0
	float:		Size								6.0
	float:		Position_X							---
	float:		Position_Y							---
	float:		Position_Z							---
	float:		Distance_Falloff					Not used.

Scene:
	float[]:	Camera[19]							---
	float:		Textures_Length						---
	float[]:	Textures[Textures_Length]			---
	float:		Materials_Length					---
	float[]:	Materials[Materials_Length]			---
	float:		Lights_Length						---
	float[]:	Lights[Lights_Length]				---
	float:		Shapes_Length						---
	float[]:	Shapes[Shapes_Length]				---

Shape:
	float:		Type								Plane=2.0, Sphere=1.0, Triangle=3.0
	float:		Size								Represents the entire Shape structure.
	float:		Material_Offset						---
	float[]:	Data[Size-3]						---

Sphere:
	float:		Type								1.0
	float:		Size								7.0
	float:		Material_Offset						---
	float:		Position_X							---
	float:		Position_Y							---
	float:		Position_Z							---
	float:		Radius								---

Texture:
	int:		Type								Solid=1, Decal=2, NormalMap=3
	int:		Size								Represents the entire Texture structure.
	int:		Width								---
	int:		Height								---
	int[]:		Data[Size-4]						---

Triangle:
	float:		Type								3.0
	float:		Size								15.0
	float:		Material_Offset						---
	float:		A_X									---
	float:		A_Y									---
	float:		A_Z									---
	float:		B_X									---
	float:		B_Y									---
	float:		B_Z									---
	float:		C_X									---
	float:		C_Y									---
	float:		C_Z									---
	float:		Surface_Normal_X					[0.0, 1.0]
	float:		Surface_Normal_Y					[0.0, 1.0]
	float:		Surface_Normal_Z					[0.0, 1.0]
Clone this wiki locally