Main Menu

Recent posts

#21
Support / Re: Software Render Color Dept...
Last post by AGP - February 08, 2025, 10:06:59 PM
I thought that it was a color thing that nothing I do makes an object fade in or out with the software render. This is a basic test I wrote (several different attempts in there, none of which work):


import java.awt.*;
import java.awt.event.*;
import com.threed.jpct.*;

public class Transparency extends Frame implements WindowListener {
    private World theWorld;
    private FrameBuffer buffer;
    private Camera cam;
    private Object3D obj;
    private boolean keepGoing, turnRight, turnLeft;
    private com.threed.jpct.util.KeyMapper keyMapper;
    private Texture boxMap;
    private int transparency = 0;
    private FadeoutEffect effect;

    public Transparency() {
       this.setTitle("BR's");
       theWorld = new World();
       buffer = new FrameBuffer(1440, 900, FrameBuffer.SAMPLINGMODE_NORMAL);
       obj = com.threed.jpct.util.ExtendedPrimitives.createBox(new SimpleVector(2f, 2f, 2f));//Primitives.getCube(1f);
       TextureManager.getInstance().addTexture("boxMap", (boxMap=new Texture("BoxMap.png", true)));
       boxMap.setEffect((effect=new FadeoutEffect()));
       obj.setTexture("boxMap");
       obj.build();
       obj.setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);
       obj.setTransparency(transparency);
       Object3D backgroundPlane = Primitives.getPlane(1, 4f);
       backgroundPlane.build();
       backgroundPlane.translate(0f, -2f, 0f);
       theWorld.addObject(backgroundPlane);
       cam = theWorld.getCamera();
       cam.moveCamera(Camera.CAMERA_MOVEOUT, 8f);
       theWorld.addObject(obj);
       obj.setLighting( Object3D.LIGHTING_NO_LIGHTS );
       keyMapper = new com.threed.jpct.util.KeyMapper(this);
       this.addWindowListener(this);
       this.setSize(buffer.getWidth(), buffer.getHeight());
       this.setVisible(true);
       loop();
    }

    public void loop() {
       keepGoing = true;
       while (keepGoing) {
           buffer.clear();
           com.threed.jpct.util.KeyState keyState = keyMapper.poll();
           if (keyState.getState() == com.threed.jpct.util.KeyState.PRESSED)
              keyPressed(keyState.getKeyCode());
           else if (keyState.getState() == com.threed.jpct.util.KeyState.RELEASED)
              keyReleased(keyState.getKeyCode());
           if (turnRight)
              obj.rotateY(-.01f);
           if (turnLeft)
              obj.rotateY(.01f);
           theWorld.renderScene(buffer);
           theWorld.draw(buffer);
           //theWorld.drawWireframe(buffer, Color.yellow);
           buffer.display(this.getGraphics());
           Thread.yield();
       }
       buffer.dispose();
       this.dispose();
       System.exit(0);
    }

    private void keyPressed(int keyCode) {
       if (keyCode == KeyEvent.VK_RIGHT)
           turnRight = true;
       if (keyCode == KeyEvent.VK_LEFT)
           turnLeft = true;
    }
    private void keyReleased(int keyCode) {
       if (keyCode == KeyEvent.VK_RIGHT)
           turnRight = false;
       if (keyCode == KeyEvent.VK_LEFT)
           turnLeft = false;
       if (keyCode == KeyEvent.VK_T) {
           float fade = 1.00f;
           if (transparency < 255)
              fade = (float)((transparency+=8)/255f);
           effect.transparency = 255-transparency;
           obj.setTransparency(255-transparency);
           //boxMap.setAlpha(255-transparency);
           TextureManager.getInstance().replaceTexture("boxMap", boxMap);
           //obj.setAdditionalColor(intensity(boxColor, fade));
           //boxMap.applyEffect();
           Logger.log("Transparency: "+transparency, Logger.MESSAGE);
       }
    }
    public void windowClosing(WindowEvent e) {
       keepGoing = false;
    }
    public void windowClosed(WindowEvent e) {}
    public void windowOpened(WindowEvent e) {}
    public void windowActivated(WindowEvent e) {}
    public void windowDeactivated(WindowEvent e) {}
    public void windowIconified(WindowEvent e) {}
    public void windowDeiconified(WindowEvent e) {}

    public static void main(String[] args) {
       new Transparency();
    }
}
class FadeoutEffect implements ITextureEffect {
    public int transparency;
    private Texture tex;
    public FadeoutEffect() {
    }

    public void init(Texture texture) {
       this.tex = texture;
    }

    public void apply(int[] dest, int[] src) {
       /*for (int y =0; y < 512;y++) {
              for (int x = 0; x < 512; x++) {
                     dest[y*x] = transparency;
              }
       }*/
       tex.setAlpha(transparency);
    }

    public boolean containsAlpha() {
       return false;
    }
}
#22
Support / Re: Software Render Color Dept...
Last post by EgonOlsen - February 08, 2025, 11:23:37 AM
No, it's working on full 24 bit color depth.
#23
Support / Software Render Color Depth
Last post by AGP - February 07, 2025, 11:08:25 PM
If I'm not mistaken, the software renderer works with 16 bits for color (and a third byte for transparency?). Is it trivial giving it all 24 bits (plus a byte for transparency). If so, would you?
#24
News / Re: Forum upgraded to 2.1.4
Last post by EgonOlsen - February 03, 2025, 04:31:12 PM
It should work now.
#25
News / Re: Forum upgraded to 2.1.4
Last post by EgonOlsen - February 03, 2025, 09:19:15 AM
I found the issue, but I can't fix it myself. I have to contact my provider.
#26
News / Re: Forum upgraded to 2.1.4
Last post by EgonOlsen - February 03, 2025, 09:00:13 AM
I see. That's a bit strange...the forum has a database user configured which works for everything else for some strange reason not for the search. I'm not sure why that it, I'll have a look and try to find something.
#27
News / Re: Forum upgraded to 2.1.4
Last post by AGP - January 31, 2025, 09:52:55 PM
Please try to search for a topic. It doesn't fail sometimes, it fails every time.
#28
Support / Re: Caching Animations in Soft...
Last post by EgonOlsen - January 30, 2025, 12:04:38 PM
It's nothing that I'm doing at least. I can only imagine that it's the JIT-compiler kicking in. Older VMs had the option to compile everything at startup. I'm not sure if this option is still available on newer ones but if it is, it might be worth to try to see if it fixes the problem. It might not be a good option in the end, because it hugely increases startup time, but to track down the problem, it might help.
#29
News / Re: Forum upgraded to 2.1.4
Last post by EgonOlsen - January 30, 2025, 12:02:13 PM
Never seen it and I got no error mail either. I had to upgrade the forum because of the old version being insecure and unspported. As long as it only happens every not and then, I guess we have to live with it.
#30
News / Re: Forum upgraded to 2.1.4
Last post by AGP - January 28, 2025, 09:00:20 PM
I've tested it with Edge, just in case. Same: "Database error. Please try again. If you come back to this error screen, report the error to an administrator."