summaryrefslogtreecommitdiffstats
path: root/scene/3d/spatial_player.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-02 19:12:25 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-02 19:12:25 -0300
commitce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch)
tree5f9c387037d0142d40f7275575436483dc0a7237 /scene/3d/spatial_player.cpp
parentab4126f51061277e87b41c48b40e7b54942d4eca (diff)
parent45c5c89de961357a7042d9e1f063e288d7a510cf (diff)
downloadredot-engine-ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae.tar.gz
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'scene/3d/spatial_player.cpp')
-rw-r--r--scene/3d/spatial_player.cpp142
1 files changed, 1 insertions, 141 deletions
diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp
index c7cf03e284..017f17226f 100644
--- a/scene/3d/spatial_player.cpp
+++ b/scene/3d/spatial_player.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -88,146 +88,6 @@ bool SpatialPlayer::_can_gizmo_scale() const {
return false;
}
-RES SpatialPlayer::_get_gizmo_geometry() const {
-
- Ref<SurfaceTool> surface_tool( memnew( SurfaceTool ));
-
- Ref<FixedMaterial> mat( memnew( FixedMaterial ));
-
- mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.05) );
- mat->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) );
- mat->set_blend_mode( Material::BLEND_MODE_ADD );
- mat->set_flag(Material::FLAG_DOUBLE_SIDED,true);
-// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true);
-
-
- surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
- surface_tool->set_material(mat);
-
- int sides=16;
- int sections=24;
-
-// float len=1;
- float deg=Math::deg2rad(params[PARAM_EMISSION_CONE_DEGREES]);
- if (deg==180)
- deg=179.5;
-
- Vector3 to=Vector3(0,0,-1);
-
- for(int j=0;j<sections;j++) {
-
- Vector3 p1=Matrix3(Vector3(1,0,0),deg*j/sections).xform(to);
- Vector3 p2=Matrix3(Vector3(1,0,0),deg*(j+1)/sections).xform(to);
-
- for(int i=0;i<sides;i++) {
-
- Vector3 p1r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p1);
- Vector3 p1s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p1);
- Vector3 p2s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p2);
- Vector3 p2r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p2);
-
- surface_tool->add_normal(p1r.normalized());
- surface_tool->add_vertex(p1r);
- surface_tool->add_normal(p1s.normalized());
- surface_tool->add_vertex(p1s);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
-
- surface_tool->add_normal(p1r.normalized());
- surface_tool->add_vertex(p1r);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
- surface_tool->add_normal(p2r.normalized());
- surface_tool->add_vertex(p2r);
-
- if (j==sections-1) {
-
- surface_tool->add_normal(p2r.normalized());
- surface_tool->add_vertex(p2r);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
- surface_tool->add_normal(Vector3(0,0,1));
- surface_tool->add_vertex(Vector3());
- }
- }
- }
-
-
- Ref<Mesh> mesh = surface_tool->commit();
-
- Ref<FixedMaterial> mat_speaker( memnew( FixedMaterial ));
-
- mat_speaker->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.3,0.3,0.6) );
- mat_speaker->set_parameter( FixedMaterial::PARAM_SPECULAR,Color(0.5,0.5,0.6) );
- //mat_speaker->set_blend_mode( Material::BLEND_MODE_MIX);
- //mat_speaker->set_flag(Material::FLAG_DOUBLE_SIDED,false);
- //mat_speaker->set_flag(Material::FLAG_UNSHADED,true);
-
- surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
- surface_tool->set_material(mat_speaker);
-
-// float radius=1;
-
-
- const int speaker_points=8;
- Vector3 speaker[speaker_points]={
- Vector3(0,0,1)*0.15,
- Vector3(1,1,1)*0.15,
- Vector3(1,1,0)*0.15,
- Vector3(2,2,-1)*0.15,
- Vector3(1,1,-1)*0.15,
- Vector3(0.8,0.8,-1.2)*0.15,
- Vector3(0.5,0.5,-1.4)*0.15,
- Vector3(0.0,0.0,-1.6)*0.15
- };
-
- int speaker_sides=10;
-
-
- for(int i = 0; i < speaker_sides ; i++) {
-
-
- Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/speaker_sides);
- Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/speaker_sides);
-
-
- for(int j=0;j<speaker_points-1;j++) {
-
- Vector3 points[4]={
- ma.xform(speaker[j]),
- mb.xform(speaker[j]),
- mb.xform(speaker[j+1]),
- ma.xform(speaker[j+1]),
- };
-
- Vector3 n = -Plane(points[0],points[1],points[2]).normal;
-
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[0]);
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[2]);
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[1]);
-
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[0]);
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[3]);
- surface_tool->add_normal(n);
- surface_tool->add_vertex(points[2]);
-
-
- }
-
-
- }
-
-
- return surface_tool->commit(mesh);
-
-}
-
-
void SpatialPlayer::_bind_methods() {