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