Light — Aspose.3D FOSS for .NET
Espai de noms: Aspose.ThreeD.Entities
Methods
Methods Light la classe representa una font de llum adjunta a un node d’escena. extends Entity i admet quatre tipus de llum: direccional, puntual, spot i ambient. Una llum es col·loca a l’escena creant un node fill i adjuntant el Light entitat a aquest.
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() | Crea una llum puntual amb nom per defecte "Light", color blanc, intensitat 1.0, abast 1.0 |
Light(LightType type) | Crea una llum del tipus indicat amb nom per defecte "Light" |
Light(LightType type, string name) | Crea una llum amb nom del tipus indicat |
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Type | LightType | obté | El tipus de llum (POINT, SPOT, DIRECTIONAL o AMBIENT). S’estableix en la construcció; només de lectura després. |
Color | Vector3 | obtenir/establir | Color RGB de la llum. Per defecte: Vector3.One (blanc) |
Intensity | float | obtenir/establir | Multiplicador de brillantor. Per defecte: 1.0 |
Range | float | obtenir/establir | Distància màxima d’influència per a llums puntuals i de focus. Per defecte: 1.0 |
Methods
| Methods | Tipus de retorn | Methods |
|---|---|---|
GetBoundingBox() | BoundingBox | Retorna una caixa delimitadora buida (les llums no tenen extensió geomètrica) |
LightType
LightType és una classe de tipus valor amb quatre instàncies públiques estàtiques:
| Methods | Methods |
|---|---|
LightType.POINT | Emet llum de manera uniforme en totes les direccions des d’un punt en l’espai |
LightType.SPOT | Emmet un con de llum en la direcció cap a la qual el node està orientat |
LightType.DIRECTIONAL | Emmet raigs de llum paral·lels com si provenissin d’una font infinita i molt llunyana |
LightType.AMBIENT | Afegeix una il·luminació ambient uniforme; l’abast i la direcció no s’utilitzen |
LightType té una propietat:
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Name | string | get | El nom per mostrar del tipus de llum ("Point", "Spot", "Directional", "Ambient") |
Methods
Afegeix una llum direccional i una llum puntual a una escena i desa a 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");