javauis/m3g_qt/src/jni/light.inl
changeset 35 85266cc22c7f
equal deleted inserted replaced
26:dc7c549001d5 35:85266cc22c7f
       
     1 /*
       
     2 * Copyright (c) 2009 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 "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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "javax_microedition_m3g_Light.h"
       
    19 
       
    20 JNIEXPORT jfloat JNICALL Java_javax_microedition_m3g_Light__1getSpotAngle
       
    21 (JNIEnv* aEnv, jclass, jint aHandle)
       
    22 {
       
    23     M3G_DO_LOCK
       
    24     jfloat angle = (jfloat)m3gGetSpotAngle((M3GLight)aHandle);
       
    25     M3G_DO_UNLOCK(aEnv)
       
    26     return angle;
       
    27 }
       
    28 
       
    29 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setSpotExponent
       
    30 (JNIEnv* aEnv, jclass, jint aHandle, jfloat aExponent)
       
    31 {
       
    32     M3G_DO_LOCK
       
    33     m3gSetSpotExponent((M3GLight)aHandle, aExponent);
       
    34     M3G_DO_UNLOCK(aEnv)
       
    35 }
       
    36 
       
    37 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setMode
       
    38 (JNIEnv* aEnv, jclass, jint aHandle, jint aMode)
       
    39 {
       
    40     M3G_DO_LOCK
       
    41     m3gSetLightMode((M3GLight)aHandle, (int)aMode);
       
    42     M3G_DO_UNLOCK(aEnv)
       
    43 }
       
    44 
       
    45 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setAttenuation
       
    46 (JNIEnv* aEnv, jclass, jint aHandle, jfloat aConstant, jfloat aLinear, jfloat aQuadratic)
       
    47 {
       
    48     M3G_DO_LOCK
       
    49     m3gSetAttenuation((M3GLight)aHandle, aConstant, aLinear, aQuadratic);
       
    50     M3G_DO_UNLOCK(aEnv)
       
    51 }
       
    52 
       
    53 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setIntensity
       
    54 (JNIEnv* aEnv, jclass, jint aHandle, jfloat aIntensity)
       
    55 {
       
    56     M3G_DO_LOCK
       
    57     m3gSetIntensity((M3GLight)aHandle, aIntensity);
       
    58     M3G_DO_UNLOCK(aEnv)
       
    59 }
       
    60 
       
    61 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Light__1ctor
       
    62 (JNIEnv* aEnv, jclass, jint aM3g)
       
    63 {
       
    64     M3G_DO_LOCK
       
    65     jint handle = (jint)m3gCreateLight((M3GInterface)aM3g);
       
    66     M3G_DO_UNLOCK(aEnv)
       
    67     return handle;
       
    68 }
       
    69 
       
    70 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Light__1getMode
       
    71 (JNIEnv* aEnv, jclass, jint aHandle)
       
    72 {
       
    73     M3G_DO_LOCK
       
    74     jint mode = (jint)m3gGetLightMode((M3GLight)aHandle);
       
    75     M3G_DO_UNLOCK(aEnv)
       
    76     return mode;
       
    77 }
       
    78 
       
    79 JNIEXPORT jfloat JNICALL Java_javax_microedition_m3g_Light__1getAttenuation
       
    80 (JNIEnv* aEnv, jclass, jint aHandle, jint aType)
       
    81 {
       
    82     M3G_DO_LOCK
       
    83     jfloat att = (jfloat)m3gGetAttenuation((M3GLight)aHandle, aType);
       
    84     M3G_DO_UNLOCK(aEnv)
       
    85     return att;
       
    86 }
       
    87 
       
    88 JNIEXPORT jfloat JNICALL Java_javax_microedition_m3g_Light__1getSpotExponent
       
    89 (JNIEnv* aEnv, jclass, jint aHandle)
       
    90 {
       
    91     M3G_DO_LOCK
       
    92     jfloat spotExp = (jfloat)m3gGetSpotExponent((M3GLight)aHandle);
       
    93     M3G_DO_UNLOCK(aEnv)
       
    94     return spotExp;
       
    95 }
       
    96 
       
    97 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setSpotAngle
       
    98 (JNIEnv* aEnv, jclass, jint aHandle, jfloat aAngle)
       
    99 {
       
   100     M3G_DO_LOCK
       
   101     m3gSetSpotAngle((M3GLight)aHandle, aAngle);
       
   102     M3G_DO_UNLOCK(aEnv)
       
   103 }
       
   104 
       
   105 JNIEXPORT jfloat JNICALL Java_javax_microedition_m3g_Light__1getIntensity
       
   106 (JNIEnv* aEnv, jclass, jint aHandle)
       
   107 {
       
   108     M3G_DO_LOCK
       
   109     jfloat intensity = (jfloat)m3gGetIntensity((M3GLight)aHandle);
       
   110     M3G_DO_UNLOCK(aEnv)
       
   111     return intensity;
       
   112 }
       
   113 
       
   114 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Light__1setColor
       
   115 (JNIEnv* aEnv, jclass, jint aHandle, jint aRGB)
       
   116 {
       
   117     M3G_DO_LOCK
       
   118     m3gSetLightColor((M3GLight)aHandle, aRGB);
       
   119     M3G_DO_UNLOCK(aEnv)
       
   120 }
       
   121 
       
   122 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Light__1getColor
       
   123 (JNIEnv* aEnv, jclass, jint aHandle)
       
   124 {
       
   125     M3G_DO_LOCK
       
   126     jint color = (jint)m3gGetLightColor((M3GLight)aHandle);
       
   127     M3G_DO_UNLOCK(aEnv)
       
   128     return color;
       
   129 }