Light — Aspose.3D FOSS for .NET
Espacio de nombres: Aspose.ThreeD.Entities
Methods
Methods Light la clase representa una fuente de luz adjunta a un nodo de escena. Extiende Entity y admite cuatro tipos de luz: direccional, puntual, foco y ambiental. Una luz se coloca en la escena creando un nodo hijo y adjuntando el Light entidad a él.
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 luz puntual con nombre predeterminado "Light", color blanco, intensidad 1.0, alcance 1.0 |
Light(LightType type) | Crea una luz del tipo especificado con nombre predeterminado "Light" |
Light(LightType type, string name) | Crea una luz con nombre del tipo especificado |
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Type | LightType | obtener | El tipo de luz (POINT, SPOT, DIRECTIONAL o AMBIENT). Se establece en la construcción; solo lectura después. |
Color | Vector3 | get/set | Color RGB de la luz. Predeterminado: Vector3.One (blanco) |
Intensity | float | get/set | Multiplicador de brillo. Predeterminado: 1.0 |
Range | float | get/set | Distancia máxima de influencia para luces puntuales y de foco. Predeterminado: 1.0 |
Methods
| Methods | Tipo de retorno | Methods |
|---|---|---|
GetBoundingBox() | BoundingBox | Devuelve un cuadro delimitador vacío (las luces no tienen extensión geométrica) |
LightType
LightType es una clase de tipo valor con cuatro instancias estáticas públicas:
| Methods | Methods |
|---|---|
LightType.POINT | Emite luz uniformemente en todas las direcciones desde un punto en el espacio |
LightType.SPOT | Emite un cono de luz en la dirección a la que está orientado el nodo |
LightType.DIRECTIONAL | Emite rayos de luz paralelos como si provinieran de una fuente infinitamente distante |
LightType.AMBIENT | Añade iluminación ambiental uniforme; el rango y la dirección no se utilizan |
LightType tiene una propiedad:
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Name | string | get | El nombre para mostrar del tipo de luz ("Point", "Spot", "Directional", "Ambient") |
Methods
Añade una luz direccional y una luz puntual a una escena y guárdala en 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");