Hangublic API hangمعلقة في Aspose.3D 1.7.0

Contents Sأوماري

Adds Aspose.ThreeD. nntities. فئة rurustum

يتم إضافة A فئة جديدة rurustum. كانت amamera و ight ight الطبقات الفرعية من فئة Entity. In الإصدار 1.7.0 ، يتم inherهذه الطبقات من rurustum و rurustum من Entity ، حيث يتم استخراج خصائص sition osition ، Up ، ooookAt ، Direction ، ararget ، lane earPlane و FarPlane في rurustum.

أعضاء Extracted من Aspose.ThreeD. nntities. Camera إلى Aspose.ThreeD. nntities. rurustum All يتم استخراج هذه الخصائص إلى الصدأ F:

C#

 Aspose.ThreeD.Utilities.Vector3 Position{ get;set;}

Aspose.ThreeD.Utilities.Vector3 Up{ get;set;}

Aspose.ThreeD.Utilities.Vector3 LookAt{ get;set;}

Aspose.ThreeD.Utilities.Vector3 Direction{ get;set;}

Aspose.ThreeD.Node Target{ get;set;}

double NearPlane{ get;set;}

double FarPlane{ get;set;}

أعضاء Extracted من الفئة Aspose.ThreeD. nntities. ight ight إلى Aspose.ThreeD. nntities. rurustum All يتم استخراج هذه الخصائص إلى الصدأ F:

C#

 Aspose.ThreeD.Node Target{ get;set;}

Aspose.ThreeD.Utilities.Vector3 Direction{ get;set;}

Adds Aspose.ThreeD. فئة مستحضرات التجميل

Convert ملف 3D لتنسيق ملف الصورة

C#

 // load an existing 3D scene

Scene scene = new Scene("test.obj");

// create a camera at (10,10,10) and look at the origin point for rendering, it must be attached to the scene before render

Camera camera = new Camera();

scene.RootNode.CreateChildNode("camera", camera);

camera.ParentNode.Transform.Translation = new Vector3(10, 10, 10);

camera.LookAt = Vector3.Origin;

//Specify the image render option

ImageRenderOptions opt = new ImageRenderOptions();

// set background color

opt.BackgroundColor = Color.AliceBlue;

// specify the path of textures

opt.AssetDirectories.Add(@"assets\textures");

// turn on shadow

opt.EnableShadows = true;

//render the scene in given camera's perspective into specified png file with size 1024x1024

scene.Render(camera, fileName, new Size(1024, 1024), ImageFormat.Png, opt);

أعضاء Added إلى الفئة Aspose.ThreeD.

C#

 public void Render(Aspose.ThreeD.Entities.Camera camera, string fileName, System.Drawing.Size size, System.Drawing.Imaging.ImageFormat format)

public void Render(Aspose.ThreeD.Entities.Camera camera, string fileName, System.Drawing.Size size, System.Drawing.Imaging.ImageFormat format, Aspose.ThreeD.ImageRenderOptions options)

public void Render(Aspose.ThreeD.Entities.Camera camera, System.Drawing.Bitmap bitmap)

public void Render(Aspose.ThreeD.Entities.Camera camera, System.Drawing.Bitmap bitmap, Aspose.ThreeD.ImageRenderOptions options)

Adds MoveFطريقة orward في Aspose.ThreeD. nntities. Camera الفئة

It يتحرك إلى الأمام الكاميرا نحو اتجاهها. يتم تحديد اتجاه الكاميرا A من قبل أي من ararget/Direction/ooookAt

  • **Target:**A الهدف عقدة في الفضاء ، فإن الكاميرا ننظر دائما إلى هذا الهدف مهما كان الهدف/الكاميرا قد غيرت موقعها في الفضاء.
  • **LookAt:**A موقف ثابت في الفضاء ، فإن الكاميرا ننظر دائما في هذا الموقف.
  • **Direction:**A اتجاه ناقلات ، يتم تحديد اتجاه الكاميرا مباشرة من قبل هذا ناقلات مهما كان موقفها.

Method Signature:

C#

 public void MoveForward(double distance)

أعضاء في Aspose.ThreeD. nntities. class eometry الفئة

يمكن formats تنسيقات ملفات ome تخزين إعدادات الظل ذات الصلة في الهندسة مثل FBX ، كما أنها تستخدم في تقديم. على سبيل المثال هذا الرمز ، ظلال الصندوق الأحمر وتوروس يلقي إلى الطائرة ، فإن الصندوق الأحمر لن تتلقى الظلال و صندوق أزرق لن يلقي الظلال.

C#

 Scene scene = new Scene();

Camera camera = new Camera();

camera.NearPlane = 0.1;

scene.RootNode.CreateChildNode("camera", camera);

Light light;

