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

📄 d.java~121~

📁 jbenchmark3D 的源码,带jbuilder工程
💻 JAVA~121~
📖 第 1 页 / 共 2 页
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2007-5-14 下午 04:38:45
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name:   d.java

import java.io.PrintStream;
import java.util.Hashtable;
import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.m3g.*;

public class d extends GameCanvas
{
    class d_a
    {

        public int a_int_fld;
        public int b;
        public int c;
        private final d a_d_fld;

        public d_a(int i, int j, int k)
        {
            a_d_fld = d.this;
            a_int_fld = i;
            b = j;
            c = k;
        }
    }


    public d(JBenchmark3D jbenchmark3d)
    {
        super(false);
        d_int_fld = 0;
        a_boolean_fld = false;
        b_int_fld = Font.getDefaultFont().getHeight() + 1;
        d_float_fld = 0.0F;
        c_float_fld = 0.0F;
        b_float_fld = 0.0F;
        a_float_fld = 0.0F;
        f = 4;
        c_int_fld = 8;
        b_boolean_fld = true;
        a_JBenchmark3D_JBenchmark3D_fld = jbenchmark3d;
        a_javax_microedition_lcdui_Display_fld = jbenchmark3d.a_javax_microedition_lcdui_Display_fld;
        a_JBenchmark3D_JBenchmark3D_fld = jbenchmark3d;
        addCommand(jbenchmark3d.i);
        setCommandListener(jbenchmark3d);
        a_javax_microedition_lcdui_Graphics_fld = getGraphics();
        a_javax_microedition_m3g_Graphics3D_fld = Graphics3D.getInstance();
        a_javax_microedition_m3g_Background_fld = new Background();
        a_javax_microedition_m3g_Background_fld.setColor(0);
        a();
    }

    public void a(String s)
    {
        if(a_javax_microedition_lcdui_Graphics_fld == null)
            a_javax_microedition_lcdui_Graphics_fld = getGraphics();
        setFullScreenMode(true);
        e();
        if(a_javax_microedition_lcdui_Graphics_fld.getClipHeight() != getHeight())
            a_javax_microedition_lcdui_Graphics_fld.setClip(0, 0, getWidth(), getHeight());
        a_javax_microedition_lcdui_Graphics_fld.setColor(255, 255, 255);
        a_javax_microedition_lcdui_Graphics_fld.fillRect(0, 0, getWidth(), getHeight());
        a_javax_microedition_lcdui_Graphics_fld.setColor(0, 0, 0);
        a_javax_microedition_lcdui_Graphics_fld.drawString("Initialising", getWidth() / 2, getHeight() / 2 - b_int_fld - 3, 17);
        Font.getFont(0, 1, 8);
        a_javax_microedition_lcdui_Graphics_fld.drawString(s, getWidth() / 2, getHeight() / 2, 17);
        Font.getFont(0, 0, 8);
        a_javax_microedition_lcdui_Graphics_fld.drawString("Please wait!", getWidth() / 2, getHeight() / 2 + b_int_fld + 3, 17);
        a_javax_microedition_lcdui_Graphics_fld.setColor(255, 255, 255);
        //flushGraphics();
    }

    public void a()
    {
        b_long_fld = 0L;
        a_long_fld = 0L;
        d_int_fld = 0;
        setFullScreenMode(true);
        e();
        a_boolean_fld = true;
    }

    public void d()
    {
        if(a_javax_microedition_m3g_World_fld != null)
        {
            float af[] = new float[4];
            a_javax_microedition_m3g_Camera_fld = a_javax_microedition_m3g_World_fld.getActiveCamera();
            a_javax_microedition_m3g_Camera_fld.getProjection(af);
            a_javax_microedition_m3g_Camera_fld.setPerspective(af[0], (float)getWidth() / (float)getHeight(), af[2], af[3]);
            float kk=af[2];
            float kk2=af[3];

            kk=1;
        }
    }

