//Title:      example.java
//Version:    
//Copyright:  Copyright (c) 2000
//Author:     SyGem Software

import java.awt.*;
import java.applet.*;

import sygem.jazz3d2_102.*;

public class example extends Applet implements Runnable {
        Thread m_ce;
        world my_world;
        int light1;
        int pid;

        //Construct the applet
        public example() {
        }
        
        //Initialize the applet
        public void init() {

                resize(400,300);
                my_world = new world(this);
                
                setLayout(new BorderLayout());
                add("Center", my_world);
                
                renderenvgs env_shader = new renderenvgs();
                env_shader.setReflectivity(0.5);
                
                String tempb = "metal.gif";
                texture txb = my_world.loadImage(tempb);
                env_shader.setImage(txb);

                torus3d torus = new torus3d(0.4,0.2,0.2,15,15,0,0,8);
                pid = my_world.addObject(torus, env_shader);
                
                light temp_light = new light(0,0,1);
                light1 = my_world.addLight(temp_light);
                
        }
        
        //Start the applet
        public void start() {
                if (m_ce == null) {
                        m_ce = new Thread(this);
                        m_ce.start();
                }
        }
        
        //Stop the applet
        public void stop() {
                if (m_ce != null) {
                        m_ce.stop();
                        m_ce = null;
                }
        }
        
        //Destroy the applet
        public void destroy() {
        }
        
        public void run() {

                my_world.prep();

                while (true) {
                        my_world.rotateObjectLocal(pid,2,4,1);
                        my_world.redraw();
                }

}