scene.RootNode.CreateChildNode("light", light = new Light()

{

    NearPlane = 0.1,

    CastShadows =  true,

    Color = new Vector3(Color.White)

}).Transform.Translation = new Vector3(9.4785, 5, 3.18);

light.LookAt = Vector3.Origin;

light.Falloff = 90;

//Create a plane

Node plane = scene.RootNode.CreateChildNode("plane", new Plane(20, 20));

plane.Material = new PhongMaterial() {DiffuseColor = new Vector3(Color.DarkOrange)};

plane.Transform.Translation = new Vector3(0, 0, 0);

//Create a torus for casting shadows

Mesh m = (new Torus("", 1, 0.4, 20, 20, Math.PI*2)).ToMesh();

Node torus = scene.RootNode.CreateChildNode("torus", m);

torus.Material = new PhongMaterial() {DiffuseColor = new Vector3(Color.Cornsilk)};

torus.Transform.Translation = new Vector3(2, 1, 1);

{//Create a blue box don't cast shadows

    m = (new Box()).ToMesh();

    m.CastShadows = false;

    Node box = scene.RootNode.CreateChildNode("box", m);

    box.Material = new PhongMaterial() {DiffuseColor = new Vector3(Color.Blue)};

    box.Transform.Translation = new Vector3(2, 1, -1);

}

{// Create a red box that don't receive shadow but cast shadows

    m = (new Box()).ToMesh();

    m.ReceiveShadows = false;

    Node box = scene.RootNode.CreateChildNode("box", m);

    box.Material = new PhongMaterial() {DiffuseColor = new Vector3(Color.Red)};

    box.Transform.Translation = new Vector3(-2, 1, 1);

}

camera.ParentNode.Transform.Translation = new Vector3(10, 10, 10);

camera.LookAt = Vector3.Origin;

ImageRenderOptions opt = new ImageRenderOptions() {EnableShadows = true};

scene.Render(camera, "pic.png", new Size(1024, 1024), ImageFormat.Png, opt);

Adds enerenerateNطريقة أورمال في Aspose.ThreeD. nntities.

It يسمح للمطورين لتوليد البيانات العادية من Mesh على سبيل المثال ، إذا تم تعريف عنصر mooertexEleالقابل moomoothingGroup على الشبكة ، فإن البيانات العادية التي تم إنشاؤها سوف تحصل على تمهيد من قبل erertexEleالقابل moomoothingGroup.

Method Signature:

C#

 public static Aspose.ThreeD.Entities.VertexElementNormal GenerateNormal(Aspose.ThreeD.Entities.Mesh mesh)

Sوافرة oode:

C#

 //Load a 3ds file, 3ds file doesn't have normal data, but it has smoothing group

Scene s = new Scene("test.3ds");

//Visit all nodes and create normal data for all meshes

s.RootNode.Accept(delegate(Node n)

{

    Mesh mesh = n.GetEntity<Mesh>();

    if (mesh != null)

    {

        VertexElementNormal normals = PolygonModifier.GenerateNormal(mesh);

        mesh.VertexElements.Add(normals);

    }

    return true;

});

طريقة ondds ononcate في Aspose.ThreeD.

It يسمح للمطورين لربط اثنين من التحول دوران إلى واحد ممثلة في Quaternion.

Method Signature:

C#

 public Aspose.ThreeD.Utilities.Quaternion Concate(Aspose.ThreeD.Utilities.Quaternion rhs)

Sوافرة oode:

C#

 Scene scene = new Scene();

Quaternion q1 = Quaternion.FromEulerAngle(Math.PI * 0.5, 0, 0);

Quaternion q2 = Quaternion.FromAngleAxis(- Math.PI * 0.5, Vector3.XAxis);

//concatenate q1 and q2. q1 and q2 rotate alone x-axis with same angle but different direction, so the concatenated result will be identity quaternion.

Quaternion q3 = q1.Concate(q2);

//Create 3 cylinders to represent each quaternion

Node cylinder = scene.RootNode.CreateChildNode("cylinder-q1", new Cylinder(0.1, 1, 2));

cylinder.Transform.Rotation = q1;

cylinder.Transform.Translation = new Vector3(-5, 2, 0);

cylinder = scene.RootNode.CreateChildNode("cylinder-q2", new Cylinder(0.1, 1, 2));

cylinder.Transform.Rotation = q2;

cylinder.Transform.Translation = new Vector3(0, 2, 0);

cylinder = scene.RootNode.CreateChildNode("cylinder-q3", new Cylinder(0.1, 1, 2));

cylinder.Transform.Rotation = q3;

cylinder.Transform.Translation = new Vector3(5, 2, 0);

//Save to file

scene.Save("test.fbx", FileFormat.FBX7400ASCII);