    public void c()
        throws Exception
    {
        System.out.println("now in c1\n");
        a_javax_microedition_m3g_Light_array1d_fld = null;
        b("/maplow.m3g");
        System.out.println("now cast world!!!!!!!!!!!!!!!!!"+a_javax_microedition_m3g_Object3D_array1d_fld.length+"\n");
        a_javax_microedition_m3g_World_fld = (World)a_javax_microedition_m3g_Object3D_array1d_fld[0];
        a_javax_microedition_m3g_World_fld.setBackground(a_javax_microedition_m3g_Background_fld);
        System.out.println("now in c2\n");
        d();
        for(int i = 0; i < a_javax_microedition_m3g_Object3D_array1d_fld.length; i++)
        {
            Node node = (Node)a_javax_microedition_m3g_Object3D_array1d_fld[i];
            a(node);
        }

        for(int j = 0; j < a_javax_microedition_m3g_Object3D_array1d_fld.length; j++)
        {
            Node node1 = (Node)a_javax_microedition_m3g_Object3D_array1d_fld[j];
            b(node1);
        }

        a_javax_microedition_m3g_World_fld.animate(0);
        b_long_fld = 0L;
        c_long_fld = System.currentTimeMillis();
        a_long_fld = 0L;
    }

    public void g()
        throws Exception
    {
        a_javax_microedition_m3g_Light_array1d_fld = null;
        b("/maphigh.m3g");
        a_javax_microedition_m3g_World_fld = (World)a_javax_microedition_m3g_Object3D_array1d_fld[0];
        a_javax_microedition_m3g_World_fld.setBackground(a_javax_microedition_m3g_Background_fld);
        d();
        for(int i = 0; i < a_javax_microedition_m3g_Object3D_array1d_fld.length; i++)
        {
            Node node = (Node)a_javax_microedition_m3g_Object3D_array1d_fld[i];
            a(node);
        }

        for(int j = 0; j < a_javax_microedition_m3g_Object3D_array1d_fld.length; j++)
        {
            Node node1 = (Node)a_javax_microedition_m3g_Object3D_array1d_fld[j];
            b(node1);
        }

        a_javax_microedition_m3g_World_fld.animate(0);
        b_long_fld = 0L;
        c_long_fld = System.currentTimeMillis();
        a_long_fld = 0L;
    }

    public void e()
    {
        d();
        a_javax_microedition_lcdui_Graphics_fld.setClip(0, 0, getWidth(), getHeight());
        a_JBenchmark3D_JBenchmark3D_fld.a_c_fld.k = getWidth();
        a_JBenchmark3D_JBenchmark3D_fld.a_c_fld.i = getHeight();
        a_javax_microedition_m3g_Graphics3D_fld.setViewport(0, 0, getWidth(), getHeight());
    }

    private void b()
        throws Exception
    {
        b("/texel.m3g");
        a_javax_microedition_m3g_World_fld = (World)a_javax_microedition_m3g_Object3D_array1d_fld[0];
        a_javax_microedition_m3g_World_fld.setBackground(a_javax_microedition_m3g_Background_fld);
        d();
        a_int_fld = 1;
        e = 1;
        for(; a_int_fld < getWidth(); a_int_fld *= 2);
        for(; e < getHeight(); e *= 2);
        Hashtable hashtable = Graphics3D.getProperties();
        Integer integer = (Integer)hashtable.get("maxTextureDimension");
        if(a_int_fld > integer.intValue())
            a_int_fld = integer.intValue();
        if(e > integer.intValue())
            e = integer.intValue();
        a_java_util_Random_fld = new Random();
        a_javax_microedition_m3g_Mesh_fld = (Mesh)a(111);
        Image tempImage = a_Image();
        a_javax_microedition_m3g_Mesh_fld.getAppearance(0).setTexture(0, new Texture2D(new Image2D(99, tempImage)));
        a_javax_microedition_m3g_World_fld.setBackground(a_javax_microedition_m3g_Background_fld);
        a_javax_microedition_m3g_Camera_fld.translate(-0.1F, 0.1F, 0.0F);
        b_long_fld = 0L;
        c_long_fld = System.currentTimeMillis();
        a_long_fld = 0L;
    }

