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


Java PMatrix3D.scale方法代码示例

本文整理汇总了Java中processing.core.PMatrix3D.scale方法的典型用法代码示例。如果您正苦于以下问题:Java PMatrix3D.scale方法的具体用法?Java PMatrix3D.scale怎么用?Java PMatrix3D.scale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在processing.core.PMatrix3D的用法示例。


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

示例1: getProjection

import processing.core.PMatrix3D; //导入方法依赖的package包/类
public PMatrix3D getProjection(){
  pg_shadowmap.updateProjmodelview();

  // 1) create shadowmap matrix, 
  //    to transform positions from camera-space to the shadowmap-space (light-space)
  PMatrix3D mat_shadow = new PMatrix3D();
  // ndc (shadowmap) -> normalized (shadowmap) 
  //         [-1,+1] -> [0,1]
  mat_shadow.scale(0.5f);
  mat_shadow.translate(1,1,1);

  // model (world) -> modelview (shadowmap) -> ndc (shadowmap)
  mat_shadow.apply(pg_shadowmap.projection);
  
  return mat_shadow;
}
 
开发者ID:diwi,项目名称:PixelFlow,代码行数:17,代码来源:DwShadowMap.java

示例2: getShadowmapMatrix

import processing.core.PMatrix3D; //导入方法依赖的package包/类
public PMatrix3D getShadowmapMatrix(){
  // 1) create shadowmap matrix, 
  //    to transform positions from camera-space to the shadowmap-space (light-space)
  PMatrix3D mat_shadow = new PMatrix3D();
  // ndc (shadowmap) -> normalized (shadowmap) 
  //         [-1,+1] -> [0,1]
  mat_shadow.scale(0.5f);
  mat_shadow.translate(1,1,1);

  // model (world) -> modelview (shadowmap) -> ndc (shadowmap)
  mat_shadow.apply(pg_shadowmap.projmodelview);
  
  return mat_shadow;
}
 
开发者ID:diwi,项目名称:PixelFlow,代码行数:15,代码来源:DwShadowMap.java

示例3: applyTransformationTo

import processing.core.PMatrix3D; //导入方法依赖的package包/类
public void applyTransformationTo(PMatrix3D matrix) {
    matrix.translate(sceneTranslate.x, sceneTranslate.y, sceneTranslate.z);
    matrix.rotateX(sceneRotateX);
    matrix.rotateY(sceneRotateY);
    matrix.rotateZ(sceneRotateZ);
    matrix.scale(sceneScale);
}
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:8,代码来源:RSTTransform.java

示例4: update

import processing.core.PMatrix3D; //导入方法依赖的package包/类
private void update(PMatrix3D newPos, int id) {
    PMatrix3D transfo = (PMatrix3D) transfos.get(id);
    fr.inria.papart.multitouch.OneEuroFilter filter[] = filters.get(id);

    if (filter == null) {
        transfo.set(newPos);
    } else {
        try {
            // Rotation
            transfo.m00 = (float) filter[0].filter(newPos.m00);
            transfo.m01 = (float) filter[1].filter(newPos.m01);
            transfo.m02 = (float) filter[2].filter(newPos.m02);
            transfo.m10 = (float) filter[3].filter(newPos.m10);
            transfo.m11 = (float) filter[4].filter(newPos.m11);
            transfo.m12 = (float) filter[5].filter(newPos.m12);
            transfo.m20 = (float) filter[6].filter(newPos.m20);
            transfo.m21 = (float) filter[7].filter(newPos.m21);
            transfo.m22 = (float) filter[8].filter(newPos.m22);

            // Translation
            transfo.m03 = (float) filter[9].filter(newPos.m03);
            transfo.m13 = (float) filter[10].filter(newPos.m13);
            transfo.m23 = (float) filter[11].filter(newPos.m23);
        } catch (Exception e) {
            System.out.println("Filtering error " + e);
        }
    }
    
    float pageHeight = markersFromSVG.getSheetHeight();
    
    // Invert the scales so that it fits Inkscape's view. 
    transfo.scale(1, -1, 1);
    transfo.translate(0, -pageHeight, 0);        
}
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:35,代码来源:MarkerBoardSvg.java

示例5: getUnitSphereMatrix

import processing.core.PMatrix3D; //导入方法依赖的package包/类
public PMatrix3D getUnitSphereMatrix(){
  PMatrix3D mat = new PMatrix3D();
  mat.scale(1.0f/rad);
  mat.translate(-pos[0], -pos[1], -pos[2]);
  return mat;
}
 
开发者ID:diwi,项目名称:PixelFlow,代码行数:7,代码来源:DwBoundingSphere.java

示例6: initDraw

