当前位置: 首页>>代码示例>>Java>>正文


Java PLSpherical2FaceOrientation类代码示例

本文整理汇总了Java中com.panoramagl.enumerations.PLSpherical2FaceOrientation的典型用法代码示例。如果您正苦于以下问题:Java PLSpherical2FaceOrientation类的具体用法?Java PLSpherical2FaceOrientation怎么用?Java PLSpherical2FaceOrientation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PLSpherical2FaceOrientation类属于com.panoramagl.enumerations包,在下文中一共展示了PLSpherical2FaceOrientation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setImage

import com.panoramagl.enumerations.PLSpherical2FaceOrientation; //导入依赖的package包/类
@Override
public void setImage(PLIImage image)
{
    if(image != null)
    {
    	int w = image.getWidth(), h = image.getHeight();
    	if(w >= 128 && w <= 2048 && h >= 64 && h <= 1024 && PLMath.isPowerOfTwo(w) && PLMath.isPowerOfTwo(h) && w % h == 0)
    	{
    		int w2 = w >> 1, w32 = w2 >> 4;
	    	PLIImage frontImage = PLImage.crop(image, w2 - w32, 0, w32 << 1, h);
	    	PLIImage backImage = PLImage.joinImagesHorizontally(PLImage.crop(image, w - w32, 0, w32, h), PLImage.crop(image, 0, 0, w32, h));
	    	PLIImage leftImage = PLImage.crop(image, 0, 0, w2, h);
	    	PLIImage rightImage = PLImage.crop(image, w2, 0, w2, h);
	        this.setTexture(new PLTexture(frontImage), PLSpherical2FaceOrientation.PLSpherical2FaceOrientationFront.ordinal());
	        this.setTexture(new PLTexture(backImage), PLSpherical2FaceOrientation.PLSpherical2FaceOrientationBack.ordinal());
	        this.setTexture(new PLTexture(leftImage), PLSpherical2FaceOrientation.PLSpherical2FaceOrientationLeft.ordinal());
	        this.setTexture(new PLTexture(rightImage), PLSpherical2FaceOrientation.PLSpherical2FaceOrientationRight.ordinal());
    	}
    }
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:21,代码来源:PLSpherical2Panorama.java

示例2: internalRender

import com.panoramagl.enumerations.PLSpherical2FaceOrientation; //导入依赖的package包/类
/**render methods*/

@Override
protected void internalRender(GL10 gl, PLIRenderer renderer)
{
	PLITexture previewTexture = this.getPreviewTextures()[0];
	PLITexture[] textures = this.getTextures();
	PLITexture frontTexture = textures[PLSpherical2FaceOrientation.PLSpherical2FaceOrientationFront.ordinal()];
	PLITexture backTexture = textures[PLSpherical2FaceOrientation.PLSpherical2FaceOrientationBack.ordinal()];
	PLITexture leftTexture = textures[PLSpherical2FaceOrientation.PLSpherical2FaceOrientationLeft.ordinal()];
	PLITexture rightTexture = textures[PLSpherical2FaceOrientation.PLSpherical2FaceOrientationRight.ordinal()];
	
    boolean frontTextureIsValid = (frontTexture != null && frontTexture.getTextureId(gl) != 0);
    boolean backTextureIsValid = (backTexture != null && backTexture.getTextureId(gl) != 0);
    boolean leftTextureIsValid = (leftTexture != null && leftTexture.getTextureId(gl) != 0);
    boolean rightTextureIsValid = (rightTexture != null && rightTexture.getTextureId(gl) != 0);
    
    if(frontTextureIsValid || backTextureIsValid || leftTextureIsValid || rightTextureIsValid || (previewTexture != null && previewTexture.getTextureId(gl) != 0))
    {
    	gl.glEnable(GL10.GL_TEXTURE_2D);
    	
    	GLUquadric quadratic = this.getQuadric();
	    float radius = PLConstants.kPanoramaRadius;
	    int halfDivs = this.getDivs() / 2, quarterDivs = halfDivs / 2;
	    
	    if(previewTexture != null)
	    {
	        if(frontTextureIsValid && backTextureIsValid && leftTextureIsValid && rightTextureIsValid)
	            this.removePreviewTextureAtIndex(0, true);
	        else
	        {
	        	int previewDivs = this.getPreviewDivs();
	            gl.glBindTexture(GL10.GL_TEXTURE_2D, previewTexture.getTextureId(gl));
	            GLUES.gluSphere(gl, quadratic, radius, previewDivs, previewDivs);
	        }
	    }
	    
	    // Front Face
	    if(frontTextureIsValid)
	    {
	        gl.glBindTexture(GL10.GL_TEXTURE_2D, frontTexture.getTextureId(gl));
	        GLUES.glu3DArc(gl, quadratic, PLConstants.kPI8, -PLConstants.kPI16, false, radius, quarterDivs, quarterDivs);
	    }
	    
	    // Back Face
	    if(backTextureIsValid)
	    {
	        gl.glBindTexture(GL10.GL_TEXTURE_2D, backTexture.getTextureId(gl));
	        GLUES.glu3DArc(gl, quadratic, PLConstants.kPI8, -PLConstants.kPI16, true, radius, quarterDivs, quarterDivs);
	    }
	    
	    // Left Face
	    if(leftTextureIsValid)
	    {
	        gl.glBindTexture(GL10.GL_TEXTURE_2D, leftTexture.getTextureId(gl));
	        GLUES.gluHemisphere(gl, quadratic, false, radius, halfDivs, halfDivs);
	    }
	    
	    //Right Face
	    if(rightTextureIsValid)
	    {
	        gl.glBindTexture(GL10.GL_TEXTURE_2D, rightTexture.getTextureId(gl));
	        GLUES.gluHemisphere(gl, quadratic, true, radius, halfDivs, halfDivs);
	    }
	    
		gl.glDisable(GL10.GL_TEXTURE_2D);
    }
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:69,代码来源:PLSpherical2Panorama.java


注:本文中的com.panoramagl.enumerations.PLSpherical2FaceOrientation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。