    private void f()
        throws Exception
    {
        b("/teapot.m3g");
        a_javax_microedition_m3g_World_fld = (World)a_javax_microedition_m3g_Object3D_array1d_fld[0];
        a_javax_microedition_m3g_World_fld.setBackground(a_javax_microedition_m3g_Background_fld);
        d();
        a_javax_microedition_m3g_Camera_fld.translate(0.0F, 20F, 0.0F);
        a_javax_microedition_m3g_Mesh_fld = (Mesh)a(111);
        c_long_fld = System.currentTimeMillis();
        System.out.println("set time millis ok\n");
        b_long_fld = 0L;
        a_long_fld = 0L;
    }

    public void c(Graphics g1)
    {
        if(g1.getClipHeight() != getHeight())
            g1.setClip(0, 0, getWidth(), getHeight());
        a_javax_microedition_m3g_Graphics3D_fld.bindTarget(g1);
        a_javax_microedition_m3g_Mesh_fld.postRotate(1.0F, (float)(a_long_fld % 2001L - 1000L) / 1000F, (float)(a_long_fld % 2001L - 1000L) / 1000F, 0.3F);
        a_javax_microedition_m3g_Graphics3D_fld.render(a_javax_microedition_m3g_World_fld);
        a_javax_microedition_m3g_Graphics3D_fld.releaseTarget();
        StringBuffer stringbuffer = new StringBuffer("KTexels ps: ");
        b_long_fld++;
        a_long_fld = System.currentTimeMillis() - c_long_fld;
        if(a_long_fld > 0L)
            stringbuffer.append((b_long_fld * (long)a_int_fld * (long)e) / a_long_fld);
        g1.drawString(stringbuffer.toString(), 3, 3, 20);
        flushGraphics();
    }

    public void a(Graphics g1)
    {
        if(g1.getClipHeight() != getHeight())
            g1.setClip(0, 0, getWidth(), getHeight());
        a_javax_microedition_m3g_Graphics3D_fld.bindTarget(g1);
        a_javax_microedition_m3g_Mesh_fld.postRotate(1.0F, 1.0F, 1.0F, 1.0F);
        a_javax_microedition_m3g_Graphics3D_fld.render(a_javax_microedition_m3g_World_fld);
        a_javax_microedition_m3g_Graphics3D_fld.releaseTarget();
        StringBuffer stringbuffer = new StringBuffer("Triangles ps: ");
        b_long_fld++;
        a_long_fld = System.currentTimeMillis() - c_long_fld;
        if(a_long_fld > 0L)
            stringbuffer.append((b_long_fld * 992L * 1000L) / a_long_fld);
    }

    public void b(Graphics g1)
    {
        if(g1.getClipHeight() != getHeight())
            g1.setClip(0, 0, getWidth(), getHeight());
        a_javax_microedition_m3g_Graphics3D_fld.bindTarget(g1);
        a_long_fld = System.currentTimeMillis() - c_long_fld;
        if(a_long_fld > 30000L)
            a_javax_microedition_m3g_World_fld.animate(30000);
        else
            a_javax_microedition_m3g_World_fld.animate((int)a_long_fld % 30000);
        Transform transform = new Transform();
        a_javax_microedition_m3g_Camera_fld.getTransformTo(a_javax_microedition_m3g_World_fld, transform);
        float af[] = new float[16];
        transform.get(af);
        int i = (int)(((af[3] - b_float_fld) / (a_float_fld - b_float_fld)) * (float)f);
        if(i >= f)
            i = f - 1;
        int j = (int)(((af[11] - d_float_fld) / (c_float_fld - d_float_fld)) * (float)c_int_fld);
        if(j >= c_int_fld)
            j = c_int_fld - 1;
        byte byte0 = 0;
        int k = 0;
        byte byte1 = 0;
        int l = 0;
        float af1[] = new float[4];
        a_javax_microedition_m3g_Camera_fld.getParent().getOrientation(af1);
        if(af1[2] > 0.0F)
            g = (int)(((af1[0] + 22.5F) % 360F) / 45F) % 8;
        else
            g = (int)((((360F - af1[0]) + 22.5F) % 360F) / 45F) % 8;
        switch(g)
        {
        case 0: // '\0'
            byte1 = -1;
            byte0 = -1;
            k = 1;
            break;

        case 1: // '\001'
            byte1 = -1;
            byte0 = -1;
            break;

        case 2: // '\002'
            byte1 = -1;
            l = 1;
            byte0 = -1;
            break;

        case 3: // '\003'
            l = 1;
            byte0 = -1;
            break;

        case 4: // '\004'
            l = 1;
            byte0 = -1;
            k = 1;
            break;

        case 5: // '\005'
            l = 1;
            k = 1;
            break;

        case 6: // '\006'
            byte1 = -1;
            l = 1;
            k = 1;
            break;

        case 7: // '\007'
            byte1 = -1;
            k = 1;
            break;
        }
        int i1 = 0;
        int j1 = j + byte1;
        if(j1 < 0)
            j1 = 0;
        int k1 = j + l;
        if(k1 >= c_int_fld)
            k1 = c_int_fld - 1;
        int l1 = i + byte0;
        if(l1 < 0)
            l1 = 0;
        int i2 = i + k;
        if(i2 >= f)
            i2 = f - 1;
        for(int j2 = j1; j2 <= k1; j2++)
        {
            for(int l2 = l1; l2 <= i2; l2++)
                i1 |= 1 << j2 * f + l2;

        }

        a_javax_microedition_m3g_Camera_fld.setScope(i1);
        for(int k2 = 0; k2 < a_javax_microedition_m3g_Light_array1d_fld.length; k2++)
            a_javax_microedition_m3g_Light_array1d_fld[k2].setScope(i1);

        a_javax_microedition_m3g_Graphics3D_fld.render(a_javax_microedition_m3g_World_fld);
        //a_javax_microedition_m3g_Graphics3D_fld.releaseTarget();
        StringBuffer stringbuffer = new StringBuffer("Fps: ");
        b_long_fld++;
        if(a_long_fld > 0L)
        {
            stringbuffer.append((b_long_fld * 1000L) / a_long_fld);
            stringbuffer.append(".");
            stringbuffer.append(((b_long_fld * 0x186a0L) / a_long_fld) % 100L);
        }
        g1.drawString(stringbuffer.toString(), 3, 3, 20);
        a_javax_microedition_m3g_Graphics3D_fld.releaseTarget();
        //flushGraphics();
    }

    public void b(String s)
        throws Exception
    {
        a_javax_microedition_m3g_Object3D_array1d_fld = Loader.load(s);
    }

    public Object3D a(int i)
    {
        for(int j = 0; j < a_javax_microedition_m3g_Object3D_array1d_fld.length; j++)
            if(a_javax_microedition_m3g_Object3D_array1d_fld[j].getUserID() == i)
                return a_javax_microedition_m3g_Object3D_array1d_fld[j];

        return a_javax_microedition_m3g_Object3D_array1d_fld[a_javax_microedition_m3g_Object3D_array1d_fld.length - 1].find(i);
    }

    public void paint(Graphics g)
    {
        if(d_int_fld == 0)
        {
            a("Triangle Test");
            try
            {
                f();
            }
            catch(Exception exception)
            {
                exception.printStackTrace();
                d_int_fld += 2;
            }
            d_int_fld++;
        }
        else   if(d_int_fld == 1)
        {
            if(a_long_fld < 100L)
            {
                a(g);//a_javax_microedition_lcdui_Graphics_fld);
                return;
            }
            d_int_fld++;
            a_JBenchmark3D_JBenchmark3D_fld.a_c_fld.e = (int)((b_long_fld * 1000L * 992L) / a_long_fld);
        }
        else if(d_int_fld==2)
        {
            try
            {
               // System.out.println("now test Texture\n");
              b();
            }
             catch (Exception exception1) {

⌨️ 快捷键说明

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