public void Render(RenderComposer c) { RenderStreamBatch <VertexData> .StreamData memory = c.RenderStream.GetStreamMemory((uint)_terrainMesh.Length, (uint)_terrainIndices.Length, BatchMode.Quad); new Span <VertexData>(_terrainMesh).CopyTo(memory.VerticesData); new Span <ushort>(_terrainIndices).CopyTo(memory.IndicesData); for (var i = 0; i < memory.IndicesData.Length; i++) { memory.IndicesData[i] += memory.StructIndex; } }
public Viewer3D() : base("3D Viewer") { DisplayObject = new Object3D(); _oldCamera = Engine.Renderer.Camera; Engine.Renderer.Camera = new Camera3D(new Vector3(20, 50, 200)); Engine.Renderer.Camera.LookAt = Vector3.Normalize(Vector3.Zero - Engine.Renderer.Camera.Position); _skeletalShader ??= Engine.AssetLoader.Get <ShaderAsset>("Shaders/SkeletalAnim.xml"); if (_boneVerticesStream == null) { GLThread.ExecuteGLThreadAsync(() => { _boneVerticesStream = new RenderStreamBatch <VertexDataWithBones>(0, 1, false); }); } _terrain = new Terrain3D(32, 32, 16); _windowFlags |= ImGuiWindowFlags.MenuBar; }