Beispiel #1
0
        public Scene(Device device, RTCBuildQuality quality, bool dyamic)
        {
            m_device = device;
            Handle   = EmbreeAPI.rtcNewScene(device.Handle);
            var flags = RTCSceneFlags.Robust | RTCSceneFlags.ContextFilterFunction;

            if (dyamic)
            {
                flags |= RTCSceneFlags.Dynamic;
            }
            EmbreeAPI.rtcSetSceneFlags(Handle, flags);
            EmbreeAPI.rtcSetSceneBuildQuality(Handle, quality);
        }
        /// <summary>
        /// Create TriangleGeometry from buffers. Indices expected to be int32 and vertices to be V3f.
        /// </summary>
        public TriangleGeometry(Device device, EmbreeBuffer vertexBuffer, int vertexOffset, int vertexCount, EmbreeBuffer indexBuffer, int indexOffset, int triangleCount, RTCBuildQuality quality)
            : base(device, RTCGeometryType.Triangle, quality)
        {
            EmbreeAPI.rtcRetainBuffer(vertexBuffer.Handle);
            EmbreeAPI.rtcRetainBuffer(indexBuffer.Handle);
            m_vertices = vertexBuffer;
            m_indices  = indexBuffer;

            // triangle index buffer needs to be UINT3
            EmbreeAPI.rtcSetGeometryBuffer(Handle, RTCBufferType.Index, 0, RTCFormat.UINT3, m_indices.Handle, (ulong)indexOffset * sizeof(int), sizeof(int) * 3, (ulong)triangleCount);
            // triangle vertex needs to be FLOAT3
            EmbreeAPI.rtcSetGeometryBuffer(Handle, RTCBufferType.Vertex, 0, RTCFormat.FLOAT3, m_vertices.Handle, (ulong)vertexOffset, sizeof(float) * 3, (ulong)vertexCount);

            Commit();

            device.CheckError("Create TriangleGeometry");
        }
 protected EmbreeGeometry(Device device, RTCGeometryType type, RTCBuildQuality quality)
 {
     Handle = EmbreeAPI.rtcNewGeometry(device.Handle, type);
     EmbreeAPI.rtcSetGeometryBuildQuality(Handle, quality);
 }
        public TriangleGeometry(Device device, V3f[] vertices, int[] triangleIndices, RTCBuildQuality quality)
            : base(device, RTCGeometryType.Triangle, quality)
        {
            m_vertices = new EmbreeBuffer(device, vertices);
            m_indices  = new EmbreeBuffer(device, triangleIndices);

            // triangle index buffer needs to be UINT3
            EmbreeAPI.rtcSetGeometryBuffer(Handle, RTCBufferType.Index, 0, RTCFormat.UINT3, m_indices.Handle, 0, sizeof(int) * 3, (ulong)(triangleIndices.Length / 3));
            // triangle vertex needs to be FLOAT3
            EmbreeAPI.rtcSetGeometryBuffer(Handle, RTCBufferType.Vertex, 0, RTCFormat.FLOAT3, m_vertices.Handle, 0, sizeof(float) * 3, (ulong)vertices.Length);

            Commit();

            device.CheckError("Create TriangleGeometry");
        }
Beispiel #5
0
 public static extern void rtcSetGeometryBuildQuality(IntPtr geometry, RTCBuildQuality quality);