os/graphics/m3g/m3gcore11/inc/m3g_camera.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
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: Camera interface
    15 *
    16 */
    17 
    18 #ifndef __M3G_CAMERA_H__
    19 #define __M3G_CAMERA_H__
    20 
    21 /*!
    22  * \internal
    23  * \file 
    24  * \brief Camera interface
    25  */
    26 
    27 #include "m3g_gl.h"
    28 #include "m3g_node.h"
    29 
    30 /*!
    31  * \internal
    32  * \brief Camera node instance data
    33  */
    34 struct M3GCameraImpl
    35 {
    36 	Node node;
    37     
    38     M3Gint	 projType;   
    39     M3Gfloat heightFov;
    40     M3Gfloat aspect;
    41     M3Gfloat clipNear;
    42     M3Gfloat clipFar;
    43 
    44     Matrix	projMatrix;
    45     Vec4 frustumPlanes[6];
    46     
    47     M3Gbool frustumPlanesValid;
    48     M3Gbool zeroViewVolume;
    49 };
    50 
    51 /*----------------------------------------------------------------------
    52  * Internal functions
    53  *--------------------------------------------------------------------*/
    54 
    55 static void m3gInitCamera(Interface *m3g, Camera *camera);
    56 static void m3gApplyProjection(const Camera *camera);
    57 
    58 static const Vec4 *m3gFrustumPlanes(const Camera *camera);
    59 static const Matrix *m3gProjectionMatrix(const Camera *camera);
    60 
    61 M3G_INLINE static M3Gbool m3gValidProjection(const Camera *camera)
    62 {
    63     if (camera->zeroViewVolume) {
    64         M3G_LOG1(M3G_LOG_WARNINGS,
    65                  "Warning: Invalid projection for camera 0x%08X\n",
    66                  (unsigned) camera);
    67         return M3G_FALSE;
    68     }
    69     return M3G_TRUE;
    70 }
    71 
    72 
    73 #endif /*__M3G_CAMERA_H__*/