Example #1
0
        public RPRShape(RPRContext context, Span <byte> vertices, Span <byte> normals, Span <byte> texcoords, Span <byte> indices, int numIndices, bool dxCoord)
        {
            this.Context = context;
            int vertexCount = vertices.Length / 4 / 3;

            int[] num_face_vertices = new int[numIndices / 3];
            Array.Fill <int>(num_face_vertices, 3);
            float[] texCoords1 = ArrayPool <float> .Shared.Rent(vertexCount * 2);

            MemoryMarshal.Cast <byte, float>(texcoords).CopyTo(texCoords1);
            for (int i = 0; i < vertexCount; i++)
            {
                texCoords1[i * 2 + 1] = 1 - texCoords1[i * 2 + 1];
            }
            //byte[] indices2 = ArrayPool<byte>.Shared.Rent(indices.Length);
            //indices.CopyTo(indices2);
            //Span<int> indiceX = MemoryMarshal.Cast<byte, int>(new Span<byte>(indices2, 0, indices.Length));
            //for (int i = 0; i < indiceX.Length; i += 3)
            //{
            //    (indiceX[i], indiceX[i + 1], indiceX[i + 2]) = (indiceX[i + 2], indiceX[i + 1], indiceX[i]);
            //}

            Check(ContextCreateMesh(context._handle, vertices, vertexCount, 12, normals, vertexCount, 12, MemoryMarshal.AsBytes <float>(texCoords1), vertexCount, 8,
                                    indices, 4, indices, 4, indices, 4, num_face_vertices, num_face_vertices.LongLength, out _handle));
            ArrayPool <float> .Shared.Return(texCoords1);

            //ArrayPool<byte>.Shared.Return(indices2);
        }
Example #2
0
        public static RPRLight SpotLight(RPRContext context)
        {
            var light = new RPRLight(context);

            Check(Rpr.ContextCreateSpotLight(context._handle, out light._handle));
            return(light);
        }
Example #3
0
        public RPRShape(RPRContext context, float[] vertices, float[] normals, float[] texcoords, int[] indices)
        {
            this.Context = context;
            int vertexCount = vertices.Length / 3;

            int[] num_face_vertices = new int[indices.Length / 3];
            Array.Fill <int>(num_face_vertices, 3);
            Check(Rpr.ContextCreateMesh(context._handle, vertices, vertexCount, 12, normals, vertexCount, 12, texcoords, vertexCount, 8,
                                        indices, 4, indices, 4, indices, 4, num_face_vertices, num_face_vertices.LongLength, out _handle));
        }
Example #4
0
        public RPRShape(RPRContext context, Span <byte> vertices, Span <byte> normals, Span <byte> texcoords, Span <byte> indices, int numIndices)
        {
            this.Context = context;
            int vertexCount = vertices.Length / 4 / 3;

            int[] num_face_vertices = new int[numIndices / 3];
            Array.Fill <int>(num_face_vertices, 3);

            Check(ContextCreateMesh(context._handle, vertices, vertexCount, 12, normals, vertexCount, 12, texcoords, vertexCount, 8,
                                    indices, 4, indices, 4, indices, 4, num_face_vertices, num_face_vertices.LongLength, out _handle));
        }
 public RPRMaterialSystem(RPRContext context, uint type = 0)
 {
     this.Context = context;
     Check(Rpr.ContextCreateMaterialSystem(context._handle, type, out _handle));
 }
Example #6
0
 public RPRCamera(RPRContext context)
 {
     this.Context = context;
     Check(Rpr.ContextCreateCamera(context._handle, out _handle));
 }
Example #7
0
 public RPRScene(RPRContext context)
 {
     this.Context = context;
     Check(Rpr.ContextCreateScene(context._handle, out _handle));
 }
Example #8
0
 public RPRImage(RPRContext context, string path)
 {
     this.Context = context;
     Check(Rpr.ContextCreateImageFromFile(context._handle, path, out _handle));
 }
Example #9
0
 public unsafe RPRFrameBuffer(RPRContext context, Rpr.FramebufferFormat format, Rpr.FrameBufferDesc desc)
 {
     this.Context = context;
     Check(Rpr.ContextCreateFrameBuffer(context._handle, format, new IntPtr(&desc), out _handle));
 }
Example #10
0
 RPRLight(RPRContext context)
 {
     this.Context = context;
 }