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

MethodsMethods
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

MethodsMethodsMethodsMethods
TypeLightTypeobtenerEl tipo de luz (POINT, SPOT, DIRECTIONAL o AMBIENT). Se establece en la construcción; solo lectura después.
ColorVector3get/setColor RGB de la luz. Predeterminado: Vector3.One (blanco)
Intensityfloatget/setMultiplicador de brillo. Predeterminado: 1.0
Rangefloatget/setDistancia máxima de influencia para luces puntuales y de foco. Predeterminado: 1.0

Methods

MethodsTipo de retornoMethods
GetBoundingBox()BoundingBoxDevuelve 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:

MethodsMethods
LightType.POINTEmite luz uniformemente en todas las direcciones desde un punto en el espacio
LightType.SPOTEmite un cono de luz en la dirección a la que está orientado el nodo
LightType.DIRECTIONALEmite rayos de luz paralelos como si provinieran de una fuente infinitamente distante
LightType.AMBIENTAñade iluminación ambiental uniforme; el rango y la dirección no se utilizan

LightType tiene una propiedad:

MethodsMethodsMethodsMethods
NamestringgetEl 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");

Ver también

 Español