sl@0: /* sl@0: * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Camera interface sl@0: * sl@0: */ sl@0: sl@0: #ifndef __M3G_CAMERA_H__ sl@0: #define __M3G_CAMERA_H__ sl@0: sl@0: /*! sl@0: * \internal sl@0: * \file sl@0: * \brief Camera interface sl@0: */ sl@0: sl@0: #include "m3g_gl.h" sl@0: #include "m3g_node.h" sl@0: sl@0: /*! sl@0: * \internal sl@0: * \brief Camera node instance data sl@0: */ sl@0: struct M3GCameraImpl sl@0: { sl@0: Node node; sl@0: sl@0: M3Gint projType; sl@0: M3Gfloat heightFov; sl@0: M3Gfloat aspect; sl@0: M3Gfloat clipNear; sl@0: M3Gfloat clipFar; sl@0: sl@0: Matrix projMatrix; sl@0: Vec4 frustumPlanes[6]; sl@0: sl@0: M3Gbool frustumPlanesValid; sl@0: M3Gbool zeroViewVolume; sl@0: }; sl@0: sl@0: /*---------------------------------------------------------------------- sl@0: * Internal functions sl@0: *--------------------------------------------------------------------*/ sl@0: sl@0: static void m3gInitCamera(Interface *m3g, Camera *camera); sl@0: static void m3gApplyProjection(const Camera *camera); sl@0: sl@0: static const Vec4 *m3gFrustumPlanes(const Camera *camera); sl@0: static const Matrix *m3gProjectionMatrix(const Camera *camera); sl@0: sl@0: M3G_INLINE static M3Gbool m3gValidProjection(const Camera *camera) sl@0: { sl@0: if (camera->zeroViewVolume) { sl@0: M3G_LOG1(M3G_LOG_WARNINGS, sl@0: "Warning: Invalid projection for camera 0x%08X\n", sl@0: (unsigned) camera); sl@0: return M3G_FALSE; sl@0: } sl@0: return M3G_TRUE; sl@0: } sl@0: sl@0: sl@0: #endif /*__M3G_CAMERA_H__*/