mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added ocean object
This commit is contained in:
@@ -39,6 +39,7 @@ public class GameView3D {
|
||||
root3D, 1000, 1000, true, SceneAntialiasing.BALANCED
|
||||
);
|
||||
view.setCamera(camera);
|
||||
view.setFill(Color.SKYBLUE);
|
||||
Sphere s = new Sphere(1);
|
||||
s.setMaterial(new PhongMaterial(Color.RED));
|
||||
Sphere left = new Sphere(1);
|
||||
@@ -72,7 +73,13 @@ public class GameView3D {
|
||||
Node coin = ModelFactory.importModel(ModelType.VELOCITY_COIN).getAssets();
|
||||
coin.setTranslateX(coin.getTranslateX() - 30);
|
||||
|
||||
gameObjects.getChildren().addAll(s, left, right, top, bottom, boat, boat2, boat3, sMarker, fMarker, marker, coin);
|
||||
gameObjects.getChildren().addAll(
|
||||
ModelFactory.importModel(ModelType.OCEAN).getAssets(),
|
||||
s, left, right, top, bottom,
|
||||
boat, boat2, boat3,
|
||||
sMarker, fMarker, marker,
|
||||
coin
|
||||
);
|
||||
view.sceneProperty().addListener((obs, old, scene) -> {
|
||||
if (scene!=null)
|
||||
enableCameraMovement(scene);
|
||||
|
||||
@@ -6,13 +6,11 @@ import javafx.animation.AnimationTimer;
|
||||
import javafx.geometry.Point3D;
|
||||
import javafx.scene.AmbientLight;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.PhongMaterial;
|
||||
import javafx.scene.shape.MeshView;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.scene.transform.Scale;
|
||||
import seng302.model.token.TokenType;
|
||||
|
||||
/**
|
||||
* Factory class for creating 3D models of boats.
|
||||
@@ -89,6 +87,8 @@ public class ModelFactory {
|
||||
case PLAIN_MARKER:
|
||||
case START_MARKER:
|
||||
return makeMarker(assets);
|
||||
case OCEAN:
|
||||
return makeOcean(assets);
|
||||
default:
|
||||
return new Model(assets, null);
|
||||
}
|
||||
@@ -121,4 +121,10 @@ public class ModelFactory {
|
||||
area.getTransforms().add(new Rotate(90, new Point3D(1, 0, 0)));
|
||||
return new Model(area, null);
|
||||
}
|
||||
|
||||
private static Model makeOcean(Group plane) {
|
||||
plane.setScaleY(100);
|
||||
plane.setScaleX(100);
|
||||
return new Model(plane, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ public enum ModelType {
|
||||
FINISH_MARKER ("finish_marker.dae"),
|
||||
START_MARKER ("start_marker.dae"),
|
||||
PLAIN_MARKER ("plain_marker.dae"),
|
||||
MARK_AREA ("mark_area.dae");
|
||||
MARK_AREA ("mark_area.dae"),
|
||||
OCEAN ("ocean.dae");
|
||||
|
||||
final String filename;
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Blender User</author>
|
||||
<authoring_tool>Blender 2.78.0 commit date:2016-09-26, commit time:12:42, hash:4bb1e22</authoring_tool>
|
||||
</contributor>
|
||||
<created>2017-09-09T12:27:53</created>
|
||||
<modified>2017-09-09T12:27:53</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_images/>
|
||||
<library_effects>
|
||||
<effect id="Material_001-effect">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<phong>
|
||||
<emission>
|
||||
<color sid="emission">0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color sid="ambient">0 0 0 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color sid="diffuse">0.64 0.001709759 0 1</color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color sid="specular">0.5 0.5 0.5 1</color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float sid="shininess">50</float>
|
||||
</shininess>
|
||||
<index_of_refraction>
|
||||
<float sid="index_of_refraction">1</float>
|
||||
</index_of_refraction>
|
||||
</phong>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="Material_001-material" name="Material_001">
|
||||
<instance_effect url="#Material_001-effect"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="Plane-mesh" name="Plane">
|
||||
<mesh>
|
||||
<source id="Plane-mesh-positions">
|
||||
<float_array id="Plane-mesh-positions-array" count="24">-1 -1 0 1 -1 0 -1 1 0 1 1 0 -1 -1 0.002058923 1 -1 0.002058923 -1 1 0.002058923 1 1 0.002058923</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Plane-mesh-positions-array" count="8" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="Plane-mesh-normals">
|
||||
<float_array id="Plane-mesh-normals-array" count="18">0 0 -1 0 0 1 0 1 0 0 -1 0 1 0 0 -1 0 0</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Plane-mesh-normals-array" count="6" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="Plane-mesh-vertices">
|
||||
<input semantic="POSITION" source="#Plane-mesh-positions"/>
|
||||
</vertices>
|
||||
<polylist material="Material_001-material" count="12">
|
||||
<input semantic="VERTEX" source="#Plane-mesh-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#Plane-mesh-normals" offset="1"/>
|
||||
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
|
||||
<p>2 0 1 0 0 0 5 1 6 1 4 1 2 2 7 2 3 2 1 3 4 3 0 3 3 4 5 4 1 4 0 5 6 5 2 5 2 0 3 0 1 0 5 1 7 1 6 1 2 2 6 2 7 2 1 3 5 3 4 3 3 4 7 4 5 4 0 5 4 5 6 5</p>
|
||||
</polylist>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_controllers/>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="Scene" name="Scene">
|
||||
<node id="Plane" name="Plane" type="NODE">
|
||||
<matrix sid="transform">8 0 0 0 0 8 0 0 0 0 8 0 0 0 0 1</matrix>
|
||||
<instance_geometry url="#Plane-mesh" name="Plane">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="Material_001-material" target="#Material_001-material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#Scene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
Reference in New Issue
Block a user