Light — Aspose.3D FOSS for .NET
Namespace: Aspose.ThreeD.Entities
Methods
Methods Light A classe representa uma fonte de luz anexada a um nó de cena. Ela estende Entity e suporta quatro tipos de luz: directional, point, spot e ambient. Uma luz é posicionada na cena criando um nó filho e anexando o Light entidade a ele.
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() | Cria um point light com nome padrão "Light", cor branca, intensidade 1.0, alcance 1.0 |
Light(LightType type) | Cria um light do tipo fornecido com nome padrão "Light" |
Light(LightType type, string name) | Cria um light nomeado do tipo especificado |
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Type | LightType | obter | O tipo de luz (POINT, SPOT, DIRECTIONAL ou AMBIENT). Definido na construção; somente leitura depois. |
Color | Vector3 | obter/definir | Cor RGB da luz. Padrão: Vector3.One (branco) |
Intensity | float | obter/definir | Multiplicador de brilho. Padrão: 1.0 |
Range | float | obter/definir | Distância máxima de influência para luzes pontuais e de foco. Padrão: 1.0 |
Methods
| Methods | Tipo de retorno | Methods |
|---|---|---|
GetBoundingBox() | BoundingBox | Retorna uma caixa delimitadora vazia (as luzes não têm extensão geométrica) |
LightType
LightType é uma classe de tipo-valor com quatro instâncias estáticas públicas:
| Methods | Methods |
|---|---|
LightType.POINT | Emite luz igualmente em todas as direções a partir de um ponto no espaço |
LightType.SPOT | Emite um cone de luz na direção que o nó está voltado |
LightType.DIRECTIONAL | Emite raios de luz paralelos como se fossem de uma fonte infinitamente distante |
LightType.AMBIENT | Adiciona iluminação ambiente uniforme; alcance e direção não são usados |
LightType possui uma propriedade:
| Methods | Methods | Methods | Methods |
|---|---|---|---|
Name | string | get | O nome exibido do tipo de luz ("Point", "Spot", "Directional", "Ambient") |
Methods
Adicione uma luz direcional e uma luz pontual a uma cena e salve em 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");