Example #1
0
        public static VerticeArrayInfo GetColorArray(Vector4[] color, int vbo, bool doubletri = false)
        {
            string sTemp = color[0].X.ToString() + "x" + color[0].Y.ToString() + "x" + color[0].Z.ToString() + "x" + color[0].W.ToString() + "x" + color[1].X.ToString() + "x" + color[1].Y.ToString() + "x" + color[1].Z.ToString() + "x" + color[1].W.ToString() + "x" + color[2].X.ToString() + "x" + color[2].Y.ToString() + "x" + color[2].Z.ToString() + "x" + color[2].W.ToString() + "x" + color[3].X.ToString() + "x" + color[3].Y.ToString() + "x" + color[3].Z.ToString() + "x" + color[3].W.ToString();
            VerticeArrayInfo vaiTemp = null;

            if(color_DicSDicIVai.ContainsKey(vbo)) {
                color_DicSDicIVai[vbo].TryGetValue(sTemp, out vaiTemp);
            }
            else {
                color_DicSDicIVai.Add(vbo, new Dictionary<string, VerticeArrayInfo>());
            }

            if(vaiTemp == null) {
                vaiTemp = new VerticeArrayInfo(vbo, (doubletri ? 6 : 3), MakeColorArray(color, doubletri));
                color_DicSDicIVai[vbo].Add(sTemp, vaiTemp);
            }

            return vaiTemp;
        }
Example #2
0
 public static int? AddToVBO(int vbo, int offset, VerticeArrayInfo vai)
 {
     return AddToVBO(vai.VBO, offset, vai.Data);
 }
Example #3
0
        private void NonInterleavedVertex(Vector2 dim)
        {
            int? errorCheckIN;

            vert_Vai = QuadVerticeHandler.GetVertexArray(dim, vBO_I, true);
            if(!vert_Vai.InVBO) {
                vert_Vai.VBO = vBO_I;
                errorCheckIN = VBOHandler.AddToVBO(vBO_I, vert_Vai);
                if(errorCheckIN.HasValue) { vert_Vai.Position = errorCheckIN.Value; vert_Vai.InVBO = true; }
                else { Console.WriteLine("ERROR: Vert position!"); }
            }
            else { vBO_I = vert_Vai.VBO; }
            vertDataPosition_I = vert_Vai.Position;
        }
Example #4
0
        public static VerticeArrayInfo GetInterleavedVertColorArray(Vector3 pos, Vector2 dim, Vector4[] colors, int vbo, bool doubletri = false)
        {
            string sTemp = pos.X.ToString() + "x" + pos.Y.ToString() + "x" + pos.Z.ToString() + "x" + dim.X.ToString() + "x" + dim.Y.ToString() + "x" + colors[0].X.ToString() + "x" + colors[0].Y.ToString() + "x" + colors[0].Z.ToString() + "x" + colors[0].W.ToString() + "x" + colors[1].X.ToString() + "x" + colors[1].Y.ToString() + "x" + colors[1].Z.ToString() + "x" + colors[1].W.ToString() + "x" + colors[2].X.ToString() + "x" + colors[2].Y.ToString() + "x" + colors[2].Z.ToString() + "x" + colors[2].W.ToString() + "x" + colors[3].X.ToString() + "x" + colors[3].Y.ToString() + "x" + colors[3].Z.ToString() + "x" + colors[3].W.ToString();
            VerticeArrayInfo vaiTemp = null;

            if(quadVertices_DicSDicIVai.ContainsKey(vbo)) {
                quadVertices_DicSDicIVai[vbo].TryGetValue(sTemp, out vaiTemp);
            }
            else {
                quadVertices_DicSDicIVai.Add(vbo, new Dictionary<string, VerticeArrayInfo>());
            }

            if(vaiTemp == null) {
                vaiTemp = new VerticeArrayInfo(vbo, (doubletri ? 6 : 3), MakeInterleavedVertColorArray(pos, dim, colors, doubletri));
                quadVertices_DicSDicIVai[vbo].Add(sTemp, vaiTemp);
            }

            return vaiTemp;
        }
Example #5
0
        public static VerticeArrayInfo GetVertexArray(Vector2 dim, int vbo, bool doubletri = false)
        {
            string sTemp = dim.X.ToString() + "x" + dim.Y.ToString(); //Varför inte göra vbo + x + width + x + height  här också? (Svar: för att här finns tillgång till en liten extra klass (som inte finns i FontHandler buffer tjosset) - vilket borde vara lite snabbare än att sätta ihop en längre string!)
            VerticeArrayInfo vaiTemp = null;

            if(quadVertices_DicSDicIVai.ContainsKey(vbo)) {
                quadVertices_DicSDicIVai[vbo].TryGetValue(sTemp, out vaiTemp);
            }
            else {
                quadVertices_DicSDicIVai.Add(vbo, new Dictionary<string, VerticeArrayInfo>());
            }

            if(vaiTemp == null) {
                vaiTemp = new VerticeArrayInfo(vbo, (doubletri ? 6 : 3), MakeVertexArray(0f, 0f, 0f, dim.X, dim.Y, doubletri));
                quadVertices_DicSDicIVai[vbo].Add(sTemp, vaiTemp);
            }

            return vaiTemp;
        }
Example #6
0
        public static VerticeArrayInfo GetTexCoordArray(float left, float bottom, float width, float height, int vbo, bool doubletri = false)
        {
            string sTemp = left.ToString() + "x" + bottom.ToString() + "x" + width.ToString() + "x" + height.ToString();
            VerticeArrayInfo vaiTemp = null;

            if(texCoords_DicSDicIVai.ContainsKey(vbo)) {
                texCoords_DicSDicIVai[vbo].TryGetValue(sTemp, out vaiTemp);
            }
            else {
                texCoords_DicSDicIVai.Add(vbo, new Dictionary<string, VerticeArrayInfo>());
            }

            if(vaiTemp == null) {
                vaiTemp = new VerticeArrayInfo(vbo, (doubletri ? 6 : 3), MakeTexCoordArray(left, bottom, width, height, doubletri));
                texCoords_DicSDicIVai[vbo].Add(sTemp, vaiTemp);
            }

            return vaiTemp;
        }
Example #7
0
        public static VerticeArrayInfo GetInterleavedVertTexCoordArray(Vector3 pos, Vector2 dim, float texcleft, float texcbottom, float texcwidth, float texcheight, int vbo, bool doubletri = false)
        {
            string sTemp = pos.X.ToString() + "x" + pos.Y.ToString() + "x" + pos.Z.ToString() + "x" + dim.X.ToString() + "x" + dim.Y.ToString() + "x" + texcleft.ToString() + "x" + texcbottom.ToString() + "x" + texcwidth.ToString() + "x" + texcheight.ToString();
            VerticeArrayInfo vaiTemp = null;

            if(quadVertices_DicSDicIVai.ContainsKey(vbo)) {
                quadVertices_DicSDicIVai[vbo].TryGetValue(sTemp, out vaiTemp);
            }
            else {
                quadVertices_DicSDicIVai.Add(vbo, new Dictionary<string, VerticeArrayInfo>());
            }

            if(vaiTemp == null) {
                vaiTemp = new VerticeArrayInfo(vbo, (doubletri ? 6 : 3), MakeInterleavedVertTexCoordArray(pos, dim, texcleft, texcbottom, texcwidth, texcheight, doubletri));
                quadVertices_DicSDicIVai[vbo].Add(sTemp, vaiTemp);
            }

            return vaiTemp;
        }