congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
View
Code IndexAdd Tabnine to your IDE (free)

How to use
View
in
javax.media.j3d

Best Java code snippets using javax.media.j3d.View (Showing top 20 results out of 315)

origin: com.googlecode.princeton-java-introduction/stdlib

private static void setScreenScale (double scale) {
  double ratio = scale / view.getScreenScale();
  view.setScreenScale(scale);
  view.setFrontClipDistance(view.getFrontClipDistance() * ratio);
  view.setBackClipDistance(view.getBackClipDistance() * ratio);
}
origin: com.googlecode.princeton-java-introduction/stdlib

public void moveRelative (Vector3D move) {
  if ((view.getProjectionPolicy() == View.PARALLEL_PROJECTION)) {
    setScreenScale(view.getScreenScale() * (1 + move.z / zoom));
    super.move(super.relToAbs(move.times(1, 1, 0)));
  } else super.move(super.relToAbs(move.times(1, 1, -1)));
}
origin: com.googlecode.princeton-java-introduction/stdlib

/**
 * Sets the projection mode to perspective projection with the
 * given field of view. In this mode, closer objects appear
 * larger, as in real life. A larger field of view means that
 * there is more perspective distortion. Reasonable values are
 * between 0.5 and 3.0.
 * 
 * @param fov The field of view to use. Try [0.5-3.0].
 */
public static void setPerspectiveProjection (double fov) {
  view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
  view.setWindowEyepointPolicy(View.RELATIVE_TO_FIELD_OF_VIEW);
  view.setFieldOfView(fov);
  setScreenScale(1);
  orbit.setZoomEnable(true);
  perspectiveButton.setSelected(true);
  if ((Double)fovSpinner.getValue() != fov)
    fovSpinner.setValue(fov);
  //if (view.getProjectionPolicy() == View.PERSPECTIVE_PROJECTION) return;
}
origin: com.googlecode.princeton-java-introduction/stdlib

/** 
 * Sets the projection mode to orthographic projection.
 * In this mode, parallel lines remain parallel after
 * projection, and there is no perspective. It is as 
 * looking from infinitely far away with a telescope.
 * AutoCAD programs use this projection mode.
 */
public static void setParallelProjection () {
  if (view.getProjectionPolicy() == View.PARALLEL_PROJECTION) return;
  view.setProjectionPolicy(View.PARALLEL_PROJECTION);
  orbit.setZoomEnable(false);
  parallelButton.setSelected(true);
  setScreenScale(0.3 / zoom);
}
origin: org.fudaa.framework.ebli/ebli-3d

public BUnivers(final BCanvas3D _canvas) {
 canvas_ = _canvas;
 locale_ = new Locale(this);
 final ViewPlatform camera = new ViewPlatform();
 final BranchGroup viewGroup = new BranchGroup();
 final TransformGroup viewTg = new TransformGroup();
 viewTg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
 viewTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
 viewTg.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
 viewTg.addChild(camera);
 viewGroup.addChild(viewTg);
 final PhysicalBody body = new PhysicalBody();
 final PhysicalEnvironment env = new PhysicalEnvironment();
 final View view = new View();
 view.setPhysicalBody(body);
 view.setPhysicalEnvironment(env);
 view.setBackClipDistance(100);
 view.setFrontClipDistance(.1);
 view.addCanvas3D(canvas_);
 view.attachViewPlatform(camera);
 transformU_ = viewTg;
 position_ = new Vector3d();
 viewGroup.setCapability(BranchGroup.ALLOW_DETACH);
 locale_.addBranchGraph(viewGroup);
}
origin: eu.mihosoft.vrl/vrl

@Override
public void init(VCanvas3D canvas) {
  GraphicsConfigTemplate3D gct = new GraphicsConfigTemplate3D();
  gct.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
  this.canvas = canvas;
  canvas.setDoubleBuffered(true);
  
  // 12.05.2015 define default size since offscreencanvas will be null
  // otherwise
  // see: https://java.net/jira/browse/JAVA3D-386
  canvas.setSize(100, 100);
  canvas.getOffscreenCanvas3D().setDoubleBufferEnable(true);
  canvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
  offscreenCanvas = new VOffscreenCanvas3D(
      SimpleUniverse.getPreferredConfiguration());
  universe = new SimpleUniverse(getCanvas().getOffscreenCanvas3D());
  universe.getViewer().getView().addCanvas3D(offscreenCanvas);
  // offscreen rendering does not work with sceneantialiasing enabled!
  // universe.getViewer().getView().setSceneAntialiasingEnable(true);
  universe.getViewingPlatform().setNominalViewingTransform();
  universe.getViewer().getView().setMinimumFrameCycleTime(0);
  universe.getViewer().getView().setFrontClipDistance(0.1);
  universe.getViewer().getView().setBackClipDistance(100);
  BranchGroup scene = createSceneGraph();
  scene.compile();
  universe.addBranchGraph(scene);
}
origin: com.googlecode.princeton-java-introduction/stdlib

