Light — Aspose.3D FOSS for .NET
Nimiavaruus: Aspose.ThreeD.Entities
Methods
Methods Light luokka edustaa valonlähdettä, joka on liitetty kohtaus-solmuun. Se laajentaa Entity ja tukee neljää valotyyppiä: suuntainen, piste, spotti ja ympäristö. Valo sijoitetaan kohtaukseen luomalla lapsisolmu ja liittämällä Light entity siihen.
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);Methods
| Methods | Methods |
|---|---|
Light() | Luo pistevalo oletusnimellä "Light", valkoinen väri, intensiteetti 1.0, kantama 1.0 |
Light(LightType type) | Luo valon annetulla tyypillä oletusnimellä "Light" |
Light(LightType type, string name) | Luo nimetty valo annetulla tyypillä |
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Type | LightType | hae | Valon tyyppi (POINT, SPOT, DIRECTIONAL tai AMBIENT). Asetetaan konstruktorissa; luettavissa vain sen jälkeen. |
Color | Vector3 | hae/aseta | Valon RGB-väri. Oletus: Vector3.One (valkoinen) |
Intensity | float | hae/aseta | Kirkkauskerroin. Oletus: 1.0 |
Range | float | get/set | Piste- ja spottivalojen enimmäisvaikutusetäisyys. Oletus: 1.0 |
Methods
| Methods | Paluutyyppi | Methods |
|---|---|---|
GetBoundingBox() | BoundingBox | Palauttaa tyhjän raja‑laatikon (valot eivät ole geometrisesti laajentuneita) |
LightType
LightType on arvotyypin luokka, jossa on neljä julkista staattista instanssia:
| Methods | Methods |
|---|---|
LightType.POINT | Lähettää valoa tasaisesti kaikissa suunnissa pisteestä avaruudessa |
LightType.SPOT | Lähettää valokartion solmun katselusuuntaan |
LightType.DIRECTIONAL | Lähettää rinnakkaisia valonsäteitä ikään kuin äärettömän kaukaisesta lähteestä |
LightType.AMBIENT | Lisää tasaisen ympäröivän valaistuksen; etäisyyttä ja suuntaa ei käytetä |
LightType sisältää yhden ominaisuuden:
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Name | string | get | Valon tyypin näytettävä nimi ("Point", "Spot", "Directional", "Ambient") |
Methods
Lisää kohtaukseen directional- ja point-valot ja tallenna FBX-muotoon:
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");