diff options
author | clayjohn <claynjohn@gmail.com> | 2018-11-18 21:13:09 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2019-07-24 12:14:31 -0700 |
commit | ff7c37927a7eac929e1518915dbeac259f63398f (patch) | |
tree | b4c01ebf454ea009a9610cb763f92da20f599c8c | |
parent | 06a6507751f5899a590a1c67915890550e5a2793 (diff) |
added pointMesh primitive
-rw-r--r-- | doc/classes/PointMesh.xml | 17 | ||||
-rw-r--r-- | editor/icons/icon_point_mesh.svg | 7 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 1 | ||||
-rw-r--r-- | scene/resources/primitive_meshes.cpp | 16 | ||||
-rw-r--r-- | scene/resources/primitive_meshes.h | 15 |
5 files changed, 56 insertions, 0 deletions
diff --git a/doc/classes/PointMesh.xml b/doc/classes/PointMesh.xml new file mode 100644 index 0000000000..dc7dd065cf --- /dev/null +++ b/doc/classes/PointMesh.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="PointMesh" inherits="PrimitiveMesh" category="Core" version="3.2"> + <brief_description> + Mesh with a single Point primitive. + </brief_description> + <description> + The PointMesh is made from a single point. Instead of relying on triangles, points are rendered as a single rectangle on the screen with a constant size. They are intended to be used with Particle systems, but can be used as a cheap way to render constant size billboarded sprites (for example in a point cloud). + PointMeshes, must be used with a material that has a point size. Point size can be accessed in a shader with [code]POINT_SIZE[/code], or in a [SpatialMaterial] by setting [member SpatialMaterial.flags_use_point_size] and the variable [member SpatialMaterial.params_point_size]. + When using PointMeshes, properties that normally alter vertices will be ignored, including billboard mode, grow, and cull face. + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/editor/icons/icon_point_mesh.svg b/editor/icons/icon_point_mesh.svg new file mode 100644 index 0000000000..8da7759daf --- /dev/null +++ b/editor/icons/icon_point_mesh.svg @@ -0,0 +1,7 @@ +<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"> +<g fill="#ffd684" stroke="#000" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" stroke-opacity="0" stroke-width="0"> +<ellipse cx="3.7237" cy="3.0268" rx="2.0114" ry="1.9956"/> +<ellipse cx="11.717" cy="6.1734" rx="2.0114" ry="1.9956"/> +<ellipse cx="6.5219" cy="12.477" rx="2.0114" ry="1.9956"/> +</g> +</svg> diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 2533d91156..245fe3856a 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -607,6 +607,7 @@ void register_scene_types() { ClassDB::register_class<PrismMesh>(); ClassDB::register_class<QuadMesh>(); ClassDB::register_class<SphereMesh>(); + ClassDB::register_class<PointMesh>(); ClassDB::register_virtual_class<Material>(); ClassDB::register_class<SpatialMaterial>(); SceneTree::add_idle_callback(SpatialMaterial::flush_changes); diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 74a493d3b5..24fdaafbe1 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -1572,3 +1572,19 @@ SphereMesh::SphereMesh() { rings = 32; is_hemisphere = false; } + +/** + PointMesh +*/ + +void PointMesh::_create_mesh_array(Array &p_arr) const { + PoolVector<Vector3> faces; + faces.resize(1); + faces.set(0, Vector3(0.0, 0.0, 0.0)); + + p_arr[VS::ARRAY_VERTEX] = faces; +} + +PointMesh::PointMesh() { + primitive_type = PRIMITIVE_POINTS; +} diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h index 312899c028..fad49f9642 100644 --- a/scene/resources/primitive_meshes.h +++ b/scene/resources/primitive_meshes.h @@ -322,4 +322,19 @@ public: SphereMesh(); }; +/** + A single point for use in particle systems +*/ + +class PointMesh : public PrimitiveMesh { + + GDCLASS(PointMesh, PrimitiveMesh) + +protected: + virtual void _create_mesh_array(Array &p_arr) const; + +public: + PointMesh(); +}; + #endif |