Package com.benkyou.client.systems

Source Code of com.benkyou.client.systems.ImagingSystem

/*
* Project Beknyou
* Copyright (c) 2010-2011 Saint Paul College, All Rights Reserved
* Redistributions in source code form must reproduce the above
* Copyright and this condition.
* The contents of this file are subject to the GNU General Public
* License, Version 2 (the "License"); you may not use this file
* except in compliance with the License. A copy of the License is
* available at http://www.opensource.org/licenses/gpl-license.php.
*/
package com.benkyou.client.systems;

import com.benkyou.client.GameClient;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Image.Format;
import com.jme3.texture.Texture2D;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author Austin Allman
*/
public class ImagingSystem {

    private GameClient gameClient;
    private Quad plane;
    private Geometry screen;
    private Material defaultMat;
    private String imageType;
    private Texture2D imageToProject;
    private float xSize;
    private float ySize;
    private int imageX;
    private int imageY;
    /**
     *
     */
    final public static Format jmeformat = Format.RGB8;

    /**
     *
     * @param gameClient
     * @param Size
     * @param imageX
     * @param imageY
     */
    public ImagingSystem(GameClient gameClient, float Size, int imageX, int imageY) {
        this.gameClient = gameClient;
        this.xSize = Size;
        this.ySize = xSize * .75f;
        this.imageX = imageX;
        this.imageY = imageY;
        generateImageQuad();
    }

    private void generateImageQuad() {
        try {
            plane = new Quad(xSize, ySize, true);
            screen = new Geometry("My " + imageType + " plane", plane);
            //  1920x1080
            imageToProject = new Texture2D(imageX, imageY, jmeformat);
            defaultMat = new Material(gameClient.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
            defaultMat.setTexture("ColorMap", imageToProject);
            screen.setMaterial(defaultMat);
            gameClient.getRoot().attachChild(screen);
        } catch (Exception ex) {
            Logger.getLogger(ImagingSystem.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /**
     *
     * @return
     */
    public Texture2D getImageToProject() {
        return imageToProject;
    }

    /**
     *
     * @return
     */
    public Geometry getScreen() {
        return screen;
    }
}
TOP

Related Classes of com.benkyou.client.systems.ImagingSystem

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.