This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
创建内容
内容优化
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Primitives Class

Header: #include <UniginePrimitives.h>

This class contains methods enabling you to create geometry primitives - dynamic meshes of the predefined forms, or add surfaces of the predefined forms to already existing dynamic meshes.

Usage Example#

Here is a small example demonstrating how to create a capsule primitive and add a box surface to it:

Source code (C++)
#include <UnigineObjects.h>
#include <UniginePrimitives.h>
// ...

// Creating a capsule-shape primitive with the specified parameters
ObjectMeshDynamicPtr MyPrimitive = Primitives::createCapsule(0.5f, 3, 16, 32);

// Adding a box-shape surface to the created capsule
Primitives::addBoxSurface(MyPrimitive, vec3(2.0f), mat4_identity);

Primitives Class

Members


Ptr<ObjectMeshDynamic> createBox ( const Math::vec3 & size ) #

Creates a dynamic mesh in a form of a box.

Arguments

  • const Math::vec3 & size - Box size along the X, Y and Z axes.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createCapsule ( float radius, float height, int stacks = 16, int slices = 32 ) #

Creates a dynamic mesh in a form of a capsule.

Arguments

  • float radius - Capsule radius.
  • float height - Capsule height.
  • int stacks - Number of stacks that divide the capsule radially.
  • int slices - Number of slices that divide the capsule horizontally.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createCylinder ( float radius, float height, int stacks = 1, int slices = 32 ) #

Creates a dynamic mesh in a form of a cylinder.

Arguments

  • float radius - Cylinder radius.
  • float height - Cylinder height.
  • int stacks - Number of stacks that divide the cylinder radially.
  • int slices - Number of slices that divide the cylinder horizontally.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createDodecahedron ( float radius ) #

Creates a dynamic mesh in a form of a dodecahedron.

Arguments

  • float radius - Dodecahedron radius.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createIcosahedron ( float radius ) #

Creates a dynamic mesh in a form of an icosahedron.

Arguments

  • float radius - Icosahedron radius.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createPlane ( float width, float height, float step ) #

Creates a dynamic mesh in a form of a plane. It is divided into equal squares whose size is defined by the given step.

Arguments

  • float width - Plane width.
  • float height - Plane height.
  • float step - Step of surface subdivision (vertical and horizontal).

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createPrism ( float size_0, float size_1, float height, int sides = 8 ) #

Creates a dynamic mesh in a form of a prism.

Arguments

  • float size_0 - Radius of the circle circumscribed about the top prism base.
  • float size_1 - Radius of the circle circumscribed about the bottom prism base.
  • float height - Height of the prism.
  • int sides - Number of the prism faces.

Return value

ObjectMeshDynamic instance.

Ptr<ObjectMeshDynamic> createSphere ( float radius, int stacks = 16, int slices = 32 ) #

Creates a dynamic mesh in a form of a sphere.

Arguments

  • float radius - Sphere radius.
  • int stacks - Number of stacks that divide the sphere radially.
  • int slices - Number of slices that divide the sphere horizontally.

Return value

ObjectMeshDynamic instance.

void addBoxSurface ( Ptr<ObjectMeshDynamic> & object, const Math::vec3 & size, const Math::mat4 & transform ) #

Appends a box of the specified size to ObjectMeshDynamic.

Arguments

void addCapsuleSurface ( Ptr<ObjectMeshDynamic> & object, float radius, float height, const Math::mat4 & transform, int stacks = 16, int slices = 32 ) #

Appends a capsule of the specified size to ObjectMeshDynamic. The stacks and slices specify the surface's subdivision.

Arguments

  • Ptr<ObjectMeshDynamic> & object - ObjectMeshDynamic instance.
  • float radius - Capsule radius.
  • float height - Capsule height along the central axis.
  • const Math::mat4 & transform - Capsule transformation matrix.
  • int stacks - Number of stacks that divide the capsule radially.
  • int slices - Number of slices that divide the capsule horizontally.

void addCylinderSurface ( Ptr<ObjectMeshDynamic> & object, float radius, float height, const Math::mat4 & transform, int stacks = 1, int slices = 32 ) #

Appends a cylinder of the specified size to ObjectMeshDynamic. The stacks and slices specify the surface's subdivision.

Arguments

  • Ptr<ObjectMeshDynamic> & object - ObjectMeshDynamic instance.
  • float radius - Cylinder radius.
  • float height - Cylinder height.
  • const Math::mat4 & transform - Cylinder transformation matrix.
  • int stacks - Number of stacks that divide the cylinder radially.
  • int slices - Number of slices that divide the cylinder horizontally.

void addDodecahedronSurface ( Ptr<ObjectMeshDynamic> & object, float radius, const Math::mat4 & transform ) #

Appends a dodecahedron (a polyhedron with twelve flat faces) of the specified size to ObjectMeshDynamic.

Arguments

void addIcosahedronSurface ( Ptr<ObjectMeshDynamic> & object, float radius, const Math::mat4 & transform ) #

Appends a icosahedron (a polyhedron with twenty flat faces) of the specified size to ObjectMeshDynamic.

Arguments

void addPlaneSurface ( Ptr<ObjectMeshDynamic> & object, float width, float height, float step, const Math::mat4 & transform ) #

Appends a plane surface to the dynamic mesh. The plane is divided into equal squares, size of which is defined by the given step.

Arguments

  • Ptr<ObjectMeshDynamic> & object - ObjectMeshDynamic instance.
  • float width - Width of the plane.
  • float height - Height of the plane.
  • float step - Step of surface subdivision (vertical and horizontal).
  • const Math::mat4 & transform - Plane transformation matrix.

void addPrismSurface ( Ptr<ObjectMeshDynamic> & object, float size_0, float size_1, float height, const Math::mat4 & transform, int sides = 8 ) #

Appends a prism to the dynamic mesh.

Arguments

  • Ptr<ObjectMeshDynamic> & object - ObjectMeshDynamic instance.
  • float size_0 - Radius of the circle circumscribed about the top prism base.
  • float size_1 - Radius of the circle circumscribed about the bottom prism base.
  • float height - Dimension of the prism's central axis.
  • const Math::mat4 & transform - Prism transformation matrix.
  • int sides - Number of the prism faces.

void addSphereSurface ( Ptr<ObjectMeshDynamic> & object, float radius, const Math::mat4 & transform, int stacks = 16, int slices = 32 ) #

Appends a sphere surface to the dynamic mesh. The stacks and slices specify the surface's subdivision.

Arguments

  • Ptr<ObjectMeshDynamic> & object - ObjectMeshDynamic instance.
  • float radius - Sphere radius.
  • const Math::mat4 & transform - Transformation matrix.
  • int stacks - Number of stacks that divide the sphere radially.
  • int slices - Number of slices that divide the sphere horizontally.
Last update: 2022-12-14
Build: ()