├── dist
├── icon256.png
├── meshes.zip
└── siteplan.jpg
├── src
└── org
│ └── twak
│ └── siteplan
│ ├── resources
│ ├── icon32.png
│ ├── icon256.png
│ └── help.txt
│ ├── jme
│ ├── resources
│ │ ├── east.png
│ │ ├── top.png
│ │ ├── west.png
│ │ ├── bottom.png
│ │ ├── grass.png
│ │ ├── north.png
│ │ ├── south.png
│ │ ├── dof_simple.vert
│ │ ├── dof_1_depth.vert
│ │ ├── dof_1_depth.frag
│ │ ├── bloom_final.frag
│ │ ├── dof_fullscreen.frag
│ │ ├── bloom_blur.vert
│ │ ├── bloom_extract.vert
│ │ ├── bloom_final.vert
│ │ ├── dof_fullscreen.vert
│ │ ├── sketch_sobel.vert
│ │ ├── sketch_norm.frag
│ │ ├── bloom_extract.frag
│ │ ├── sketch_norm.vert
│ │ ├── bloom_blur_horizontal5.frag
│ │ ├── motionblur.frag
│ │ ├── bloom_blur_vertical5.frag
│ │ ├── bloom_blur_horizontal7.frag
│ │ ├── bloom_blur_vertical7.frag
│ │ ├── bloom_blur_horizontal9.frag
│ │ ├── bloom_blur_vertical9.frag
│ │ ├── sketch_sobel.frag
│ │ ├── motionblur.vert
│ │ ├── bloom_blur.frag
│ │ └── dof_3_dof_2.frag
│ ├── PillarFeature.java
│ └── Jme.java
│ ├── tags
│ ├── LowPriorityTag.java
│ ├── RoofTag.java
│ ├── SubdivideTag.java
│ ├── PlanTag.java
│ ├── SubdivideTagUI.form
│ ├── SubdivideTagUI.java
│ ├── JStringProfileCheckItem.form
│ ├── JStringProfileCheckMap.form
│ └── JStringProfileCheckMap.java
│ ├── anchors
│ ├── VerticalMeshShip.java
│ ├── ProfileAnchor.java
│ ├── ProfileAnchorUI.java
│ ├── Anchor.java
│ ├── NaturalStepShipHACK.java
│ ├── JProfileProfileItem.form
│ ├── AnchorUI.form
│ ├── AnimateAnchorShipUI.form
│ ├── PlanSpeedWidget.form
│ ├── JProfileProfileMap.java
│ ├── CapShip.java
│ ├── AnimateAnchorShipUI.java
│ ├── SubdivideShipUI.form
│ ├── AnchorUI.java
│ ├── AnimateAnchorCircularShipUI.form
│ ├── NaturalStepPanel.form
│ ├── FaceMergeGraph.java
│ └── SubdivideShipUI.java
│ ├── campskeleton
│ ├── Tool.java
│ ├── WindowSkeleton.java
│ ├── CapFeature.java
│ ├── TagsFeaturesUI.form
│ ├── TagsFeaturesUI.java
│ ├── CapFeatureFactory.java
│ ├── Global.java
│ ├── ForcedUI.java
│ ├── AboutBox.form
│ ├── StepUI.java
│ └── ClipperDebug.java
│ ├── junk
│ ├── SelectableComponent.java
│ ├── PlanFeature.java
│ ├── ForcedStep.java
│ ├── NaturalFeature.java
│ ├── TagFeatureList.form
│ ├── JWindow.java
│ ├── SaturdayEditor.form
│ ├── AlgoElement.form
│ ├── TagFeatureList.java
│ ├── JDirection.java
│ ├── DirectionUI.form
│ ├── AlgoElement.java
│ └── JDirectionRack.java
│ └── anim
│ ├── APlanBoxes.java
│ └── JSimpleList.form
├── .idea
├── encodings.xml
├── vcs.xml
├── misc.xml
└── compiler.xml
├── .gitignore
├── README.md
└── pom.xml
/dist/icon256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/dist/icon256.png
--------------------------------------------------------------------------------
/dist/meshes.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/dist/meshes.zip
--------------------------------------------------------------------------------
/dist/siteplan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/dist/siteplan.jpg
--------------------------------------------------------------------------------
/src/org/twak/siteplan/resources/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/resources/icon32.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/east.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/east.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/top.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/west.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/west.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/resources/icon256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/resources/icon256.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/bottom.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/grass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/grass.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/north.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/north.png
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/south.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twak/siteplan/HEAD/src/org/twak/siteplan/jme/resources/south.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/LowPriorityTag.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.tags;
2 |
3 | /**
4 | *
5 | * @author twak
6 | */
7 | public class LowPriorityTag extends PlanTag
8 | {
9 | public LowPriorityTag()
10 | {
11 | super ("low priority");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/PillarFeature.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.jme;
2 |
3 | import org.twak.camp.Tag;
4 |
5 | /**
6 | *
7 | * @author twak
8 | */
9 | public class PillarFeature extends Tag
10 | {
11 | public PillarFeature (String name)
12 | {
13 | super (name);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/VerticalMeshShip.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | /**
4 | *
5 | * @author twak
6 | */
7 | public class VerticalMeshShip extends MeshShip
8 | {
9 | public VerticalMeshShip()
10 | {
11 | super();
12 | ignoreSlope = true;
13 | meshFile = "chimney_mesh.md5";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /bin/
3 | /build
4 | .gradle
5 |
6 | # Game libs
7 | /liblwjgl64.so
8 | /libopenal64.so
9 |
10 | # PyDev
11 | /.pydevproject
12 |
13 | # Eclipse
14 | .classpath
15 | .project
16 | .settings/
17 |
18 | # IntelliJ
19 | *.iml
20 | /.idea/caches
21 | /.idea/libraries
22 | /.idea/modules.xml
23 | /.idea/workspace.xml
24 |
25 | # Mac
26 | .DS_Store
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_simple.vert:
--------------------------------------------------------------------------------
1 | varying vec4 viewCoords;
2 | varying vec2 vTexCoord;
3 |
4 | void main()
5 | {
6 | vec2 Pos = sign(gl_Vertex.xy);
7 | gl_Position = vec4(Pos.xy, 0, 1);
8 | vTexCoord.x = 0.5 * (1.0 + Pos.x);
9 | vTexCoord.y = 0.5 * (1.0 + Pos.y);
10 | //viewCoords = gl_ModelViewProjectionMatrix * gl_Vertex;
11 | }
12 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/Tool.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | /**
4 | *
5 | * @author twak
6 | */
7 | public enum Tool {
8 | // create vertices
9 | Vertex,
10 | ProfilePaint,
11 | // tag edges
12 | Features,
13 | Tag,
14 | // paint on the current profile
15 | // create anchor poitns
16 | Anchor;
17 | // attach features to anchor points
18 | }
19 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/SelectableComponent.java:
--------------------------------------------------------------------------------
1 |
2 | package org.twak.siteplan.junk;
3 |
4 | import org.twak.camp.ui.MachineEvent;
5 |
6 | /**
7 | *
8 | * @author twak
9 | */
10 | public interface SelectableComponent
11 | {
12 |
13 | public MachineEvent getMachineEvent();
14 | public void setSelected(boolean selected);
15 | public boolean isSelected();
16 | public void repaint();
17 | }
18 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/WindowSkeleton.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | /**
4 | *
5 | * @author twak
6 | */
7 | public class WindowSkeleton extends PlanSkeleton
8 | {
9 | Plan output;
10 | public WindowSkeleton(Plan input)
11 | {
12 | super();
13 |
14 | output = new Plan();
15 |
16 | this.plan = output;
17 |
18 | init();
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/CapFeature.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | package org.twak.siteplan.campskeleton;
7 |
8 | import org.twak.camp.Tag;
9 |
10 | /**
11 | *
12 | * @author twak
13 | */
14 | public class CapFeature extends Tag
15 | {
16 | public CapFeature(){
17 | super ("cap feature");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_1_depth.vert:
--------------------------------------------------------------------------------
1 | // "Depth of Field" demo for Ogre
2 | // Copyright (C) 2006 Christian Lindequist Larsen
3 | //
4 | // This code is in the public domain. You may do whatever you want with it.
5 |
6 | varying float depth; // in view space
7 |
8 | void main()
9 | {
10 | vec4 viewPos = gl_ModelViewMatrix * gl_Vertex;
11 | depth = -viewPos.z;
12 |
13 | gl_Position = ftransform();
14 | gl_TexCoord[0] = gl_MultiTexCoord0;
15 | }
16 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/PlanFeature.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.junk;
2 |
3 | import org.twak.camp.Tag;
4 | import org.twak.camp.ui.PointEditor.BarSelected;
5 | import org.twak.siteplan.campskeleton.PlanUI;
6 |
7 | /**
8 | *
9 | * @author twak
10 | */
11 | public abstract class PlanFeature extends Tag
12 | {
13 | public PlanFeature(String name)
14 | {
15 | super (name);
16 | }
17 | public abstract PlanUI getEditor( BarSelected bs );
18 | }
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/ProfileAnchor.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import javax.swing.ButtonGroup;
4 | import javax.swing.JComponent;
5 |
6 | public class ProfileAnchor extends Anchor
7 | {
8 | public ProfileAnchor( Object profileGen )
9 | {
10 | super(null, profileGen);
11 | this.setProfileGen(profileGen);
12 | }
13 |
14 | @Override
15 | public boolean matches( Object plan, Object profile )
16 | {
17 | return plan == null && profile == getProfileGen();
18 | }
19 |
20 | @Override
21 | public JComponent createUI( ButtonGroup bg )
22 | {
23 | return new ProfileAnchorUI( this, bg );
24 | }
25 |
26 | @Override
27 | public Object getPlanGen() {
28 | // we have no such gen! there never was! the class hierarchy is broken!
29 | return null;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/ProfileAnchorUI.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import java.awt.Color;
4 | import javax.swing.ButtonGroup;
5 |
6 | import org.twak.siteplan.campskeleton.Siteplan;
7 |
8 | /**
9 | * Type of anchor that only has a height. Okay the class hierarchy is upside down, but this is
10 | * academia :p
11 | *
12 | * @author twak
13 | */
14 | public class ProfileAnchorUI extends AnchorUI
15 | {
16 | public ProfileAnchorUI( ProfileAnchor anchor, ButtonGroup bg )
17 | {
18 | super ( anchor, bg );
19 | }
20 |
21 | @Override
22 | public void updateButton()
23 | {
24 | int count = 0;
25 |
26 | if (Siteplan.instance.plan.countMarkerMatches(anchor.getProfileGen()) > 0)
27 | count++;
28 |
29 | selectButton.setText( count + "/1" );
30 | selectButton.setForeground( count < 1 ? Color.red : Color.green );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#twak/siteplan)
2 |
3 | combine 2D plans and profiles to create 3D houses. an implementaiton of our "procedural extrusions". info about running or building the project here. [video](https://www.youtube.com/watch?v=BrCDKrBS9To).
4 |
5 | 
6 |
7 |
8 | this is a [research project](http://twak.blogspot.com/2011/04/interactive-architectural-modeling-with.html) - if you use it, please cite us:
9 |
10 |
11 | @article{kelly2011interactive,
12 | title={Interactive architectural modeling with procedural extrusions},
13 | author={Kelly, Tom and Wonka, Peter},
14 | journal={ACM Transactions on Graphics (TOG)},
15 | volume={30},
16 | number={2},
17 | pages={14},
18 | year={2011},
19 | publisher={ACM}
20 | }
21 |
22 |
23 | [some of the kinds of buildings](https://youtu.be/HGO_kCp_6ys) you can create if you invest a little more time:
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/TagsFeaturesUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_1_depth.frag:
--------------------------------------------------------------------------------
1 | // "Depth of Field" demo for Ogre
2 | // Copyright (C) 2006 Christian Lindequist Larsen
3 | //
4 | // This code is in the public domain. You may do whatever you want with it.
5 |
6 | // dofParams coefficients:
7 | // x = near blur depth; y = focal plane depth; z = far blur depth
8 | // w = blurriness cutoff constant for objects behind the focal plane
9 | uniform vec4 dofParams;
10 |
11 | varying float depth; // in view space
12 |
13 | uniform sampler2D mainTexture;
14 |
15 | void main()
16 | {
17 | float f;
18 | vec4 texCol = texture2D(mainTexture,gl_TexCoord[0].st);
19 |
20 | if (depth < dofParams.y)
21 | {
22 | // scale depth value between near blur distance and focal distance to
23 | // [-1, 0] range
24 | f = (depth - dofParams.y) / (dofParams.y - dofParams.x);
25 | }
26 | else
27 | {
28 | // scale depth value between focal distance and far blur distance to
29 | // [0, 1] range
30 | f = (depth - dofParams.y) / (dofParams.z - dofParams.y);
31 | // clamp the far blur to a maximum blurriness
32 | f = clamp(f, 0.0, dofParams.w);
33 | }
34 |
35 | // scale and bias into [0, 1] range
36 | vec4 sum = vec4(0.5*f + 0.5);
37 | if (texCol.a<0.1)
38 | {
39 | texCol.a = 0.0;
40 | }
41 | sum.a = texCol.a;
42 | gl_FragColor = sum;
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/Anchor.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import javax.swing.ButtonGroup;
4 | import javax.swing.JComponent;
5 |
6 | public class Anchor
7 | {
8 | private Object planGen;
9 | private Object profileGen;
10 | String name = "unknown";
11 |
12 | public Anchor( Object planGen, Object profileGen )
13 | {
14 | super();
15 | this.planGen = planGen;
16 | this.profileGen = profileGen;
17 | }
18 |
19 | public boolean matches( Object plan, Object profile )
20 | {
21 | return plan == getPlanGen() && profile == getProfileGen();
22 | }
23 |
24 | public JComponent createUI( ButtonGroup bg )
25 | {
26 | return new AnchorUI( this, bg );
27 | }
28 |
29 | /**
30 | * @return the planGen
31 | */
32 | public Object getPlanGen() {
33 | return planGen;
34 | }
35 |
36 | /**
37 | * @param planGen the planGen to set
38 | */
39 | public void setPlanGen(Object planGen) {
40 | this.planGen = planGen;
41 | }
42 |
43 | /**
44 | * @return the profileGen
45 | */
46 | public Object getProfileGen() {
47 | return profileGen;
48 | }
49 |
50 | /**
51 | * @param profileGen the profileGen to set
52 | */
53 | public void setProfileGen(Object profileGen) {
54 | this.profileGen = profileGen;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/TagsFeaturesUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | /*
7 | * TagsFeaturesUI.java
8 | *
9 | * Created on 02-Dec-2010, 02:09:04
10 | */
11 |
12 | package org.twak.siteplan.campskeleton;
13 |
14 | import org.twak.siteplan.anchors.FeatureUI;
15 | import org.twak.siteplan.tags.TagListUI;
16 |
17 | /**
18 | *
19 | * @author twak
20 | */
21 | public class TagsFeaturesUI extends javax.swing.JPanel {
22 |
23 | /** Creates new form TagsFeaturesUI */
24 | public TagsFeaturesUI() {
25 | initComponents();
26 | }
27 | public TagsFeaturesUI(Plan plan ) {
28 | initComponents();
29 |
30 | add( new FeatureUI(plan));
31 | add ( new TagListUI(plan) );
32 | }
33 |
34 | /** This method is called from within the constructor to
35 | * initialize the form.
36 | * WARNING: Do NOT modify this code. The content of this method is
37 | * always regenerated by the Form Editor.
38 | */
39 | @SuppressWarnings("unchecked")
40 | // //GEN-BEGIN:initComponents
41 | private void initComponents() {
42 |
43 | setLayout(new java.awt.GridLayout(1, 2));
44 | }// //GEN-END:initComponents
45 |
46 |
47 | // Variables declaration - do not modify//GEN-BEGIN:variables
48 | // End of variables declaration//GEN-END:variables
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/RoofTag.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | package org.twak.siteplan.tags;
7 |
8 | import java.util.HashSet;
9 | import java.util.Set;
10 |
11 | import javax.swing.JComponent;
12 |
13 | import org.twak.camp.Output;
14 | import org.twak.camp.Output.Face;
15 | import org.twak.siteplan.campskeleton.Plan;
16 | import org.twak.siteplan.jme.Preview;
17 | import org.twak.utils.WeakListener.Changed;
18 |
19 | /**
20 | *
21 | * @author twak
22 | */
23 | public class RoofTag extends PlanTag
24 | {
25 | public double width = 0.5, height = 0.5;
26 | public double jitter = 1;
27 | public boolean stagger = true;
28 |
29 | public RoofTag()
30 | {
31 | super ("tile");
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "tile ("+width+","+height+")";
37 | }
38 |
39 | @Override
40 | public JComponent getToolInterface(Changed rebuildFeatureList, Plan plan) {
41 | return new RoofUI(this, rebuildFeatureList);
42 | }
43 |
44 | @Override
45 | public void postProcess(Output output, Preview preview, Object threadKey) {
46 |
47 | Set allFaces = new HashSet();
48 | for (Face f : output.faces.values()) {
49 | if (f.profile.contains(this)) {
50 | allFaces.add(f);
51 | }
52 | }
53 |
54 | // new Tiler( preview, allFaces, threadKey, this );
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/SubdivideTag.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.tags;
2 |
3 | import java.util.Arrays;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 | import javax.swing.JComponent;
8 |
9 | import org.twak.siteplan.campskeleton.Plan;
10 | import org.twak.siteplan.campskeleton.Profile;
11 | import org.twak.utils.WeakListener.Changed;
12 |
13 | /**
14 | *
15 | * @author twak
16 | */
17 | public class SubdivideTag extends PlanTag
18 | {
19 | public final static String side = "side", bottom = "bottom", top = "top";
20 | public final static List types = Arrays.asList( new String[]{side, bottom, top} );
21 |
22 | public Map assignments = new HashMap();
23 | public boolean enabled = true;
24 |
25 | public SubdivideTag()
26 | {
27 | super("subdivide");
28 | }
29 |
30 | @Override
31 | public JComponent getToolInterface(Changed rebuildFeatureList, Plan plan) {
32 | return new SubdivideTagUI (rebuildFeatureList, plan, this);
33 | }
34 |
35 | public static class ProfileMerge
36 | {
37 | public Profile profile;
38 | public boolean merge;
39 |
40 | public ProfileMerge( Profile profile, boolean merge )
41 | {
42 | this.profile = profile;
43 | this.merge = merge;
44 | }
45 | }
46 |
47 | @Override
48 | public void addUsedProfiles( List vProfiles )
49 | {
50 | for (ProfileMerge pm : assignments.values())
51 | if (pm.profile != null)
52 | vProfiles.add( pm.profile );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/PlanTag.java:
--------------------------------------------------------------------------------
1 |
2 | package org.twak.siteplan.tags;
3 |
4 | import java.util.List;
5 | import java.util.Set;
6 | import javax.swing.JComponent;
7 |
8 | import org.twak.camp.Output;
9 | import org.twak.camp.Tag;
10 | import org.twak.camp.ui.Bar;
11 | import org.twak.siteplan.campskeleton.Plan;
12 | import org.twak.siteplan.campskeleton.Profile;
13 | import org.twak.siteplan.jme.Preview;
14 | import org.twak.utils.WeakListener.Changed;
15 |
16 | /**
17 | *
18 | * @author twak
19 | */
20 | public class PlanTag extends Tag
21 | {
22 | String className;
23 |
24 | public PlanTag (String name)
25 | {
26 | super(name);
27 | }
28 |
29 | public JComponent getToolInterface(Changed rebuildFeatureList, Plan plan) {
30 | return null;
31 | }
32 |
33 | public static PlanTag createATag(String className) {
34 | try {
35 | PlanTag tag = (PlanTag) Class.forName(className).newInstance();
36 | tag.className = className;
37 | return tag;
38 | } catch (Throwable ex) {
39 | ex.printStackTrace();
40 | }
41 | return null;
42 | }
43 |
44 | public void postProcess(Output output, Preview preview, Object threadKey) {
45 | // override to add something to the output geometry
46 | }
47 |
48 | /**
49 | * @param vProfiles
50 | */
51 | public void addUsedProfiles( List vProfiles )
52 | {
53 | // override me
54 | }
55 |
56 | public void update( int frame )
57 | {
58 | }
59 |
60 | public void addUsedBars(Set out) {
61 | // override me
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/ForcedStep.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.junk;
2 |
3 | import java.util.Arrays;
4 | import javax.vecmath.Point2d;
5 |
6 | import org.twak.camp.ui.Bar;
7 | import org.twak.camp.ui.PointEditor.BarSelected;
8 | import org.twak.siteplan.campskeleton.ForcedUI;
9 | import org.twak.siteplan.campskeleton.Plan;
10 | import org.twak.siteplan.campskeleton.PlanUI;
11 | import org.twak.siteplan.campskeleton.Profile;
12 | import org.twak.utils.Pair;
13 | import org.twak.utils.collections.ConsecutiveItPairs;
14 | import org.twak.utils.collections.Loop;
15 | import org.twak.utils.collections.LoopL;
16 |
17 | /**
18 | *
19 | * @author twak
20 | */
21 | public class ForcedStep extends PlanFeature
22 | {
23 | public LoopL shape = new LoopL();
24 |
25 | public ForcedStep(){ super ("a forced step"); }
26 |
27 | public ForcedStep(Plan plan)
28 | {
29 | this();
30 |
31 | Loop line = new Loop();
32 |
33 | Point2d[] coords = new Point2d[] {
34 | new Point2d (0,0), new Point2d (50,0), new Point2d (50,-20), new Point2d (250,-20), new Point2d (250,0), new Point2d (300, 0) };
35 |
36 | Profile profile = new Profile( 50 );
37 |
38 | for ( Pair pair : new ConsecutiveItPairs( Arrays.asList( coords ) ) )
39 | {
40 | Bar b = new Bar (pair.first(), pair.second());
41 | line.append( b );
42 | plan.profiles.put( b, profile );
43 | }
44 |
45 |
46 | shape.add( line );
47 |
48 | // plan.tags.add( this );
49 | plan.addLoop( profile.points.get( 0 ), plan.root, profile );
50 |
51 | }
52 |
53 | @Override
54 | public PlanUI getEditor( BarSelected bs )
55 | {
56 | return new ForcedUI( this, bs );
57 | }
58 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_final.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform sampler2D RT;
34 |
35 | varying vec2 vTexCoord;
36 |
37 | void main(void)
38 | {
39 | gl_FragColor = texture2D(RT, vTexCoord);
40 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_fullscreen.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform sampler2D RT;
34 |
35 | varying vec2 vTexCoord;
36 |
37 | void main(void)
38 | {
39 | gl_FragColor = texture2D(RT, vTexCoord);
40 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec2 texCoord;
34 |
35 | void main(void)
36 | {
37 | vec2 Pos = sign(gl_Vertex.xy);
38 | gl_Position = vec4(Pos.xy, 0, 1);
39 | texCoord.x = 0.5 * (1.0 + Pos.x);
40 | texCoord.y = 0.5 * (1.0 + Pos.y);
41 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_extract.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec2 vTexCoord;
34 |
35 | void main(void)
36 | {
37 | vec2 Pos = sign(gl_Vertex.xy);
38 | gl_Position = vec4(Pos.xy, 0, 1);
39 | vTexCoord.x = 0.5 * (1.0 + Pos.x);
40 | vTexCoord.y = 0.5 * (1.0 + Pos.y);
41 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_final.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec2 vTexCoord;
34 |
35 | void main(void)
36 | {
37 | vec2 Pos = sign(gl_Vertex.xy);
38 | gl_Position = vec4(Pos.xy, 0, 1);
39 | vTexCoord.x = 0.5 * (1.0 + Pos.x);
40 | vTexCoord.y = 0.5 * (1.0 + Pos.y);
41 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_fullscreen.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec2 vTexCoord;
34 |
35 | void main(void)
36 | {
37 | vec2 Pos = sign(gl_Vertex.xy);
38 | gl_Position = vec4(Pos.xy, 0, 1);
39 | vTexCoord.x = 0.5 * (1.0 + Pos.x);
40 | vTexCoord.y = 0.5 * (1.0 + Pos.y);
41 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/sketch_sobel.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 |
34 |
35 | varying vec2 vTexCoord;
36 |
37 | void main(void)
38 | {
39 | vec2 Pos = sign(gl_Vertex.xy);
40 | gl_Position = vec4(Pos.xy, 0, 1);
41 | vTexCoord.x = 0.5 * (1.0 + Pos.x);
42 | vTexCoord.y = 0.5 * (1.0 + Pos.y);
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/sketch_norm.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec3 vNormal;
34 | varying vec4 pos;
35 | varying float depth;
36 |
37 |
38 | void main(void)
39 | {
40 | //gl_FragColor = vec4(vNormal,depth);
41 | gl_FragColor = vec4(vNormal, depth);//depth,depth,depth,1);//0,1,0,1);//vNormal,depth);
42 | //gl_FragColor = vec4(depth*40,depth*40,depth*40,1);
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_extract.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float exposurePow;
34 | uniform float exposureCutoff;
35 | uniform sampler2D RT;
36 |
37 | varying vec2 vTexCoord;
38 |
39 | void main(void)
40 | {
41 | vec4 sum = texture2D(RT, vTexCoord);
42 | if ( (sum.r+sum.g+sum.b)/3.0 < exposureCutoff ) {
43 | sum = vec4(0.0);
44 | }
45 | sum = pow(sum,vec4(exposurePow));
46 | gl_FragColor = sum;
47 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/sketch_norm.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | varying vec3 vNormal;
34 | varying vec4 pos;
35 | varying float depth;
36 |
37 | uniform float nearClip;
38 | uniform float diffClip;
39 |
40 | void main(void)
41 | {
42 | gl_Position = ftransform();
43 | vNormal = (normalize(gl_NormalMatrix * gl_Normal)+1.0)*0.5;
44 |
45 | pos = gl_ModelViewMatrix * gl_Vertex;
46 | depth = -(pos.z-nearClip)/diffClip;
47 | }
48 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/Jme.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.jme;
2 |
3 | import com.jme3.math.Quaternion;
4 | import com.jme3.math.Vector3f;
5 | import javax.vecmath.Matrix4d;
6 | import javax.vecmath.Point3d;
7 | import javax.vecmath.Tuple3d;
8 |
9 | /**
10 | * scale factor and y/z swap between skeleton coord system (pixels in ui space) and
11 | * jme (meters?))
12 | *
13 | * @author twak
14 | */
15 | public class Jme
16 | {
17 | public static Matrix4d transform = new Matrix4d();
18 | public final static double scale = 30;
19 | static
20 | {
21 | transform.setIdentity();
22 | transform.setScale( 1 / scale );
23 |
24 | double[] tmp = new double[4], tmp2 = new double[4];
25 |
26 | transform.getRow( 1, tmp);
27 | transform.getRow( 2, tmp2 );
28 |
29 | transform.setRow( 1, tmp2 );
30 | transform.setRow( 2, tmp );
31 | // transform.m33 = scale;
32 | }
33 |
34 | public static Matrix4d transformNoScale = new Matrix4d();
35 | static
36 | {
37 | transformNoScale.setIdentity();
38 |
39 | double[] tmp = new double[4], tmp2 = new double[4];
40 |
41 | transformNoScale.getRow( 1, tmp);
42 | transformNoScale.getRow( 2, tmp2 );
43 |
44 | transformNoScale.setRow( 1, tmp2 );
45 | transformNoScale.setRow( 2, tmp );
46 | // transform.m33 = scale;
47 | }
48 |
49 | public static Point3d convert (Tuple3d in)
50 | {
51 | Point3d out = new Point3d(in);
52 | transform.transform( out );
53 | return out;
54 | }
55 |
56 | public static Quaternion asQuat( Matrix4d m )
57 | {
58 | Quaternion rot = new Quaternion();
59 | rot.fromRotationMatrix(
60 | (float) m.m00, (float) m.m01, (float) m.m02,
61 | (float) m.m10, (float) m.m11, (float) m.m12,
62 | (float) m.m20, (float) m.m21, (float) m.m22
63 | );
64 | return rot;
65 | }
66 |
67 | public static Vector3f toF (Tuple3d in)
68 | {
69 | return new Vector3f ((float)in.x,(float)in.y,(float)in.z);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/CapFeatureFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | package org.twak.siteplan.campskeleton;
7 |
8 | import javax.vecmath.Point3d;
9 | import javax.vecmath.Vector3d;
10 |
11 | import org.twak.camp.Corner;
12 | import org.twak.camp.Skeleton;
13 | import org.twak.camp.SkeletonCapUpdate;
14 | import org.twak.utils.collections.DHash;
15 | import org.twak.utils.collections.Loop;
16 | import org.twak.utils.collections.LoopL;
17 | import org.twak.utils.collections.SetCorrespondence;
18 |
19 | /**
20 | *
21 | * @author twak
22 | */
23 | public class CapFeatureFactory extends FeatureFactory
24 | {
25 | public CapFeatureFactory()
26 | {
27 | super (new CapFeature());
28 | }
29 |
30 | @Override
31 | public FactoryEvent createFactoryEvent( double height, Global g, int valency )
32 | {
33 | return new CapEvent( height, g, valency );
34 | }
35 |
36 | public class CapEvent extends FactoryEvent
37 | {
38 | public CapEvent( double height, Global global, int valency )
39 | {
40 | super( height, global, valency );
41 | }
42 |
43 | @Override
44 | public boolean process( Skeleton skel )
45 | {
46 | SkeletonCapUpdate capUpdate = new SkeletonCapUpdate(skel);
47 | LoopL flatTop = capUpdate.getCap(height);
48 |
49 | LoopL pts = new LoopL();
50 | for (Loop cLoop : flatTop)
51 | {
52 | Loop loop = new Loop();
53 | pts.add(loop);
54 | for ( Corner c : cLoop)
55 | loop.append( new Point3d( c.x, c.y, height) );
56 | }
57 |
58 | skel.output.addNonSkeletonOutputFace2(pts , new Vector3d(0,0,1) );
59 |
60 | capUpdate.update(new LoopL(), new SetCorrespondence(), new DHash());
61 | skel.qu.clearFaceEvents();
62 | skel.qu.clearOtherEvents();
63 | return true;
64 |
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/Global.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | import java.util.Arrays;
4 | import java.util.LinkedHashSet;
5 | import java.util.List;
6 | import javax.vecmath.Point2d;
7 |
8 | import org.twak.camp.ui.Bar;
9 | import org.twak.utils.collections.Loop;
10 |
11 | /**
12 | * There's one of these for every inflection over a plan. All profiles inflect at the same point to preserve
13 | * loop-properties.
14 | *
15 | * @author twak
16 | */
17 | public class Global
18 | {
19 | public String name = "0";
20 |
21 | public int valency = 2;
22 |
23 | public Profile edgeProfile;
24 |
25 | Global()
26 | {
27 | }
28 |
29 | public Global( String string )
30 | {
31 | this();
32 | this.name = string;
33 | }
34 |
35 | public void assertHeight( Plan plan, double y )
36 | {
37 | for (Profile prof : new LinkedHashSet ( plan.profiles.values()) ) // might repeat :(
38 | {
39 | prof.assertHeight ( plan, this, y );
40 | }
41 | }
42 |
43 | public void remove( Plan plan )
44 | {
45 | if (this == plan.root)
46 | throw new Error ("Sorry dave, I can't do that");
47 | plan.globals.remove( this );
48 | for (Profile prof : new LinkedHashSet ( plan.profiles.values()) ) // might repeat :(
49 | {
50 | List> bars = prof.globalProfiles.get(this).chainStarts;
51 | if ( bars != null )
52 | {
53 | prof.points.removeAll( bars );
54 | prof.globalProfiles.remove( this );
55 | }
56 | }
57 | }
58 |
59 | public void add( Plan plan, Point2d loc )
60 | {
61 | plan.globals.add(this);
62 | for (Profile p : new LinkedHashSet ( plan.profiles.values() ))
63 | {
64 | for (int xLoc : Arrays.asList( new Integer[] { -50,0} ) )
65 | {
66 | Loop loop = new Loop();
67 | loop.append( new Bar ( new Point2d( loc.x + xLoc, loc.y ) , new Point2d( loc.x + 50 + xLoc, loc.y - 100 ) ) );
68 | p.points.add( loop );
69 | plan.addLoop( loop, this, p );//loopStarts.put( new Plan.GlobalProfile( g, p ), loop );
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur_horizontal5.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform sampler2D RT;
35 | varying vec2 texCoord;
36 |
37 | void main(void)
38 | {
39 | vec4 sum = vec4(0.0);
40 |
41 | sum += texture2D(RT, vec2(texCoord.x - 1.0*sampleDist, texCoord.y)) * 1.0/9.0;
42 | sum += texture2D(RT, vec2(texCoord.x - 0.5*sampleDist, texCoord.y)) * 2.0/9.0;
43 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y)) * 3.0/9.0;
44 | sum += texture2D(RT, vec2(texCoord.x + 0.5*sampleDist, texCoord.y)) * 2.0/9.0;
45 | sum += texture2D(RT, vec2(texCoord.x + 1.0*sampleDist, texCoord.y)) * 1.0/9.0;
46 |
47 | gl_FragColor = sum;
48 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/motionblur.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform sampler2D screenTexture;
34 |
35 | varying vec4 viewCoords;
36 | varying vec2 velocity;
37 |
38 | void main(void)
39 | {
40 | // sample scene texture along direction of motion
41 | const float samples = 16.0;
42 | const float w = 1.0 / samples; // sample weight
43 |
44 | vec2 projCoord = viewCoords.xy / viewCoords.q;
45 | projCoord = (projCoord + vec2(1.0)) * vec2(0.5);
46 |
47 | vec4 a = vec4(0.0); // accumulator - fixed4
48 | int i;
49 | for(i=0; i shape = new LoopL();
33 |
34 | /**
35 | * Bar is the plan-bar in LoopL shape, above
36 | * @return the distance we want to expand this bar by.
37 | */
38 | public double getSize( Bar bar )
39 | {
40 | return radius;
41 | }
42 |
43 | public NaturalFeature( Plan plan, String name )
44 | {
45 | super( name );
46 |
47 | }
48 |
49 | public Color getColor()
50 | {
51 | return Color.pink;
52 | }
53 |
54 | void setAllProfiles( Profile createBay, Plan plan )
55 | {
56 | for ( int i = 0; i < profiles.length; i++ )
57 | profiles[i] = createBay;
58 |
59 | for ( Bar b : shape.eIterator() )
60 | plan.profiles.put( b, createBay );
61 | }
62 |
63 | abstract public PlanUI getEditor( BarSelected bs );
64 |
65 |
66 | /** context overwhelming **/
67 | public abstract Corner insert( // returns the last corner in the object we've just added.
68 | PlanSkeleton skel,
69 | Marker m,
70 | LContext leadingCorner, // the edge we're editing
71 | Edge old,
72 | CornerClone cc, // the new data structure
73 | List machines, // as specified by this NatrualFeature's shape LoopL
74 | List bars, // the bars from this NaturalFeature
75 | double height, // the height of this event
76 | Global global,
77 | int valency );
78 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur_horizontal7.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform sampler2D RT;
35 | varying vec2 texCoord;
36 |
37 | void main(void)
38 | {
39 | vec4 sum = vec4(0.0);
40 |
41 | sum += texture2D(RT, vec2(texCoord.x - 1.0*sampleDist, texCoord.y)) * 0.25/4.0;
42 | sum += texture2D(RT, vec2(texCoord.x - 0.666*sampleDist, texCoord.y)) * 0.5/4.0;
43 | sum += texture2D(RT, vec2(texCoord.x - 0.333*sampleDist, texCoord.y)) * 0.75/4.0;
44 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y)) * 1.0/4.0;
45 | sum += texture2D(RT, vec2(texCoord.x + 0.333*sampleDist, texCoord.y)) * 0.75/4.0;
46 | sum += texture2D(RT, vec2(texCoord.x + 0.666*sampleDist, texCoord.y)) * 0.5/4.0;
47 | sum += texture2D(RT, vec2(texCoord.x + 1.0*sampleDist, texCoord.y)) * 0.25/4.0;
48 |
49 | gl_FragColor = sum;
50 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/NaturalStepShipHACK.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import java.util.Arrays;
4 | import java.util.HashSet;
5 | import java.util.Set;
6 | import javax.vecmath.Point2d;
7 |
8 | import org.twak.siteplan.campskeleton.Siteplan;
9 | import org.twak.utils.collections.Loopable;
10 | import org.twak.camp.ui.Bar;
11 | import org.twak.siteplan.campskeleton.Plan;
12 | import org.twak.siteplan.campskeleton.Profile;
13 |
14 | /**
15 | * hacked to animate the speed of a single edge
16 | * @author twak
17 | */
18 | public class NaturalStepShipHACK extends NaturalStepShip
19 | {
20 |
21 | @Override
22 | protected Instance createInstance() {
23 | return new NaturalInstanceHACK();
24 | }
25 |
26 | public class NaturalInstanceHACK extends NaturalInstance
27 | {
28 | @Override
29 | protected void update(int frame, int delta, Plan plan) {
30 |
31 | // if (1==1)
32 | // return; -2.5008333333333335
33 | double yOff = (70 - 30.01 )*5 / 60.;// Math.cos ( frame/20. ) * 40.;
34 | speeds.get(0).start.getNext().getNext().set( yOff );
35 | System.out.println(frame + " speed is "+yOff);
36 |
37 | double sideSpeed = yOff < 0 ? -4 : 4;
38 | speeds.get(0).start.getNext().set(sideSpeed);
39 | speeds.get(0).start.getNext().getNext().getNext().set(sideSpeed);
40 |
41 | double midOff = yOff < 0 ? -30 : 30;
42 | Loopable mid = shape.get(0).start.getNext().getNext();
43 | mid.get().start = new Point2d ( mid.get().start.x, midOff );
44 | mid.get().end = new Point2d ( mid.get().end.x, midOff+1);
45 | mid.getPrev().get().end = mid.get().start;
46 | mid.getNext().get().start = mid.get().end;
47 |
48 | Profile p = Siteplan.instance.plan.profiles.get( shape.get(0).start.getNext().get() );
49 | Point2d lastInP = p.points.get(0).start.getPrev().get().end;
50 |
51 | if ( (lastInP.x > 0 && yOff > 0) || (lastInP.x < 0 && yOff < 0 )) {
52 | // flip profile
53 | Set seen = new HashSet();
54 | for (Bar b : p.points.get(0)) {
55 | for (Point2d pt : Arrays.asList(b.start, b.end))
56 | if (!seen.contains (pt))
57 | {
58 | seen.add(pt);
59 | pt.x = -pt.x;
60 | }
61 | }
62 | }
63 | }
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/JProfileProfileItem.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
44 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur_vertical7.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform float blurIntensityMultiplier;
35 | uniform sampler2D RT;
36 | varying vec2 texCoord;
37 |
38 | void main(void)
39 | {
40 | vec4 sum = vec4(0.0);
41 |
42 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 1.0*sampleDist)) * 1.0/16.0;
43 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 0.666*sampleDist)) * 2.0/16.0;
44 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 0.333*sampleDist)) * 3.0/16.0;
45 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y)) * 4.0/16.0;
46 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 0.333*sampleDist)) * 3.0/16.0;
47 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 0.666*sampleDist)) * 2.0/16.0;
48 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 1.0*sampleDist)) * 1.0/16.0;
49 |
50 | sum *= blurIntensityMultiplier;
51 |
52 | gl_FragColor = sum;
53 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/SubdivideTagUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
49 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur_horizontal9.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform sampler2D RT;
35 | varying vec2 texCoord;
36 |
37 | void main(void)
38 | {
39 | vec4 sum = vec4(0.0);
40 |
41 | sum += texture2D(RT, vec2(texCoord.x - 1.0*sampleDist, texCoord.y)) * 1.0/25.0;
42 | sum += texture2D(RT, vec2(texCoord.x - 0.75*sampleDist, texCoord.y)) * 2.0/25.0;
43 | sum += texture2D(RT, vec2(texCoord.x - 0.5*sampleDist, texCoord.y)) * 3.0/25.0;
44 | sum += texture2D(RT, vec2(texCoord.x - 0.25*sampleDist, texCoord.y)) * 4.0/25.0;
45 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y)) * 5.0/25.0;
46 | sum += texture2D(RT, vec2(texCoord.x + 0.25*sampleDist, texCoord.y)) * 4.0/25.0;
47 | sum += texture2D(RT, vec2(texCoord.x + 0.5*sampleDist, texCoord.y)) * 3.0/25.0;
48 | sum += texture2D(RT, vec2(texCoord.x + 0.75*sampleDist, texCoord.y)) * 2.0/25.0;
49 | sum += texture2D(RT, vec2(texCoord.x + 1.0*sampleDist, texCoord.y)) * 1.0/25.0;
50 |
51 | gl_FragColor = sum;
52 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/TagFeatureList.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
52 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur_vertical9.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform float blurIntensityMultiplier;
35 | uniform sampler2D RT;
36 | varying vec2 texCoord;
37 |
38 | void main(void)
39 | {
40 | vec4 sum = vec4(0.0);
41 |
42 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 1.0*sampleDist)) * 1.0/25.0;
43 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 0.75*sampleDist)) * 2.0/25.0;
44 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 0.5*sampleDist)) * 3.0/25.0;
45 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y - 0.25*sampleDist)) * 4.0/25.0;
46 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y)) * 5.0/25.0;
47 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 0.25*sampleDist)) * 4.0/25.0;
48 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 0.5*sampleDist)) * 3.0/25.0;
49 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 0.75*sampleDist)) * 2.0/25.0;
50 | sum += texture2D(RT, vec2(texCoord.x, texCoord.y + 1.0*sampleDist)) * 1.0/25.0;
51 |
52 | sum *= blurIntensityMultiplier;
53 |
54 | gl_FragColor = sum;
55 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/sketch_sobel.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform sampler2D depth;
34 |
35 | uniform float normalMult;
36 | uniform float depthMult;
37 | uniform float off;
38 |
39 | varying vec2 vTexCoord;
40 |
41 | void main(void)
42 | {
43 | vec4 s00 = texture2D(depth, vTexCoord + vec2(-off, -off));
44 | vec4 s01 = texture2D(depth, vTexCoord + vec2( 0, -off));
45 | vec4 s02 = texture2D(depth, vTexCoord + vec2( off, -off));
46 |
47 | vec4 s10 = texture2D(depth, vTexCoord + vec2(-off, 0));
48 | vec4 s12 = texture2D(depth, vTexCoord + vec2( off, 0));
49 |
50 | vec4 s20 = texture2D(depth, vTexCoord + vec2(-off, off));
51 | vec4 s21 = texture2D(depth, vTexCoord + vec2( 0, off));
52 | vec4 s22 = texture2D(depth, vTexCoord + vec2( off, off));
53 |
54 | vec4 sobelX = s00 + 2.0 * s10 + s20 - s02 - 2.0 * s12 - s22;
55 | vec4 sobelY = s00 + 2.0 * s01 + s02 - s20 - 2.0 * s21 - s22;
56 |
57 | vec4 edgeSqr = sobelX * sobelX + sobelY * sobelY;
58 | float col = dot(edgeSqr, vec4(normalMult,normalMult,normalMult,depthMult));
59 |
60 | // gl_FragColor = vec4(1,0,0,1);
61 | gl_FragColor = vec4(0.1, 0.1, 0.1, col);//vec4(col);
62 | // gl_FragColor = texture2D(depth, vTexCoord );
63 | }
64 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/resources/help.txt:
--------------------------------------------------------------------------------
1 | Use this program at your own risk. It may well destroy your computer, and make out with your grandmother and/or dog. It isn't well tested, and isn't fit for any purpose.
2 |
3 | (c) 2017 twak, twak.org. Source/bundled resources that I created released under some sort of LGPL-ish license. Please reference "Interactive Modeling with Procedural Extrusions" if you publish anything in academia using this software.
4 |
5 | 3D Window Controls:
6 |
7 | (designed for nice demo videos, rather than being useful)
8 |
9 | WASD: strafe/move camera
10 | mouse: rotate camera
11 | up/down: ambient lighting
12 | left/right: camera speed
13 |
14 | 2D Mouse Window Controls:
15 |
16 | Left - select, drag points, plans & anchors. Click on a point for options.
17 | Control + Left click add stuff - click on a blank space to add a plan/global offset, or a line to add a point.
18 | Shift + Left click - delete points, delete all the points to remove a plan
19 | Right drag - move view
20 | Wheel - zoom view
21 | The Alt key will change the behavour of the corner-dragging - in plan mode it snaps to grid, and profile mode it moves all points above the selected point as well.
22 |
23 | 2D Interface for Single-Building Application:
24 |
25 | The left window is the plan view. The right window is the profile view. Select an edge by left clicking on it, and edit the plan in the right window. Ctrl-click will add a point to the plan or profile.
26 | Click the go button to view the result in 3D.
27 | Selecting the updates button will update the 3D every time you change something. This can get slow. The go button just creates the 3D for the current design.
28 | After selecting an edge, assign a profile to it from the combo box above the profile.
29 | Create a new profile using the + button above the profile editor.
30 | The plans must not self-intersect ("don't cross the beams"), or be inside out (or you'll get inside out buildings). Courtyards/holes in footprints must be defined in the opposite direction. If you add a new plan inside an existing shape, it should reverse the loop for you, but no guarantees.
31 |
32 | Edit the profiles in a similar way to the plans, note that they can only move upwards, or horizontally (the "monotone restriction", if you talk to Peter about this). To get around this, control-clicking in a profile will add a global event (overhanging roof).
33 |
34 | Rules for overhangs:
35 |
36 | The start and the end of the overhang have to be on the same side of the nearest wall.
37 | You can put overhangs on the inside to carve out space.
38 | Everytime you add a global event to a profile, it is added to all profiles (think about it...)
39 | You can change the height of a global event using the dark-blue hollow handle in the plan editor. It changes the height for all plans
40 | Double clicking on the hollow handle disables/enables the global for this roof edge. Easiest understood if you view the output!
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/AnchorUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
56 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/ForcedUI.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | import java.awt.BasicStroke;
4 | import java.awt.Graphics2D;
5 | import java.awt.Point;
6 | import java.awt.event.MouseEvent;
7 | import javax.vecmath.Point2d;
8 |
9 | import org.twak.camp.ui.Bar;
10 | import org.twak.camp.ui.PointEditor;
11 | import org.twak.siteplan.junk.ForcedStep;
12 | import org.twak.utils.LContext;
13 | import org.twak.utils.collections.Loop;
14 |
15 | /**
16 | * UI for an-almost-plan. A step edge adjustment. First and last points are fixed.
17 | * @author twak
18 | */
19 | public class ForcedUI extends PlanUI
20 | {
21 | ForcedStep step;
22 |
23 | public ForcedUI( ForcedStep forcedStep, PointEditor.BarSelected es )
24 | {
25 | super (Siteplan.instance.plan, forcedStep.shape , es);
26 | this.step = forcedStep;
27 | }
28 |
29 | @Override
30 | public void movePoint( LContext ctx, Point2d pt,javax.vecmath.Point2d location,MouseEvent evt)
31 | {
32 | if ( isFixedPoint( ctx, pt ))
33 | return; // can't move start or end
34 |
35 | super.movePoint( ctx, pt, location, null);
36 | }
37 |
38 | @Override
39 | protected boolean allowRemove( LContext ctx, Point2d corner )
40 | {
41 | if ( ctx.hook == null ) // it's an edge!
42 | return false;
43 |
44 | if ( isFixedPoint( ctx, corner ))
45 | return false; // don't remove the first or last points
46 |
47 | return super.allowRemove( ctx, corner );
48 | }
49 |
50 | private boolean isFixedPoint( LContext ctx, Point2d corner)
51 | {
52 | return ctx.loop == step.shape.get( 0) && (ctx.loop.start.get().start == corner || ctx.loop.start.getPrev().get().end == corner);
53 | }
54 |
55 | @Override
56 | public void paintPointEditor( Graphics2D g2 )
57 | {
58 | for ( Loop e2 : edges )
59 | for ( Bar e : e2 )
60 | {
61 | g2.setStroke( new BasicStroke( currentBar == null ? 2f : currentBar.get() == e ? 4f : 2f ) );
62 | g2.setColor( plan.profiles.get( e ).color );
63 | g2.drawLine( ma.toX( e.start.x ), ma.toY ( e.start.y ), ma.toX( e.end.x ), ma.toY( e.end.y ) );
64 | }
65 |
66 | g2.setColor( grass.darker().darker() );
67 |
68 | // first loop is inserted into existing loop, everything else comes outside
69 | boolean firstLoop = true;
70 | for ( Loop e2 : edges )
71 | {
72 | for ( Bar e : e2 )
73 | if ( !firstLoop || e != e2.getFirst() )
74 | drawPixel( g2, e.start );
75 | firstLoop = false;
76 | }
77 |
78 | drawMarkers( g2 );
79 |
80 | Loop first = step.shape.get( 0 );
81 | drawSpecialMarker( g2, first.start.get().start );
82 | drawSpecialMarker( g2, first.start.getPrev().get().end );
83 |
84 | somethingChanged( null );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/AnimateAnchorShipUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
58 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/motionblur.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform mat4 prevModelViewMatrix;
34 | uniform mat4 prevModelViewProjectionMatrix;
35 | uniform vec2 halfWinSize;
36 | uniform float blurStrength;
37 |
38 | varying vec4 viewCoords;
39 | varying vec2 velocity;
40 |
41 | void main(void)
42 | {
43 | // transform previous and current pos to eye space
44 | vec4 P = gl_ModelViewMatrix * gl_Vertex;
45 | vec4 Pprev = prevModelViewMatrix * gl_Vertex; //TODO: should be previous coord
46 |
47 | // transform normal to eye space
48 | vec3 N = gl_NormalMatrix * gl_Normal;
49 |
50 | // calculate eye space motion vector
51 | vec3 motionVector = P.xyz - Pprev.xyz;
52 |
53 | // calculate clip space motion vector
54 | vec4 addNormal = vec4(gl_Normal,0.0)*vec4(0.2);
55 | P = gl_ModelViewProjectionMatrix * (gl_Vertex+addNormal);
56 | Pprev = prevModelViewProjectionMatrix * (gl_Vertex+addNormal); //TODO: should be previous coord
57 |
58 | // choose previous or current position based
59 | // on dot product between motion vector and normal
60 | bool flag = dot(motionVector, N) > 0.0;
61 | vec4 Pstretch = flag ? P : Pprev;
62 |
63 | gl_Position = Pstretch;
64 | viewCoords = Pstretch;
65 |
66 | // do divide by W -> NDC coordinates
67 | P.xy = P.xy / P.w;
68 | Pprev.xy = Pprev.xy / Pprev.w;
69 |
70 | // calculate window space velocity
71 | velocity = halfWinSize.xy * (P.xy - Pprev.xy) * vec2(blurStrength);
72 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/JWindow.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.junk;
2 |
3 | import java.awt.Color;
4 | import java.awt.Dimension;
5 | import java.awt.Graphics;
6 | import java.awt.Point;
7 | import java.awt.event.MouseAdapter;
8 | import java.awt.event.MouseEvent;
9 | import javax.swing.JComponent;
10 |
11 | import org.twak.camp.ui.MachineEvent;
12 |
13 | /**
14 | * Doffit that represents a window event in the direciton - rack
15 | * @author twak
16 | */
17 | public class JWindow extends JComponent implements SelectableComponent
18 | {
19 | public WindowEvent direction;
20 | public JDirectionRack rack;
21 | public boolean selected;
22 |
23 | public JWindow() // unused?
24 | {
25 | setPreferredSize( new Dimension (30,30) );
26 | MouseAdapter ap = new DMouseListener();
27 | addMouseListener( ap );
28 | addMouseMotionListener( ap );
29 | }
30 |
31 | public JWindow (JDirectionRack rack, WindowEvent direction)
32 | {
33 | this();
34 | this.direction = direction;
35 | this.rack = rack;
36 | }
37 |
38 | @Override
39 | public void paint(Graphics g)
40 | {
41 |
42 | g.setColor( selected ? Color.cyan : Color.blue );
43 | g.fillArc( 0,0,getWidth(), getHeight(), 0, 360 );
44 | g.setColor( Color.black );
45 | g.drawArc( 0,0,getWidth(), getHeight(), 0, 360 );
46 | }
47 |
48 | public void setSelected( boolean selected )
49 | {
50 | this.selected = selected;
51 | }
52 |
53 | public boolean isSelected()
54 | {
55 | return selected;
56 | }
57 |
58 | public MachineEvent getMachineEvent()
59 | {
60 | return null;
61 | }
62 |
63 | public class DMouseListener extends MouseAdapter
64 | {
65 | Point old;
66 | @Override
67 | public void mousePressed( MouseEvent e )
68 | {
69 | old = e.getPoint();
70 | rack.selected(JWindow.this);
71 | repaint(); // might have been selected!
72 | }
73 |
74 | /**
75 | * Vertical direction gets thrown to parent, Horizontal changes angle
76 | * @param e
77 | */
78 | @Override
79 | public void mouseDragged( MouseEvent e )
80 | {
81 | int dY = e.getPoint().y - old.y;
82 |
83 | // direction.height -= dY * rack.pixelsToHeight(); // not good, depends on height of JDirectionRack :(
84 | //
85 | // direction.height = MUtils.clamp( direction.height, 0, rack.height);
86 |
87 | Point sL = getLocation();
88 | getParent().doLayout(); //...?
89 | Point eL = getLocation();
90 |
91 | // position for mouse event deltas
92 | old = new Point (
93 | e.getPoint().x - eL.x + sL.x,
94 | e.getPoint().y - eL.y + sL.y );
95 | repaint();
96 | // hack - force root repaint to refresh skeleton
97 | getRootPane().repaint();
98 | }
99 |
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/SaturdayEditor.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
66 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/PlanSpeedWidget.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
57 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/JProfileProfileMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | /*
7 | * JProfileProfileMap.java
8 | *
9 | * Created on 09-Nov-2010, 00:53:58
10 | */
11 |
12 | package org.twak.siteplan.anchors;
13 |
14 | import java.util.Map;
15 |
16 | import org.twak.siteplan.campskeleton.Plan;
17 | import org.twak.siteplan.campskeleton.Profile;
18 | import org.twak.utils.ui.ListDownLayout;
19 |
20 | /**
21 | *
22 | * @author twak
23 | */
24 | public class JProfileProfileMap extends javax.swing.JPanel {
25 |
26 | Plan plan;
27 |
28 | /** Creates new form JProfileProfileMap */
29 | public JProfileProfileMap() {
30 | initComponents();
31 | }
32 | public JProfileProfileMap( Plan plan, Map map, Iterable keys ) {
33 | this.plan = plan;
34 | initComponents();
35 |
36 | update(map, keys);
37 | }
38 |
39 | public void update( Map map, Iterable keys )
40 | {
41 | profilePanel.removeAll();
42 | profilePanel.setLayout( new ListDownLayout() );
43 | for ( Profile p : keys )
44 | profilePanel.add( new JProfileProfileItem( plan, p, map ) );
45 | }
46 |
47 | /** This method is called from within the constructor to
48 | * initialize the form.
49 | * WARNING: Do NOT modify this code. The content of this method is
50 | * always regenerated by the Form Editor.
51 | */
52 | @SuppressWarnings("unchecked")
53 | // //GEN-BEGIN:initComponents
54 | private void initComponents() {
55 |
56 | jScrollPane1 = new javax.swing.JScrollPane();
57 | profilePanel = new javax.swing.JPanel();
58 |
59 | javax.swing.GroupLayout profilePanelLayout = new javax.swing.GroupLayout(profilePanel);
60 | profilePanel.setLayout(profilePanelLayout);
61 | profilePanelLayout.setHorizontalGroup(
62 | profilePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
63 | .addGap(0, 122, Short.MAX_VALUE)
64 | );
65 | profilePanelLayout.setVerticalGroup(
66 | profilePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
67 | .addGap(0, 220, Short.MAX_VALUE)
68 | );
69 |
70 | jScrollPane1.setViewportView(profilePanel);
71 |
72 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
73 | this.setLayout(layout);
74 | layout.setHorizontalGroup(
75 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
76 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
77 | );
78 | layout.setVerticalGroup(
79 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
80 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
81 | );
82 | }// //GEN-END:initComponents
83 |
84 |
85 | // Variables declaration - do not modify//GEN-BEGIN:variables
86 | private javax.swing.JScrollPane jScrollPane1;
87 | private javax.swing.JPanel profilePanel;
88 |
89 | // End of variables declaration//GEN-END:variables
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/AlgoElement.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
64 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/SubdivideTagUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SubdivideUI.java
3 | *
4 | * Created on 17-Nov-2010, 20:23:52
5 | */
6 |
7 | package org.twak.siteplan.tags;
8 |
9 | import java.util.ArrayList;
10 |
11 | import org.twak.siteplan.anchors.JProfileProfileMap;
12 | import org.twak.siteplan.campskeleton.Siteplan;
13 | import org.twak.siteplan.campskeleton.Plan;
14 | import org.twak.utils.WeakListener.Changed;
15 |
16 | /**
17 | *
18 | * @author twak
19 | */
20 | public class SubdivideTagUI extends javax.swing.JPanel {
21 |
22 | public SubdivideTag tag;
23 | Plan plan;
24 |
25 | /** Creates new form SubdivideUI */
26 | public SubdivideTagUI() {
27 | initComponents();
28 | }
29 |
30 | public SubdivideTagUI(Changed rebuildFeatureList, Plan plan, SubdivideTag tag)
31 | {
32 | this.tag = tag;
33 | this.plan = plan;
34 |
35 | initComponents();
36 |
37 | outputArea.setSelected(tag.enabled);
38 | }
39 |
40 | /** This method is called from within the constructor to
41 | * initialize the form.
42 | * WARNING: Do NOT modify this code. The content of this method is
43 | * always regenerated by the Form Editor.
44 | */
45 | @SuppressWarnings("unchecked")
46 | // //GEN-BEGIN:initComponents
47 | private void initComponents() {
48 |
49 | outputArea = new javax.swing.JCheckBox();
50 | outputMap = new JStringProfileCheckMap(plan, tag.assignments, SubdivideTag.types);
51 |
52 | outputArea.setText("outputArea");
53 | outputArea.addActionListener(new java.awt.event.ActionListener() {
54 | public void actionPerformed(java.awt.event.ActionEvent evt) {
55 | outputAreaActionPerformed(evt);
56 | }
57 | });
58 |
59 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
60 | this.setLayout(layout);
61 | layout.setHorizontalGroup(
62 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
63 | .addComponent(outputArea, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
64 | .addComponent(outputMap, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
65 | );
66 | layout.setVerticalGroup(
67 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
68 | .addGroup(layout.createSequentialGroup()
69 | .addComponent(outputArea)
70 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
71 | .addComponent(outputMap, javax.swing.GroupLayout.PREFERRED_SIZE, 239, Short.MAX_VALUE))
72 | );
73 | }// //GEN-END:initComponents
74 |
75 | private void outputAreaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outputAreaActionPerformed
76 | tag.enabled = outputArea.isSelected();
77 | outputMap.setVisible(tag.enabled);
78 | Siteplan.instance.somethingChanged();
79 | }//GEN-LAST:event_outputAreaActionPerformed
80 |
81 |
82 | // Variables declaration - do not modify//GEN-BEGIN:variables
83 | private javax.swing.JCheckBox outputArea;
84 | private org.twak.siteplan.tags.JStringProfileCheckMap outputMap;
85 | // End of variables declaration//GEN-END:variables
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/CapShip.java:
--------------------------------------------------------------------------------
1 |
2 | package org.twak.siteplan.anchors;
3 |
4 | import javax.swing.JComponent;
5 | import javax.vecmath.Point3d;
6 | import javax.vecmath.Vector3d;
7 |
8 | import org.twak.camp.Corner;
9 | import org.twak.camp.Edge;
10 | import org.twak.camp.SkeletonCapUpdate;
11 | import org.twak.camp.debug.DebugDevice;
12 | import org.twak.camp.ui.Marker;
13 | import org.twak.siteplan.anchors.AnchorHauler.AnchorHeightEvent;
14 | import org.twak.siteplan.campskeleton.Siteplan;
15 | import org.twak.siteplan.campskeleton.Plan;
16 | import org.twak.siteplan.campskeleton.PlanSkeleton;
17 | import org.twak.utils.LContext;
18 | import org.twak.utils.WeakListener;
19 | import org.twak.utils.WeakListener.Changed;
20 | import org.twak.utils.collections.DHash;
21 | import org.twak.utils.collections.LoopL;
22 | import org.twak.utils.collections.Loopable;
23 | import org.twak.utils.collections.SetCorrespondence;
24 |
25 | /**
26 | *
27 | * @author twak
28 | */
29 | public class CapShip extends Ship
30 | {
31 | transient boolean addCap = true; // really for debug no need to serialize yet
32 | boolean atZeroHeight = false;
33 |
34 | @Override
35 | public JComponent getToolInterface( WeakListener refreshAnchors, Changed refreshFeatureListListener, Plan plan )
36 | {
37 | return new CapShipUI( this, plan );
38 | }
39 |
40 | @Override
41 | protected Instance createInstance()
42 | {
43 | return new CapInstance();
44 | }
45 |
46 | public class CapInstance extends Instance
47 | {
48 | @Override
49 | public LContext process( Anchor anchor, LContext toEdit, Marker planMarker, Marker profileMarker, Edge edge, AnchorHeightEvent hauler, Corner oldLeadingCorner )
50 | {
51 | PlanSkeleton skel = hauler.skel;
52 |
53 | SkeletonCapUpdate capUpdate = new SkeletonCapUpdate(skel);
54 |
55 | LoopL flatTop = capUpdate.getCap(-profileMarker.y);
56 |
57 | capUpdate.update(new LoopL(), new SetCorrespondence(), new DHash());
58 |
59 | if (addCap)
60 | {
61 | LoopL togo =
62 | flatTop.new Map()
63 | {
64 | @Override
65 | public Point3d map( Loopable input )
66 | {
67 | return new Point3d( input.get().x, input.get().y, atZeroHeight ? 0.01 : input.get().z );
68 | }
69 | }.run();
70 | skel.output.addNonSkeletonOutputFace2( togo, new Vector3d( 0, 0, 1 ) );
71 | }
72 |
73 |
74 |
75 | skel.qu.clearFaceEvents();
76 | skel.qu.clearOtherEvents();
77 |
78 | DebugDevice.dump("post cap dump", skel);
79 |
80 | return null;
81 | }
82 | }
83 |
84 | @Override
85 | protected Anchor createNewAnchor()
86 | {
87 | return Siteplan.instance.plan.createAnchor( Plan.AnchorType.PROFILE, this );
88 | }
89 |
90 | @Override
91 | public String getFeatureName()
92 | {
93 | return ("cap");
94 | }
95 |
96 | @Override
97 | public Ship clone( Plan plan )
98 | {
99 | return new CapShip();
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/TagFeatureList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | /*
7 | * TagFeatureList.java
8 | *
9 | * Created on 28-Jun-2010, 04:27:52
10 | */
11 |
12 | package org.twak.siteplan.junk;
13 |
14 | import javax.swing.DefaultListModel;
15 |
16 | import org.twak.camp.Tag;
17 | import org.twak.siteplan.campskeleton.Siteplan;
18 |
19 | /**
20 | *
21 | * @author twak
22 | */
23 | public class TagFeatureList extends javax.swing.JPanel {
24 | /** Creates new form TagFeatureList */
25 | public TagFeatureList() {
26 | initComponents();
27 | }
28 |
29 | TagFeatureList(Tag ... features) {
30 | initComponents();
31 | DefaultListModel lm = new DefaultListModel();
32 | for (Tag f : features)
33 | lm.addElement( f );
34 |
35 | tagList.setModel(lm);
36 | tagList.setSelectedIndex(0);
37 | }
38 |
39 | /** This method is called from within the constructor to
40 | * initialize the form.
41 | * WARNING: Do NOT modify this code. The content of this method is
42 | * always regenerated by the Form Editor.
43 | */
44 | @SuppressWarnings("unchecked")
45 | // //GEN-BEGIN:initComponents
46 | private void initComponents() {
47 |
48 | jScrollPane1 = new javax.swing.JScrollPane();
49 | tagList = new javax.swing.JList();
50 | jSeparator1 = new javax.swing.JSeparator();
51 |
52 | tagList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
53 | public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
54 | tagListValueChanged(evt);
55 | }
56 | });
57 | jScrollPane1.setViewportView(tagList);
58 |
59 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
60 | this.setLayout(layout);
61 | layout.setHorizontalGroup(
62 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
63 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
64 | .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
65 | );
66 | layout.setVerticalGroup(
67 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
68 | .addGroup(layout.createSequentialGroup()
69 | .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
70 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
71 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE))
72 | );
73 | }// //GEN-END:initComponents
74 |
75 | private void tagListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_tagListValueChanged
76 | Tag f = (Tag)tagList.getSelectedValue();
77 | // CampSkeleton.instance.setSelectedFeature(f); // may be null ;)
78 | }//GEN-LAST:event_tagListValueChanged
79 |
80 |
81 | // Variables declaration - do not modify//GEN-BEGIN:variables
82 | private javax.swing.JScrollPane jScrollPane1;
83 | private javax.swing.JSeparator jSeparator1;
84 | private javax.swing.JList tagList;
85 | // End of variables declaration//GEN-END:variables
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anim/APlanBoxes.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anim;
2 |
3 | import java.awt.Rectangle;
4 | import java.awt.geom.Area;
5 | import java.awt.geom.PathIterator;
6 | import javax.vecmath.Point2d;
7 |
8 | import org.twak.camp.ui.Bar;
9 | import org.twak.siteplan.campskeleton.*;
10 | import org.twak.utils.Cache2;
11 | import org.twak.utils.collections.Loop;
12 | import org.twak.utils.collections.LoopL;
13 |
14 | /**
15 | *
16 | * @author twak
17 | */
18 | public class APlanBoxes extends Plan
19 | {
20 |
21 | public APlanBoxes()
22 | {
23 | // buildFromPlan = new BuildFromPlan(this);
24 | }
25 |
26 | // tolerance for removing coincident points
27 | final static double TOL = 0.001;
28 |
29 | @Override
30 | public void update( int frame, int delta )
31 | {
32 | super.update( frame, delta );
33 |
34 | Rectangle r1 = new Rectangle( 10, 10, 200, 200 );
35 | Rectangle r2 = new Rectangle( -50 + frame * 5, 50, 50, 100 );
36 |
37 | Area a = new Area( r1 );
38 | // a.transform( AffineTransform.getRotateInstance( 43 ));
39 | a.subtract( new Area( r2 ) );
40 |
41 | Cache2 pCache = new Cache2()
42 | {
43 |
44 | @Override
45 | public Point2d create( Double i1, Double i2 )
46 | {
47 | return new Point2d( i1, i2 );
48 | }
49 | };
50 |
51 |
52 | // any for now
53 | Profile p = new Profile( 100 );//findProfiles().iterator().next();
54 |
55 | p.points.get( 0 ).start.get().end.x += 20;
56 |
57 | addLoop( p.points.get( 0 ), root, p );
58 |
59 | profiles.clear();
60 |
61 | points = new LoopL();
62 | Loop loop = null;
63 |
64 | PathIterator pit = a.getPathIterator( null );
65 |
66 | Point2d start = null, last = null;
67 |
68 | while ( !pit.isDone() )
69 | {
70 | double[] coords = new double[6];
71 | switch ( pit.currentSegment( coords ) )
72 | {
73 | case PathIterator.SEG_LINETO:
74 | {
75 | Bar b;
76 |
77 | Point2d pt = new Point2d (coords[0], coords[1]);
78 | if ( pt.distance( last ) > TOL )
79 | {
80 | loop.append( b = new Bar( pCache.get( pt.x, pt.y ), pCache.get( last.x, last.y ) ) );
81 | profiles.put( b, p );
82 | last = pt;
83 | }
84 | }
85 | break;
86 | case PathIterator.SEG_MOVETO:
87 | loop = new Loop();
88 | start = last = new Point2d( coords[0], coords[1] );
89 | points.add( loop );
90 | break;
91 | case PathIterator.SEG_CLOSE:
92 | {
93 | Bar b;
94 |
95 | loop.append( b = new Bar( pCache.get( start.x, start.y ), pCache.get( last.x, last.y ) ) );
96 | profiles.put( b, p );
97 | loop.append( b );
98 | }
99 | break;
100 | default:
101 | break;
102 | }
103 | pit.next();
104 | }
105 | points.reverseEachLoop();
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/AnimateAnchorShipUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | /*
7 | * AnimateAnchorShipUI.java
8 | *
9 | * Created on 02-Dec-2010, 03:00:52
10 | */
11 |
12 | package org.twak.siteplan.anchors;
13 |
14 | import javax.swing.event.ChangeEvent;
15 | import javax.swing.event.ChangeListener;
16 |
17 | /**
18 | *
19 | * @author twak
20 | */
21 | public class AnimateAnchorShipUI extends javax.swing.JPanel {
22 |
23 | AnimateAnchorShip ship;
24 |
25 | /** Creates new form AnimateAnchorShipUI */
26 | public AnimateAnchorShipUI() {
27 | initComponents();
28 | }
29 |
30 | AnimateAnchorShipUI( AnimateAnchorShip ship )
31 | {
32 | this.ship = ship;
33 |
34 | initComponents();
35 |
36 | speedSlider.setValue( (int) ship.speed );
37 | }
38 |
39 | /** This method is called from within the constructor to
40 | * initialize the form.
41 | * WARNING: Do NOT modify this code. The content of this method is
42 | * always regenerated by the Form Editor.
43 | */
44 | @SuppressWarnings("unchecked")
45 | // //GEN-BEGIN:initComponents
46 | private void initComponents() {
47 |
48 | jLabel1 = new javax.swing.JLabel();
49 | speedSlider = new javax.swing.JSlider();
50 |
51 | jLabel1.setText("speed");
52 |
53 | speedSlider.setMinimum(-100);
54 | speedSlider.setValue(5);
55 | speedSlider.addChangeListener(new javax.swing.event.ChangeListener() {
56 | public void stateChanged(javax.swing.event.ChangeEvent evt) {
57 | speedSliderStateChanged(evt);
58 | }
59 | });
60 |
61 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
62 | this.setLayout(layout);
63 | layout.setHorizontalGroup(
64 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
65 | .addGroup(layout.createSequentialGroup()
66 | .addContainerGap()
67 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
68 | .addComponent(speedSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
69 | .addComponent(jLabel1))
70 | .addContainerGap())
71 | );
72 | layout.setVerticalGroup(
73 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
74 | .addGroup(layout.createSequentialGroup()
75 | .addContainerGap()
76 | .addComponent(jLabel1)
77 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
78 | .addComponent(speedSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
79 | .addContainerGap(229, Short.MAX_VALUE))
80 | );
81 | }// //GEN-END:initComponents
82 |
83 | private void speedSliderStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_speedSliderStateChanged
84 | {//GEN-HEADEREND:event_speedSliderStateChanged
85 | ship.speed = (double) speedSlider.getValue();
86 | }//GEN-LAST:event_speedSliderStateChanged
87 |
88 |
89 | // Variables declaration - do not modify//GEN-BEGIN:variables
90 | private javax.swing.JLabel jLabel1;
91 | private javax.swing.JSlider speedSlider;
92 | // End of variables declaration//GEN-END:variables
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/SubdivideShipUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
69 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/JDirection.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.junk;
2 |
3 | import java.awt.Color;
4 | import java.awt.Dimension;
5 | import java.awt.Graphics;
6 | import java.awt.Point;
7 | import java.awt.event.MouseAdapter;
8 | import java.awt.event.MouseEvent;
9 | import javax.swing.JComponent;
10 |
11 | import org.twak.camp.ui.DirectionEvent;
12 | import org.twak.camp.ui.MachineEvent;
13 | import org.twak.utils.Mathz;
14 |
15 | /**
16 | *
17 | * @author twak
18 | */
19 | public class JDirection extends JComponent implements SelectableComponent
20 | {
21 | public DirectionEvent direction;
22 | public JDirectionRack rack;
23 | public boolean selected;
24 |
25 | public JDirection() // unused?
26 | {
27 | setPreferredSize( new Dimension (30,30) );
28 | MouseAdapter ap = new DMouseListener();
29 | addMouseListener( ap );
30 | addMouseMotionListener( ap );
31 | }
32 |
33 | public JDirection (JDirectionRack rack, DirectionEvent direction)
34 | {
35 | this();
36 | this.rack = rack;
37 | setDirection( direction );
38 | }
39 |
40 | public void setDirection(DirectionEvent direction)
41 | {
42 | this.direction = direction;
43 | repaint();
44 | }
45 |
46 | public void paint(Graphics g)
47 | {
48 | g.setColor( selected ? Color.yellow : Color.lightGray);
49 | g.fillArc( 0,0,getWidth(), getHeight(), 0, 360 );
50 | g.setColor( Color.darkGray );
51 | g.drawLine( getWidth()/2, getHeight()/2,
52 | (int)((getWidth()/2) *(Math.sin( direction.angle ) + 1 )) ,
53 | (int)((getHeight()/2) *(-Math.cos( direction.angle) + 1 )) );
54 | g.setColor( Color.black );
55 | g.drawArc( 0,0,getWidth(), getHeight(), 0, 360 );
56 | }
57 |
58 | public void setSelected( boolean selected )
59 | {
60 | this.selected = selected;
61 | }
62 |
63 | public boolean isSelected()
64 | {
65 | return selected;
66 | }
67 |
68 | public MachineEvent getMachineEvent()
69 | {
70 | return direction;
71 | }
72 |
73 | public class DMouseListener extends MouseAdapter
74 | {
75 | Point old;
76 | @Override
77 | public void mousePressed( MouseEvent e )
78 | {
79 | old = e.getPoint();
80 | rack.selected(JDirection.this);
81 | repaint(); // might have been selected!
82 | }
83 |
84 | /**
85 | * Vertical direction gets thrown to parent, Horizontal changes angle
86 | * @param e
87 | */
88 | @Override
89 | public void mouseDragged( MouseEvent e )
90 | {
91 | int dX = e.getPoint().x - old.x;
92 | int dY = e.getPoint().y - old.y;
93 |
94 | direction.angle += dX / (double) 50;
95 | direction.height -= dY * rack.pixelsToHeight(); // not good, depends on height of JDirectionRack :(
96 |
97 | direction.angle = Mathz.clamp( direction.angle, -Math.PI/2+.1, Math.PI/2-.1);
98 | direction.height = Mathz.clamp( direction.height, 0, rack.height);
99 |
100 | Point sL = getLocation();
101 | getParent().doLayout(); //...?
102 | Point eL = getLocation();
103 |
104 | // position for mouse event deltas
105 | old = new Point (
106 | e.getPoint().x - eL.x + sL.x,
107 | e.getPoint().y - eL.y + sL.y );
108 | repaint();
109 | // hack - force root repaint to refresh skeleton
110 | getRootPane().repaint();
111 | }
112 |
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/bloom_blur.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2006 jMonkeyEngine
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | *
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | uniform float sampleDist;
34 | uniform float blurIntensityMultiplier;
35 | uniform sampler2D RT;
36 | varying vec2 texCoord;
37 |
38 | void main(void)
39 | {
40 | vec2 samples00 = vec2(-0.326212, -0.405805);
41 | vec2 samples01 = vec2(-0.840144, -0.073580);
42 | vec2 samples02 = vec2(-0.695914, 0.457137);
43 | vec2 samples03 = vec2(-0.203345, 0.620716);
44 | vec2 samples04 = vec2( 0.962340, -0.194983);
45 | vec2 samples05 = vec2( 0.473434, -0.480026);
46 | vec2 samples06 = vec2( 0.519456, 0.767022);
47 | vec2 samples07 = vec2( 0.185461, -0.893124);
48 | vec2 samples08 = vec2( 0.507431, 0.064425);
49 | vec2 samples09 = vec2( 0.896420, 0.412458);
50 | vec2 samples10 = vec2(-0.321940, -0.932615);
51 | vec2 samples11 = vec2(-0.791559, -0.597705);
52 |
53 | vec2 newCoord;
54 | vec4 sum = texture2D(RT, texCoord);
55 |
56 | newCoord = texCoord + sampleDist * samples00;
57 | sum += texture2D(RT, newCoord);
58 |
59 | newCoord = texCoord + sampleDist * samples01;
60 | sum += texture2D(RT, newCoord);
61 |
62 | newCoord = texCoord + sampleDist * samples02;
63 | sum += texture2D(RT, newCoord);
64 |
65 | newCoord = texCoord + sampleDist * samples03;
66 | sum += texture2D(RT, newCoord);
67 |
68 | newCoord = texCoord + sampleDist * samples04;
69 | sum += texture2D(RT, newCoord);
70 |
71 | newCoord = texCoord + sampleDist * samples05;
72 | sum += texture2D(RT, newCoord);
73 |
74 | newCoord = texCoord + sampleDist * samples06;
75 | sum += texture2D(RT, newCoord);
76 |
77 | newCoord = texCoord + sampleDist * samples07;
78 | sum += texture2D(RT, newCoord);
79 |
80 | newCoord = texCoord + sampleDist * samples08;
81 | sum += texture2D(RT, newCoord);
82 |
83 | newCoord = texCoord + sampleDist * samples09;
84 | sum += texture2D(RT, newCoord);
85 |
86 | newCoord = texCoord + sampleDist * samples10;
87 | sum += texture2D(RT, newCoord);
88 |
89 | newCoord = texCoord + sampleDist * samples11;
90 | sum += texture2D(RT, newCoord);
91 |
92 | sum /= 13.0;
93 | sum *= blurIntensityMultiplier;
94 |
95 | gl_FragColor = sum;
96 | }
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/JStringProfileCheckItem.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
65 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/DirectionUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
79 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/JStringProfileCheckMap.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
83 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/AlgoElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * AlgoElement.java
3 | *
4 | * Created on 08-May-2010, 01:41:30
5 | */
6 |
7 | package org.twak.siteplan.junk;
8 |
9 | import java.util.List;
10 | import java.util.Map;
11 | import java.util.Set;
12 | import javax.swing.DefaultComboBoxModel;
13 |
14 | import org.twak.siteplan.campskeleton.Profile;
15 |
16 | /**
17 | *
18 | * @author twak
19 | */
20 | public class AlgoElement extends javax.swing.JPanel
21 | {
22 | String name;
23 | Set profile;
24 | Map mapping;
25 |
26 | /** Creates new form AlgoElement */
27 | public AlgoElement() {
28 | initComponents();
29 | }
30 | public AlgoElement(String name, List profile, Map mapping, Profile selected) {
31 | this.mapping = mapping;
32 | this.name = name;
33 | initComponents();
34 |
35 | DefaultComboBoxModel cm = new DefaultComboBoxModel();
36 |
37 | nameLabel.setText( name );
38 |
39 | for (Profile p : profile)
40 | cm.addElement( p );
41 |
42 | profileChooser.setModel( cm );
43 | profileChooser.setSelectedItem( selected == null ? profile.iterator().next() : selected );
44 | if (mapping.get(name) == null)
45 | mapping.put (name, (Profile)profileChooser.getSelectedItem());
46 | }
47 |
48 |
49 |
50 | /** This method is called from within the constructor to
51 | * initialize the form.
52 | * WARNING: Do NOT modify this code. The content of this method is
53 | * always regenerated by the Form Editor.
54 | */
55 | @SuppressWarnings("unchecked")
56 | // //GEN-BEGIN:initComponents
57 | private void initComponents() {
58 |
59 | profileChooser = new javax.swing.JComboBox();
60 | nameLabel = new javax.swing.JLabel();
61 |
62 | profileChooser.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
63 | profileChooser.addItemListener(new java.awt.event.ItemListener() {
64 | public void itemStateChanged(java.awt.event.ItemEvent evt) {
65 | profileChooserItemStateChanged(evt);
66 | }
67 | });
68 |
69 | nameLabel.setText("jLabel1");
70 |
71 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
72 | this.setLayout(layout);
73 | layout.setHorizontalGroup(
74 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
75 | .addGroup(layout.createSequentialGroup()
76 | .addContainerGap()
77 | .addComponent(nameLabel)
78 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
79 | .addComponent(profileChooser, 0, 319, Short.MAX_VALUE)
80 | .addContainerGap())
81 | );
82 | layout.setVerticalGroup(
83 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
84 | .addGroup(layout.createSequentialGroup()
85 | .addContainerGap()
86 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
87 | .addComponent(profileChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
88 | .addComponent(nameLabel))
89 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
90 | );
91 | }// //GEN-END:initComponents
92 |
93 | private void profileChooserItemStateChanged(java.awt.event.ItemEvent evt)//GEN-FIRST:event_profileChooserItemStateChanged
94 | {//GEN-HEADEREND:event_profileChooserItemStateChanged
95 | System.out.println(name+" set to "+ profileChooser.getSelectedItem());
96 | mapping.put( name, (Profile) profileChooser.getSelectedItem() );
97 | }//GEN-LAST:event_profileChooserItemStateChanged
98 |
99 |
100 | // Variables declaration - do not modify//GEN-BEGIN:variables
101 | private javax.swing.JLabel nameLabel;
102 | private javax.swing.JComboBox profileChooser;
103 | // End of variables declaration//GEN-END:variables
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/junk/JDirectionRack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | package org.twak.siteplan.junk;
7 |
8 | import java.awt.Color;
9 | import java.awt.Component;
10 | import java.awt.Dimension;
11 | import java.awt.Graphics;
12 | import java.util.ArrayList;
13 | import java.util.Collection;
14 | import java.util.Collections;
15 | import java.util.Comparator;
16 | import java.util.List;
17 | import javax.swing.JComponent;
18 | import javax.swing.border.LineBorder;
19 |
20 | import org.twak.camp.ui.MachineEvent;
21 |
22 | /**
23 | *
24 | * @author twak
25 | */
26 | public class JDirectionRack extends JComponent
27 | {
28 | // height that this rack represents
29 | double height = 200;
30 | List model = new ArrayList();
31 | SelectableComponent selected = null;
32 |
33 |
34 | public JDirectionRack()
35 | {
36 | setBorder( new LineBorder ( Color.black, 4 ));
37 | setPreferredSize( new Dimension (50, 200));
38 | setMaximumSize( new Dimension (50, Integer.MAX_VALUE));
39 | }
40 |
41 | public JDirectionRack( List model)
42 | {
43 | this();
44 | for (MachineEvent jd : model)
45 | addDirection( jd );
46 | this.model = model;
47 | }
48 |
49 | public Collection getDirectionsCopy()
50 | {
51 | List out = new ArrayList();
52 | out.addAll( model );
53 | Collections.sort( out, new Comparator()
54 | { public int compare( MachineEvent o1, MachineEvent o2 )
55 | { return Double.compare( o1.height, o2.height ); } } );
56 | return out;
57 | }
58 |
59 | @Override
60 | public void paint( Graphics g )
61 | {
62 | g.setColor( getBackground() );
63 | g.fillRect( 0,0, getWidth(), getHeight());
64 | super.paint( g );
65 | }
66 |
67 | String MACHINE_EVENT = "machine event";
68 |
69 | public void addDirection ( MachineEvent dir )
70 | {
71 | // JComponent jc = dir.createUI( this );
72 | // jc.putClientProperty( MACHINE_EVENT, dir);
73 | // add(jc);
74 | model.add( dir );
75 | doLayout();
76 | }
77 |
78 | public void removeSelectedDirection()
79 | {
80 | if (selected == null)
81 | return; // make an annoying sound
82 | removeDirection( selected.getMachineEvent() );
83 | selected = null;
84 | repaint();
85 | }
86 |
87 | public void removeDirection( MachineEvent dir )
88 | {
89 | Component togo = null;
90 |
91 | for ( Component c : getComponents() )
92 | {
93 | if ( c instanceof SelectableComponent )
94 | {
95 | SelectableComponent jd = (SelectableComponent) c;
96 | if ( dir == jd.getMachineEvent() )
97 | {
98 | togo = c;
99 | }
100 | }
101 | }
102 | if ( togo != null )
103 | {
104 | remove( togo );
105 | model.remove( dir );
106 | }
107 | }
108 |
109 | @Override
110 | public void doLayout()
111 | {
112 | for (Component c : getComponents())
113 | {
114 | if (c instanceof JComponent)
115 | {
116 | JComponent jd = (JComponent)c;
117 | MachineEvent me = (MachineEvent)jd.getClientProperty( MACHINE_EVENT );
118 | if ( me != null )
119 | {
120 | jd.setSize( jd.getPreferredSize() );
121 | jd.setLocation( 0, getHeight() - jd.getHeight() - (int) ( me.height * ( getHeight() - jd.getHeight() ) / height ) );
122 | }
123 | }
124 | }
125 | }
126 |
127 | public double pixelsToHeight()
128 | {
129 | return (height / (getHeight() -30 ));
130 | }
131 |
132 | void selected( SelectableComponent aThis )
133 | {
134 | if ( selected != null )
135 | {
136 | selected.setSelected( false );
137 | selected.repaint();
138 | }
139 |
140 | aThis.setSelected( true );
141 | selected = aThis;
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/AnchorUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * AnchorUI.java
3 | *
4 | * Created on 24-Jun-2010, 01:42:23
5 | */
6 |
7 | package org.twak.siteplan.anchors;
8 |
9 | import java.awt.Color;
10 | import javax.swing.ButtonGroup;
11 | import javax.swing.JToggleButton;
12 |
13 | import org.twak.siteplan.campskeleton.Siteplan;
14 | import org.twak.utils.WeakListener;
15 |
16 | /**
17 | *
18 | * @author twak
19 | */
20 | public class AnchorUI extends javax.swing.JPanel implements WeakListener.Changed
21 | {
22 | Anchor anchor;
23 | ButtonGroup bg;
24 |
25 | /** Creates new form AnchorUI */
26 | public AnchorUI()
27 | {
28 | initComponents();
29 | }
30 | public AnchorUI( Anchor anchor, ButtonGroup bg )
31 | {
32 | this.anchor = anchor;
33 | this.bg = bg;
34 | initComponents();
35 | nameLabel.setText(anchor.name);
36 | bg.add(selectButton);
37 | Siteplan.instance.selectedAnchorListeners.add(this);
38 | Siteplan.instance.somethingChangedListeners.add(this);
39 | changed();
40 | }
41 |
42 | public void changed()
43 | {
44 | updateButton();
45 | }
46 |
47 | public void updateButton()
48 | {
49 | if (Siteplan.instance.selectedAnchor != anchor)
50 | selectButton.setSelected(false);
51 |
52 | int count = 0;
53 |
54 | if (Siteplan.instance.plan.countMarkerMatches(anchor.getPlanGen()) > 0)
55 | count++;
56 |
57 | if (Siteplan.instance.plan.countMarkerMatches(anchor.getProfileGen()) > 0)
58 | count++;
59 |
60 | selectButton.setText( count + "/2" );
61 | selectButton.setForeground( count < 2 ? Color.red : Color.green );
62 | }
63 |
64 | public JToggleButton getButton()
65 | {
66 | return selectButton;
67 | }
68 |
69 | /** This method is called from within the constructor to
70 | * initialize the form.
71 | * WARNING: Do NOT modify this code. The content of this method is
72 | * always regenerated by the Form Editor.
73 | */
74 | @SuppressWarnings("unchecked")
75 | // //GEN-BEGIN:initComponents
76 | private void initComponents() {
77 |
78 | selectButton = new javax.swing.JToggleButton();
79 | nameLabel = new javax.swing.JLabel();
80 |
81 | selectButton.setText("0/2");
82 | selectButton.setToolTipText("click on anchors after clicking this to locate feature");
83 | selectButton.addActionListener(new java.awt.event.ActionListener() {
84 | public void actionPerformed(java.awt.event.ActionEvent evt) {
85 | selectButtonActionPerformed(evt);
86 | }
87 | });
88 |
89 | nameLabel.setText("a very very long name that goes on and on and one");
90 |
91 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
92 | this.setLayout(layout);
93 | layout.setHorizontalGroup(
94 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
96 | .addContainerGap()
97 | .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, Short.MAX_VALUE)
98 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
99 | .addComponent(selectButton))
100 | );
101 | layout.setVerticalGroup(
102 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
103 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
104 | .addComponent(selectButton)
105 | .addComponent(nameLabel))
106 | );
107 | }// //GEN-END:initComponents
108 |
109 | private void selectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed
110 | Siteplan.instance.nowSelectingFor(anchor);
111 | }//GEN-LAST:event_selectButtonActionPerformed
112 |
113 |
114 | // Variables declaration - do not modify//GEN-BEGIN:variables
115 | private javax.swing.JLabel nameLabel;
116 | protected javax.swing.JToggleButton selectButton;
117 | // End of variables declaration//GEN-END:variables
118 | }
119 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/jme/resources/dof_3_dof_2.frag:
--------------------------------------------------------------------------------
1 | // "Depth of Field" demo for Ogre
2 | // Copyright (C) 2006 Christian Lindequist Larsen
3 | //
4 | // This code is in the public domain. You may do whatever you want with it.
5 |
6 | uniform float sampleDist0;
7 | uniform sampler2D scene; // full resolution image
8 | uniform sampler2D depth; // full resolution image with depth values
9 |
10 | varying vec2 vTexCoord;
11 |
12 |
13 | void main()
14 | {
15 |
16 | vec2 samples00 = vec2(-0.326212, -0.405805);
17 | vec2 samples01 = vec2(-0.840144, -0.073580);
18 | vec2 samples02 = vec2(-0.695914, 0.457137);
19 | vec2 samples03 = vec2(-0.203345, 0.620716);
20 | vec2 samples04 = vec2( 0.962340, -0.194983);
21 | vec2 samples05 = vec2( 0.473434, -0.480026);
22 | vec2 samples06 = vec2( 0.519456, 0.767022);
23 | vec2 samples07 = vec2( 0.185461, -0.893124);
24 | vec2 samples08 = vec2( 0.507431, 0.064425);
25 | vec2 samples09 = vec2( 0.896420, 0.412458);
26 | vec2 samples10 = vec2(-0.321940, -0.932615);
27 | vec2 samples11 = vec2(-0.791559, -0.597705);
28 |
29 | vec2 newCoord;
30 | vec4 sum = texture2D(scene, vTexCoord);
31 |
32 |
33 | vec4 d = texture2D(depth, vTexCoord);
34 |
35 | float _sampleDist0 = (d.r)*sampleDist0;
36 |
37 | float additionCount = 1.0;
38 |
39 | vec4 dCheck = vec4(0.0, 0.0, 0.0, 0.0);
40 | newCoord = vTexCoord + _sampleDist0 * samples00;
41 | dCheck = texture2D(depth, newCoord);
42 | if (abs(dCheck.r-d.r)<0.1)
43 | {
44 | sum += texture2D(scene, newCoord);
45 | additionCount = additionCount+1.0;
46 | }
47 |
48 | newCoord = vTexCoord + _sampleDist0 * samples01;
49 | dCheck = texture2D(depth, newCoord);
50 | if (abs(dCheck.r-d.r)<0.1)
51 | {
52 | sum += texture2D(scene, newCoord);
53 | additionCount = additionCount+1.0;
54 | }
55 |
56 | newCoord = vTexCoord + _sampleDist0 * samples02;
57 | dCheck = texture2D(depth, newCoord);
58 | if (abs(dCheck.r-d.r)<0.1)
59 | {
60 | sum += texture2D(scene, newCoord);
61 | additionCount = additionCount+1.0;
62 | }
63 |
64 | newCoord = vTexCoord + _sampleDist0 * samples03;
65 | dCheck = texture2D(depth, newCoord);
66 | if (abs(dCheck.r-d.r)<0.1)
67 | {
68 | sum += texture2D(scene, newCoord);
69 | additionCount = additionCount+1.0;
70 | }
71 |
72 | newCoord = vTexCoord + _sampleDist0 * samples04;
73 | dCheck = texture2D(depth, newCoord);
74 | if (abs(dCheck.r-d.r)<0.1)
75 | {
76 | sum += texture2D(scene, newCoord);
77 | additionCount = additionCount+1.0;
78 | }
79 |
80 | newCoord = vTexCoord + _sampleDist0 * samples05;
81 | dCheck = texture2D(depth, newCoord);
82 | if (abs(dCheck.r-d.r)<0.1)
83 | {
84 | sum += texture2D(scene, newCoord);
85 | additionCount = additionCount+1.0;
86 | }
87 |
88 | newCoord = vTexCoord + _sampleDist0 * samples06;
89 | dCheck = texture2D(depth, newCoord);
90 | if (abs(dCheck.r-d.r)<0.1)
91 | {
92 | sum += texture2D(scene, newCoord);
93 | additionCount = additionCount+1.0;
94 | }
95 |
96 | newCoord = vTexCoord + _sampleDist0 * samples07;
97 | dCheck = texture2D(depth, newCoord);
98 | if (abs(dCheck.r-d.r)<0.1)
99 | {
100 | sum += texture2D(scene, newCoord);
101 | additionCount = additionCount+1.0;
102 | }
103 |
104 | newCoord = vTexCoord + _sampleDist0 * samples08;
105 | dCheck = texture2D(depth, newCoord);
106 | if (abs(dCheck.r-d.r)<0.1)
107 | {
108 | sum += texture2D(scene, newCoord);
109 | additionCount = additionCount+1.0;
110 | }
111 |
112 | newCoord = vTexCoord + _sampleDist0 * samples09;
113 | dCheck = texture2D(depth, newCoord);
114 | if (abs(dCheck.r-d.r)<0.1)
115 | {
116 | sum += texture2D(scene, newCoord);
117 | additionCount = additionCount+1.0;
118 | }
119 |
120 | newCoord = vTexCoord + _sampleDist0 * samples10;
121 | dCheck = texture2D(depth, newCoord);
122 | if (abs(dCheck.r-d.r)<0.1)
123 | {
124 | sum += texture2D(scene, newCoord);
125 | additionCount = additionCount+1.0;
126 | }
127 |
128 | newCoord = vTexCoord + _sampleDist0 * samples11;
129 | dCheck = texture2D(depth, newCoord);
130 | if (abs(dCheck.r-d.r)<0.1)
131 | {
132 | sum += texture2D(scene, newCoord);
133 | additionCount = additionCount+1.0;
134 | }
135 |
136 | sum /= additionCount;
137 | sum.a = d.r*2.0;
138 | gl_FragColor = sum;
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/AboutBox.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
91 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/AnimateAnchorCircularShipUI.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
86 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.twak.siteplan
5 | siteplan
6 | 0.0.1
7 |
8 | jar
9 |
10 |
11 | org.jmonkeyengine
12 | 3.3.2-stable
13 | UTF-8
14 | 8
15 | 8
16 |
17 |
18 |
19 | src
20 |
21 |
22 | src
23 |
24 | **/*.java
25 | **/*.form
26 |
27 |
28 |
29 |
30 |
31 | maven-compiler-plugin
32 | 3.5.1
33 |
34 | 1.8
35 | 1.8
36 |
37 |
38 |
39 |
40 |
41 | maven-assembly-plugin
42 |
43 |
44 |
45 | org.twak.siteplan.campskeleton.Siteplan
46 |
47 |
48 |
49 | jar-with-dependencies
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | maven2-repository.dev.java.net
59 | Java.net repository
60 | http://download.java.net/maven/2
61 |
62 |
63 |
64 | jcenter
65 | https://jcenter.bintray.com
66 |
67 |
68 |
69 |
70 |
71 | release
72 |
73 | true
74 |
75 |
76 |
77 |
78 | jitpack.io
79 | https://jitpack.io
80 |
81 |
82 |
83 |
84 |
85 | com.github.twak
86 | jutils
87 | 0.0.1
88 |
89 |
90 | com.github.twak
91 | campskeleton
92 | 0.0.1
93 |
94 |
95 |
96 |
97 |
98 | dev
99 |
100 |
101 |
102 | org.twak.utils
103 | utils
104 | 0.0.1-SNAPSHOT
105 |
106 |
107 |
108 | org.twak.campskeleton
109 | campskeleton
110 | 0.0.1-SNAPSHOT
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | javax.vecmath
121 | vecmath
122 | 1.5.2
123 |
124 |
125 |
126 | org.apache.xmlgraphics
127 | batik-svg-dom
128 | 1.8
129 |
130 |
131 |
132 | com.thoughtworks.xstream
133 | xstream
134 | 1.4.9
135 |
136 |
137 |
138 | ${jme3_g}
139 | jme3-core
140 | ${jme3_v}
141 |
142 |
143 |
144 | ${jme3_g}
145 | jme3-desktop
146 | ${jme3_v}
147 |
148 |
149 |
150 | ${jme3_g}
151 | jme3-lwjgl
152 | ${jme3_v}
153 |
154 |
155 | ${jme3_g}
156 | jme3-effects
157 | ${jme3_v}
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/NaturalStepPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
85 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/tags/JStringProfileCheckMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 |
6 | /*
7 | * JProfileProfileMap.java
8 | *
9 | * Created on 09-Nov-2010, 00:53:58
10 | */
11 |
12 | package org.twak.siteplan.tags;
13 |
14 | import java.util.Map;
15 |
16 | import org.twak.siteplan.campskeleton.Plan;
17 | import org.twak.siteplan.campskeleton.Profile;
18 | import org.twak.utils.ui.ListDownLayout;
19 |
20 | /**
21 | *
22 | * @author twak
23 | */
24 | public class JStringProfileCheckMap extends javax.swing.JPanel {
25 |
26 | Plan plan;
27 |
28 | /** Creates new form JProfileProfileMap */
29 | public JStringProfileCheckMap() {
30 | initComponents();
31 | }
32 | public JStringProfileCheckMap( Plan plan, Map map, Iterable keys ) {
33 | this.plan = plan;
34 | initComponents();
35 |
36 | profilePanel.setLayout(new ListDownLayout());
37 | for (String p : keys)
38 | {
39 | // map to self for now
40 | if (map.get(p) == null)
41 | map.put (p,new SubdivideTag.ProfileMerge( plan.profiles.values().iterator().next(), false));
42 |
43 | profilePanel.add (new JStringProfileCheckItem(plan, p, map.get( p )));
44 | }
45 | }
46 |
47 | /** This method is called from within the constructor to
48 | * initialize the form.
49 | * WARNING: Do NOT modify this code. The content of this method is
50 | * always regenerated by the Form Editor.
51 | */
52 | @SuppressWarnings("unchecked")
53 | // //GEN-BEGIN:initComponents
54 | private void initComponents() {
55 |
56 | jScrollPane1 = new javax.swing.JScrollPane();
57 | profilePanel = new javax.swing.JPanel();
58 | jLabel1 = new javax.swing.JLabel();
59 | jLabel2 = new javax.swing.JLabel();
60 | jLabel3 = new javax.swing.JLabel();
61 |
62 | javax.swing.GroupLayout profilePanelLayout = new javax.swing.GroupLayout(profilePanel);
63 | profilePanel.setLayout(profilePanelLayout);
64 | profilePanelLayout.setHorizontalGroup(
65 | profilePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
66 | .addGap(0, 213, Short.MAX_VALUE)
67 | );
68 | profilePanelLayout.setVerticalGroup(
69 | profilePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
70 | .addGap(0, 248, Short.MAX_VALUE)
71 | );
72 |
73 | jScrollPane1.setViewportView(profilePanel);
74 |
75 | jLabel1.setText("merge");
76 |
77 | jLabel2.setText("input");
78 |
79 | jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
80 | jLabel3.setText("output");
81 |
82 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
83 | this.setLayout(layout);
84 | layout.setHorizontalGroup(
85 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
86 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
87 | .addComponent(jLabel2)
88 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
89 | .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
90 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
91 | .addComponent(jLabel1))
92 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
93 | );
94 | layout.setVerticalGroup(
95 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
96 | .addGroup(layout.createSequentialGroup()
97 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
98 | .addComponent(jLabel1)
99 | .addComponent(jLabel2)
100 | .addComponent(jLabel3))
101 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
102 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))
103 | );
104 | }// //GEN-END:initComponents
105 |
106 |
107 | // Variables declaration - do not modify//GEN-BEGIN:variables
108 | private javax.swing.JLabel jLabel1;
109 | private javax.swing.JLabel jLabel2;
110 | private javax.swing.JLabel jLabel3;
111 | private javax.swing.JScrollPane jScrollPane1;
112 | private javax.swing.JPanel profilePanel;
113 | // End of variables declaration//GEN-END:variables
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/FaceMergeGraph.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import java.util.HashSet;
4 | import java.util.Set;
5 |
6 | import org.twak.camp.Output.Face;
7 | import org.twak.camp.Output.SharedEdge;
8 |
9 | /**
10 | * Given a set of faces, and certain shared edges, marked for merging, we must
11 | * return groups of faces to be merged
12 | *
13 | * @author twak
14 | */
15 | class FaceMergeGraph
16 | {
17 |
18 | Set faces = new HashSet();
19 | Set reversed = new HashSet();
20 | Set toMerge = new HashSet();
21 |
22 | /**
23 | * @param f
24 | * @param reverse
25 | */
26 | public void add( Face f, boolean reverse )
27 | {
28 | faces.add(f);
29 |
30 | if ( reverse )
31 | reversed.add( f );
32 | }
33 |
34 | public Set findAdjacent( Face start )
35 | {
36 | Set out = new HashSet();
37 | findAdjacent( start, out );
38 | return out;
39 | }
40 |
41 | private void findAdjacent( Face f, Set adjacent )
42 | {
43 | adjacent.add( f );
44 |
45 | for ( SharedEdge se : f.edges.eIterator() )
46 | {
47 | Face f2 = se.getOther( f );
48 | if ( f2 != null && toMerge.contains( se ) && !adjacent.contains( f2 ) )
49 | findAdjacent( f2, adjacent );
50 | }
51 | }
52 |
53 | /**
54 | *
55 | * @param se a shared edge that has already been added (above).
56 | * @param fileProfile the profile to associate with the edge, in results, below
57 | * @param merge should this edge be merged with it's neighbours? If any shared edges are merged, the faces are merged in the output
58 | */
59 | public void registerMerge( SharedEdge se )
60 | {
61 | toMerge.add( se );
62 | }
63 |
64 | /**
65 | *
66 | * @param height
67 | * @return A list of corners whose associated edges contain ProfileMachine
68 | */
69 | public Set> getResults()
70 | {
71 | Set> out = new HashSet();
72 |
73 | // list of processed faces
74 | Set togo = new HashSet( faces );
75 | while ( !togo.isEmpty() )
76 | {
77 | // pick any old face
78 | Face f = togo.iterator().next();
79 | Set set = new HashSet();
80 | out.add(set);
81 | // find all faces that we'll merge
82 | findAdjacent( f, set );
83 | togo.removeAll( set );
84 |
85 | }
86 |
87 | return out;
88 | }
89 |
90 | public boolean isReversed( Face f )
91 | {
92 | return reversed.contains( f );
93 | }
94 | /**
95 | // use point3d instead of corner to get correct hashing behaviour
96 | DAGMeta dm = new DAGMeta();
97 |
98 | // build graph from set of faces to merge
99 | for ( Face face : set )
100 | {
101 | DebugDevice.dumpPoints( "a face", face.getLoopL() );
102 |
103 | for ( SharedEdge se : face.edges.eIterator() )
104 | {
105 |
106 | Point3d start = reversed.contains( face ) ? se.getStart( face ) : se.getEnd( face );
107 | Point3d end = reversed.contains( face ) ? se.getEnd( face ) : se.getStart( face );
108 | // profile map isn't reverse
109 | ProfileMachine p = profiles.get( se.getStart( face ), se.getEnd( face ) );
110 | dm.add( start, end, p );
111 | }
112 | }
113 |
114 | // remove returning edges of graph to give union
115 | DebugDevice.dumpPoints( "dm before", (LoopL) dm.debug() );
116 | dm.removeReturning();
117 | DebugDevice.dumpPoints( "dm after", dm.debug() );
118 |
119 | // a list of all the points we have to visit
120 | Set startPoints = new HashSet( dm.map.keySet() );
121 |
122 | // now traverse dm to create the boundaries:- output is an arbitrary region on the plane
123 | while ( !startPoints.isEmpty() )
124 | {
125 | Loop loop = new Loop();
126 | out.add( loop );
127 |
128 | Point3d start = startPoints.iterator().next();
129 | Point3d prev = start;
130 |
131 | Cache cCache = new Cache()
132 | {
133 |
134 | @Override
135 | public Corner create( Point3d i )
136 | {
137 | return new Corner( i.x, i.y, 0 );
138 | }
139 | };
140 |
141 | while ( true )
142 | {
143 | List> aiL = dm.get( prev );
144 | DAGMeta.ArcInfo ai = aiL.get( 0 );
145 |
146 | Corner s = cCache.get( prev ),
147 | e = cCache.get( ai.e );
148 |
149 |
150 | startPoints.remove( prev ); // startPoints.size()
151 |
152 | loop.append( e );
153 | Edge edge = new Edge( s, e );
154 | s.nextL = edge;
155 | e.prevL = edge;
156 | s.nextC = e;
157 | e.prevC = s;
158 | edge.machine = ai.d;
159 |
160 | if ( ai.e == start )
161 | // if (True)
162 | break;
163 |
164 | prev = ai.e;
165 | }
166 | }
167 | }
168 |
169 | */
170 | }
171 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/StepUI.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | import java.awt.BasicStroke;
4 | import java.awt.Graphics2D;
5 | import java.awt.event.MouseEvent;
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import javax.vecmath.Point2d;
9 |
10 | import org.twak.camp.ui.Bar;
11 | import org.twak.camp.ui.PointEditor;
12 | import org.twak.siteplan.junk.NaturalStep;
13 | import org.twak.utils.LContext;
14 | import org.twak.utils.collections.Loop;
15 |
16 | /**
17 | * UI for a square protusion. A natural extrude that gets melded into the plan. First and last points are fixed.
18 | */
19 | public class StepUI extends PlanUI
20 | {
21 | NaturalStep step;
22 |
23 | double[] xes, yes;
24 |
25 | public StepUI( NaturalStep step, PointEditor.BarSelected es )
26 | {
27 | super (Siteplan.instance.plan, step.shape , es);
28 | this.step = step;
29 | }
30 |
31 | @Override
32 | protected void createInitial()
33 | {
34 | super.createInitial();
35 | int i = 0;
36 |
37 | xes = new double[4];
38 | yes = new double[2];
39 |
40 | List lbar = new ArrayList();
41 | for (Bar b : edges.get( 0 ))
42 | lbar.add(b);
43 |
44 | // coordinates of step values
45 | xes[0] = lbar.get( 0 ).start.x;
46 | xes[1] = lbar.get( 1 ).start.x;
47 | xes[2] = lbar.get( 2 ).end.x;
48 | xes[3] = lbar.get( 4 ).end.x;
49 |
50 | yes[0] = lbar.get( 0 ).start.y;
51 | yes[1] = lbar.get( 2 ).start.y;
52 | }
53 |
54 | @Override
55 | public void movePoint( LContext ctx, Point2d pt,javax.vecmath.Point2d location,MouseEvent evt)
56 | {
57 | List lbar = new ArrayList();
58 | for ( Bar b : edges.get( 0 ) )
59 | lbar.add( b );
60 |
61 | // propogate change to other points
62 | if ( pt == lbar.get( 0 ).start )
63 | xes[0] = location.x;
64 | else if ( pt == lbar.get( 1 ).start )
65 | xes[1] = location.x;
66 | else if ( pt == lbar.get( 2 ).start )
67 | {
68 | xes[1] = location.x;
69 | yes[1] = location.y;
70 | }
71 | else if ( pt == lbar.get( 3 ).start )
72 | {
73 | xes[2] = location.x;
74 | yes[1] = location.y;
75 | }
76 | else if ( pt == lbar.get( 4 ).start )
77 | {
78 | xes[2] = location.x;
79 | }
80 | else if ( pt == lbar.get( 4 ).end )
81 | {
82 | xes[3] = location.x;
83 | }
84 |
85 | // ensure no overlaps
86 | double min = -Double.MAX_VALUE;
87 | for (int i = 0; i < xes.length; i++)
88 | {
89 | if (xes[i] < min)
90 | {
91 | xes[i] = min;
92 | }
93 | else
94 | min = xes[i]+5;
95 | }
96 |
97 | // push values back
98 | lbar.get(0).start.set (xes[0], yes[0]);
99 | lbar.get(1).start.set (xes[1], yes[0]);
100 | lbar.get(2).start.set (xes[1], yes[1]);
101 | lbar.get(3).start.set (xes[2], yes[1]);
102 | lbar.get(4).start.set (xes[2], yes[0]);
103 | lbar.get(4).end.set (xes[3], yes[0]);
104 |
105 | for ( Bar b : edges.eIterator() )
106 | refreshMarkersOn(b);
107 | }
108 |
109 |
110 |
111 | @Override
112 | protected boolean allowRemove( LContext ctx, Point2d corner )
113 | {
114 | // all points shall remain!
115 | return false;
116 | }
117 |
118 | // private boolean isFixedPoint( LContext ctx, Point2d corner)
119 | // {
120 | // return ctx.loop == step.shape.get( 0) && (ctx.loop.start.get().start == corner || ctx.loop.start.getPrev().get().end == corner);
121 | // }
122 |
123 | @Override
124 | public void paintPointEditor( Graphics2D g2 )
125 | {
126 | for ( Loop e2 : edges )
127 | for ( Bar e : e2 )
128 | {
129 | g2.setStroke( new BasicStroke( currentBar == null ? 2f : currentBar.get() == e ? 4f : 2f ) );
130 | g2.setColor( plan.profiles.get( e ).color );
131 | g2.drawLine( ma.toX( e.start.x ), ma.toY ( e.start.y ), ma.toX( e.end.x ), ma.toY( e.end.y ) );
132 | }
133 |
134 | g2.setColor( grass.darker().darker() );
135 |
136 | // first loop is inserted into existing loop, everything else comes outside
137 | boolean firstLoop = true;
138 | for ( Loop e2 : edges )
139 | {
140 | for ( Bar e : e2 )
141 | drawPixel( g2, e.start );
142 |
143 | drawPixel( g2, e2.start.getPrev().get().end );
144 | firstLoop = false;
145 | }
146 |
147 | drawMarkers( g2 );
148 | for (Bar b : edges.eIterator())
149 | drawTags( g2, b, plan );
150 |
151 | Loop first = step.shape.get( 0 );
152 | drawSpecialMarker( g2, first.start.get().start );
153 | drawSpecialMarker( g2, first.start.getPrev().get().end );
154 |
155 | somethingChanged( null );
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/campskeleton/ClipperDebug.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.campskeleton;
2 |
3 | import org.twak.camp.ui.PointEditor;
4 |
5 | /**
6 | *
7 | * @author twak
8 | */
9 | public class ClipperDebug extends PointEditor
10 | {
11 | //
12 | //// ClipPreview preview;
13 | //
14 | // public ClipperDebug()
15 | // {
16 | // new Thread()
17 | // {
18 | //
19 | // @Override
20 | // public void run()
21 | // {
22 | //// preview = new ClipPreview();
23 | //// preview.start();
24 | // }
25 | // }.start();
26 | // }
27 | //
28 | //
29 | // /**
30 | // * Extrude shape created by in to create a prism of height height
31 | // * This could be done with the skeleton?
32 | // */
33 | // Solid createSolid ()
34 | // {
35 | // return createSolid( edges, 50);
36 | // }
37 | //
38 | // Solid createSolid (LoopL in, double height)
39 | // {
40 | // Triangulator tri = new Triangulator();
41 | //
42 | //
43 | // List allVerts = new ArrayList();
44 | //
45 | // Map verts = new HashMap();
46 | // for (Bar b : in.eIterator())
47 | // {
48 | // TriangulationVertex tv = tri.addVertex( new Vector3f ((float)b.start.x, (float)b.start.y, 0f) );
49 | // Point3d key = new Point3d ( b.start.x, b.start.y, 0);
50 | // allVerts.add( key );
51 | // verts.put( key , tv.getIndex() );
52 | // }
53 | //
54 | // for (Loop loop : in)
55 | // for (Bar b : loop)
56 | // tri.addEdge( verts.get( new Point3d ( b.start.x, b.start.y, 0)), verts.get( new Point3d ( b.end.x, b.end.y, 0)));
57 | //
58 | // List v0 = new ArrayList ( );
59 | // for (int i : BufferUtils.getIntArray( tri.triangulate() ) )
60 | // v0.add( i );
61 | //
62 | // int offset = allVerts.size();
63 | // for (Point3d p : new ArrayList(allVerts))
64 | // {
65 | // Point3d key = new Point3d (p.x,p.y, height);
66 | // allVerts.add( key );
67 | // verts.put( key, offset + verts.get( p ) );
68 | // }
69 | //
70 | // List i1 = new ArrayList(v0);
71 | // for (int i = i1.size() -1 ; i >= 0; i--) // reverse faces for other end cap
72 | // v0.add( v0.get(i)+offset );
73 | //
74 | // // now add in a strip around the edge
75 | // for ( Loop loop : in )
76 | // for ( Bar r : loop )
77 | // {
78 | // int a = verts.get( new Point3d( r.start.x, r.start.y, 0 ) );
79 | // int b = verts.get( new Point3d( r.end.x, r.end.y, 0 ) );
80 | // int c = verts.get( new Point3d( r.start.x, r.start.y, height ) );
81 | // int d = verts.get( new Point3d( r.end.x, r.end.y, height ) );
82 | //
83 | // v0.addAll( Arrays.asList( a, b, c, d, c, b ) );
84 | // }
85 | //
86 | // int[] v0_ = new int[v0.size()];
87 | // for (int i = 0; i < v0.size(); i++)
88 | // v0_[i]= v0.get( i );
89 | //
90 | // Color3f white = new Color3f (1f,1f,1f);
91 | // Color3f[] cols = new Color3f[allVerts.size() ];
92 | // for (int i = 0; i < allVerts.size(); i++)
93 | // cols[i] = white;
94 | //
95 | // return new Solid( allVerts.toArray( new Point3d[1] ),v0_, cols );
96 | // }
97 | //
98 | // public void show()
99 | // {
100 | //// if (preview != null) // might take a while...
101 | //// preview.display( this );
102 | // }
103 | //
104 | // @Override
105 | // public void paintPointEditor( Graphics2D g2 )
106 | // {
107 | // double tileHeight = 50, tileWidth = 50;
108 | //
109 | // g2.setColor( Color.green );
110 | //
111 | // LoopL flat = new LoopL();
112 | // for ( Loop pll : edges )
113 | // {
114 | // Loop loop = new Loop();
115 | // flat.add( loop );
116 | // for ( Loopable pp : pll.loopableIterator() )
117 | // {
118 | // Line l = new Line (pp.get().start, pp.get().end);
119 | // loop.append( l );
120 | // drawLine( g2, l );
121 | // }
122 | // }
123 | //
124 | // DHash lineToEdge = new DHash();
125 | //
126 | // List allLines = new ArrayList();
127 | //
128 | // FindBounds2D bounds= new FindBounds2D();
129 | //// for (Line l : flat.eIterator())
130 | //// {
131 | // Bar line = edges.eIterator().iterator().next();
132 | // g2.drawLine( (int) line.start.x, (int) line.start.y, (int) line.end.x, (int) line.end.y );
133 | // show();
134 | //// }
135 | // }
136 | //
137 | // public static void main (String[] args)
138 | // {
139 | // JFrame frame = new JFrame ("argh");
140 | // ClipperDebug tc = new ClipperDebug() ;
141 | // tc.setup();
142 | // frame.setContentPane( tc );
143 | // frame.setSize (800,800);
144 | // frame.setVisible( true );
145 | // frame.setLocation (900, 100);
146 | // }
147 | }
148 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anchors/SubdivideShipUI.java:
--------------------------------------------------------------------------------
1 | package org.twak.siteplan.anchors;
2 |
3 | import org.twak.siteplan.campskeleton.Siteplan;
4 | import org.twak.siteplan.campskeleton.Plan;
5 | import org.twak.utils.WeakListener;
6 | import org.twak.utils.WeakListener.Changed;
7 | import org.twak.utils.ui.AbstractDocumentListener;
8 |
9 | /**
10 | *
11 | * @author twak
12 | */
13 | public class SubdivideShipUI extends javax.swing.JPanel {
14 |
15 | Plan plan;
16 | SubdivideShip ship;
17 | WeakListener.Changed pListChangedListener = new Changed()
18 | {
19 | @Override
20 | public void changed()
21 | {
22 | jProfileProfileMap1.update( ship.volumeSubdivide, SubdivideShipUI.this.plan.findProfiles());
23 | }
24 | } ;
25 |
26 | /** Creates new form SubdivideShipUI */
27 | public SubdivideShipUI() {
28 | initComponents();
29 | }
30 |
31 | public SubdivideShipUI( Plan plan, final SubdivideShip ship, final Changed refreshFeatureListListener ) {
32 | this.plan = plan;
33 | this.ship = ship;
34 | initComponents();
35 |
36 | Siteplan.instance.profileListChangedListeners.add( pListChangedListener );
37 |
38 | useOriginalCheck.setSelected( ship.keepOriginal );
39 | nameField.setText( ship.name );
40 | nameField.getDocument().addDocumentListener(new AbstractDocumentListener() {
41 | @Override
42 | public void changed() {
43 | SubdivideShipUI.this.ship.name = nameField.getText();
44 | refreshFeatureListListener.changed(); // flush to ui
45 | }
46 | });
47 | }
48 |
49 | /** This method is called from within the constructor to
50 | * initialize the form.
51 | * WARNING: Do NOT modify this code. The content of this method is
52 | * always regenerated by the Form Editor.
53 | */
54 | @SuppressWarnings("unchecked")
55 | // //GEN-BEGIN:initComponents
56 | private void initComponents() {
57 |
58 | jLabel1 = new javax.swing.JLabel();
59 | nameField = new javax.swing.JTextField();
60 | jProfileProfileMap1 = new JProfileProfileMap(plan, ship.volumeSubdivide, plan.findProfiles());
61 | useOriginalCheck = new javax.swing.JCheckBox();
62 |
63 | jLabel1.setText("name:");
64 |
65 | nameField.setText("name");
66 |
67 | useOriginalCheck.setText("keep original");
68 | useOriginalCheck.addActionListener(new java.awt.event.ActionListener() {
69 | public void actionPerformed(java.awt.event.ActionEvent evt) {
70 | useOriginalCheckActionPerformed(evt);
71 | }
72 | });
73 |
74 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
75 | this.setLayout(layout);
76 | layout.setHorizontalGroup(
77 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
78 | .addGroup(layout.createSequentialGroup()
79 | .addComponent(jLabel1)
80 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
81 | .addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE))
82 | .addComponent(jProfileProfileMap1, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
83 | .addComponent(useOriginalCheck, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
84 | );
85 | layout.setVerticalGroup(
86 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
87 | .addGroup(layout.createSequentialGroup()
88 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
89 | .addComponent(jLabel1)
90 | .addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
91 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
92 | .addComponent(useOriginalCheck)
93 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
94 | .addComponent(jProfileProfileMap1, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE))
95 | );
96 | }// //GEN-END:initComponents
97 |
98 | private void useOriginalCheckActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_useOriginalCheckActionPerformed
99 | {//GEN-HEADEREND:event_useOriginalCheckActionPerformed
100 | ship.keepOriginal = useOriginalCheck.isSelected();
101 | Siteplan.instance.somethingChanged();
102 | }//GEN-LAST:event_useOriginalCheckActionPerformed
103 |
104 |
105 | // Variables declaration - do not modify//GEN-BEGIN:variables
106 | private javax.swing.JLabel jLabel1;
107 | private org.twak.siteplan.anchors.JProfileProfileMap jProfileProfileMap1;
108 | private javax.swing.JTextField nameField;
109 | private javax.swing.JCheckBox useOriginalCheck;
110 | // End of variables declaration//GEN-END:variables
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/src/org/twak/siteplan/anim/JSimpleList.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
101 |
--------------------------------------------------------------------------------