Beispiel #1
0
        unsafe private static vec2[] GetTexCoords(EZMVertexbuffer vertexbuffer)
        {
            Passbuffer passbuffer = vertexbuffer.GetBuffer("texcoord1");
            IntPtr     address    = passbuffer.Mapbuffer();
            vec2 *     pointer    = (vec2 *)address.ToPointer();
            int        length     = passbuffer.Length();
            var        texCoords  = new vec2[length];

            for (int i = 0; i < length; i++)
            {
                texCoords[i] = pointer[i];
            }
            passbuffer.Unmapbuffer();
            return(texCoords);
        }
Beispiel #2
0
        CSharpGL.Objects.VertexBuffers.BufferPointer IModel.GetColorBufferRenderer(string varNameInShader)
        {
            if (model.uvList.Count == 0)
            {
                return(null);
            }

            using (var buffer = new ObjModelColorBuffer(varNameInShader))
            {
                buffer.Alloc(model.uvList.Count);
                unsafe
                {
                    vec2 *array = (vec2 *)buffer.FirstElement();
                    for (int i = 0; i < model.uvList.Count; i++)
                    {
                        array[i] = model.uvList[i];
                    }
                }

                return(buffer.GetRenderer());
            }
        }