/**
 * Sets the scale for all three dimensions.
 * 
 * @param minimum The minimum value of each scale.
 * @param maximum The maximum value of each scale.
 */
public static void setScale (double minimum, double maximum) {
  min = minimum;
  max = maximum;
  zoom = (max - min) / 2;
  double center = min + zoom;
  //double nominalDist = camera.getPosition().z;
  camera.setPosition(center, center, zoom * (2 + Math.sqrt(2)));
  double orbitScale = 0.5 * zoom;
  orbit.setZoomFactor(orbitScale);
  orbit.setTransFactors(orbitScale, orbitScale);
  setOrbitCenter(new Point3d(center, center, center));
  view.setFrontClipDistance(DEFAULT_FRONT_CLIP * zoom);
  view.setBackClipDistance(DEFAULT_BACK_CLIP * zoom);
}
origin: org.fudaa.framework.ebli/ebli-3d

final double angleCamera = getCanvas3D().getView().getFieldOfView();
final double maxL = Math.max(deltaX, deltaY);
getCanvas3D().getView().setBackClipDistance(Math.abs(backClip));
getCanvas3D().getView().setFrontClipDistance(backClip / 100);
origin: com.googlecode.princeton-java-introduction/stdlib

/**
 * This method cannot be called directly.
 * @deprecated
 */
public void mouseWheelMoved (MouseWheelEvent e) {
  double notches = e.getWheelRotation();
  //System.out.println(notches);
  if ((cameraMode == ORBIT_MODE) && (view.getProjectionPolicy() == View.PARALLEL_PROJECTION)) {
    camera.moveRelative(0, 0, notches * zoom / 20);
  }
}
origin: com.googlecode.princeton-java-introduction/stdlib

private static Appearance createCustomAppearance (boolean fill) {
  Appearance ap = createBlankAppearance();
  PolygonAttributes pa = new PolygonAttributes();
  if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE);
  pa.setCullFace(PolygonAttributes.CULL_NONE);
  LineAttributes la = new LineAttributes();
  la.setLineWidth(penRadius);
  la.setLineAntialiasingEnable(view.getSceneAntialiasingEnable());
  PointAttributes poa = new PointAttributes();
  poa.setPointAntialiasingEnable(view.getSceneAntialiasingEnable());
  ap.setPolygonAttributes(pa);
  ap.setLineAttributes(la);
  ap.setPointAttributes(poa);
  Color3f col = new Color3f(penColor);
  Color3f black = new Color3f(0, 0, 0);
  Color3f specular = new Color3f(GRAY);
  // Material properties
  Material material = new Material(col, black, col, specular, 64);
  material.setCapability(Material.ALLOW_COMPONENT_READ);
  material.setCapability(Material.ALLOW_COMPONENT_WRITE);
  material.setLightingEnable(true);
  ap.setMaterial(material);
  return ap;
}
origin: org.fudaa.framework.ebli/ebli-3d

