⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m3gpolygonmode.c

📁 java 1.1 gemini 08_16
💻 C
字号:
/*******************************************************************************
 *  Modification Notice:
 *  --------------------------
 *  This software is modified by MediaTek Inc. and the information contained
 *  herein is confidential. The software may not be copied and the information
 *  contained herein may not be used or disclosed except with the written
 *  permission of MediaTek Inc. (C) 2001
 *
 *******************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *  PolygonMode.c
 *
 * Project:
 * --------
 *   Maui_Software
 *
 * Description:
 * ------------
 *   
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
 
/*************************************************************************
 * Include Header Files
 *************************************************************************/
#include "m3g.h"

#ifdef SUPPORT_JSR_184
/*************************************************************************
 * Function Definition
 *************************************************************************/
 
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_PolygonMode_create()
{
	st_m3g_polygonmode* handle; 
	
	ENTER_M3D_CS;
	handle = M3G_PolygonMode_new();
	LEAVE_M3D_CS;

	if (handle == NULL) KNI_ThrowNew("java/lang/NullPointerException", "null handle");
	
	KNI_ReturnInt((jint)handle);	
}

KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_PolygonMode_getCullingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);

	//KNI_ReturnInt((jint)handle->culling);
	KNI_ReturnInt((jint)M3G_PolygonMode_getCulling(handle));
}

KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_PolygonMode_getShadingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);

	//KNI_ReturnInt((jint)handle->shading);
	KNI_ReturnInt((jint)M3G_PolygonMode_getShading(handle));
}

KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_PolygonMode_getWindingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);

	//KNI_ReturnInt((jint)handle->winding);
	KNI_ReturnInt((jint)M3G_PolygonMode_getWinding(handle));
}

KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_javax_microedition_m3g_PolygonMode_isTwoSidedLightingEnabledImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);

	//KNI_ReturnBoolean((jint)handle->enable_twosidedlighting);
	KNI_ReturnBoolean((jint)M3G_PolygonMode_isTwoSidedLightingEnabled(handle));
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setCullingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jint culling = KNI_GetParameterAsInt(2);
	
	kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETCULLING, handle, culling);

	if (culling < M3G_CULL_BACK || culling > M3G_CULL_NONE) {
 		KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid culling");		
	} else {
		M3G_PolygonMode_setCulling(handle, (kal_uint8)culling);
	}

	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setLocalCameraLightingEnableImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jboolean local_camera = KNI_GetParameterAsBoolean(2);

	kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETLOCALCAMERALIGHTING, handle, local_camera);

	//handle->enable_localcameralighting = local_camera;
	M3G_PolygonMode_setLocalCameraLightingEnable(handle,local_camera);
	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setPerspectiveCorrectionEnableImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jboolean perspective_correction = KNI_GetParameterAsBoolean(2);
	//handle->enable_perspectivecorrection = perspective_correction;
	M3G_PolygonMode_setPerspectiveCorrectionEnable(handle,perspective_correction);
	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setShadingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jint shading = KNI_GetParameterAsInt(2);
	
	kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETSHADING, handle, shading);

	if (shading != M3G_SHADE_FLAT && shading != M3G_SHADE_SMOOTH) {
 		KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid shading");						
	} else {
		//andle->shading = shading;
		M3G_PolygonMode_setShading(handle,shading);
	}
	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setTwoSidedLightingEnableImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jboolean twoside_lighting = KNI_GetParameterAsBoolean(2);

	kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETTWOSIDELIGHTING, handle, twoside_lighting);

	//handle->enable_twosidedlighting = twoside_lighting;
	M3G_PolygonMode_setTwoSidedLightingEnable(handle,twoside_lighting);
	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_PolygonMode_setWindingImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	jint winding = KNI_GetParameterAsInt(2);
	
	kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETWINDING, handle, winding);

	if (winding != M3G_WINDING_CCW && winding != M3G_WINDING_CW) {
 		KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid winding");
	} else {
		//handle->winding = winding;
		M3G_PolygonMode_setWinding(handle,winding);
	}
	
	KNI_ReturnVoid();
}

KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_javax_microedition_m3g_PolygonMode_isPerspectiveCorrectionEnabledImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	//KNI_ReturnBoolean(handle->enable_perspectivecorrection);
	KNI_ReturnBoolean(M3G_PolygonMode_isPerspectiveCorrectionEnabled(handle));
}

KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_javax_microedition_m3g_PolygonMode_isLocalCameraLightingEnabledImpl()
{
	st_m3g_polygonmode* handle = (st_m3g_polygonmode*)KNI_GetParameterAsInt(1);
	//KNI_ReturnBoolean(handle->enable_localcameralighting);
	KNI_ReturnBoolean(M3G_PolygonMode_isLocalCameraLightingEnable(handle));
}
#endif /* #ifdef SUPPORT_JSR_184 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -