demo.java
来自「可在索爱K700C上运行的3D例程」· Java 代码 · 共 53 行
JAVA
53 行
/**
*
* COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2004.
*
* The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
* The use of the software is subject to the terms of the end-user license agreement which
* accompanies or is included with the software. The software is provided "as is" and Sony Ericsson
* specifically disclaim any warranty or condition whatsoever regarding merchantability or fitness for
* a specific purpose, title or non-infringement. No warranty of any kind is made in relation to the condition,
* suitability, availability, accuracy, reliability, merchantability and/or non-infringement of the software provided herein
*
*/
package com.sonyericsson.javatest.mobile3d;
import javax.microedition.m3g.Appearance;
import javax.microedition.m3g.Image2D;
import javax.microedition.m3g.Material;
import javax.microedition.m3g.Texture2D;
/**
* Main demo class
*
*/
public class Demo extends DemoBase {
/**
* Apply appearance for object
*
*/
protected void applyAppearance() {
iImage = Mobile3D.getInstance().getImageTexture();
// create the Image2D (we need this so we can make a Texture2D)
Image2D image2D = new Image2D(Image2D.RGB, iImage);
// create the Texture2D and enable mipmapping
// texture color is to be modulated with the lit material color
Texture2D texture = new Texture2D(image2D);
texture.setFiltering(Texture2D.FILTER_NEAREST, Texture2D.FILTER_NEAREST);
texture.setWrapping(Texture2D.WRAP_CLAMP, Texture2D.WRAP_CLAMP);
texture.setBlending(Texture2D.FUNC_MODULATE);
// create the appearance
iAppearance = new Appearance();
iAppearance.setTexture(0, texture);
iAppearance.setMaterial(iMaterial);
iMaterial.setColor(Material.DIFFUSE, 0xFFFFFFFF); // white
iMaterial.setColor(Material.SPECULAR, 0xFFFFFFFF); // white
iMaterial.setShininess(100.0f);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?