/// <summary> /// Draw the drawable mesh; Uses Capture Volume's transform to determine if play space has changed /// Animated meshes are set to redraw every frame while statics only redrawn on them or the volume /// changing transform. /// </summary> public void DrawMesh(ref voxie_frame_t vf, Transform voxieCameraTransform) { if (isSkinnedMesh) { gameObject.GetComponent <SkinnedMeshRenderer>().BakeMesh(Umesh); } if (isSkinnedMesh || voxieCameraTransform.hasChanged || transform.hasChanged) { BuildMesh(voxieCameraTransform); } for (int mesh = 0; mesh < submesh_n; mesh++) { if (Umaterials[mesh].mainTexture) { voxie_drawmeshtex(ref vf, ref textures[mesh], vt, vtn, tris[mesh], tri_n[mesh], draw_flags, cols[mesh]); } else { voxie_drawmeshtex(ref vf, 0, vt, vtn, tris[mesh], tri_n[mesh], draw_flags, cols[mesh]); } } }
/// <summary> /// Draw the drawable mesh; Uses Capture Volume's transform to determine if play space has changed /// Animated meshes are set to redraw every frame while statics only redrawn on them or the volume /// changing transform. /// </summary> public void DrawMesh(ref voxie_frame_t vf, Transform voxieCameraTransform) { try { if (!gameObject.activeSelf) { return; } Profiler.BeginSample("Bake Mesh"); if (isSkinnedMesh) { gameObject.GetComponent <SkinnedMeshRenderer>().BakeMesh(Umesh); } Profiler.EndSample(); Profiler.BeginSample("Build Mesh"); if (isSkinnedMesh || voxieCameraTransform.hasChanged || transform.hasChanged) { BuildMesh(voxieCameraTransform); } Profiler.EndSample(); for (int mesh = 0; mesh < submesh_n; mesh++) { if (Umaterials[mesh].mainTexture) { Profiler.BeginSample("Draw Textured Mesh"); if (isSkinnedMesh) { voxie_drawmeshtex(ref vf, ref textures[mesh], vt, vtn, tris[mesh], tri_n[mesh], draw_flags, 0x3F3F3F); } else { voxie_drawmeshtex(ref vf, ref textures[mesh], vt, vtn, tris[mesh], tri_n[mesh], draw_flags, 0x3F3F3F); } Profiler.EndSample(); } else { Profiler.BeginSample("Draw UnTextured Mesh"); if (isSkinnedMesh) { voxie_drawmeshtex(ref vf, 0, vt, vtn, tris[mesh], tri_n[mesh], draw_flags, GetComponent <SkinnedMeshRenderer>().materials[mesh].color.toInt()); } else { voxie_drawmeshtex(ref vf, 0, vt, vtn, tris[mesh], tri_n[mesh], draw_flags, GetComponent <MeshRenderer>().materials[mesh].color.toInt()); } Profiler.EndSample(); } } } catch (Exception E) { ExceptionHandler("Error while Drawing " + gameObject.name, E); } }
public void Draw(ref voxie_frame_t vf, Transform voxieCameraTransform) { if (m_Particles != null) { n_Particles = ps.GetParticles(m_Particles); Vector3 l; foreach (var par in m_Particles) { float size = par.GetCurrentSize(ps) / 50; l = Matrix * par.position; voxie_drawbox(ref vf, l.x - size, -l.y, l.z - size, l.x + size, -l.y, l.z + size, 2, (par.GetCurrentColor(ps)).toInt()); } } }
protected static extern void voxie_printalph(ref voxie_frame_t vf, ref point3d p, ref point3d r, ref point3d d, int col, [MarshalAs(UnmanagedType.LPStr)] string st);
protected static extern void voxie_drawcube(ref voxie_frame_t vf, ref point3d p, ref point3d r, ref point3d d, ref point3d f, int fillmode, int col);
protected static extern void voxie_drawcone(ref voxie_frame_t vf, float x0, float y0, float z0, float r0, float x1, float y1, float z1, float r1, int issol, int col);
protected static extern int voxie_drawspr(ref voxie_frame_t vf, [MarshalAs(UnmanagedType.LPStr)] string st, ref point3d p, ref point3d r, ref point3d d, ref point3d f, int col);
[DllImport("voxiebox", CallingConvention = CallingConvention.Cdecl)] protected extern static void voxie_drawmesh(ref voxie_frame_t vf, ref point3d pt, int ptn, ref int mesh, int meshn, int fillmode, int col);
protected static extern void voxie_drawsph(ref voxie_frame_t vf, float fx, float fy, float fz, float rad, int issol, int col);
protected static extern void voxie_setview(ref voxie_frame_t vf, float x0, float y0, float z0, float x1, float y1, float z1);
protected static extern void voxie_drawvox(ref voxie_frame_t vf, float fx, float fy, float fz, int col);
protected static extern void voxie_drawmesh(ref voxie_frame_t vf, point3dcol_t[] vt, int vtn, int[] mesh, int meshn, int fillmode, int col);
protected static extern void voxie_drawmeshtex(ref voxie_frame_t vf, ref tiletype texture, poltex_t[] vt, int vtn, int[] mesh, int meshn, int flags, int col);
protected static extern void voxie_drawpol(ref voxie_frame_t vf, ref pol_t pt, int n, int col);
protected static extern void voxie_drawlin(ref voxie_frame_t vf, float x0, float y0, float z0, float x1, float y1, float z1, int col);
protected static extern void voxie_drawbox(ref voxie_frame_t vf, float x0, float y0, float z0, float x1, float y1, float z1, int fillmode, int col);
protected static extern float voxie_drawheimap(ref voxie_frame_t vf, [MarshalAs(UnmanagedType.LPStr)] string st, ref point3d p, ref point3d r, ref point3d d, ref point3d f, int colorkey, int heimin, int flags);
protected static extern void voxie_printalph(ref voxie_frame_t vf, ref point3d p, ref point3d r, ref point3d d, int col, byte[] st);
protected static extern void voxie_drawmeshtex(ref voxie_frame_t vf, int nullptr, poltex_t[] vt, int vtn, int[] mesh, int meshn, int flags, int col);
protected static extern int voxie_frame_start(ref voxie_frame_t vf);
/// <summary> /// Draw the drawable mesh; Uses Capture Volume's transform to determine if play space has changed /// Animated meshes are set to redraw every frame while statics only redrawn on them or the volume /// changing transform. /// </summary> public void DrawMesh(ref voxie_frame_t vf, Transform voxieCameraTransform) { voxie_printalph(ref vf, ref pp, ref pr, ref pd, 0xffffff, ts); }
[DllImport("voxiebox", CallingConvention = CallingConvention.Cdecl)] protected extern static void voxie_drawpol(ref voxie_frame_t vf, ref tri_t tri, int n, int col);