Light
Namespace: Aspose.ThreeD.Entities
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
using Aspose.ThreeD.Utilities;
var scene = new Scene();
// Add a point light to the scene
var light = new Light(LightType.POINT, "SunLight");
light.Color = new Vector3(1.0f, 0.95f, 0.8f);
light.Intensity = 2.0f;
light.Range = 10.0f;
scene.RootNode.CreateChildNode("sun", light);| ———————————— | ———————————————————————————————— |
| Light() | Kreira point svetlo sa podrazumevanim imenom "Light", bela boja, intenzitet 1.0, domet 1.0 |
| Light(LightType type) | Kreira svetlo datog tipa sa podrazumevanim imenom "Light" |
| Light(LightType type, string name) | Kreira imenovano svetlo datog tipa |
| ————————- | ————————- | ————————- | ————————————————————————————————————– |
| Type | LightType | get | Tip svetla (POINT, SPOT, DIRECTIONAL, ili AMBIENT). Postavlja se pri konstrukciji; samo za čitanje nakon toga. |
| Color | Vector3 | get/set | RGB boja svetla. Podrazumevano: Vector3.One (bela) |
| Intensity | float | get/set | Množitelj osvetljenja. Podrazumevano: 1.0 |
| Range | float | get/set | Maksimalna udaljenost uticaja za tačkaste i spot svetla. Podrazumevano: 1.0 |
| ————————- | ———————- | ———————————————————————— |
| GetBoundingBox() | BoundingBox | Vraća praznu ograničavajuću kutiju (svetla nemaju geometrijsku veličinu) |
LightType
LightType je klasa tipa vrednosti sa četiri javna statička instance:
| ————————- | ————————————————————————— |
| LightType.POINT | Emituje svetlo jednako u svim pravcima iz tačke u prostoru |
| LightType.SPOT | Emituje konus svetla u pravcu u kojem je čvor okrenut |
| LightType.DIRECTIONAL | Emituje paralelne zrake svetla kao da dolaze iz beskonačno udaljenog izvora |
| LightType.AMBIENT | Dodaje uniformno ambijentalno osvetljenje; domet i smer se ne koriste |
LightType ima jednu osobinu:
| ————————- | ————————- | ————————- | ——————————————————————————- |
| Name | string | dobij | Prikazani naziv tipa svetla ("Point", "Spot", "Directional", "Ambient") |
Dodajte usmerenu i tačkastu svetlost u scenu i sačuvajte u FBX:
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
using Aspose.ThreeD.Utilities;
var scene = new Scene();
// Directional light — positioned and oriented via the node Transform
var dirLight = new Light(LightType.DIRECTIONAL, "Sun");
dirLight.Color = new Vector3(1.0f, 1.0f, 0.9f);
dirLight.Intensity = 1.5f;
scene.RootNode.CreateChildNode("dirLight", dirLight);
// Point light with limited range
var pointLight = new Light(LightType.POINT, "Lamp");
pointLight.Color = new Vector3(1.0f, 0.6f, 0.3f);
pointLight.Intensity = 3.0f;
pointLight.Range = 5.0f;
scene.RootNode.CreateChildNode("lamp", pointLight);
scene.Save("lit_scene.fbx");