Castle Game Engine: CastleBackground: Class TBackground

# Class TBackground
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleBackground ## Declaration `type TBackground = class(TObject)` ## Description Background for 3D world. Background defined here has the same features as VRML/X3D Background: skybox - a cube with each face potentially textured (textures may have alpha channel) a ground sphere around this, with color rings for ground colors a sky sphere around this, with color rings for sky colors Engine users should not use this class directly. Instead TCastleSceneManager automatically uses this to render the background defined by TCastleSceneManager.MainScene. ## Hierarchy TObject TBackground ## Overview ### Methods
| `class function NearFarToSkySphereRadius(const zNear, zFar: Single; const Proposed: Single = 0): Single;`
| `constructor Create;`
| `destructor Destroy; override;`
| `procedure Update(const Node: TAbstractBackgroundNode; const SkySphereRadius: Single);`
| `procedure Render(const Wireframe: boolean; const Frustum: TFrustum);`
| `procedure UpdateTransform(const Transform: TMatrix4Single);`
| `procedure FreeResources;`
## Description ### Methods
| `class function NearFarToSkySphereRadius(const zNear, zFar: Single; const Proposed: Single = 0): Single;`
Calculate (or just confirm that Proposed value is still OK) the sky sphere radius that fits nicely in your projection near/far. Background spheres (for sky and ground) are rendered at given radius. And inside these spheres, we have a cube (to apply background textures). Both spheres and cube must fit nicely within your projection near/far to avoid any artifacts. We first check is Proposed a good result value (it satisfies the conditions, with some safety margin). If yes, then we return exactly the Proposed value. Otherwise, we calculate new value as an average in our range. This way, if you already had sky sphere radius calculated (and prepared some OpenGL resources for it), and projection near/far changes very slightly (e.g. because bounding box slightly changed), then you don't have to recreate background — if the old sky sphere radius is still OK, then the old background resources are still OK. Just pass Proposed = 0 (or anything else that is always outside the range) if you don't need this feature.
| `constructor Create;`
| `destructor Destroy; override;`
| `procedure Update(const Node: TAbstractBackgroundNode; const SkySphereRadius: Single);`
| `procedure Render(const Wireframe: boolean; const Frustum: TFrustum);`
| `procedure UpdateTransform(const Transform: TMatrix4Single);`
| `procedure FreeResources;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:08