view.removeAllCanvas3Ds();
try {
 view.attachViewPlatform(null);
} catch (final RuntimeException _evt) {
origin: org.fudaa.framework.ebli/ebli-3d

BCanvas3DOffScreen(final BCanvas3D _init) {
 super(_init.getGraphicsConfiguration(), true);
 initDimensions(_init);
 _init.getView().addCanvas3D(this);
}
origin: eu.mihosoft.vrl/vrl

@Override
public void dispose() {
  if (universe != null) {
    universe.getViewer().getView().removeAllCanvas3Ds();
    universe.getViewer().setViewingPlatform(null);
    universe.removeAllLocales();
  }
}
origin: com.github.fracpete/princeton-java-stdlib

/**
 * Sets the scale for all three dimensions.
 * 
 * @param minimum The minimum value of each scale.
 * @param maximum The maximum value of each scale.
 */
public static void setScale (double minimum, double maximum) {
  min = minimum;
  max = maximum;
  zoom = (max - min) / 2;
  double center = min + zoom;
  //double nominalDist = camera.getPosition().z;
  camera.setPosition(center, center, zoom * (2 + Math.sqrt(2)));
  double orbitScale = 0.5 * zoom;
  orbit.setZoomFactor(orbitScale);
  orbit.setTransFactors(orbitScale, orbitScale);
  setOrbitCenter(new Point3d(center, center, center));
  view.setFrontClipDistance(DEFAULT_FRONT_CLIP * zoom);
  view.setBackClipDistance(DEFAULT_BACK_CLIP * zoom);
}
origin: com.github.fracpete/princeton-java-stdlib

/** 
 * Sets the projection mode to orthographic projection.
 * In this mode, parallel lines remain parallel after
 * projection, and there is no perspective. It is as 
 * looking from infinitely far away with a telescope.
 * AutoCAD programs use this projection mode.
 */
public static void setParallelProjection () {
  if (view.getProjectionPolicy() == View.PARALLEL_PROJECTION) return;
  view.setProjectionPolicy(View.PARALLEL_PROJECTION);
  orbit.setZoomEnable(false);
  parallelButton.setSelected(true);
  setScreenScale(0.3 / zoom);
}
origin: com.github.fracpete/princeton-java-stdlib

/**
 * This method cannot be called directly.
 * @deprecated
 */
public void mouseWheelMoved (MouseWheelEvent e) {
  double notches = e.getWheelRotation();
  //System.out.println(notches);
  if ((cameraMode == ORBIT_MODE) && (view.getProjectionPolicy() == View.PARALLEL_PROJECTION)) {
    camera.moveRelative(0, 0, notches * zoom / 20);
  }
}
origin: com.github.fracpete/princeton-java-stdlib

private static Appearance createCustomAppearance (boolean fill) {
  Appearance ap = createBlankAppearance();
  PolygonAttributes pa = new PolygonAttributes();
  if (!fill) pa.setPolygonMode(PolygonAttributes.POLYGON_LINE);
  pa.setCullFace(PolygonAttributes.CULL_NONE);
  LineAttributes la = new LineAttributes();
  la.setLineWidth(penRadius);
  la.setLineAntialiasingEnable(view.getSceneAntialiasingEnable());
  PointAttributes poa = new PointAttributes();
  poa.setPointAntialiasingEnable(view.getSceneAntialiasingEnable());
  ap.setPolygonAttributes(pa);
  ap.setLineAttributes(la);
  ap.setPointAttributes(poa);
  Color3f col = new Color3f(penColor);
  Color3f black = new Color3f(0, 0, 0);
  Color3f specular = new Color3f(GRAY);
  // Material properties
  Material material = new Material(col, black, col, specular, 64);
  material.setCapability(Material.ALLOW_COMPONENT_READ);
  material.setCapability(Material.ALLOW_COMPONENT_WRITE);
  material.setLightingEnable(true);
  ap.setMaterial(material);
  return ap;
}
origin: com.github.fracpete/princeton-java-stdlib

private static void setScreenScale (double scale) {
  double ratio = scale / view.getScreenScale();
  view.setScreenScale(scale);
  view.setFrontClipDistance(view.getFrontClipDistance() * ratio);
  view.setBackClipDistance(view.getBackClipDistance() * ratio);
}
origin: com.github.fracpete/princeton-java-stdlib

/**
 * Sets the projection mode to perspective projection with the
 * given field of view. In this mode, closer objects appear
 * larger, as in real life. A larger field of view means that
 * there is more perspective distortion. Reasonable values are
 * between 0.5 and 3.0.
 * 
 * @param fov The field of view to use. Try [0.5-3.0].
 */
public static void setPerspectiveProjection (double fov) {
  view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
  view.setWindowEyepointPolicy(View.RELATIVE_TO_FIELD_OF_VIEW);
  view.setFieldOfView(fov);
  setScreenScale(1);
  orbit.setZoomEnable(true);
  perspectiveButton.setSelected(true);
  if ((Double)fovSpinner.getValue() != fov)
    fovSpinner.setValue(fov);
  //if (view.getProjectionPolicy() == View.PERSPECTIVE_PROJECTION) return;
}
origin: com.github.fracpete/princeton-java-stdlib

public void moveRelative (Vector3D move) {
  if ((view.getProjectionPolicy() == View.PARALLEL_PROJECTION)) {
    setScreenScale(view.getScreenScale() * (1 + move.z / zoom));
    super.move(super.relToAbs(move.times(1, 1, 0)));
  } else super.move(super.relToAbs(move.times(1, 1, -1)));
}
javax.media.j3dView

Most used methods

  • setBackClipDistance
  • setFrontClipDistance
  • addCanvas3D
  • getBackClipDistance
  • getFrontClipDistance
  • getProjectionPolicy
  • getSceneAntialiasingEnable
  • getScreenScale
  • removeAllCanvas3Ds
  • setFieldOfView
  • setLocalEyeLightingEnable
  • setProjectionPolicy
  • setLocalEyeLightingEnable,
  • setProjectionPolicy,
  • setSceneAntialiasingEnable,
  • setScreenScale,
  • setScreenScalePolicy,
  • setTransparencySortingPolicy,
  • setWindowEyepointPolicy,
  • <init>,
  • attachViewPlatform,
  • getFieldOfView

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now