/** * {@inheritDoc} * * @see org.eclipse.draw3d.AbstractSurface#getYAxis(org.eclipse.draw3d.geometry.Vector3f) */ @Override protected Vector3f getYAxis(Vector3f io_result) { ICamera camera = m_scene.getCamera(); Vector3f yAxis = camera.getUpVector(io_result); yAxis.scale(-1); return yAxis; }
/** * Creates a new void surface for the given scene. The given depth value specifies the distance of * the surface from the camera. * * @param i_host the host figure of this surface * @param i_scene the scene * @param i_depth the depth value of the surface */ public VoidSurface(IFigure3D i_host, IScene i_scene, float i_depth) { if (i_host == null) throw new NullPointerException("i_host must not be null"); if (i_scene == null) throw new NullPointerException("i_scene must not be null"); m_host = i_host; m_scene = i_scene; m_depth = i_depth; m_scene.getCamera().addCameraListener(m_cameraListener); }
/** * {@inheritDoc} * * @see org.eclipse.draw3d.ISurface#findFigureAt(int, int, org.eclipse.draw2d.TreeSearch) */ public IFigure findFigureAt(int i_sx, int i_sy, TreeSearch i_search) { Point sLocation = Draw3DCache.getPoint(); Vector3f rayPoint = Draw3DCache.getVector3f(); try { Picker picker = m_scene.getPicker(); ISurface currentSurface = picker.getCurrentSurface(); sLocation.setLocation(i_sx, i_sy); currentSurface.getWorldLocation(sLocation, rayPoint); Hit hit = picker.getHit(rayPoint, i_search); if (hit != null) return hit.getSearchResult(); if (i_search == null || (!i_search.prune(m_host) && i_search.accept(m_host))) return m_host; return null; } finally { Draw3DCache.returnPoint(sLocation); Draw3DCache.returnVector3f(rayPoint); } }
/** * {@inheritDoc} * * @see org.eclipse.draw3d.AbstractSurface#getZAxis(org.eclipse.draw3d.geometry.Vector3f) */ @Override protected Vector3f getZAxis(Vector3f io_result) { ICamera camera = m_scene.getCamera(); return camera.getViewDirection(io_result); }
/** * {@inheritDoc} * * @see org.eclipse.draw3d.AbstractSurface#getXAxis(org.eclipse.draw3d.geometry.Vector3f) */ @Override protected Vector3f getXAxis(Vector3f io_result) { ICamera camera = m_scene.getCamera(); return camera.getRightVector(io_result); }
/** * {@inheritDoc} * * @see org.eclipse.draw3d.AbstractSurface#getOrigin(org.eclipse.draw3d.geometry.Vector3f) */ @Override protected Vector3f getOrigin(Vector3f io_result) { ICamera camera = m_scene.getCamera(); return camera.unProject(0, 0, m_depth, null, io_result); }