import processing.core.PMatrix3D; //导入方法依赖的package包/类
public void initDraw(Camera cam, PVector userPos, float nearPlane, float farPlane, boolean isAnaglyph, boolean isLeft, boolean isOnly) {

        PGraphicsOpenGL graphics = getGraphics();

        if (initPosM == null) {
            this.isOpenGL = true;
            // Transformation  Camera -> Marker

            initPosM = this.getLocation(cam);

            initPosM.translate(this.getDrawSizeX() / 2, this.getDrawSizeY() / 2);
            // All is relative to the paper's center. not the corner. 
            initPosM.scale(-1, 1, -1);

        }

        // get the current transformation... 
        PMatrix3D newPos = this.getLocation(cam);

        newPos.translate(this.getDrawSizeX() / 2, this.getDrawSizeY() / 2);
        newPos.scale(-1, 1, -1);

        newPos.invert();
        newPos.apply(initPosM);

        PVector user = new PVector();

        if (isAnaglyph && isLeft) {
            userPos.add(-halfEyeDist * 2, 0, 0);
        }
        newPos.mult(userPos, user);
        PVector paperCameraPos = user;

        // Camera must look perpendicular to the screen. 
        graphics.camera(paperCameraPos.x, paperCameraPos.y, paperCameraPos.z,
                paperCameraPos.x, paperCameraPos.y, 0,
                0, 1, 0);

        // http://www.gamedev.net/topic/597564-view-and-projection-matrices-for-vr-window-using-head-tracking/
        float nearFactor = nearPlane / paperCameraPos.z;

        float left = nearFactor * (-size.x / 2f - paperCameraPos.x);
        float right = nearFactor * (size.x / 2f - paperCameraPos.x);
        float top = nearFactor * (size.y / 2f - paperCameraPos.y);
        float bottom = nearFactor * (-size.y / 2f - paperCameraPos.y);

        graphics.frustum(left, right, bottom, top, nearPlane, farPlane);
        graphics.projection.m11 = -graphics.projection.m11;

        // No detection?
        PMatrix3D transformation = this.getLocation(cam);
        if (transformation.m03 == 0 && transformation.m13 == 0 && transformation.m23 == 0) {
            resetPos();
        }
    }
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:56,代码来源:Screen.java

示例7: update

import processing.core.PMatrix3D; //导入方法依赖的package包/类
private void update(ARToolKitPlus.ARMultiMarkerInfoT multiMarkerConfig, int id) {
        fr.inria.papart.multitouch.OneEuroFilter filter[] = filters.get(id);

        PMatrix3D inputMatrix = new PMatrix3D();

        if (filter == null) {
            inputMatrix.m00 = multiMarkerConfig.trans().get(0);
            inputMatrix.m01 = multiMarkerConfig.trans().get(1);
            inputMatrix.m02 = multiMarkerConfig.trans().get(2);
            inputMatrix.m03 = multiMarkerConfig.trans().get(3);

            inputMatrix.m10 = multiMarkerConfig.trans().get(4);
            inputMatrix.m11 = multiMarkerConfig.trans().get(5);
            inputMatrix.m12 = multiMarkerConfig.trans().get(6);
            inputMatrix.m13 = multiMarkerConfig.trans().get(7);

            inputMatrix.m20 = multiMarkerConfig.trans().get(8);
            inputMatrix.m21 = multiMarkerConfig.trans().get(9);
            inputMatrix.m22 = multiMarkerConfig.trans().get(10);
            inputMatrix.m23 = multiMarkerConfig.trans().get(11);
        } else {
            try {
                inputMatrix.m00 = (float) filter[0].filter(multiMarkerConfig.trans().get(0));
                inputMatrix.m01 = (float) filter[1].filter(multiMarkerConfig.trans().get(1));
                inputMatrix.m02 = (float) filter[2].filter(multiMarkerConfig.trans().get(2));
                inputMatrix.m03 = (float) filter[3].filter(multiMarkerConfig.trans().get(3));

                inputMatrix.m10 = (float) filter[4].filter(multiMarkerConfig.trans().get(4));
                inputMatrix.m11 = (float) filter[5].filter(multiMarkerConfig.trans().get(5));
                inputMatrix.m12 = (float) filter[6].filter(multiMarkerConfig.trans().get(6));
                inputMatrix.m13 = (float) filter[7].filter(multiMarkerConfig.trans().get(7));

                inputMatrix.m20 = (float) filter[8].filter(multiMarkerConfig.trans().get(8));
                inputMatrix.m21 = (float) filter[9].filter(multiMarkerConfig.trans().get(9));
                inputMatrix.m22 = (float) filter[10].filter(multiMarkerConfig.trans().get(10));
                inputMatrix.m23 = (float) filter[11].filter(multiMarkerConfig.trans().get(11));
            } catch (Exception e) {
                System.out.println("Filtering error " + e);
            }
        }

//        inputMatrix.translate(0, height / 2, 0);
//        inputMatrix.scale(1, -1, 1);
//        inputMatrix.translate(0, -height / 2, 0);
        // Invert the scales so that it fits Inkscape's view. 
        
        inputMatrix.scale(1, -1, 1);
        inputMatrix.translate(0, -markerBoardSize.y, 0);

        PMatrix3D transfo = transfos.get(id);
        transfo.set(inputMatrix);
//    Z negation ?
//        tmp.scale(1, 1, -1);
//        transfo[11] = -transfo[11];
    }
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:56,代码来源:MarkerBoardARToolKitPlus.java


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