📄 m3gappearance.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:
* ---------
* World.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_Appearance_create()
{
st_m3g_appearance* handle;
ENTER_M3D_CS;
handle = M3G_Appearance_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_Appearance_getCompositingModeImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->compositing_mode);
KNI_ReturnInt((jint)M3G_Appearance_getCompositingMode(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_Appearance_getFogImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->fog);
KNI_ReturnInt((jint)M3G_Appearance_getFog(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_Appearance_getLayerImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->layer);
KNI_ReturnInt((jint)M3G_Appearance_getLayer(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_Appearance_getMaterialImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->material);
KNI_ReturnInt((jint)M3G_Appearance_getMaterial(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_Appearance_getPolygonModeImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt(handle->polygon_mode);
KNI_ReturnInt(M3G_Appearance_getPolygonMode(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_Appearance_getTextureImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
jint index = KNI_GetParameterAsInt(2);
if (index < 0 || index >= m3g_graphics3d.max_texunits) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid texture index");
KNI_ReturnInt(0);
} else {
//KNI_ReturnInt((jint)handle->textures[index]);
KNI_ReturnInt((jint)M3G_Appearance_getTexture(handle,index));
}
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setCompositingModeImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
st_m3g_compositingmode* compositing_mode = (st_m3g_compositingmode*)KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETCOMPOSITINGMODE, handle, compositing_mode);
if (M3G_Appearance_setCompositingMode(handle, compositing_mode) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid compositingmode");
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setFogImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
st_m3g_fog* fog = (st_m3g_fog*)KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETFOG, handle, fog);
if (M3G_Appearance_setFog(handle, fog) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid fog");
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setLayerImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
jint layer = KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETLAYER, handle, layer);
if (layer < -63 || layer > 63) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid layer");
} else {
if (M3G_Appearance_setLayer(handle, layer) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid layer");
}
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setMaterialImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
st_m3g_material* material = (st_m3g_material*)KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETMATERIAL, handle, material);
if (M3G_Appearance_setMaterial(handle, material) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid material");
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setPolygonModeImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
st_m3g_polygonmode* polygonmode = (st_m3g_polygonmode*)KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETPOLYGONMODE, handle, polygonmode);
if (M3G_Appearance_setPolygonMode(handle, polygonmode) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid polygonmode");
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_Appearance_setTextureImpl()
{
st_m3g_appearance* handle = (st_m3g_appearance*)KNI_GetParameterAsInt(1);
jint index = KNI_GetParameterAsInt(2);
st_m3g_texture2d* texture = (st_m3g_texture2d*)KNI_GetParameterAsInt(3);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETTEXTURE, handle, index, texture);
if (index < 0 || index>=m3g_graphics3d.max_texunits) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid index");
} else {
ENTER_M3D_CS;
if (M3G_Appearance_setTexture(handle, index, texture) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid texture");
}
LEAVE_M3D_CS;
}
KNI_ReturnVoid();
}
#endif /* #ifdef SUPPORT_JSR_184 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -