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

📄 d.java~12~

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


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
    implements Runnable
{
    class a
    {

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

        public 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.b);
        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]);
        }
    }

    public void c()
        throws Exception
    {
        a_javax_microedition_m3g_Light_array1d_fld = null;
        b("/JBenchmark3D/maplow.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 g()
        throws Exception
    {
        a_javax_microedition_m3g_Light_array1d_fld = null;
        b("/JBenchmark3D/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("/JBenchmark3D/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);
        a_javax_microedition_m3g_Mesh_fld.getAppearance(0).setTexture(0, new Texture2D(new Image2D(99, a_Image())));
        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("/JBenchmark3D/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();
        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);
        g1.drawString(stringbuffer.toString(), 3, 3, 20);
        flushGraphics();
    }

    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);
        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 run()
    {
_L11:
       // if(d_int_fld >= 8)
        //    break; /* Loop/switch isn't completed */
       // d_int_fld;
       // JVM INSTR tableswitch 0 7: default 521
    //                   0 60
    //                   1 115
    //                   2 178
    //                   3 233
    //                   4 300

⌨️ 快捷键说明

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