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

MethodsMethods
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

MethodsMethodsMethodsMethods
TypeLightTypeobtéEl tipus de llum (POINT, SPOT, DIRECTIONAL o AMBIENT). S’estableix en la construcció; només de lectura després.
ColorVector3obtenir/establirColor RGB de la llum. Per defecte: Vector3.One (blanc)
Intensityfloatobtenir/establirMultiplicador de brillantor. Per defecte: 1.0
Rangefloatobtenir/establirDistància màxima d’influència per a llums puntuals i de focus. Per defecte: 1.0

Methods

MethodsTipus de retornMethods
GetBoundingBox()BoundingBoxRetorna 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:

MethodsMethods
LightType.POINTEmet llum de manera uniforme en totes les direccions des d’un punt en l’espai
LightType.SPOTEmmet un con de llum en la direcció cap a la qual el node està orientat
LightType.DIRECTIONALEmmet raigs de llum paral·lels com si provenissin d’una font infinita i molt llunyana
LightType.AMBIENTAfegeix una il·luminació ambient uniforme; l’abast i la direcció no s’utilitzen

LightType té una propietat:

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

Vegeu també

 Català