[openwonderland-modules] r2026 committed - contribute to open source

2 views
Skip to first unread message

openwonderl...@googlecode.com

unread,
May 30, 2014, 1:01:09 AM5/30/14
to openwonder...@googlegroups.com
Revision: 2026
Author: abhishek...@wishtreetech.com
Date: Fri May 30 05:00:39 2014 UTC
Log: contribute to open source
http://code.google.com/p/openwonderland-modules/source/detail?r=2026

Added:
/trunk/0.5/unstable/stereo-view/build.xml
/trunk/0.5/unstable/stereo-view/my.module.properties
/trunk/0.5/unstable/stereo-view/nbproject
/trunk/0.5/unstable/stereo-view/nbproject/project.xml
/trunk/0.5/unstable/stereo-view/src
/trunk/0.5/unstable/stereo-view/src/classes
/trunk/0.5/unstable/stereo-view/src/classes/org
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/ConfigureStereoViewFrame.form

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/ConfigureStereoViewFrame.java

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoCamera.java

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewEntity.java

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewFrame.form

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewFrame.java

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewPlugin.java

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/resources

/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties

=======================================
--- /dev/null
+++ /trunk/0.5/unstable/stereo-view/build.xml Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="wonderland-stereoview-module" default="dist" basedir=".">
+ <!-- current directory needed in all scripts -->
+ <dirname property="current.dir"
file="${ant.file.wonderland-stereoview-module}"/>
+
+ <!-- import properties from the common modules properties. These values
+ may overwrite some values in my.module.properties, such as the
+ location of the Wonderland directory in the case of the entire
modules
+ directory being checked out instead of an individual file -->
+ <!-- not yet in stable
+ <property file="${current.dir}/../modules-stable.properties"/>
+ -->
+
+ <!-- import properties for this module -->
+ <property file="${current.dir}/my.module.properties"/>
+
+ <property name="modules.dir" location="${wonderland.dir}/modules"/>
+ <property name="module.src" value="${module.plugin.src}"/>
+ <property name="module.jarname" value="${module.name}"/>
+
+ <pathconvert property="module-client.classpath">
+ <path
location="${modules.dir}/foundation/hud/build/client/hud-client.jar"/>
+ </pathconvert>
+
+ <!-- import common build file -->
+ <import
file="${modules.dir}/build-tools/build-scripts/module-build.xml"/>
+
+ <target name="build" depends="-module-init, -module-compile-common,
+ -module-compile-server,
+ -module-compile-client"/>
+
+ <target name="dist" depends="build">
+ <mkdir dir="${module.dist.dir}"/>
+
+ <module name="${module.name}" majorVersion="0" minorVersion="1"
jarfile="${module.dist.dir}/${module.name}.jar"
+ moduleDescription="${module.description}"
builddir="${build.dir}">
+
+ <client>
+ <clientjar name="${module.name}-client"
basedir="${build.classes.dir}">
+ <include name="${module.src}/client/**"/>
+ <fileset dir="${current.dir}/src/classes">
+ <include name="${module.src}/client/resources/**"/>
+ </fileset>
+ </clientjar>
+ </client>
+ </module>
+ </target>
+
+ <target name="clean" depends="-module-clean"/>
+ <target name="deploy" depends="dist, -module-deploy"/>
+</project>
=======================================
--- /dev/null
+++ /trunk/0.5/unstable/stereo-view/my.module.properties Fri May 30
05:00:39 2014 UTC
@@ -0,0 +1,32 @@
+#################################################################################################
+# my.module.properties - Property files for Wonderland module projects #
+# #
+# Customize the properties in this file for your module project. A
Wonderland module contains #
+# a collection art, plugins, and WFSs. This module project architecture
supports only one #
+# plugin. #
+#################################################################################################
+
+#
+# Property: module.name (required)
+# The unique name of the module
+#
+module.name=stereo-view
+
+#
+# Property: module.description (optional)
+# A textual description of the module
+#
+module.description=Second window with alternate view
+
+#
+# Property: wonderland.dir (required)
+# The location of the Wonderland source
+#
+wonderland.dir=${current.dir}/../../wonderland
+
+#
+# Property: module.plugin.src (optional)
+# Beneath src/classes/, where is the module code located (common/,
client/, server/)
+#
+module.plugin.src=org/jdesktop/wonderland/modules/stereoview
+
=======================================
--- /dev/null
+++ /trunk/0.5/unstable/stereo-view/nbproject/project.xml Fri May 30
05:00:39 2014 UTC
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data
xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>stereo-view</name>
+ </general-data>
+ <general-data
xmlns="http://www.netbeans.org/ns/freeform-project/2">
+ <!-- Do not use Project Properties customizer when editing
this file manually. -->
+ <name>stereo-view</name>
+ <properties/>
+ <folders>
+ <source-folder>
+ <label>stereo-view</label>
+ <location>.</location>
+ <encoding>UTF-8</encoding>
+ </source-folder>
+ <source-folder>
+ <label>src/classes</label>
+ <type>java</type>
+ <location>src/classes</location>
+ <encoding>UTF-8</encoding>
+ </source-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>dist</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>dist</target>
+ </action>
+ <action name="run.single">
+ <script>nbproject/ide-file-targets.xml</script>
+ <target>run-selected-file-in-classes</target>
+ <context>
+ <property>run.class</property>
+ <folder>src/classes</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/ide-file-targets.xml</script>
+ <target>debug-selected-file-in-classes</target>
+ <context>
+ <property>debug.class</property>
+ <folder>src/classes</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ </ide-actions>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>src/classes</label>
+ <location>src/classes</location>
+ </source-folder>
+ <source-file>
+ <location>build.xml</location>
+ </source-file>
+ <source-file>
+ <location>my.module.properties</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="clean"/>
+ <action>
+ <label>Deploy Module to Server</label>
+ <target>deploy</target>
+ </action>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data
xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
+ <compilation-unit>
+ <package-root>src/classes</package-root>
+ <classpath
mode="compile">../../wonderland/core/ext/common/mtgame.jar:../../wonderland/core/build/lib/wonderland-client.jar:../../wonderland/core/build/lib/wonderland-common.jar:../../wonderland/core/ext/jme20/target/jme.jar:../../wonderland/core/ext/common/javolution.jar:../../wonderland/core/ext/macosx/jars/jogl.jar</classpath>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/ConfigureStereoViewFrame.form
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,163 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.7"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.title"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_formBundle" type="java.lang.String"
value="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget"
type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle"
type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean"
value="false"/>
+ <AuxValue name="FormSettings_variablesModifier"
type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel1" min="-2" max="-2"
attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jLabel9" alignment="1" min="-2"
max="-2" attributes="0"/>
+ <Component id="jLabel2" alignment="1" min="-2"
max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="angle" min="-2" pref="89"
max="-2" attributes="1"/>
+ <Component id="dist" alignment="0" min="-2"
pref="89" max="-2" attributes="1"/>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel3" min="-2" max="-2"
attributes="0"/>
+ <Component id="jLabel4" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="cancelButton" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="okButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel2" min="-2" max="-2"
attributes="0"/>
+ <Component id="dist" alignment="0" min="-2" max="-2"
attributes="0"/>
+ <Component id="jLabel3" alignment="0" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel9" min="-2" max="-2"
attributes="0"/>
+ <Component id="angle" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <EmptySpace pref="33" max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="okButton" alignment="3" min="-2"
max="-2" attributes="0"/>
+ <Component id="cancelButton" alignment="3"
min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Component id="jLabel4" alignment="0" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.jLabel1.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="okButton">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.okButton.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="cancelButton">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.cancelButton.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="cancelButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel2">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.jLabel2.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JSpinner" name="dist">
+ <Properties>
+ <Property name="model" type="javax.swing.SpinnerModel"
editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="0.0" numberType="java.lang.Float"
stepSize="0.05" type="number"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel9">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.jLabel9.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JSpinner" name="angle">
+ <Properties>
+ <Property name="model" type="javax.swing.SpinnerModel"
editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="0.0" numberType="java.lang.Float"
stepSize="0.5" type="number"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.jLabel3.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel4">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="ConfigureStereoViewFrame.jLabel4.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/ConfigureStereoViewFrame.java
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,185 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * ConfigureStereoViewFrame.java
+ *
+ * Created on Sep 21, 2011, 4:27:18 PM
+ */
+package org.jdesktop.wonderland.modules.stereoview.client;
+
+import com.jme.math.FastMath;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author jkaplan
+ */
+public class ConfigureStereoViewFrame extends javax.swing.JFrame {
+ private final StereoViewPlugin plugin;
+ private final float origDist;
+ private final float origAngle;
+
+ /** Creates new form ConfigureStereoViewFrame */
+ public ConfigureStereoViewFrame(StereoViewPlugin plugin) {
+ this.plugin = plugin;
+ this.origDist = plugin.getDistance();
+ this.origAngle = plugin.getAngle();
+
+ initComponents();
+
+ dist.setValue(origDist);
+ angle.setValue(origAngle);
+
+ ChangeListener updateListener = new ChangeListener() {
+ public void stateChanged(ChangeEvent e) {
+ preview();
+ }
+ };
+
+ dist.addChangeListener(updateListener);
+ angle.addChangeListener(updateListener);
+ }
+
+ private void preview() {
+ plugin.setDistance((Float) dist.getValue());
+ plugin.setAngle(FastMath.DEG_TO_RAD * (Float) angle.getValue());
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated
Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ okButton = new javax.swing.JButton();
+ cancelButton = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ dist = new javax.swing.JSpinner();
+ jLabel9 = new javax.swing.JLabel();
+ angle = new javax.swing.JSpinner();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+
+
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ java.util.ResourceBundle bundle =
java.util.ResourceBundle.getBundle("org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle");
// NOI18N
+ setTitle(bundle.getString("ConfigureStereoViewFrame.title")); //
NOI18N
+
+
jLabel1.setText(bundle.getString("ConfigureStereoViewFrame.jLabel1.text"));
// NOI18N
+
+
okButton.setText(bundle.getString("ConfigureStereoViewFrame.okButton.text"));
// NOI18N
+ okButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ okButtonActionPerformed(evt);
+ }
+ });
+
+
cancelButton.setText(bundle.getString("ConfigureStereoViewFrame.cancelButton.text"));
// NOI18N
+ cancelButton.addActionListener(new java.awt.event.ActionListener()
{
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ cancelButtonActionPerformed(evt);
+ }
+ });
+
+
jLabel2.setText(bundle.getString("ConfigureStereoViewFrame.jLabel2.text"));
// NOI18N
+
+ dist.setModel(new
javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null,
Float.valueOf(0.05f)));
+
+
jLabel9.setText(bundle.getString("ConfigureStereoViewFrame.jLabel9.text"));
// NOI18N
+
+ angle.setModel(new
javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null,
Float.valueOf(0.5f)));
+
+
jLabel3.setText(bundle.getString("ConfigureStereoViewFrame.jLabel3.text"));
// NOI18N
+
+
jLabel4.setText(bundle.getString("ConfigureStereoViewFrame.jLabel4.text"));
// NOI18N
+
+ javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel9)
+ .addComponent(jLabel2))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(angle,
javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(dist,
javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel3)
+ .addComponent(jLabel4))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(cancelButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(okButton)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel2)
+ .addComponent(dist,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel3))
+ .addGap(17, 17, 17)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel9)
+ .addComponent(angle,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
33,
Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(okButton)
+ .addComponent(cancelButton)))
+ .addComponent(jLabel4))
+ .addContainerGap())
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void okButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_okButtonActionPerformed
+ preview();
+
+ setVisible(false);
+ dispose();
+ }//GEN-LAST:event_okButtonActionPerformed
+
+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent
evt) {//GEN-FIRST:event_cancelButtonActionPerformed
+ plugin.setDistance(origDist);
+ plugin.setAngle(origAngle);
+
+ setVisible(false);
+ dispose();
+ }//GEN-LAST:event_cancelButtonActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JSpinner angle;
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JSpinner dist;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel9;
+ private javax.swing.JButton okButton;
+ // End of variables declaration//GEN-END:variables
+}
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoCamera.java
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,99 @@
+/*
+ */
+package org.jdesktop.wonderland.modules.stereoview.client;
+
+import com.jme.math.Quaternion;
+import com.jme.math.Vector3f;
+import com.jme.scene.CameraNode;
+import org.jdesktop.wonderland.client.jme.ClientContextJME;
+import org.jdesktop.wonderland.client.jme.ThirdPersonCameraProcessor;
+
+/**
+ * A camera class that updates the position of two cameras based on
+ * an interaxial distance and an angle of rotation
+ * @author Jonathan Kaplan <jonat...@wonderbuilders.com>
+ */
+public class StereoCamera extends ThirdPersonCameraProcessor {
+ // second camera
+ private final CameraNode secondCam;
+
+ // first camera
+ private CameraNode firstCam;
+
+ // interaxial distance
+ private float dist = 0.0f;
+
+ // focus rotation
+ private float angle = 0.0f;
+
+ public StereoCamera(CameraNode secondCam) {
+ super();
+
+ this.secondCam = secondCam;
+ }
+
+ public synchronized float getAxialDistance() {
+ return dist;
+ }
+
+ public synchronized void setAxialDistance(float dist) {
+ this.dist = dist;
+
+ setCommitRequired();
+ }
+
+ public synchronized float getAngle() {
+ return angle;
+ }
+
+ public synchronized void setAngle(float angle) {
+ this.angle = angle;
+
+ setCommitRequired();
+ }
+
+ @Override
+ protected void setCameraPosition(Quaternion rotation, Vector3f
translation) {
+ float fDist = getAxialDistance() / 2.0f;
+ float fAngle = getAngle() / 2.0f;
+
+ // calculate the distance at the current location, rotated to the
+ // correct angle
+ Vector3f vDist = new Vector3f(fDist, 0f, 0f);
+ rotation.multLocal(vDist);
+
+ // update translations based on offset
+ Vector3f firstCamTrans = new Vector3f(translation);
+ firstCamTrans.addLocal(vDist);
+
+ Vector3f secondCamTrans = new Vector3f(translation);
+ secondCamTrans.subtractLocal(vDist);
+
+ // update rotations
+ Quaternion firstCamRot = new Quaternion();
+ firstCamRot.fromAngleAxis(-fAngle, Vector3f.UNIT_Y);
+ firstCamRot = rotation.mult(firstCamRot);
+
+ Quaternion secondCamRot = new Quaternion();
+ secondCamRot.fromAngleAxis(fAngle, Vector3f.UNIT_Y);
+ secondCamRot = rotation.mult(secondCamRot);
+
+ firstCam.setLocalRotation(firstCamRot);
+ firstCam.setLocalTranslation(firstCamTrans);
+
+ secondCam.setLocalRotation(secondCamRot);
+ secondCam.setLocalTranslation(secondCamTrans);
+
+ // make sure to update the second camera position
+ ClientContextJME.getWorldManager().addToUpdateList(secondCam);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled, CameraNode cameraNode) {
+ super.setEnabled(enabled, cameraNode);
+
+ if (enabled) {
+ this.firstCam = cameraNode;
+ }
+ }
+}
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewEntity.java
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,314 @@
+/**
+ */
+package org.jdesktop.wonderland.modules.stereoview.client;
+
+import com.jme.image.Texture;
+import com.jme.image.Texture.Type;
+import com.jme.math.Quaternion;
+import com.jme.math.Vector3f;
+import com.jme.scene.CameraNode;
+import com.jme.scene.Node;
+import com.jme.scene.state.jogl.JOGLTextureState;
+import com.jme.util.geom.BufferUtils;
+import java.awt.image.ImageConsumer;
+import java.awt.image.ImageProducer;
+import java.awt.image.MemoryImageSource;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import java.util.logging.Logger;
+import javax.media.opengl.GL;
+import javax.media.opengl.glu.GLU;
+import org.jdesktop.mtgame.Entity;
+import org.jdesktop.wonderland.client.jme.ClientContextJME;
+import org.jdesktop.mtgame.CameraComponent;
+import org.jdesktop.mtgame.RenderManager;
+import org.jdesktop.mtgame.RenderUpdater;
+import org.jdesktop.mtgame.TextureRenderBuffer;
+import org.jdesktop.mtgame.processor.WorkProcessor.WorkCommit;
+import org.jdesktop.wonderland.client.jme.SceneWorker;
+import org.jdesktop.wonderland.client.jme.ViewManager;
+import org.jdesktop.wonderland.client.jme.ViewProperties;
+import org.jdesktop.wonderland.common.cell.CellTransform;
+
+/**
+ */
+public class StereoViewEntity extends Entity
+ implements RenderUpdater, ImageProducer
+{
+ private static final Logger LOGGER =
+ Logger.getLogger(StereoViewEntity.class.getName());
+
+ // The scene graph node for the position of the camera
+ private final Node cameraPosition;
+
+ // the actual camera node
+ private final CameraNode cameraNode;
+
+ // The camera component
+ private final CameraComponent cameraComponent;
+
+ // The byte array into which the camera data is copied
+ private final int[] pixels;
+
+ // The buffer into which the camera is renderer, so we can copy it into
+ // a BufferedImage
+ private final TextureRenderBuffer textureBuffer;
+
+ // image source
+ private final MemoryImageSource imageSource;
+
+ // the stereo camera
+ private final StereoCamera stereoCam;
+
+ // whether this entity is enabled
+ private boolean enabled = false;
+
+ public StereoViewEntity(int width, int height)
+ {
+ super("Stereo View Entity");
+
+ this.cameraPosition = new Node("Stereo View Camera");
+ this.cameraNode = new CameraNode();
+ cameraPosition.attachChild(cameraNode);
+
+ ViewProperties viewProps =
ViewManager.getViewManager().getViewProperties();
+ this.cameraComponent = createCameraComponent(cameraPosition,
cameraNode,
+ width, height,
viewProps);
+ addComponent(CameraComponent.class, cameraComponent);
+
+ this.textureBuffer = createTextureBuffer(width, height,
cameraComponent);
+ this.stereoCam = new StereoCamera(cameraNode);
+
+ this.pixels = new int[width * height];
+ this.imageSource = new MemoryImageSource(width, height, pixels, 0,
width);
+ this.imageSource.setAnimated(true);
+ }
+
+ public synchronized void setAngle(float angle) {
+ stereoCam.setAngle(angle);
+ }
+
+ public synchronized float getAngle() {
+ return stereoCam.getAngle();
+ }
+
+ public synchronized void setDistance(float distance) {
+ stereoCam.setAxialDistance(distance);
+ }
+
+ public synchronized float getDistance() {
+ return stereoCam.getAxialDistance();
+ }
+
+ public synchronized void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+
+ if (enabled) {
+ // register listeners
+ getTextureBuffer().setRenderUpdater(this);
+ getTextureBuffer().setEnable(true);
+ ViewManager.getViewManager().setCameraController(stereoCam);
+ } else {
+ // unregiester listeners
+
ViewManager.getViewManager().setCameraController(ViewManager.getDefaultCamera());
+ getTextureBuffer().setEnable(false);
+ getTextureBuffer().setRenderUpdater(null);
+
+ }
+ }
+
+ public synchronized boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Get the texture buffer
+ * @return the texture buffer
+ */
+ protected TextureRenderBuffer getTextureBuffer() {
+ return textureBuffer;
+ }
+
+ /**
+ * Get the current camera position
+ * @return the camera position node
+ */
+ protected Node getCameraPosition() {
+ return cameraPosition;
+ }
+
+ /**
+ * Get the actual camera node
+ * @return the camera node
+ */
+ protected CameraNode getCameraNode() {
+ return cameraNode;
+ }
+
+ /**
+ * Get the current camera component
+ * @return the camera component
+ */
+ protected CameraComponent getCameraComponent() {
+ return cameraComponent;
+ }
+
+ /**
+ * Create a camera component
+ * @param cameraPosition the camera node to attach this component to
+ * @param cameraNode the actual camera node
+ * @param width the width of the image
+ * @param height the height of the image
+ * @param viewProps the view properties for the camera
+ * @return a camera component
+ */
+ private static CameraComponent createCameraComponent(Node
cameraPosition,
+ CameraNode cameraNode, int width, int height, ViewProperties
viewProps)
+ {
+ RenderManager rm =
ClientContextJME.getWorldManager().getRenderManager();
+ float aspectRatio = (float) width / height;
+
+ // Create a camera component and associated with the texture
buffer we
+ // have created.
+ return rm.createCameraComponent(
+ cameraPosition, // The Node of the camera
scene graph
+ cameraNode, // The Camera
+ width, // Viewport width
+ height, // Viewport height
+ viewProps.getFieldOfView(), // Field of view
+ aspectRatio, // Aspect ratio
+ viewProps.getFrontClip(), // Front clip
+ viewProps.getBackClip(), // Rear clip
+ false // Primary?
+ );
+ }
+
+ /**
+ * Create a texture buffer for the given image
+ * @param width the width of the image
+ * @param height the height of the image
+ * @return a texture buffer for that image
+ */
+ private static TextureRenderBuffer createTextureBuffer(int width, int
height,
+ CameraComponent
cc)
+ {
+ RenderManager rm =
ClientContextJME.getWorldManager().getRenderManager();
+ TextureRenderBuffer out = new PackedTextureRenderBuffer(width,
height);
+ out.setIncludeOrtho(true);
+
+ // Associated the texture buffer with the render manager, but keep
it
+ // off initially.
+ out.setEnable(false);
+ out.setCameraComponent(cc);
+ rm.addRenderBuffer(out);
+
+ return out;
+ }
+
+ /**
+ * Dispose of any resources associated with this entity. Once called,
the
+ * Entity can no longer be used.
+ */
+ public void dispose() {
+ // Remove the listener from the view cell, if there is one
+ setEnabled(false);
+
+ // Remove the render buffer to clean it up
+ RenderManager rm =
ClientContextJME.getWorldManager().getRenderManager();
+ rm.removeRenderBuffer(getTextureBuffer());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update(Object arg0) {
+ // Take the latest from the texture buffer into which we rendered
+ // the camera and draw it into the image
+ IntBuffer ib = getTextureBuffer().getTextureData().asIntBuffer();
+ ib.rewind();
+ ib.get(pixels);
+ imageSource.newPixels();
+ }
+
+ /**
+ * Camera update method. Must be called on MT-Game render thread
+ * @param camera the camera position
+ */
+// public void cameraMoved(CellTransform camera) {
+// // start with the camera position
+// Vector3f translation = camera.getTranslation(null);
+// Quaternion rotation = camera.getRotation(null);
+// Vector3f scale = camera.getScaling(null);
+//
+// // apply the offset
+// CellTransform off = getOffset();
+// translation.addLocal(off.getTranslation(null));
+// rotation.multLocal(off.getRotation(null));
+// scale.mult(off.getScaling());
+//
+// Node pos = getCameraPosition();
+// pos.setLocalTranslation(translation);
+// pos.setLocalRotation(rotation);
+// pos.setLocalScale(scale);
+// ClientContextJME.getWorldManager().addToUpdateList(pos);
+// }
+
+ public void addConsumer(ImageConsumer ic) {
+ imageSource.addConsumer(ic);
+ }
+
+ public boolean isConsumer(ImageConsumer ic) {
+ return imageSource.isConsumer(ic);
+ }
+
+ public void removeConsumer(ImageConsumer ic) {
+ imageSource.removeConsumer(ic);
+ }
+
+ public void startProduction(ImageConsumer ic) {
+ imageSource.startProduction(ic);
+ }
+
+ public void requestTopDownLeftRightResend(ImageConsumer ic) {
+ imageSource.requestTopDownLeftRightResend(ic);
+ }
+
+ private static class PackedTextureRenderBuffer extends
TextureRenderBuffer {
+ private ByteBuffer readBuffer;
+
+ public PackedTextureRenderBuffer(int width, int height) {
+ super (Target.TEXTURE_2D, width, height, 0);
+ }
+
+ @Override
+ protected ByteBuffer allocateTextureData(GL gl, Texture t, Type
type) {
+ int components = GL.GL_RGBA8;
+ int format = GL.GL_RGBA;
+ int dataType = GL.GL_UNSIGNED_BYTE;
+
+ Texture.RenderToTextureType rttType =
Texture.RenderToTextureType.RGBA;
+ t.setRenderToTextureType(rttType);
+
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, components, getWidth(),
getHeight(), 0,
+ format, dataType, null);
+
+ if (t.getMinificationFilter().usesMipMapLevels()) {
+ gl.glGenerateMipmapEXT(GL.GL_TEXTURE_2D);
+ }
+
+ readBuffer =
BufferUtils.createByteBuffer(getWidth()*getHeight()*4);
+ return readBuffer;
+ }
+
+ @Override
+ public ByteBuffer getTextureData() {
+ GL gl = GLU.getCurrentGL();
+
+ JOGLTextureState.doTextureBind(getTexture().getTextureId(), 0,
Texture.Type.TwoDimensional);
+ gl.glGetTexImage(GL.GL_TEXTURE_2D, 0, GL.GL_BGRA,
GL.GL_UNSIGNED_INT_8_8_8_8_REV, readBuffer.asIntBuffer());
+
+ //System.out.println("GetErroe: " + gl.glGetError());
+ return (readBuffer);
+ }
+ }
+}
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewFrame.form
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,166 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.7"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <NonVisualComponents>
+ <Menu class="javax.swing.JMenuBar" name="jMenuBar1">
+ <SubComponents>
+ <Menu class="javax.swing.JMenu" name="jMenu1">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu1.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu2">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu2.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu3">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu3.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu4">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu4.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu5">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu5.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu6">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu6.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu7">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu7.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ <Menu class="javax.swing.JMenu" name="jMenu8">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jMenu8.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Menu>
+ </SubComponents>
+ </Menu>
+ </NonVisualComponents>
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.title"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ <Property name="resizable" type="boolean" value="false"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="menuBar" type="java.lang.String"
value="jMenuBar1"/>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_formBundle" type="java.lang.String"
value="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget"
type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle"
type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean"
value="false"/>
+ <AuxValue name="FormSettings_variablesModifier"
type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout
class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="serverPanel">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border"
editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border
info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="5" left="5" right="5" top="5"/>
+ </Border>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension"
editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[35, 35]"/>
+ </Property>
+ <Property name="size" type="java.awt.Dimension"
editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[0, 0]"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"
value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="North"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout
class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jLabel1.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"
value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="West"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButton1">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.jButton1.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"
value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="East"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="locationTF">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.locationTF.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"
value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JLabel" name="viewLabel">
+ <Properties>
+ <Property name="horizontalAlignment" type="int" value="0"/>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties"
key="StereoViewFrame.viewLabel.text"
replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"
value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ </SubComponents>
+</Form>
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewFrame.java
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,129 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * StereoViewFrame.java
+ *
+ * Created on Sep 21, 2011, 3:30:18 PM
+ */
+package org.jdesktop.wonderland.modules.stereoview.client;
+
+import java.awt.Image;
+import javax.swing.ImageIcon;
+
+/**
+ *
+ * @author jkaplan
+ */
+public class StereoViewFrame extends javax.swing.JFrame {
+ private final Image image;
+
+ /** Creates new form StereoViewFrame */
+ public StereoViewFrame(Image image) {
+ this.image = image;
+
+ initComponents();
+
+ viewLabel.setText("");
+ viewLabel.setIcon(new ImageIcon(image));
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated
Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ serverPanel = new javax.swing.JPanel();
+ jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ locationTF = new javax.swing.JTextField();
+ viewLabel = new javax.swing.JLabel();
+ jMenuBar1 = new javax.swing.JMenuBar();
+ jMenu1 = new javax.swing.JMenu();
+ jMenu2 = new javax.swing.JMenu();
+ jMenu3 = new javax.swing.JMenu();
+ jMenu4 = new javax.swing.JMenu();
+ jMenu5 = new javax.swing.JMenu();
+ jMenu6 = new javax.swing.JMenu();
+ jMenu7 = new javax.swing.JMenu();
+ jMenu8 = new javax.swing.JMenu();
+
+
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ java.util.ResourceBundle bundle =
java.util.ResourceBundle.getBundle("org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle");
// NOI18N
+ setTitle(bundle.getString("StereoViewFrame.title")); // NOI18N
+ setResizable(false);
+
+
serverPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5,
5));
+ serverPanel.setPreferredSize(new java.awt.Dimension(35, 35));
+ serverPanel.setSize(new java.awt.Dimension(0, 0));
+ serverPanel.setLayout(new java.awt.BorderLayout());
+
+ jLabel1.setText(bundle.getString("StereoViewFrame.jLabel1.text"));
// NOI18N
+ serverPanel.add(jLabel1, java.awt.BorderLayout.WEST);
+
+
jButton1.setText(bundle.getString("StereoViewFrame.jButton1.text")); //
NOI18N
+ serverPanel.add(jButton1, java.awt.BorderLayout.EAST);
+
+
locationTF.setText(bundle.getString("StereoViewFrame.locationTF.text")); //
NOI18N
+ serverPanel.add(locationTF, java.awt.BorderLayout.CENTER);
+
+ getContentPane().add(serverPanel, java.awt.BorderLayout.NORTH);
+
+
viewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+
viewLabel.setText(bundle.getString("StereoViewFrame.viewLabel.text")); //
NOI18N
+ getContentPane().add(viewLabel, java.awt.BorderLayout.CENTER);
+
+ jMenu1.setText(bundle.getString("StereoViewFrame.jMenu1.text"));
// NOI18N
+ jMenuBar1.add(jMenu1);
+
+ jMenu2.setText(bundle.getString("StereoViewFrame.jMenu2.text"));
// NOI18N
+ jMenuBar1.add(jMenu2);
+
+ jMenu3.setText(bundle.getString("StereoViewFrame.jMenu3.text"));
// NOI18N
+ jMenuBar1.add(jMenu3);
+
+ jMenu4.setText(bundle.getString("StereoViewFrame.jMenu4.text"));
// NOI18N
+ jMenuBar1.add(jMenu4);
+
+ jMenu5.setText(bundle.getString("StereoViewFrame.jMenu5.text"));
// NOI18N
+ jMenuBar1.add(jMenu5);
+
+ jMenu6.setText(bundle.getString("StereoViewFrame.jMenu6.text"));
// NOI18N
+ jMenuBar1.add(jMenu6);
+
+ jMenu7.setText(bundle.getString("StereoViewFrame.jMenu7.text"));
// NOI18N
+ jMenuBar1.add(jMenu7);
+
+ jMenu8.setText(bundle.getString("StereoViewFrame.jMenu8.text"));
// NOI18N
+ jMenuBar1.add(jMenu8);
+
+ setJMenuBar(jMenuBar1);
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JMenu jMenu1;
+ private javax.swing.JMenu jMenu2;
+ private javax.swing.JMenu jMenu3;
+ private javax.swing.JMenu jMenu4;
+ private javax.swing.JMenu jMenu5;
+ private javax.swing.JMenu jMenu6;
+ private javax.swing.JMenu jMenu7;
+ private javax.swing.JMenu jMenu8;
+ private javax.swing.JMenuBar jMenuBar1;
+ private javax.swing.JTextField locationTF;
+ private javax.swing.JPanel serverPanel;
+ private javax.swing.JLabel viewLabel;
+ // End of variables declaration//GEN-END:variables
+
+}
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/StereoViewPlugin.java
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,223 @@
+package org.jdesktop.wonderland.modules.stereoview.client;
+
+import java.awt.Canvas;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.geom.AffineTransform;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImageFilter;
+import java.awt.image.FilteredImageSource;
+import java.awt.image.ImageProducer;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.SwingUtilities;
+import org.jdesktop.wonderland.client.BaseClientPlugin;
+import org.jdesktop.wonderland.client.jme.JmeClientMain;
+import org.jdesktop.wonderland.common.annotation.Plugin;
+
+/**
+ * Plugin for stereo view
+ * @author Jonathan Kaplan <jonat...@wonderbuilders.com>
+ */
+@Plugin
+public class StereoViewPlugin extends BaseClientPlugin {
+
+ // The error logger
+ private static Logger LOGGER =
+ Logger.getLogger(StereoViewPlugin.class.getName());
+
+ // The I18N resource bundle
+ private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(
+ "org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle");
+
+ // The menu item to add to the Windows menu
+ private JCheckBoxMenuItem stereoMI = null;
+ private JCheckBoxMenuItem configMI = null;
+
+
+ // The entity for viewing
+ private StereoViewEntity entity = null;
+
+ // the view frame
+ private StereoViewFrame frame = null;
+
+ // the configure frame
+ private ConfigureStereoViewFrame config = null;
+
+ // the inter axial distance
+ private float dist;
+
+ // the angle
+ private float angle;
+
+ @Override
+ protected void activate() {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ stereoMI = new
JCheckBoxMenuItem(BUNDLE.getString("Stereo_View"));
+ stereoMI.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ setWindowVisible(stereoMI.isSelected());
+ }
+ });
+
+ configMI = new
JCheckBoxMenuItem(BUNDLE.getString("Stereo_View_Config"));
+ configMI.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ setConfigVisible(configMI.isSelected());
+ }
+ });
+
+ JmeClientMain.getFrame().addToWindowMenu(stereoMI, 500);
+ JmeClientMain.getFrame().addToWindowMenu(configMI, 501);
+ }
+ });
+ }
+
+ @Override
+ protected void deactivate() {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ setWindowVisible(false);
+ setConfigVisible(false);
+
+ if (stereoMI != null) {
+
JmeClientMain.getFrame().removeFromWindowMenu(stereoMI);
+ stereoMI = null;
+ }
+
+ if (configMI != null) {
+
JmeClientMain.getFrame().removeFromWindowMenu(configMI);
+ configMI = null;
+ }
+ }
+ });
+ }
+
+ synchronized void setDistance(float dist) {
+ this.dist = dist;
+
+ if (entity != null) {
+ entity.setDistance(dist);
+ }
+ }
+
+ synchronized float getDistance() {
+ return dist;
+ }
+
+ synchronized void setAngle(float angle) {
+ this.angle = angle;
+
+ if (entity != null) {
+ entity.setAngle(angle);
+ }
+ }
+
+ synchronized float getAngle() {
+ return angle;
+ }
+
+ // must be called on AWT event thread
+ private void setWindowVisible(boolean visible) {
+ if (visible) {
+ if (entity != null) {
+ throw new IllegalStateException("Entity already created");
+ }
+
+ // create the image
+ Canvas canvas = JmeClientMain.getFrame().getCanvas();
+
+ synchronized (this) {
+ entity = new StereoViewEntity(canvas.getWidth(),
canvas.getHeight());
+ frame = new StereoViewFrame(createImage(entity,
+ canvas.getWidth(),
canvas.getHeight()));
+ }
+
+ entity.setDistance(getDistance());
+ entity.setAngle(getAngle());
+ entity.setEnabled(true);
+
+ frame.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ LOGGER.warning("Stereo window closing");
+
+ // uncheck the checkbox, which should also dispose of
+ // the frame
+ if (stereoMI != null) {
+ stereoMI.setSelected(false);
+ }
+
+ if (entity != null) {
+ setWindowVisible(false);
+ }
+ }
+ });
+
+ frame.setSize(JmeClientMain.getFrame().getFrame().getSize());
+ frame.setVisible(true);
+ } else {
+ if (entity == null) {
+ // already disposed
+ return;
+ }
+
+ frame.dispose();
+ entity.dispose();
+
+ synchronized (this) {
+ frame = null;
+ entity = null;
+ }
+ }
+ }
+
+ private Image createImage(ImageProducer producer, int width, int
height) {
+ AffineTransform tx = AffineTransform.getScaleInstance(1.0, -1.0);
+ tx.translate(0, -height);
+ AffineTransformOp txop = new AffineTransformOp(tx,
AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
+
+ FilteredImageSource src = new FilteredImageSource(producer,
+ new BufferedImageFilter(txop));
+ return Toolkit.getDefaultToolkit().createImage(src);
+ }
+
+ // must be called on awt event thread
+ private void setConfigVisible(boolean visible) {
+ if (visible) {
+ if (config != null) {
+ config.toFront();
+ } else {
+ config = new ConfigureStereoViewFrame(this);
+ config.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ LOGGER.warning("Config window closing");
+
+ if (configMI != null) {
+ configMI.setSelected(false);
+ }
+
+ if (config != null) {
+ config = null;
+ }
+ }
+ });
+
+ config.pack();
+ config.setVisible(true);
+ }
+ } else {
+ if (config != null) {
+ config.dispose();
+ config = null;
+ }
+ }
+ }
+}
=======================================
--- /dev/null
+++
/trunk/0.5/unstable/stereo-view/src/classes/org/jdesktop/wonderland/modules/stereoview/client/resources/Bundle.properties
Fri May 30 05:00:39 2014 UTC
@@ -0,0 +1,23 @@
+Stereo_View=Stereo View
+Stereo_View_Config=Configure Stereo View...
+StereoViewFrame.jMenu1.text=File
+StereoViewFrame.viewLabel.text=Content
+StereoViewFrame.jMenu6.text=Tools
+StereoViewFrame.jMenu7.text=Window
+StereoViewFrame.jMenu2.text=Edit
+StereoViewFrame.jMenu3.text=View
+StereoViewFrame.jMenu4.text=Insert
+StereoViewFrame.jMenu5.text=Placemarks
+StereoViewFrame.jMenu8.text=Help
+ConfigureStereoViewFrame.title=Configure Stereo View
+ConfigureStereoViewFrame.jLabel1.text=Stereo View Configuration
+ConfigureStereoViewFrame.okButton.text=OK
+ConfigureStereoViewFrame.cancelButton.text=Cancel
+StereoViewFrame.title=Wonderland
+StereoViewFrame.jLabel1.text=Location:
+StereoViewFrame.jButton1.text=Go!
+StereoViewFrame.locationTF.text=
+ConfigureStereoViewFrame.jLabel2.text=Inter-Axial Distance:
+ConfigureStereoViewFrame.jLabel9.text=Angle:
+ConfigureStereoViewFrame.jLabel3.text=Meters
+ConfigureStereoViewFrame.jLabel4.text=Degrees
Reply all
Reply to author
Forward
0 new messages