Merge branch 'master' of https://github.com/okamstudio/godot
This commit is contained in:
commit
963845eea9
|
@ -23,6 +23,9 @@ tools/editor/editor_icons.cpp
|
|||
make.bat
|
||||
log.txt
|
||||
|
||||
# Javascript specific
|
||||
*.bc
|
||||
|
||||
# Android specific
|
||||
platform/android/java/local.properties
|
||||
platform/android/java/project.properties
|
||||
|
|
|
@ -111,6 +111,7 @@ opts.Add('jpg','JPG Image loader support (yes/no)','yes')
|
|||
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
|
||||
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
|
||||
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
|
||||
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
|
||||
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
|
||||
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
|
||||
opts.Add('musepack','Musepack Audio (yes/no)','yes')
|
||||
|
@ -121,6 +122,7 @@ opts.Add("LINKFLAGS", "Custom flags for the linker");
|
|||
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
|
||||
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
|
||||
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
|
||||
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
|
||||
|
||||
# add platform specific options
|
||||
|
||||
|
@ -176,6 +178,9 @@ if selected_platform in platform_list:
|
|||
env = env_base.Clone()
|
||||
|
||||
env.extra_suffix=""
|
||||
|
||||
if env["extra_suffix"] != '' :
|
||||
env.extra_suffix += '.'+env["extra_suffix"]
|
||||
|
||||
CCFLAGS = env.get('CCFLAGS', '')
|
||||
env['CCFLAGS'] = ''
|
||||
|
@ -307,6 +312,8 @@ if selected_platform in platform_list:
|
|||
if (env['colored']=='yes'):
|
||||
methods.colored(sys,env)
|
||||
|
||||
if (env['etc1']=='yes'):
|
||||
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
|
||||
|
||||
Export('env')
|
||||
|
||||
|
|
|
@ -709,13 +709,13 @@ void _OS::_bind_methods() {
|
|||
|
||||
ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count);
|
||||
ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen);
|
||||
ObjectTypeDB::bind_method(_MD("set_current_screen"),&_OS::set_current_screen);
|
||||
ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen);
|
||||
ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position);
|
||||
ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_size","size"),&_OS::set_window_size);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen);
|
||||
ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable);
|
||||
|
|
|
@ -1503,6 +1503,8 @@ void Object::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE);
|
||||
ObjectTypeDB::bind_method(_MD("tr","message"),&Object::tr);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion);
|
||||
|
||||
ADD_SIGNAL( MethodInfo("script_changed"));
|
||||
|
||||
BIND_VMETHOD( MethodInfo("_notification",PropertyInfo(Variant::INT,"what")) );
|
||||
|
@ -1566,6 +1568,10 @@ void Object::get_translatable_strings(List<String> *p_strings) const {
|
|||
|
||||
}
|
||||
|
||||
bool Object::is_queued_for_deletion() const {
|
||||
return _is_queued_for_deletion;
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void Object::set_edited(bool p_edited) {
|
||||
|
||||
|
@ -1587,6 +1593,7 @@ Object::Object() {
|
|||
_instance_ID=0;
|
||||
_instance_ID = ObjectDB::add_instance(this);
|
||||
_can_translate=true;
|
||||
_is_queued_for_deletion=false;
|
||||
script_instance=NULL;
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
|
|
|
@ -397,7 +397,6 @@ friend void postinitialize_handler(Object*);
|
|||
|
||||
protected:
|
||||
|
||||
|
||||
virtual bool _use_builtin_script() const { return false; }
|
||||
virtual void _initialize_typev() { initialize_type(); }
|
||||
virtual bool _setv(const StringName& p_name,const Variant &p_property) { return false; };
|
||||
|
@ -589,6 +588,9 @@ public:
|
|||
StringName XL_MESSAGE(const StringName& p_message) const; //translate message (internationalization)
|
||||
StringName tr(const StringName& p_message) const; //translate message (alternative)
|
||||
|
||||
bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
|
||||
bool is_queued_for_deletion() const;
|
||||
|
||||
_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; }
|
||||
_FORCE_INLINE_ bool can_translate_messages() const { return _can_translate; }
|
||||
Object();
|
||||
|
|
|
@ -498,6 +498,27 @@ String String::capitalize() const {
|
|||
|
||||
return cap;
|
||||
}
|
||||
|
||||
String String::camelcase_to_underscore() const {
|
||||
const CharType * cstr = c_str();
|
||||
String newString;
|
||||
const char A = 'A', Z = 'Z';
|
||||
int startIndex = 0;
|
||||
|
||||
for ( int i = 1; i < this->size()-1; i++ ) {
|
||||
bool isCapital = cstr[i] >= A && cstr[i] <= Z;
|
||||
|
||||
if ( isCapital ) {
|
||||
newString += "_" + this->substr(startIndex, i-startIndex);
|
||||
startIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
newString += "_" + this->substr(startIndex, this->size()-startIndex);
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
int String::get_slice_count(String p_splitter) const{
|
||||
|
||||
if (empty())
|
||||
|
|
|
@ -149,6 +149,7 @@ public:
|
|||
static double to_double(const CharType* p_str, const CharType **r_end=NULL);
|
||||
static int64_t to_int(const CharType* p_str,int p_len=-1);
|
||||
String capitalize() const;
|
||||
String camelcase_to_underscore() const;
|
||||
|
||||
int get_slice_count(String p_splitter) const;
|
||||
String get_slice(String p_splitter,int p_slice) const;
|
||||
|
|
|
@ -149,7 +149,16 @@ public:
|
|||
sort_custom<_DefaultComparator<T> >();
|
||||
}
|
||||
|
||||
void ordered_insert(const T& p_val) {
|
||||
int i;
|
||||
for (i=0; i<size(); i++) {
|
||||
|
||||
if (p_val < operator[](i)) {
|
||||
break;
|
||||
};
|
||||
};
|
||||
insert(i, p_val);
|
||||
}
|
||||
|
||||
void operator=(const Vector& p_from);
|
||||
Vector(const Vector& p_from);
|
||||
|
|
|
@ -6,7 +6,8 @@ etc_sources = [
|
|||
"etc1/rg_etc1.cpp"
|
||||
]
|
||||
|
||||
env.drivers_sources+=etc_sources
|
||||
if (env["etc1"] != "no"):
|
||||
env.drivers_sources+=etc_sources
|
||||
|
||||
#env.add_source_files(env.drivers_sources, etc_sources)
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
namespace rg_etc1
|
||||
{
|
||||
|
||||
inline long labs(long val) {
|
||||
return val < 0 ? -val : val;
|
||||
}
|
||||
|
||||
inline int intabs(int val) {
|
||||
|
||||
|
@ -1913,7 +1916,7 @@ done:
|
|||
for (uint packed_c = 0; packed_c < limit; packed_c++)
|
||||
{
|
||||
int v = etc1_decode_value(diff, inten, selector, packed_c);
|
||||
uint err = intabs(v - color);
|
||||
uint err = labs(v - static_cast<int>(color));
|
||||
//printf("err: %d - %u = %u\n",v,color,err);
|
||||
if (err < best_error)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,10 @@
|
|||
|
||||
static RasterizerGLES2* _singleton = NULL;
|
||||
|
||||
#ifdef GLES_NO_CLIENT_ARRAYS
|
||||
static float GlobalVertexBuffer[MAX_POLYGON_VERTICES * 8] = {0};
|
||||
#endif
|
||||
|
||||
static const GLenum prim_type[]={GL_POINTS,GL_LINES,GL_TRIANGLES,GL_TRIANGLE_FAN};
|
||||
|
||||
_FORCE_INLINE_ static void _set_color_attrib(const Color& p_color) {
|
||||
|
@ -8341,20 +8345,22 @@ void RasterizerGLES2::canvas_draw_primitive(const Vector<Point2>& p_points, cons
|
|||
|
||||
void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor) {
|
||||
|
||||
bool do_colors=false;
|
||||
bool do_colors=false;
|
||||
Color m;
|
||||
if (p_singlecolor) {
|
||||
m = *p_colors;
|
||||
m.a*=canvas_opacity;
|
||||
_set_color_attrib(m);
|
||||
} else if (!p_colors) {
|
||||
m = Color(1, 1, 1, canvas_opacity);
|
||||
_set_color_attrib(m);
|
||||
} else
|
||||
do_colors=true;
|
||||
|
||||
if (p_singlecolor) {
|
||||
Color m = *p_colors;
|
||||
m.a*=canvas_opacity;
|
||||
_set_color_attrib(m);
|
||||
} else if (!p_colors) {
|
||||
_set_color_attrib( Color(1,1,1,canvas_opacity));
|
||||
} else
|
||||
do_colors=true;
|
||||
Texture *texture = _bind_canvas_texture(p_texture);
|
||||
|
||||
Texture *texture = _bind_canvas_texture(p_texture);
|
||||
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
#ifndef GLES_NO_CLIENT_ARRAYS
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(Vector2), p_vertices );
|
||||
if (do_colors) {
|
||||
|
||||
|
@ -8384,11 +8390,78 @@ void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indic
|
|||
};
|
||||
glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, _draw_poly_indices );
|
||||
#endif
|
||||
//glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices );
|
||||
} else {
|
||||
glDrawArrays(GL_TRIANGLES,0,p_vertex_count);
|
||||
}
|
||||
|
||||
|
||||
#else //WebGL specific impl.
|
||||
glBindBuffer(GL_ARRAY_BUFFER, gui_quad_buffer);
|
||||
float *b = GlobalVertexBuffer;
|
||||
int ofs = 0;
|
||||
if(p_vertex_count > MAX_POLYGON_VERTICES){
|
||||
print_line("Too many vertices to render");
|
||||
return;
|
||||
}
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(float)*2, ((float*)0)+ofs );
|
||||
for(int i=0;i<p_vertex_count;i++) {
|
||||
b[ofs++]=p_vertices[i].x;
|
||||
b[ofs++]=p_vertices[i].y;
|
||||
}
|
||||
|
||||
if (p_colors && do_colors) {
|
||||
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttribPointer( VS::ARRAY_COLOR, 4 ,GL_FLOAT, false, sizeof(float)*4, ((float*)0)+ofs );
|
||||
for(int i=0;i<p_vertex_count;i++) {
|
||||
b[ofs++]=p_colors[i].r;
|
||||
b[ofs++]=p_colors[i].g;
|
||||
b[ofs++]=p_colors[i].b;
|
||||
b[ofs++]=p_colors[i].a;
|
||||
}
|
||||
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
}
|
||||
|
||||
|
||||
if (p_uvs) {
|
||||
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer( VS::ARRAY_TEX_UV, 2 ,GL_FLOAT, false, sizeof(float)*2, ((float*)0)+ofs );
|
||||
for(int i=0;i<p_vertex_count;i++) {
|
||||
b[ofs++]=p_uvs[i].x;
|
||||
b[ofs++]=p_uvs[i].y;
|
||||
}
|
||||
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER,0,ofs*4,&b[0]);
|
||||
|
||||
//bind the indices buffer.
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer);
|
||||
|
||||
static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!!
|
||||
ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices);
|
||||
static uint16_t _draw_poly_indices[_max_draw_poly_indices];
|
||||
for (int i=0; i<p_vertex_count; i++) {
|
||||
_draw_poly_indices[i] = p_indices[i];
|
||||
//OS::get_singleton()->print("ind: %d ", p_indices[i]);
|
||||
};
|
||||
|
||||
//copy the data to GPU.
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, p_vertex_count * sizeof(uint16_t), &_draw_poly_indices[0]);
|
||||
|
||||
//draw the triangles.
|
||||
glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
#endif
|
||||
|
||||
_rinfo.ci_draw_commands++;
|
||||
|
||||
};
|
||||
|
@ -10673,10 +10746,21 @@ void RasterizerGLES2::init() {
|
|||
|
||||
glGenBuffers(1,&gui_quad_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,gui_quad_buffer);
|
||||
glBufferData(GL_ARRAY_BUFFER,128,NULL,GL_DYNAMIC_DRAW);
|
||||
#ifdef GLES_NO_CLIENT_ARRAYS //WebGL specific implementation.
|
||||
glBufferData(GL_ARRAY_BUFFER, 8 * MAX_POLYGON_VERTICES,NULL,GL_DYNAMIC_DRAW);
|
||||
#else
|
||||
glBufferData(GL_ARRAY_BUFFER,128,NULL,GL_DYNAMIC_DRAW);
|
||||
#endif
|
||||
glBindBuffer(GL_ARRAY_BUFFER,0); //unbind
|
||||
|
||||
|
||||
#ifdef GLES_NO_CLIENT_ARRAYS //webgl indices buffer
|
||||
glGenBuffers(1, &indices_buffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 16*1024, NULL, GL_DYNAMIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);// unbind
|
||||
#endif
|
||||
|
||||
using_canvas_bg=false;
|
||||
_update_framebuffer();
|
||||
DEBUG_TEST_ERROR("Initializing");
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "servers/visual/rasterizer.h"
|
||||
|
||||
#define MAX_POLYGON_VERTICES 4096 //used for WebGL canvas_draw_polygon call.
|
||||
|
||||
#ifdef GLES2_ENABLED
|
||||
|
||||
#include "image.h"
|
||||
|
@ -828,6 +830,7 @@ class RasterizerGLES2 : public Rasterizer {
|
|||
GLuint base_framebuffer;
|
||||
|
||||
GLuint gui_quad_buffer;
|
||||
GLuint indices_buffer;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -222,7 +222,10 @@ void register_driver_types() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ETC1_ENABLED
|
||||
_register_etc1_compress_func();
|
||||
#endif
|
||||
|
||||
initialize_chibi();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ const char *GDFunctions::get_func_name(Function p_func) {
|
|||
"randi",
|
||||
"randf",
|
||||
"rand_range",
|
||||
"seed",
|
||||
"rand_seed",
|
||||
"deg2rad",
|
||||
"rad2deg",
|
||||
|
@ -97,6 +98,7 @@ const char *GDFunctions::get_func_name(Function p_func) {
|
|||
"dict2inst",
|
||||
"hash",
|
||||
"print_stack",
|
||||
"get_inst",
|
||||
};
|
||||
|
||||
return _names[p_func];
|
||||
|
@ -328,6 +330,13 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
|||
VALIDATE_ARG_NUM(1);
|
||||
r_ret=Math::random(*p_args[0],*p_args[1]);
|
||||
} break;
|
||||
case MATH_SEED: {
|
||||
VALIDATE_ARG_COUNT(1);
|
||||
VALIDATE_ARG_NUM(0);
|
||||
uint32_t seed=*p_args[0];
|
||||
Math::seed(seed);
|
||||
r_ret=Variant();
|
||||
} break;
|
||||
case MATH_RANDSEED: {
|
||||
VALIDATE_ARG_COUNT(1);
|
||||
VALIDATE_ARG_NUM(0);
|
||||
|
@ -575,7 +584,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
|||
}
|
||||
|
||||
//str+="\n";
|
||||
OS::get_singleton()->print("%s\n",str.utf8().get_data());
|
||||
OS::get_singleton()->print("%s",str.utf8().get_data());
|
||||
r_ret=Variant();
|
||||
|
||||
} break;
|
||||
|
@ -895,6 +904,20 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
|||
};
|
||||
} break;
|
||||
|
||||
case GET_INST: {
|
||||
|
||||
VALIDATE_ARG_COUNT(1);
|
||||
if (p_args[0]->get_type()!=Variant::INT && p_args[0]->get_type()!=Variant::REAL) {
|
||||
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument=0;
|
||||
r_ret=Variant();
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t id=*p_args[0];
|
||||
r_ret=ObjectDB::get_instance(id);
|
||||
|
||||
} break;
|
||||
case FUNC_MAX: {
|
||||
|
||||
ERR_FAIL_V();
|
||||
|
@ -1130,6 +1153,11 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||
mi.return_val.type=Variant::REAL;
|
||||
return mi;
|
||||
} break;
|
||||
case MATH_SEED: {
|
||||
MethodInfo mi("seed",PropertyInfo(Variant::REAL,"seed"));
|
||||
mi.return_val.type=Variant::NIL;
|
||||
return mi;
|
||||
} break;
|
||||
case MATH_RANDSEED: {
|
||||
MethodInfo mi("rand_seed",PropertyInfo(Variant::REAL,"seed"));
|
||||
mi.return_val.type=Variant::ARRAY;
|
||||
|
@ -1288,6 +1316,12 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
|||
return mi;
|
||||
} break;
|
||||
|
||||
case GET_INST: {
|
||||
MethodInfo mi("get_info",PropertyInfo(Variant::INT,"instance_id"));
|
||||
mi.return_val.type=Variant::OBJECT;
|
||||
return mi;
|
||||
} break;
|
||||
|
||||
case FUNC_MAX: {
|
||||
|
||||
ERR_FAIL_V(MethodInfo());
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
MATH_RAND,
|
||||
MATH_RANDF,
|
||||
MATH_RANDOM,
|
||||
MATH_SEED,
|
||||
MATH_RANDSEED,
|
||||
MATH_DEG2RAD,
|
||||
MATH_RAD2DEG,
|
||||
|
@ -93,6 +94,7 @@ public:
|
|||
DICT2INST,
|
||||
HASH,
|
||||
PRINT_STACK,
|
||||
GET_INST,
|
||||
FUNC_MAX
|
||||
|
||||
};
|
||||
|
|
|
@ -1689,7 +1689,7 @@ bool GDScript::_update_exports() {
|
|||
}
|
||||
|
||||
|
||||
if (c->extends_used && String(c->extends_file)!="") {
|
||||
if (c->extends_used && String(c->extends_file)!="" && String(c->extends_file) != get_path()) {
|
||||
|
||||
String path = c->extends_file;
|
||||
if (path.is_rel_path()) {
|
||||
|
|
|
@ -571,9 +571,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
}
|
||||
|
||||
@Override public void onSensorChanged(SensorEvent event) {
|
||||
float x = event.values[0];
|
||||
float y = event.values[1];
|
||||
float z = event.values[2];
|
||||
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
||||
int displayRotation = display.getRotation();
|
||||
|
||||
float[] adjustedValues = new float[3];
|
||||
final int axisSwap[][] = {
|
||||
{ 1, -1, 0, 1 }, // ROTATION_0
|
||||
{-1, -1, 1, 0 }, // ROTATION_90
|
||||
{-1, 1, 0, 1 }, // ROTATION_180
|
||||
{ 1, 1, 1, 0 } }; // ROTATION_270
|
||||
|
||||
final int[] as = axisSwap[displayRotation];
|
||||
adjustedValues[0] = (float)as[0] * event.values[ as[2] ];
|
||||
adjustedValues[1] = (float)as[1] * event.values[ as[3] ];
|
||||
adjustedValues[2] = event.values[2];
|
||||
|
||||
float x = adjustedValues[0];
|
||||
float y = adjustedValues[1];
|
||||
float z = adjustedValues[2];
|
||||
GodotLib.accelerometer(x,y,z);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ def get_name():
|
|||
|
||||
def can_build():
|
||||
|
||||
import os
|
||||
if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
|
||||
return False
|
||||
import os
|
||||
if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_opts():
|
||||
|
@ -36,6 +36,7 @@ def get_flags():
|
|||
('squish', 'no'),
|
||||
('speex', 'no'),
|
||||
('old_scenes', 'no'),
|
||||
('etc1', 'no'),
|
||||
# ('default_gui_theme', 'no'),
|
||||
|
||||
#('builtin_zlib', 'no'),
|
||||
|
@ -44,33 +45,36 @@ def get_flags():
|
|||
|
||||
|
||||
def configure(env):
|
||||
|
||||
|
||||
env.Append(CPPPATH=['#platform/javascript'])
|
||||
|
||||
|
||||
em_path=os.environ["EMSCRIPTEN_ROOT"]
|
||||
|
||||
|
||||
env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH']
|
||||
|
||||
env['CC'] = em_path+'/emcc'
|
||||
env['CXX'] = em_path+'/emcc'
|
||||
env['AR'] = em_path+"/emar"
|
||||
env['RANLIB'] = em_path+"/emranlib"
|
||||
#env['AR'] = em_path+"/emar"
|
||||
env['AR'] = em_path+"/emcc"
|
||||
env['ARFLAGS'] = "-o"
|
||||
|
||||
# env['RANLIB'] = em_path+"/emranlib"
|
||||
env['RANLIB'] = em_path + "/emcc"
|
||||
env['OBJSUFFIX'] = '.bc'
|
||||
env['LIBSUFFIX'] = '.bc'
|
||||
env['CCCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
|
||||
env['CXXCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
|
||||
|
||||
# env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2'])
|
||||
|
||||
# env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
|
||||
|
||||
if (env["target"]=="release"):
|
||||
|
||||
env.Append(CCFLAGS=['-O2'])
|
||||
|
||||
elif (env["target"]=="release_debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
|
||||
|
||||
elif (env["target"]=="debug"):
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
|
||||
#env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
|
||||
|
@ -84,10 +88,11 @@ def configure(env):
|
|||
lzma_binpath = em_path+"/third_party/lzma.js/lzma-native"
|
||||
lzma_decoder = em_path+"/third_party/lzma.js/lzma-decoder.js"
|
||||
lzma_dec = "LZMA.decompress"
|
||||
|
||||
env.Append(LINKFLAGS=['--compression',lzma_binpath+","+lzma_decoder+","+lzma_dec])
|
||||
|
||||
env.Append(LINKFLAGS=['-s','ASM_JS=1'])
|
||||
env.Append(LINKFLAGS=['-O2'])
|
||||
|
||||
|
||||
#env.Append(LINKFLAGS=['-g4'])
|
||||
|
||||
#print "CCCOM is:", env.subst('$CCCOM')
|
||||
#print "P: ", env['p'], " Platofrm: ", env['platform']
|
||||
|
|
|
@ -423,6 +423,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
|||
case WM_RBUTTONUP:
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
/*case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONUP: */{
|
||||
|
||||
|
@ -476,6 +477,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
|||
mb.button_index=1;
|
||||
mb.doubleclick = true;
|
||||
} break;
|
||||
case WM_RBUTTONDBLCLK: {
|
||||
|
||||
mb.pressed=true;
|
||||
mb.button_index=2;
|
||||
mb.doubleclick = true;
|
||||
} break;
|
||||
case WM_MOUSEWHEEL: {
|
||||
|
||||
mb.pressed=true;
|
||||
|
@ -2045,7 +2052,7 @@ String OS_Windows::get_executable_path() const {
|
|||
wchar_t bufname[4096];
|
||||
GetModuleFileNameW(NULL,bufname,4096);
|
||||
String s= bufname;
|
||||
print_line("EXEC PATHPó: "+s);
|
||||
print_line("EXEC PATHP¨®: "+s);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ void SpotLight::_bind_methods() {
|
|||
ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ATTENUATION );
|
||||
|
||||
ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_angle", PROPERTY_HINT_RANGE, "0.01,89.9,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ANGLE );
|
||||
ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ATTENUATION );
|
||||
ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_EXP_EASING, "spot_attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ATTENUATION );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
PARAM_ENERGY=VisualServer::LIGHT_PARAM_ENERGY,
|
||||
PARAM_ATTENUATION=VisualServer::LIGHT_PARAM_ATTENUATION,
|
||||
PARAM_SPOT_ANGLE=VisualServer::LIGHT_PARAM_SPOT_ANGLE,
|
||||
PARAM_SPOT_ATTENUATION=VisualServer::LIGHT_PARAM_ATTENUATION,
|
||||
PARAM_SPOT_ATTENUATION=VisualServer::LIGHT_PARAM_SPOT_ATTENUATION,
|
||||
PARAM_SHADOW_DARKENING=VisualServer::LIGHT_PARAM_SHADOW_DARKENING,
|
||||
PARAM_SHADOW_Z_OFFSET=VisualServer::LIGHT_PARAM_SHADOW_Z_OFFSET,
|
||||
PARAM_SHADOW_Z_SLOPE_SCALE=VisualServer::LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE,
|
||||
|
|
|
@ -850,6 +850,7 @@ void SceneTree::queue_delete(Object *p_object) {
|
|||
|
||||
_THREAD_SAFE_METHOD_
|
||||
ERR_FAIL_NULL(p_object);
|
||||
p_object->_is_queued_for_deletion = true;
|
||||
delete_queue.push_back(p_object->get_instance_ID());
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ void Viewport::_notification(int p_what) {
|
|||
int rc = ss2d->intersect_point(point,res,64,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF);
|
||||
for(int i=0;i<rc;i++) {
|
||||
|
||||
if (res[i].collider) {
|
||||
if (res[i].collider_id && res[i].collider) {
|
||||
CollisionObject2D *co=res[i].collider->cast_to<CollisionObject2D>();
|
||||
if (co) {
|
||||
|
||||
|
|
|
@ -358,10 +358,10 @@ void BodySW::_compute_area_gravity(const AreaSW *p_area) {
|
|||
|
||||
if (p_area->is_gravity_point()) {
|
||||
|
||||
gravity = (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
|
||||
gravity += (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
|
||||
|
||||
} else {
|
||||
gravity = p_area->get_gravity_vector() * p_area->get_gravity();
|
||||
gravity += p_area->get_gravity_vector() * p_area->get_gravity();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,23 +371,29 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
if (mode==PhysicsServer::BODY_MODE_STATIC)
|
||||
return;
|
||||
|
||||
AreaSW *current_area = get_space()->get_default_area();
|
||||
ERR_FAIL_COND(!current_area);
|
||||
AreaSW *def_area = get_space()->get_default_area();
|
||||
ERR_FAIL_COND(!def_area);
|
||||
|
||||
int prio = current_area->get_priority();
|
||||
int ac = areas.size();
|
||||
bool replace = false;
|
||||
gravity=Vector3(0,0,0);
|
||||
if (ac) {
|
||||
areas.sort();
|
||||
const AreaCMP *aa = &areas[0];
|
||||
for(int i=0;i<ac;i++) {
|
||||
if (aa[i].area->get_priority() > prio) {
|
||||
current_area=aa[i].area;
|
||||
prio=current_area->get_priority();
|
||||
density = aa[ac-1].area->get_density();
|
||||
for(int i=ac-1;i>=0;i--) {
|
||||
_compute_area_gravity(aa[i].area);
|
||||
if (aa[i].area->get_space_override_mode() == PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE) {
|
||||
replace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
density=def_area->get_density();
|
||||
}
|
||||
if( !replace ) {
|
||||
_compute_area_gravity(def_area);
|
||||
}
|
||||
|
||||
_compute_area_gravity(current_area);
|
||||
density=current_area->get_density();
|
||||
|
||||
Vector3 motion;
|
||||
bool do_motion=false;
|
||||
|
@ -455,7 +461,7 @@ void BodySW::integrate_forces(real_t p_step) {
|
|||
}
|
||||
|
||||
|
||||
current_area=NULL; // clear the area, so it is set in the next frame
|
||||
def_area=NULL; // clear the area, so it is set in the next frame
|
||||
contact_count=0;
|
||||
|
||||
}
|
||||
|
|
|
@ -84,13 +84,13 @@ class BodySW : public CollisionObjectSW {
|
|||
struct AreaCMP {
|
||||
|
||||
AreaSW *area;
|
||||
_FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_self() < p_cmp.area->get_self() ; }
|
||||
_FORCE_INLINE_ bool operator==(const AreaCMP& p_cmp) const { return area->get_self() == p_cmp.area->get_self();}
|
||||
_FORCE_INLINE_ bool operator<(const AreaCMP a) const { return area->get_priority() < a.area->get_priority();}
|
||||
_FORCE_INLINE_ AreaCMP() {}
|
||||
_FORCE_INLINE_ AreaCMP(AreaSW *p_area) { area=p_area;}
|
||||
};
|
||||
|
||||
|
||||
VSet<AreaCMP> areas;
|
||||
Vector<AreaCMP> areas;
|
||||
|
||||
struct Contact {
|
||||
|
||||
|
@ -134,8 +134,7 @@ public:
|
|||
|
||||
void set_force_integration_callback(ObjectID p_id,const StringName& p_method,const Variant& p_udata=Variant());
|
||||
|
||||
|
||||
_FORCE_INLINE_ void add_area(AreaSW *p_area) { areas.insert(AreaCMP(p_area)); }
|
||||
_FORCE_INLINE_ void add_area(AreaSW *p_area) { areas.ordered_insert(AreaCMP(p_area)); }
|
||||
_FORCE_INLINE_ void remove_area(AreaSW *p_area) { areas.erase(AreaCMP(p_area)); }
|
||||
|
||||
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) { contacts.resize(p_size); contact_count=0; if (mode==PhysicsServer::BODY_MODE_KINEMATIC && p_size) set_active(true);}
|
||||
|
|
|
@ -1390,7 +1390,9 @@ EditorHelp::EditorHelp(EditorNode *p_editor) {
|
|||
|
||||
{
|
||||
PanelContainer *pc = memnew( PanelContainer );
|
||||
pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
|
||||
Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) );
|
||||
style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") );
|
||||
pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
|
||||
h_split->add_child(pc);
|
||||
class_desc = memnew( RichTextLabel );
|
||||
pc->add_child(class_desc);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.6 KiB |
|
@ -33,7 +33,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
Ref<Mesh> mesh = node->get_mesh();
|
||||
if (mesh.is_null()) {
|
||||
err_dialog->set_text("Mesh is empty!");
|
||||
err_dialog->popup_centered(Size2(100,50));
|
||||
err_dialog->popup_centered(Size2(100,80));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,6 +240,9 @@ MeshInstanceEditor::MeshInstanceEditor() {
|
|||
add_child(outline_dialog);
|
||||
outline_dialog->connect("confirmed",this,"_create_outline_mesh");
|
||||
|
||||
err_dialog = memnew( AcceptDialog );
|
||||
add_child(err_dialog);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -235,6 +235,7 @@ void SampleLibraryEditor::_update_library() {
|
|||
|
||||
List<StringName> names;
|
||||
sample_library->get_sample_list(&names);
|
||||
names.sort_custom<StringName::AlphCompare>();
|
||||
|
||||
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ void SamplePlayerEditor::_update_sample_library() {
|
|||
|
||||
List<StringName> samplenames;
|
||||
sl->get_sample_list(&samplenames);
|
||||
samplenames.sort_custom<StringName::AlphCompare>();
|
||||
for(List<StringName>::Element *E=samplenames.front();E;E=E->next()) {
|
||||
samples->add_item(E->get());
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ void GraphCurveMapEdit::_input_event(const InputEvent& p_event) {
|
|||
update();
|
||||
}
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && grabbing) {
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) {
|
||||
|
||||
Point2 p = Vector2(p_event.mouse_button.x,p_event.mouse_button.y)/get_size();
|
||||
p.y=1.0-p.y;
|
||||
|
|
|
@ -2258,7 +2258,7 @@ void PropertyEditor::update_tree() {
|
|||
}
|
||||
|
||||
if (capitalize_paths)
|
||||
item->set_text( 0, name.capitalize() );
|
||||
item->set_text( 0, name.camelcase_to_underscore().capitalize() );
|
||||
else
|
||||
item->set_text( 0, name );
|
||||
|
||||
|
|
Loading…
Reference in New Issue