os/graphics/m3g/m3gcore11/inc/m3g_vertexarray.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: VertexArray interface
    15 *
    16 */
    17 
    18 #ifndef __M3G_VERTEXARRAY_H__
    19 #define __M3G_VERTEXARRAY_H__
    20 
    21 /*!
    22  * \internal
    23  * \file
    24  * \brief VertexArray interface
    25  */
    26 
    27 #include "m3g_object.h"
    28 #include "m3g_gl.h"
    29 
    30 /*!
    31  * \internal
    32  * \brief \c VertexArray object instance
    33  */
    34 struct M3GVertexArrayImpl
    35 {
    36     Object object;
    37     
    38     M3Gsizei vertexCount;
    39     M3Gint mapCount;
    40     M3Guint numLocks;
    41     
    42     GLint elementSize;
    43     GLenum elementType;
    44     GLsizei stride;
    45 
    46     M3GMemObject data;
    47     M3Gshort rangeMin, rangeMax;
    48 
    49     /*!
    50      * \internal
    51      * \brief Cached color array(s?) with premultiplied alpha
    52      */
    53     M3GMemObject cachedColors;
    54 
    55     /*!
    56      * \internal
    57      * \brief Alpha factor for currently stored scaled colors
    58      *
    59      * anything below zero is considered a dirty value
    60      */
    61     M3Gint cachedAlphaFactor;
    62     M3Gint timestamp;
    63 };
    64 
    65 /* If this assert fails, check the compiler padding settings */
    66 M3G_CT_ASSERT(sizeof(VertexArray) == sizeof(Object) + 44);
    67 
    68 /*----------------------------------------------------------------------
    69  * Internal functions
    70  *--------------------------------------------------------------------*/
    71 
    72 static void m3gLockColorArray   (const VertexArray *array, M3Gint alphaFactor);
    73 static void m3gLockNormalArray  (const VertexArray *array);
    74 static void m3gLockTexCoordArray(const VertexArray *array);
    75 static void m3gLockVertexArray  (const VertexArray *array);
    76 static void m3gUnlockArray      (const VertexArray *array);
    77 
    78 static M3Gbool m3gCreateAlphaColorCache(VertexArray *array);
    79     
    80 static VertexArray *m3gCloneVertexArray(const VertexArray *array);
    81 static M3Gint m3gGetArrayVertexCount (const VertexArray *array);
    82 static M3Gbool m3gIsCompatible  (const VertexArray *array, const VertexArray *other);
    83 static M3Gint m3gGetArrayTimestamp(const VertexArray *array);
    84 static void m3gGetArrayBoundingBox(const VertexArray *array, M3Gshort *boundingBox);
    85 static M3Gbool m3gGetCoordinates(VertexArray *va,
    86                                  M3Gint elementCount,
    87                                  M3Gint idx,
    88                                  M3Gfloat *v);
    89 
    90 static void m3gGetArrayValueRange(const VertexArray *array,
    91                                   M3Gint *minValue, M3Gint *maxValue);
    92 
    93 #endif /*__M3G_VERTEXARRAY_H__*/