Created
May 20, 2020 09:41
-
-
Save IRCSS/d59ed3a41cdf5aea852633d0d6190f6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### creates a series of planes lined up along one axis. I use this as a basis for a particle system when | |
### I dont have access to compute shader or a cache friendly enviroment | |
import bpy | |
import bmesh | |
#mesh arrays | |
m_verts = [] | |
m_faces = [] | |
m_number_of_planes=900 | |
m_distance_between_planes=1 | |
for i in range(0, m_number_of_planes): | |
m_verts.append((i*m_distance_between_planes, -1.0, -1.0)) | |
m_verts.append((i*m_distance_between_planes, -1.0, 1.0)) | |
m_verts.append((i*m_distance_between_planes, 1.0, 1.0)) | |
m_verts.append((i*m_distance_between_planes, 1.0, -1.0)) | |
m_face_one=(i*4+0, i*4 +3, i*4 + 1) | |
m_face_two=(i*4+1, i*4 +3, i*4 + 2) | |
m_faces.append(m_face_one) | |
m_faces.append(m_face_two) | |
m_mesh = bpy.data.meshes.new("planes_lined_up") | |
m_object = bpy.data.objects.new(m_mesh.name,m_mesh) | |
m_scene = bpy.context.scene | |
bpy.context.collection.objects.link(m_object) | |
m_mesh.from_pydata(m_verts,[],m_faces) | |
m_mesh.update(calc_edges=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment