mirror of
https://github.com/godotengine/godot.git
synced 2025-04-13 01:00:35 +08:00
Merge pull request #5275 from akien-mga/pr-empty-files
Drop empty or commented out files and classes that are not in use
This commit is contained in:
commit
81a10795dc
@ -1,35 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* balloon_allocator.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef BALLOON_ALLOCATOR_H
|
||||
#define BALLOON_ALLOCATOR_H
|
||||
|
||||
#include "os/memory.h"
|
||||
|
||||
#include "allocators.h"
|
||||
#endif // BALLOON_ALLOCATOR_H
|
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* fpstr.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
28
core/fpstr.h
28
core/fpstr.h
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* fpstr.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
@ -1,29 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* bezier_curve.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "bezier_curve.h"
|
@ -1,35 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* bezier_curve.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef BEZIER_CURVE_H
|
||||
#define BEZIER_CURVE_H
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // BEZIER_CURVE_H
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* math_defs.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "math_defs.h"
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* multi_bucket_array.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef MULTI_BUCKET_ARRAY_H
|
||||
#define MULTI_BUCKET_ARRAY_H
|
||||
|
||||
|
||||
template<class T>
|
||||
class MultiBucketArray {
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // MULTI_BUCKET_ARRAY_H
|
@ -1,29 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* pair.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "pair.h"
|
@ -1,90 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* res_ptr.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#if 0
|
||||
#include "ref_ptr.h"
|
||||
#include "resource.h"
|
||||
#include "stdio.h"
|
||||
|
||||
void RefPtr::operator=(const RefPtr& p_other) {
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
Ref<Resource> *ref_other = reinterpret_cast<Ref<Resource>*>( const_cast<char*>(&p_other.data[0]) );
|
||||
|
||||
*ref = *ref_other;
|
||||
}
|
||||
|
||||
bool RefPtr::operator==(const RefPtr& p_other) const {
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
Ref<Resource> *ref_other = reinterpret_cast<Ref<Resource>*>( const_cast<char*>(&p_other.data[0]) );
|
||||
|
||||
return *ref == *ref_other;
|
||||
}
|
||||
|
||||
RefPtr::RefPtr(const RefPtr& p_other) {
|
||||
|
||||
memnew_placement(&data[0],Ref<Resource>);
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
Ref<Resource> *ref_other = reinterpret_cast<Ref<Resource>*>( const_cast<char*>(&p_other.data[0]) );
|
||||
|
||||
*ref = *ref_other;
|
||||
}
|
||||
|
||||
bool RefPtr::is_null() const {
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
return ref->is_null();
|
||||
|
||||
|
||||
}
|
||||
|
||||
RID RefPtr::get_rid() const {
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
if (ref->is_null())
|
||||
return RID();
|
||||
return (*ref)->get_rid();
|
||||
}
|
||||
|
||||
RefPtr::RefPtr() {
|
||||
|
||||
ERR_FAIL_COND(sizeof(Ref<Resource>)>DATASIZE);
|
||||
memnew_placement(&data[0],Ref<Resource>);
|
||||
}
|
||||
|
||||
|
||||
RefPtr::~RefPtr() {
|
||||
|
||||
Ref<Resource> *ref = reinterpret_cast<Ref<Resource>*>( &data[0] );
|
||||
ref->~Ref<Resource>();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,63 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* res_ptr.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef RES_PTR_H
|
||||
#define RES_PTR_H
|
||||
|
||||
#if 0
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
* This class exists to workaround a limitation in C++ but keep the design OK.
|
||||
* It's basically an opaque container of a Resource reference, so Variant can use it.
|
||||
*/
|
||||
|
||||
#include "rid.h"
|
||||
|
||||
class ResBase;
|
||||
|
||||
class RefPtr {
|
||||
friend class ResBase;
|
||||
enum {
|
||||
|
||||
DATASIZE=sizeof(void*)*4
|
||||
};
|
||||
|
||||
mutable char data[DATASIZE]; // too much probably, virtual class + pointer
|
||||
public:
|
||||
|
||||
bool is_null() const;
|
||||
void operator=(const RefPtr& p_other);
|
||||
bool operator==(const RefPtr& p_other) const;
|
||||
RID get_rid() const;
|
||||
RefPtr(const RefPtr& p_other);
|
||||
RefPtr();
|
||||
~RefPtr();
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif
|
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* script_debugger_debugger.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
@ -1,40 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* variant_call_bind.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef VARIANT_CALL_BIND_H
|
||||
#define VARIANT_CALL_BIND_H
|
||||
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // VARIANT_CALL_BIND_H
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* vmap.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "vmap.h"
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* vset.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
@ -1,35 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* cp_file_access_wrapper.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "cp_file_access_wrapper.h"
|
||||
|
||||
|
||||
//CPFileAccessWrapper* (*CPFileAccessWrapper::create)()=0;
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* cp_player_data_reserved.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "cp_player_data.h"
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -2,4 +2,3 @@ Import('env')
|
||||
Export('env');
|
||||
|
||||
env.add_source_files(env.drivers_sources,"*.cpp")
|
||||
#env.add_source_files(env.drivers_sources,"*.c")
|
||||
|
@ -1,19 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nedmalloc", "nedmalloc.vcproj", "{B89384F5-360B-4AB2-8F43-2F5F98A947FE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B89384F5-360B-4AB2-8F43-2F5F98A947FE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B89384F5-360B-4AB2-8F43-2F5F98A947FE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B89384F5-360B-4AB2-8F43-2F5F98A947FE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B89384F5-360B-4AB2-8F43-2F5F98A947FE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,259 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="nedmalloc"
|
||||
ProjectGUID="{B89384F5-360B-4AB2-8F43-2F5F98A947FE}"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/nedmalloc.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/nedmalloc.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Ow"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/nedmalloc.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\nedmalloc.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\test.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\malloc.c.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\nedmalloc.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\..\..\gcLink.cc"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Readme.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,356 +0,0 @@
|
||||
/* test.c
|
||||
An example of how to use nedalloc
|
||||
(C) 2005-2007 Niall Douglas
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "nedmalloc.c"
|
||||
|
||||
#define THREADS 5
|
||||
#define RECORDS (100000/THREADS)
|
||||
#define TORTURETEST 1
|
||||
|
||||
static int whichmalloc;
|
||||
static int doRealloc;
|
||||
static struct threadstuff_t
|
||||
{
|
||||
int ops;
|
||||
unsigned int *toalloc;
|
||||
void **allocs;
|
||||
char cachesync1[128];
|
||||
int done;
|
||||
char cachesync2[128];
|
||||
} threadstuff[THREADS];
|
||||
|
||||
static void threadcode(int);
|
||||
|
||||
#ifdef WIN32
|
||||
static DWORD WINAPI _threadcode(LPVOID a)
|
||||
{
|
||||
threadcode((int)(size_t) a);
|
||||
return 0;
|
||||
}
|
||||
#define THREADVAR HANDLE
|
||||
#define THREADINIT(v, id) (*v=CreateThread(NULL, 0, _threadcode, (LPVOID)(size_t) id, 0, NULL))
|
||||
#define THREADSLEEP(v) SleepEx(v, FALSE)
|
||||
#define THREADWAIT(v) (WaitForSingleObject(v, INFINITE), 0)
|
||||
|
||||
typedef unsigned __int64 usCount;
|
||||
static FORCEINLINE usCount GetUsCount()
|
||||
{
|
||||
static LARGE_INTEGER ticksPerSec;
|
||||
static double scalefactor;
|
||||
LARGE_INTEGER val;
|
||||
if(!scalefactor)
|
||||
{
|
||||
if(QueryPerformanceFrequency(&ticksPerSec))
|
||||
scalefactor=ticksPerSec.QuadPart/1000000000000.0;
|
||||
else
|
||||
scalefactor=1;
|
||||
}
|
||||
if(!QueryPerformanceCounter(&val))
|
||||
return (usCount) GetTickCount() * 1000000000;
|
||||
return (usCount) (val.QuadPart/scalefactor);
|
||||
}
|
||||
|
||||
static HANDLE win32heap;
|
||||
static void *win32malloc(size_t size)
|
||||
{
|
||||
return HeapAlloc(win32heap, 0, size);
|
||||
}
|
||||
static void *win32realloc(void *p, size_t size)
|
||||
{
|
||||
return HeapReAlloc(win32heap, 0, p, size);
|
||||
}
|
||||
static void win32free(void *mem)
|
||||
{
|
||||
HeapFree(win32heap, 0, mem);
|
||||
}
|
||||
|
||||
static void *(*const mallocs[])(size_t size)={ malloc, nedmalloc, win32malloc };
|
||||
static void *(*const reallocs[])(void *p, size_t size)={ realloc, nedrealloc, win32realloc };
|
||||
static void (*const frees[])(void *mem)={ free, nedfree, win32free };
|
||||
#else
|
||||
static void *_threadcode(void *a)
|
||||
{
|
||||
threadcode((int)(size_t) a);
|
||||
return 0;
|
||||
}
|
||||
#define THREADVAR pthread_t
|
||||
#define THREADINIT(v, id) pthread_create(v, NULL, _threadcode, (void *)(size_t) id)
|
||||
#define THREADSLEEP(v) usleep(v*1000)
|
||||
#define THREADWAIT(v) pthread_join(v, NULL)
|
||||
|
||||
typedef unsigned long long usCount;
|
||||
static FORCEINLINE usCount GetUsCount()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
return ((usCount) tv.tv_sec*1000000000000LL)+tv.tv_usec*1000000LL;
|
||||
}
|
||||
|
||||
static void *(*const mallocs[])(size_t size)={ malloc, nedmalloc };
|
||||
static void *(*const reallocs[])(void *p, size_t size)={ realloc, nedrealloc };
|
||||
static void (*const frees[])(void *mem)={ free, nedfree };
|
||||
#endif
|
||||
static usCount times[THREADS];
|
||||
|
||||
|
||||
static FORCEINLINE unsigned int myrandom(unsigned int *seed)
|
||||
{
|
||||
*seed=1664525UL*(*seed)+1013904223UL;
|
||||
return *seed;
|
||||
}
|
||||
|
||||
static void threadcode(int threadidx)
|
||||
{
|
||||
int n;
|
||||
unsigned int *toallocptr=threadstuff[threadidx].toalloc;
|
||||
void **allocptr=threadstuff[threadidx].allocs;
|
||||
unsigned int seed=threadidx;
|
||||
usCount start;
|
||||
threadstuff[threadidx].done=0;
|
||||
/*neddisablethreadcache(0);*/
|
||||
THREADSLEEP(100);
|
||||
start=GetUsCount();
|
||||
#ifdef TORTURETEST
|
||||
/* A randomised malloc/realloc/free test (torture test) */
|
||||
for(n=0; n<RECORDS*100; n++)
|
||||
{
|
||||
unsigned int r=myrandom(&seed), i;
|
||||
i=(int)(r % RECORDS);
|
||||
if(!allocptr[i])
|
||||
{
|
||||
allocptr[i]=mallocs[whichmalloc](r & 0x1FFF);
|
||||
threadstuff[threadidx].ops++;
|
||||
}
|
||||
else if(r & (1<<31))
|
||||
{
|
||||
allocptr[i]=reallocs[whichmalloc](allocptr[i], r & 0x1FFF);
|
||||
threadstuff[threadidx].ops++;
|
||||
}
|
||||
else
|
||||
{
|
||||
frees[whichmalloc](allocptr[i]);
|
||||
allocptr[i]=0;
|
||||
}
|
||||
}
|
||||
for(n=0; n<RECORDS; n++)
|
||||
{
|
||||
if(allocptr[n])
|
||||
{
|
||||
frees[whichmalloc](allocptr[n]);
|
||||
allocptr[n]=0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* A simple stack which allocates and deallocates off the top (speed test) */
|
||||
for(n=0; n<RECORDS;)
|
||||
{
|
||||
#if 1
|
||||
r=myrandom(&seed);
|
||||
if(allocptr>threadstuff[threadidx].allocs && (r & 65535)<32760) /*<32760)*/
|
||||
{ /* free */
|
||||
--toallocptr;
|
||||
--allocptr;
|
||||
--n;
|
||||
frees[whichmalloc](*allocptr);
|
||||
*allocptr=0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(doRealloc && allocptr>threadstuff[threadidx].allocs && (r & 1))
|
||||
{
|
||||
allocptr[-1]=reallocs[whichmalloc](allocptr[-1], *toallocptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
allocptr[0]=mallocs[whichmalloc](*toallocptr);
|
||||
allocptr++;
|
||||
}
|
||||
n++;
|
||||
toallocptr++;
|
||||
threadstuff[threadidx].ops++;
|
||||
}
|
||||
}
|
||||
while(allocptr>threadstuff[threadidx].allocs)
|
||||
{
|
||||
frees[whichmalloc](*--allocptr);
|
||||
}
|
||||
#endif
|
||||
times[threadidx]+=GetUsCount()-start;
|
||||
neddisablethreadcache(0);
|
||||
threadstuff[threadidx].done=1;
|
||||
}
|
||||
|
||||
static double runtest()
|
||||
{
|
||||
unsigned int seed=1;
|
||||
int n, i;
|
||||
double opspersec=0;
|
||||
THREADVAR threads[THREADS];
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
unsigned int *toallocptr;
|
||||
int m;
|
||||
threadstuff[n].ops=0;
|
||||
times[n]=0;
|
||||
threadstuff[n].toalloc=toallocptr=calloc(RECORDS, sizeof(unsigned int));
|
||||
threadstuff[n].allocs=calloc(RECORDS, sizeof(void *));
|
||||
for(m=0; m<RECORDS; m++)
|
||||
{
|
||||
unsigned int size=myrandom(&seed);
|
||||
if(size<(1<<30))
|
||||
{ /* Make it two power multiple of less than 512 bytes to
|
||||
model frequent C++ new's */
|
||||
size=4<<(size & 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
size&=0x3FFF; /* < 16Kb */
|
||||
/*size&=0x1FFF;*/ /* < 8Kb */
|
||||
/*size=(1<<6)<<(size & 7);*/ /* < 8Kb */
|
||||
}
|
||||
*toallocptr++=size;
|
||||
}
|
||||
}
|
||||
#ifdef TORTURETEST
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
THREADINIT(&threads[n], n);
|
||||
}
|
||||
for(i=0; i<32; i++)
|
||||
{
|
||||
int found=-1;
|
||||
do
|
||||
{
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
THREADSLEEP(100);
|
||||
if(threadstuff[n].done)
|
||||
{
|
||||
found=n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while(found<0);
|
||||
THREADWAIT(threads[found]);
|
||||
threads[found]=0;
|
||||
THREADINIT(&threads[found], found);
|
||||
printf("Relaunched thread %d\n", found);
|
||||
}
|
||||
for(n=THREADS-1; n>=0; n--)
|
||||
{
|
||||
THREADWAIT(threads[n]);
|
||||
threads[n]=0;
|
||||
}
|
||||
#else
|
||||
#if 1
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
THREADINIT(&threads[n], n);
|
||||
}
|
||||
for(n=THREADS-1; n>=0; n--)
|
||||
{
|
||||
THREADWAIT(threads[n]);
|
||||
threads[n]=0;
|
||||
}
|
||||
#else
|
||||
/* Quick realloc() test */
|
||||
doRealloc=1;
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
THREADINIT(&threads[n], n);
|
||||
}
|
||||
for(n=THREADS-1; n>=0; n--)
|
||||
{
|
||||
THREADWAIT(threads[n]);
|
||||
threads[n]=0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
usCount totaltime=0;
|
||||
int totalops=0;
|
||||
for(n=0; n<THREADS; n++)
|
||||
{
|
||||
totaltime+=times[n];
|
||||
totalops+=threadstuff[n].ops;
|
||||
}
|
||||
opspersec=1000000000000.0*totalops/totaltime*THREADS;
|
||||
printf("This allocator achieves %lfops/sec under %d threads\n", opspersec, THREADS);
|
||||
}
|
||||
for(n=THREADS-1; n>=0; n--)
|
||||
{
|
||||
free(threadstuff[n].allocs); threadstuff[n].allocs=0;
|
||||
free(threadstuff[n].toalloc); threadstuff[n].toalloc=0;
|
||||
}
|
||||
return opspersec;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
double std=0, ned=0;
|
||||
|
||||
#if 0
|
||||
{
|
||||
usCount start, end;
|
||||
start=GetUsCount();
|
||||
THREADSLEEP(5000);
|
||||
end=GetUsCount();
|
||||
printf("Wait was %lf\n", (end-start)/1000000000000.0);
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
{ /* Force load of user32.dll so we can debug */
|
||||
BOOL v;
|
||||
SystemParametersInfo(SPI_GETBEEP, 0, &v, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(0)
|
||||
{
|
||||
printf("\nTesting standard allocator with %d threads ...\n", THREADS);
|
||||
std=runtest();
|
||||
}
|
||||
if(1)
|
||||
{
|
||||
printf("\nTesting nedmalloc with %d threads ...\n", THREADS);
|
||||
whichmalloc=1;
|
||||
ned=runtest();
|
||||
}
|
||||
#ifdef WIN32
|
||||
if(0)
|
||||
{
|
||||
ULONG data=2;
|
||||
win32heap=HeapCreate(0, 0, 0);
|
||||
HeapSetInformation(win32heap, HeapCompatibilityInformation, &data, sizeof(data));
|
||||
HeapQueryInformation(win32heap, HeapCompatibilityInformation, &data, sizeof(data), NULL);
|
||||
if(2!=data)
|
||||
{
|
||||
printf("The win32 low frag allocator won't work under a debugger!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Testing win32 low frag allocator with %d threads ...\n\n", THREADS);
|
||||
whichmalloc=2;
|
||||
runtest();
|
||||
}
|
||||
HeapDestroy(win32heap);
|
||||
}
|
||||
#endif
|
||||
if(std && ned)
|
||||
{ // ned should have more ops/sec
|
||||
printf("\n\nnedmalloc allocator is %lf times faster than standard\n", ned/std);
|
||||
}
|
||||
printf("\nPress a key to trim\n");
|
||||
getchar();
|
||||
nedmalloc_trim(0);
|
||||
#ifdef _MSC_VER
|
||||
printf("\nPress a key to end\n");
|
||||
getchar();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
@ -3,7 +3,6 @@ Import('env_drivers')
|
||||
|
||||
|
||||
png_sources = [
|
||||
"png/example.c",
|
||||
"png/png.c",
|
||||
"png/pngerror.c",
|
||||
"png/pngget.c",
|
||||
|
@ -1,879 +0,0 @@
|
||||
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.5.19 [August 21, 2014]
|
||||
* Maintained 1998-2014 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger
|
||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
*/
|
||||
|
||||
/* This is an example of how to use libpng to read and write PNG files.
|
||||
* The file libpng-manual.txt is much more verbose then this. If you have not
|
||||
* read it, do so first. This was designed to be a starting point of an
|
||||
* implementation. This is not officially part of libpng, is hereby placed
|
||||
* in the public domain, and therefore does not require a copyright notice.
|
||||
* To the extent possible under law, the authors have waived all copyright and
|
||||
* related or neighboring rights to this file.
|
||||
*
|
||||
* This file does not currently compile, because it is missing certain
|
||||
* parts, like allocating memory to hold an image. You will have to
|
||||
* supply these parts to get it to compile. For an example of a minimal
|
||||
* working PNG reader/writer, see pngtest.c, included in this distribution;
|
||||
* see also the programs in the contrib directory.
|
||||
*/
|
||||
|
||||
#define _POSIX_SOURCE 1 /* libpng and zlib are POSIX-compliant. You may
|
||||
* change this if your application uses non-POSIX
|
||||
* extensions. */
|
||||
|
||||
#include "png.h"
|
||||
|
||||
/* The png_jmpbuf() macro, used in error handling, became available in
|
||||
* libpng version 1.0.6. If you want to be able to run your code with older
|
||||
* versions of libpng, you must define the macro yourself (but only if it
|
||||
* is not already defined by libpng!).
|
||||
*/
|
||||
|
||||
#ifndef png_jmpbuf
|
||||
# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
|
||||
#endif
|
||||
|
||||
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||
* returns zero if the image is a PNG and nonzero if it isn't a PNG.
|
||||
*
|
||||
* The function check_if_png() shown here, but not used, returns nonzero (true)
|
||||
* if the file can be opened and is a PNG, 0 (false) otherwise.
|
||||
*
|
||||
* If this call is successful, and you are going to keep the file open,
|
||||
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
|
||||
* you have created the png_ptr, so that libpng knows your application
|
||||
* has read that many bytes from the start of the file. Make sure you
|
||||
* don't call png_set_sig_bytes() with more than 8 bytes read or give it
|
||||
* an incorrect number of bytes read, or you will either have read too
|
||||
* many bytes (your fault), or you are telling libpng to read the wrong
|
||||
* number of magic bytes (also your fault).
|
||||
*
|
||||
* Many applications already read the first 2 or 4 bytes from the start
|
||||
* of the image to determine the file type, so it would be easiest just
|
||||
* to pass the bytes to png_sig_cmp() or even skip that if you know
|
||||
* you have a PNG file, and call png_set_sig_bytes().
|
||||
*/
|
||||
#define PNG_BYTES_TO_CHECK 4
|
||||
int check_if_png(char *file_name, FILE **fp)
|
||||
{
|
||||
char buf[PNG_BYTES_TO_CHECK];
|
||||
|
||||
/* Open the prospective PNG file. */
|
||||
if ((*fp = fopen(file_name, "rb")) == NULL)
|
||||
return 0;
|
||||
|
||||
/* Read in some of the signature bytes */
|
||||
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
|
||||
return 0;
|
||||
|
||||
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
||||
Return nonzero (true) if they match */
|
||||
|
||||
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
||||
}
|
||||
|
||||
/* Read a PNG file. You may want to return an error code if the read
|
||||
* fails (depending upon the failure). There are two "prototypes" given
|
||||
* here - one where we are given the filename, and we need to open the
|
||||
* file, and the other where we are given an open file (possibly with
|
||||
* some or all of the magic bytes read - see comments above).
|
||||
*/
|
||||
#ifdef open_file /* prototype 1 */
|
||||
void read_png(char *file_name) /* We need to open the file */
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
int sig_read = 0;
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type;
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(file_name, "rb")) == NULL)
|
||||
return (ERROR);
|
||||
|
||||
#else no_open_file /* prototype 2 */
|
||||
void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type;
|
||||
#endif no_open_file /* Only use one prototype! */
|
||||
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
* functions. If you want to use the default stderr and longjump method,
|
||||
* you can supply NULL for the last three parameters. We also supply the
|
||||
* the compiler header file version, so that we know if the application
|
||||
* was compiled with a compatible version of the library. REQUIRED
|
||||
*/
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||
|
||||
if (png_ptr == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Allocate/initialize the memory for image information. REQUIRED. */
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Set error handling if you are using the setjmp/longjmp method (this is
|
||||
* the normal method of doing things with libpng). REQUIRED unless you
|
||||
* set up your own error handlers in the png_create_read_struct() earlier.
|
||||
*/
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
fclose(fp);
|
||||
/* If we get here, we had a problem reading the file */
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* One of the following I/O initialization methods is REQUIRED */
|
||||
#ifdef streams /* PNG file I/O method 1 */
|
||||
/* Set up the input control if you are using standard C streams */
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
#else no_streams /* PNG file I/O method 2 */
|
||||
/* If you are using replacement read functions, instead of calling
|
||||
* png_init_io() here you would call:
|
||||
*/
|
||||
png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn);
|
||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||
#endif no_streams /* Use only one I/O method! */
|
||||
|
||||
/* If we have already read some of the signature */
|
||||
png_set_sig_bytes(png_ptr, sig_read);
|
||||
|
||||
#ifdef hilevel
|
||||
/*
|
||||
* If you have enough memory to read in the entire image at once,
|
||||
* and you need to specify only transforms that can be controlled
|
||||
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||
* quantizing, filling, setting background, and doing gamma
|
||||
* adjustment), then you can read the entire image (including
|
||||
* pixels) into the info structure with this call:
|
||||
*/
|
||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||
|
||||
#else
|
||||
/* OK, you're doing it the hard way, with the lower-level functions */
|
||||
|
||||
/* The call to png_read_info() gives us all of the information from the
|
||||
* PNG file before the first IDAT (image data chunk). REQUIRED
|
||||
*/
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
&interlace_type, NULL, NULL);
|
||||
|
||||
/* Set up the data transformations you want. Note that these are all
|
||||
* optional. Only call them if you want/need them. Many of the
|
||||
* transformations only work on specific types of images, and many
|
||||
* are mutually exclusive.
|
||||
*/
|
||||
|
||||
/* Tell libpng to strip 16 bits/color files down to 8 bits/color.
|
||||
* Use accurate scaling if it's available, otherwise just chop off the
|
||||
* low byte.
|
||||
*/
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png_ptr);
|
||||
#else
|
||||
png_set_strip_16(png_ptr);
|
||||
#endif
|
||||
|
||||
/* Strip alpha bytes from the input data without combining with the
|
||||
* background (not recommended).
|
||||
*/
|
||||
png_set_strip_alpha(png_ptr);
|
||||
|
||||
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
|
||||
* byte into separate bytes (useful for paletted and grayscale images).
|
||||
*/
|
||||
png_set_packing(png_ptr);
|
||||
|
||||
/* Change the order of packed pixels to least significant bit first
|
||||
* (not useful if you are using png_set_packing). */
|
||||
png_set_packswap(png_ptr);
|
||||
|
||||
/* Expand paletted colors into true RGB triplets */
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb(png_ptr);
|
||||
|
||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||
|
||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||
* so the data will be available as RGBA quartets.
|
||||
*/
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
png_set_tRNS_to_alpha(png_ptr);
|
||||
|
||||
/* Set the background color to draw transparent and alpha images over.
|
||||
* It is possible to set the red, green, and blue components directly
|
||||
* for paletted images instead of supplying a palette index. Note that
|
||||
* even if the PNG file supplies a background, you are not required to
|
||||
* use it - you should use the (solid) application background if it has one.
|
||||
*/
|
||||
|
||||
png_color_16 my_background, *image_background;
|
||||
|
||||
if (png_get_bKGD(png_ptr, info_ptr, &image_background))
|
||||
png_set_background(png_ptr, image_background,
|
||||
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||
else
|
||||
png_set_background(png_ptr, &my_background,
|
||||
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||
|
||||
/* Some suggestions as to how to get a screen gamma value
|
||||
*
|
||||
* Note that screen gamma is the display_exponent, which includes
|
||||
* the CRT_exponent and any correction for viewing conditions
|
||||
*/
|
||||
if (/* We have a user-defined screen gamma value */)
|
||||
{
|
||||
screen_gamma = user-defined screen_gamma;
|
||||
}
|
||||
/* This is one way that applications share the same screen gamma value */
|
||||
else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL)
|
||||
{
|
||||
screen_gamma = atof(gamma_str);
|
||||
}
|
||||
/* If we don't have another value */
|
||||
else
|
||||
{
|
||||
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
|
||||
in a dimly lit room */
|
||||
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */
|
||||
}
|
||||
|
||||
/* Tell libpng to handle the gamma conversion for you. The final call
|
||||
* is a good guess for PC generated images, but it should be configurable
|
||||
* by the user at run time by the user. It is strongly suggested that
|
||||
* your application support gamma correction.
|
||||
*/
|
||||
|
||||
int intent;
|
||||
|
||||
if (png_get_sRGB(png_ptr, info_ptr, &intent))
|
||||
png_set_gamma(png_ptr, screen_gamma, PNG_DEFAULT_sRGB);
|
||||
else
|
||||
{
|
||||
double image_gamma;
|
||||
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma))
|
||||
png_set_gamma(png_ptr, screen_gamma, image_gamma);
|
||||
else
|
||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
/* Quantize RGB files down to 8-bit palette or reduce palettes
|
||||
* to the number of colors available on your screen.
|
||||
*/
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
{
|
||||
int num_palette;
|
||||
png_colorp palette;
|
||||
|
||||
/* This reduces the image to the application supplied palette */
|
||||
if (/* We have our own palette */)
|
||||
{
|
||||
/* An array of colors to which the image should be quantized */
|
||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||
|
||||
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||
MAX_SCREEN_COLORS, NULL, 0);
|
||||
}
|
||||
/* This reduces the image to the palette supplied in the file */
|
||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||
{
|
||||
png_uint_16p histogram = NULL;
|
||||
|
||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||
|
||||
png_set_quantize(png_ptr, palette, num_palette,
|
||||
max_screen_colors, histogram, 0);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||
|
||||
/* Invert monochrome files to have 0 as white and 1 as black */
|
||||
png_set_invert_mono(png_ptr);
|
||||
|
||||
/* If you want to shift the pixel values from the range [0,255] or
|
||||
* [0,65535] to the original [0,7] or [0,31], or whatever range the
|
||||
* colors were originally in:
|
||||
*/
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||
{
|
||||
png_color_8p sig_bit_p;
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
||||
png_set_shift(png_ptr, sig_bit_p);
|
||||
}
|
||||
|
||||
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||
png_set_swap_alpha(png_ptr);
|
||||
|
||||
/* Swap bytes of 16-bit files to least significant byte first */
|
||||
png_set_swap(png_ptr);
|
||||
|
||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
||||
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Turn on interlace handling. REQUIRED if you are not using
|
||||
* png_read_image(). To see how to handle interlacing passes,
|
||||
* see the png_read_row() method below:
|
||||
*/
|
||||
number_passes = png_set_interlace_handling(png_ptr);
|
||||
#else
|
||||
number_passes = 1;
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
|
||||
|
||||
/* Optional call to gamma correct and add the background to the palette
|
||||
* and update info structure. REQUIRED if you are expecting libpng to
|
||||
* update the palette for you (ie you selected such a transform above).
|
||||
*/
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
|
||||
/* Allocate the memory to hold the image using the fields of info_ptr. */
|
||||
|
||||
/* The easiest way to read the image: */
|
||||
png_bytep row_pointers[height];
|
||||
|
||||
/* Clear the pointer array */
|
||||
for (row = 0; row < height; row++)
|
||||
row_pointers[row] = NULL;
|
||||
|
||||
for (row = 0; row < height; row++)
|
||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||
info_ptr));
|
||||
|
||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||
#ifdef entire /* Read the entire image in one go */
|
||||
png_read_image(png_ptr, row_pointers);
|
||||
|
||||
#else no_entire /* Read the image one or more scanlines at a time */
|
||||
/* The other way to read images - deal with interlacing: */
|
||||
|
||||
for (pass = 0; pass < number_passes; pass++)
|
||||
{
|
||||
#ifdef single /* Read the image a single row at a time */
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
||||
}
|
||||
|
||||
#else no_single /* Read the image several rows at a time */
|
||||
for (y = 0; y < height; y += number_of_rows)
|
||||
{
|
||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||
png_read_rows(png_ptr, &row_pointers[y], NULL,
|
||||
number_of_rows);
|
||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||
png_read_rows(png_ptr, NULL, &row_pointers[y],
|
||||
number_of_rows);
|
||||
#endif no_sparkle /* Use only one of these two methods */
|
||||
}
|
||||
|
||||
/* If you want to display the image after every pass, do so here */
|
||||
#endif no_single /* Use only one of these two methods */
|
||||
}
|
||||
#endif no_entire /* Use only one of these two methods */
|
||||
|
||||
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
#endif hilevel
|
||||
|
||||
/* At this point you have read the entire image */
|
||||
|
||||
/* Clean up after the read, and free any memory allocated - REQUIRED */
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
/* Close the file */
|
||||
fclose(fp);
|
||||
|
||||
/* That's it */
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* Progressively read a file */
|
||||
|
||||
int
|
||||
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||
{
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
* functions. If you want to use the default stderr and longjump method,
|
||||
* you can supply NULL for the last three parameters. We also check that
|
||||
* the library version is compatible in case we are using dynamically
|
||||
* linked libraries.
|
||||
*/
|
||||
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||
|
||||
if (*png_ptr == NULL)
|
||||
{
|
||||
*info_ptr = NULL;
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
*info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
if (*info_ptr == NULL)
|
||||
{
|
||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||
{
|
||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* This one's new. You will need to provide all three
|
||||
* function callbacks, even if you aren't using them all.
|
||||
* If you aren't using all functions, you can specify NULL
|
||||
* parameters. Even when all three functions are NULL,
|
||||
* you need to call png_set_progressive_read_fn().
|
||||
* These functions shouldn't be dependent on global or
|
||||
* static variables if you are decoding several images
|
||||
* simultaneously. You should store stream specific data
|
||||
* in a separate struct, given as the second parameter,
|
||||
* and retrieve the pointer from inside the callbacks using
|
||||
* the function png_get_progressive_ptr(png_ptr).
|
||||
*/
|
||||
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
|
||||
info_callback, row_callback, end_callback);
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
int
|
||||
process_data(png_structp *png_ptr, png_infop *info_ptr,
|
||||
png_bytep buffer, png_uint_32 length)
|
||||
{
|
||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||
{
|
||||
/* Free the png_ptr and info_ptr memory on error */
|
||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* This one's new also. Simply give it chunks of data as
|
||||
* they arrive from the data stream (in order, of course).
|
||||
* On segmented machines, don't give it any more than 64K.
|
||||
* The library seems to run fine with sizes of 4K, although
|
||||
* you can give it much less if necessary (I assume you can
|
||||
* give it chunks of 1 byte, but I haven't tried with less
|
||||
* than 256 bytes yet). When this function returns, you may
|
||||
* want to display any rows that were generated in the row
|
||||
* callback, if you aren't already displaying them there.
|
||||
*/
|
||||
png_process_data(*png_ptr, *info_ptr, buffer, length);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
info_callback(png_structp png_ptr, png_infop info)
|
||||
{
|
||||
/* Do any setup here, including setting any of the transformations
|
||||
* mentioned in the Reading PNG files section. For now, you _must_
|
||||
* call either png_start_read_image() or png_read_update_info()
|
||||
* after all the transformations are set (even if you don't set
|
||||
* any). You may start getting rows before png_process_data()
|
||||
* returns, so this is your last chance to prepare for that.
|
||||
*/
|
||||
}
|
||||
|
||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
png_uint_32 row_num, int pass)
|
||||
{
|
||||
/*
|
||||
* This function is called for every row in the image. If the
|
||||
* image is interlaced, and you turned on the interlace handler,
|
||||
* this function will be called for every row in every pass.
|
||||
*
|
||||
* In this function you will receive a pointer to new row data from
|
||||
* libpng called new_row that is to replace a corresponding row (of
|
||||
* the same data format) in a buffer allocated by your application.
|
||||
*
|
||||
* The new row data pointer "new_row" may be NULL, indicating there is
|
||||
* no new data to be replaced (in cases of interlace loading).
|
||||
*
|
||||
* If new_row is not NULL then you need to call
|
||||
* png_progressive_combine_row() to replace the corresponding row as
|
||||
* shown below:
|
||||
*/
|
||||
|
||||
/* Get pointer to corresponding row in our
|
||||
* PNG read buffer.
|
||||
*/
|
||||
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* If both rows are allocated then copy the new row
|
||||
* data to the corresponding row data.
|
||||
*/
|
||||
if ((old_row != NULL) && (new_row != NULL))
|
||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||
|
||||
/*
|
||||
* The rows and passes are called in order, so you don't really
|
||||
* need the row_num and pass, but I'm supplying them because it
|
||||
* may make your life easier.
|
||||
*
|
||||
* For the non-NULL rows of interlaced images, you must call
|
||||
* png_progressive_combine_row() passing in the new row and the
|
||||
* old row, as demonstrated above. You can call this function for
|
||||
* NULL rows (it will just return) and for non-interlaced images
|
||||
* (it just does the png_memcpy for you) if it will make the code
|
||||
* easier. Thus, you can just do this for all cases:
|
||||
*/
|
||||
|
||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||
|
||||
/* where old_row is what was displayed for previous rows. Note
|
||||
* that the first pass (pass == 0 really) will completely cover
|
||||
* the old row, so the rows do not have to be initialized. After
|
||||
* the first pass (and only for interlaced images), you will have
|
||||
* to pass the current row as new_row, and the function will combine
|
||||
* the old row and the new row.
|
||||
*/
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
}
|
||||
|
||||
end_callback(png_structp png_ptr, png_infop info)
|
||||
{
|
||||
/* This function is called when the whole image has been read,
|
||||
* including any chunks after the image (up to and including
|
||||
* the IEND). You will usually have the same info chunk as you
|
||||
* had in the header, although some data may have been added
|
||||
* to the comments and time fields.
|
||||
*
|
||||
* Most people won't do much here, perhaps setting a flag that
|
||||
* marks the image as finished.
|
||||
*/
|
||||
}
|
||||
|
||||
/* Write a png file */
|
||||
void write_png(char *file_name /* , ... other image information ... */)
|
||||
{
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_colorp palette;
|
||||
|
||||
/* Open the file */
|
||||
fp = fopen(file_name, "wb");
|
||||
if (fp == NULL)
|
||||
return (ERROR);
|
||||
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
* functions. If you want to use the default stderr and longjump method,
|
||||
* you can supply NULL for the last three parameters. We also check that
|
||||
* the library version is compatible with the one used at compile time,
|
||||
* in case we are using dynamically linked libraries. REQUIRED.
|
||||
*/
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||
|
||||
if (png_ptr == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Allocate/initialize the image information data. REQUIRED */
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
png_destroy_write_struct(&png_ptr, NULL);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Set error handling. REQUIRED if you aren't supplying your own
|
||||
* error handling functions in the png_create_write_struct() call.
|
||||
*/
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
/* If we get here, we had a problem writing the file */
|
||||
fclose(fp);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* One of the following I/O initialization functions is REQUIRED */
|
||||
|
||||
#ifdef streams /* I/O initialization method 1 */
|
||||
/* Set up the output control if you are using standard C streams */
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
#else no_streams /* I/O initialization method 2 */
|
||||
/* If you are using replacement write functions, instead of calling
|
||||
* png_init_io() here you would call
|
||||
*/
|
||||
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
||||
user_IO_flush_function);
|
||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||
#endif no_streams /* Only use one initialization method */
|
||||
|
||||
#ifdef hilevel
|
||||
/* This is the easy way. Use it if you already have all the
|
||||
* image info living in the structure. You could "|" many
|
||||
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||
*/
|
||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||
|
||||
#else
|
||||
/* This is the hard way */
|
||||
|
||||
/* Set the image information here. Width and height are up to 2^31,
|
||||
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
||||
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
||||
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
||||
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
|
||||
*/
|
||||
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
/* Set the palette if there is one. REQUIRED for indexed-color images */
|
||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||
* png_sizeof(png_color));
|
||||
/* ... Set palette colors ... */
|
||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||
* the palette that you malloced. Wait until you are about to destroy
|
||||
* the png structure.
|
||||
*/
|
||||
|
||||
/* Optional significant bit (sBIT) chunk */
|
||||
png_color_8 sig_bit;
|
||||
|
||||
/* If we are dealing with a grayscale image then */
|
||||
sig_bit.gray = true_bit_depth;
|
||||
|
||||
/* Otherwise, if we are dealing with a color image then */
|
||||
sig_bit.red = true_red_bit_depth;
|
||||
sig_bit.green = true_green_bit_depth;
|
||||
sig_bit.blue = true_blue_bit_depth;
|
||||
|
||||
/* If the image has an alpha channel then */
|
||||
sig_bit.alpha = true_alpha_bit_depth;
|
||||
|
||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
|
||||
|
||||
/* Optional gamma chunk is strongly suggested if you have any guess
|
||||
* as to the correct gamma of the image.
|
||||
*/
|
||||
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||
|
||||
/* Optionally write comments into the image */
|
||||
{
|
||||
png_text text_ptr[3];
|
||||
|
||||
char key0[]="Title";
|
||||
char text0[]="Mona Lisa";
|
||||
text_ptr[0].key = key0;
|
||||
text_ptr[0].text = text0;
|
||||
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr[0].itxt_length = 0;
|
||||
text_ptr[0].lang = NULL;
|
||||
text_ptr[0].lang_key = NULL;
|
||||
|
||||
char key1[]="Author";
|
||||
char text1[]="Leonardo DaVinci";
|
||||
text_ptr[1].key = key1;
|
||||
text_ptr[1].text = text1;
|
||||
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr[1].itxt_length = 0;
|
||||
text_ptr[1].lang = NULL;
|
||||
text_ptr[1].lang_key = NULL;
|
||||
|
||||
char key2[]="Description";
|
||||
char text2[]="<long text>";
|
||||
text_ptr[2].key = key2;
|
||||
text_ptr[2].text = text2;
|
||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text_ptr[2].itxt_length = 0;
|
||||
text_ptr[2].lang = NULL;
|
||||
text_ptr[2].lang_key = NULL;
|
||||
|
||||
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
|
||||
}
|
||||
|
||||
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
|
||||
|
||||
/* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
||||
* on read and, if your application chooses to write them, they must
|
||||
* be written in accordance with the sRGB profile
|
||||
*/
|
||||
|
||||
/* Write the file header information. REQUIRED */
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
/* If you want, you can write the info in two steps, in case you need to
|
||||
* write your private chunk ahead of PLTE:
|
||||
*
|
||||
* png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
||||
* write_my_chunk();
|
||||
* png_write_info(png_ptr, info_ptr);
|
||||
*
|
||||
* However, given the level of known- and unknown-chunk support in 1.2.0
|
||||
* and up, this should no longer be necessary.
|
||||
*/
|
||||
|
||||
/* Once we write out the header, the compression type on the text
|
||||
* chunk gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
|
||||
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
|
||||
* at the end.
|
||||
*/
|
||||
|
||||
/* Set up the transformations you want. Note that these are
|
||||
* all optional. Only call them if you want them.
|
||||
*/
|
||||
|
||||
/* Invert monochrome pixels */
|
||||
png_set_invert_mono(png_ptr);
|
||||
|
||||
/* Shift the pixels up to a legal bit depth and fill in
|
||||
* as appropriate to correctly scale the image.
|
||||
*/
|
||||
png_set_shift(png_ptr, &sig_bit);
|
||||
|
||||
/* Pack pixels into bytes */
|
||||
png_set_packing(png_ptr);
|
||||
|
||||
/* Swap location of alpha bytes from ARGB to RGBA */
|
||||
png_set_swap_alpha(png_ptr);
|
||||
|
||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
||||
* RGB (4 channels -> 3 channels). The second parameter is not used.
|
||||
*/
|
||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||
|
||||
/* Flip BGR pixels to RGB */
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
/* Swap bytes of 16-bit files to most significant byte first */
|
||||
png_set_swap(png_ptr);
|
||||
|
||||
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
||||
png_set_packswap(png_ptr);
|
||||
|
||||
/* Turn on interlace handling if you are not using png_write_image() */
|
||||
if (interlacing != 0)
|
||||
number_passes = png_set_interlace_handling(png_ptr);
|
||||
|
||||
else
|
||||
number_passes = 1;
|
||||
|
||||
/* The easiest way to write the image (you may have a different memory
|
||||
* layout, however, so choose what fits your needs best). You need to
|
||||
* use the first method if you aren't handling interlacing yourself.
|
||||
*/
|
||||
png_uint_32 k, height, width;
|
||||
|
||||
/* In this example, "image" is a one-dimensional array of bytes */
|
||||
png_byte image[height*width*bytes_per_pixel];
|
||||
|
||||
png_bytep row_pointers[height];
|
||||
|
||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
|
||||
png_error (png_ptr, "Image is too tall to process in memory");
|
||||
|
||||
/* Set up pointers into your "image" byte array */
|
||||
for (k = 0; k < height; k++)
|
||||
row_pointers[k] = image + k*width*bytes_per_pixel;
|
||||
|
||||
/* One of the following output methods is REQUIRED */
|
||||
|
||||
#ifdef entire /* Write out the entire image data in one call */
|
||||
png_write_image(png_ptr, row_pointers);
|
||||
|
||||
/* The other way to write the image - deal with interlacing */
|
||||
|
||||
#else no_entire /* Write out the image data by one or more scanlines */
|
||||
|
||||
/* The number of passes is either 1 for non-interlaced images,
|
||||
* or 7 for interlaced images.
|
||||
*/
|
||||
for (pass = 0; pass < number_passes; pass++)
|
||||
{
|
||||
/* Write a few rows at a time. */
|
||||
png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
|
||||
|
||||
/* If you are only writing one row at a time, this works */
|
||||
for (y = 0; y < height; y++)
|
||||
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||
}
|
||||
#endif no_entire /* Use only one output method */
|
||||
|
||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
|
||||
* chunks are supported and you can use png_set_unknown_chunks() to
|
||||
* register unknown chunks into the info structure to be written out.
|
||||
*/
|
||||
|
||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
#endif hilevel
|
||||
|
||||
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
||||
* as recommended in versions 1.0.5m and earlier of this example; if
|
||||
* libpng mallocs info_ptr->palette, libpng will free it). If you
|
||||
* allocated it with malloc() instead of png_malloc(), use free() instead
|
||||
* of png_free().
|
||||
*/
|
||||
png_free(png_ptr, palette);
|
||||
palette = NULL;
|
||||
|
||||
/* Similarly, if you png_malloced any data that you passed in with
|
||||
* png_set_something(), such as a hist or trans array, free it here,
|
||||
* when you can be sure that libpng is through with it.
|
||||
*/
|
||||
png_free(png_ptr, trans);
|
||||
trans = NULL;
|
||||
/* Whenever you use png_free() it is a good idea to set the pointer to
|
||||
* NULL in case your application inadvertently tries to png_free() it
|
||||
* again. When png_free() sees a NULL it returns without action, thus
|
||||
* avoiding the double-free security problem.
|
||||
*/
|
||||
|
||||
/* Clean up after the write, and free any memory allocated */
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
/* Close the file */
|
||||
fclose(fp);
|
||||
|
||||
/* That's it */
|
||||
return (OK);
|
||||
}
|
||||
|
||||
#endif /* if 0 */
|
@ -1,34 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* gd_pretty_print.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "gd_pretty_print.h"
|
||||
|
||||
GDPrettyPrint::GDPrettyPrint() {
|
||||
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* gd_pretty_print.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef GD_PRETTY_PRINT_H
|
||||
#define GD_PRETTY_PRINT_H
|
||||
|
||||
|
||||
|
||||
|
||||
class GDPrettyPrint {
|
||||
public:
|
||||
GDPrettyPrint();
|
||||
};
|
||||
|
||||
#endif // GD_PRETTY_PRINT_H
|
@ -1,5 +0,0 @@
|
||||
#include "java_bind.h"
|
||||
|
||||
JavaBind::JavaBind()
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#ifndef JAVA_BIND_H
|
||||
#define JAVA_BIND_H
|
||||
|
||||
class JavaBind
|
||||
{
|
||||
public:
|
||||
JavaBind();
|
||||
};
|
||||
|
||||
#endif // JAVA_BIND_H
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* node_2d_singleton.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "node_2d_singleton.h"
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* node_2d_singleton.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef NODE_2D_SINGLETON_H
|
||||
#define NODE_2D_SINGLETON_H
|
||||
|
||||
|
||||
#endif // NODE_2D_SINGLETON_H
|
@ -32,11 +32,10 @@
|
||||
#include "scene/resources/ray_shape.h"
|
||||
#include "scene/resources/box_shape.h"
|
||||
#include "scene/resources/capsule_shape.h"
|
||||
//#include "scene/resources/cylinder_shape.h"
|
||||
#include "scene/resources/convex_polygon_shape.h"
|
||||
#include "scene/resources/concave_polygon_shape.h"
|
||||
#include "scene/resources/height_map_shape.h"
|
||||
#include "scene/resources/plane_shape.h"
|
||||
//TODO: Implement CylinderShape and HeightMapShape?
|
||||
#include "mesh_instance.h"
|
||||
#include "physics_body.h"
|
||||
#include "quick_hull.h"
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "navigation_agent.h"
|
||||
|
||||
NavigationAgent::NavigationAgent()
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#ifndef NAVIGATION_AGENT_H
|
||||
#define NAVIGATION_AGENT_H
|
||||
|
||||
class NavigationAgent
|
||||
{
|
||||
public:
|
||||
NavigationAgent();
|
||||
};
|
||||
|
||||
#endif // NAVIGATION_AGENT_H
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* optimized_spatial_scene.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "optimized_spatial_scene.h"
|
||||
|
||||
OptimizedSpatialScene::OptimizedSpatialScene()
|
||||
{
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* optimized_spatial_scene.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef OPTIMIZED_SPATIAL_SCENE_H
|
||||
#define OPTIMIZED_SPATIAL_SCENE_H
|
||||
|
||||
#include "scene/3d/spatial.h"
|
||||
|
||||
class OptimizedSpatialScene : public Spatial {
|
||||
|
||||
OBJ_TYPE( OptimizedSpatialScene, Spatial );
|
||||
public:
|
||||
OptimizedSpatialScene();
|
||||
};
|
||||
|
||||
#endif // OPTIMIZED_SPATIAL_SCENE_H
|
@ -33,7 +33,6 @@
|
||||
#include "scene/resources/animation.h"
|
||||
#include "scene/3d/spatial.h"
|
||||
#include "scene/3d/skeleton.h"
|
||||
#include "scene/main/misc.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "scene/resources/animation.h"
|
||||
#include "scene/3d/spatial.h"
|
||||
#include "scene/3d/skeleton.h"
|
||||
#include "scene/main/misc.h"
|
||||
#include "animation_player.h"
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* transitioner.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "transitioner.h"
|
||||
/*
|
||||
Transitioner::Transitioner()
|
||||
{
|
||||
}
|
||||
*/
|
@ -1,68 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* transitioner.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TRANSITIONER_H
|
||||
#define TRANSITIONER_H
|
||||
|
||||
/*
|
||||
class Transitioner : public Node {
|
||||
OBJ_TYPE(Transitioner, Node);
|
||||
public:
|
||||
enum Interpolation {
|
||||
INTERPOLATION_NEAREST,
|
||||
INTERPOLATION_LINEAR,
|
||||
INTERPOLATION_CUBIC
|
||||
};
|
||||
|
||||
enum TransitionType {
|
||||
TYPE_PROPERTY,
|
||||
TYPE_METHOD,
|
||||
TYPE_TRANSITION
|
||||
|
||||
};
|
||||
|
||||
|
||||
void create_transition(const String& p_transition, TransitionType p_type);
|
||||
void transition_set_target(const NodePath& p_node,const String& p_target);
|
||||
TransitionType transition_get_type() const;
|
||||
void transition_add_key(const String& p_transition,float p_time, const Variant& p_key);
|
||||
int transition_get_key_count(const String& p_transition) const;
|
||||
Variant transition_get_key_time(const String& p_transition.int p_key_index) const
|
||||
Variant transition_get_key(const String& p_transition,int p_key_index) const;
|
||||
|
||||
void transition_remove_key(const String& p_transition, int p_key_index);
|
||||
void transition_clear_keys(const String& p_transition);
|
||||
void remove_transition(const String& p_transition);
|
||||
|
||||
void transition_
|
||||
|
||||
|
||||
Transitioner();
|
||||
};
|
||||
*/
|
||||
#endif // TRANSITIONER_H
|
@ -1,40 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* custom_button.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "custom_button.h"
|
||||
|
||||
CustomButton::CustomButton()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CustomButton::~CustomButton()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* custom_button.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef CUSTOM_BUTTON_H
|
||||
#define CUSTOM_BUTTON_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
class CustomButton{
|
||||
public:
|
||||
CustomButton();
|
||||
|
||||
~CustomButton();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* misc.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "misc.h"
|
||||
|
||||
Misc::Misc()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Misc::~Misc()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* misc.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#include "scene/main/node.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
class Misc : public Node {
|
||||
|
||||
OBJ_TYPE( Misc, Node );
|
||||
public:
|
||||
Misc();
|
||||
~Misc();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -33,7 +33,6 @@
|
||||
#include "os/main_loop.h"
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/main/scene_singleton.h"
|
||||
#include "os/thread_safe.h"
|
||||
#include "self_list.h"
|
||||
/**
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* scene_singleton.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "scene_singleton.h"
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* scene_singleton.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef SCENE_SINGLETON_H
|
||||
#define SCENE_SINGLETON_H
|
||||
|
||||
|
||||
#include "reference.h"
|
||||
|
||||
|
||||
#endif // SCENE_SINGLETON_H
|
@ -172,7 +172,6 @@
|
||||
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/volume.h"
|
||||
|
||||
#include "scene/resources/sample_library.h"
|
||||
#include "scene/resources/audio_stream.h"
|
||||
@ -476,31 +475,10 @@ void register_scene_types() {
|
||||
AcceptDialog::set_swap_ok_cancel( GLOBAL_DEF("display/swap_ok_cancel",bool(OS::get_singleton()->get_swap_ok_cancel())) );
|
||||
|
||||
ObjectTypeDB::register_type<SamplePlayer>();
|
||||
|
||||
|
||||
// ObjectTypeDB::register_type<StaticBody>();
|
||||
// ObjectTypeDB::register_type<RigidBody>();
|
||||
// ObjectTypeDB::register_type<CharacterBody>();
|
||||
// ObjectTypeDB::register_type<BodyVolumeSphere>();
|
||||
//ObjectTypeDB::register_type<BodyVolumeBox>();
|
||||
//ObjectTypeDB::register_type<BodyVolumeCylinder>();
|
||||
//ObjectTypeDB::register_type<BodyVolumeCapsule>();
|
||||
//ObjectTypeDB::register_type<PhysicsJointPin>();
|
||||
|
||||
|
||||
|
||||
|
||||
ObjectTypeDB::register_type<StreamPlayer>();
|
||||
ObjectTypeDB::register_type<EventPlayer>();
|
||||
|
||||
|
||||
/* disable types by default, only editors should enable them */
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeSphere",false);
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeBox",false);
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeCapsule",false);
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeCylinder",false);
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeConvexPolygon",false);
|
||||
|
||||
ObjectTypeDB::register_type<CanvasItemMaterial>();
|
||||
ObjectTypeDB::register_virtual_type<CanvasItem>();
|
||||
ObjectTypeDB::register_type<Node2D>();
|
||||
@ -621,11 +599,11 @@ void register_scene_types() {
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
//ObjectTypeDB::register_type<Volume>();
|
||||
ObjectTypeDB::register_type<Sample>();
|
||||
ObjectTypeDB::register_type<SampleLibrary>();
|
||||
ObjectTypeDB::register_virtual_type<AudioStream>();
|
||||
ObjectTypeDB::register_virtual_type<AudioStreamPlayback>();
|
||||
//TODO: Adapt to the new AudioStream API or drop (GH-3307)
|
||||
// ObjectTypeDB::register_type<AudioStreamGibberish>();
|
||||
ObjectTypeDB::register_virtual_type<VideoStream>();
|
||||
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include "gibberish_stream.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
//TODO: This class needs to be adapted to the new AudioStream API,
|
||||
// or dropped if nobody cares about fixing it :) (GH-3307)
|
||||
|
||||
#if 0
|
||||
|
||||
int AudioStreamGibberish::get_channel_count() const {
|
||||
|
@ -29,6 +29,9 @@
|
||||
#ifndef GIBBERISH_STREAM_H
|
||||
#define GIBBERISH_STREAM_H
|
||||
|
||||
//TODO: This class needs to be adapted to the new AudioStream API,
|
||||
// or dropped if nobody cares about fixing it :) (GH-3307)
|
||||
|
||||
#if 0
|
||||
#include "scene/resources/audio_stream.h"
|
||||
#include "scene/resources/sample_library.h"
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* height_map_shape.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "height_map_shape.h"
|
||||
|
||||
HeightMapShape::HeightMapShape()
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* height_map_shape.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef HEIGHT_MAP_SHAPE_H
|
||||
#define HEIGHT_MAP_SHAPE_H
|
||||
|
||||
class HeightMapShape
|
||||
{
|
||||
public:
|
||||
HeightMapShape();
|
||||
};
|
||||
|
||||
#endif // HEIGHT_MAP_SHAPE_H
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* rich_text.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "rich_text.h"
|
||||
|
||||
RichText::RichText()
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* rich_text.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef RICH_TEXT_H
|
||||
#define RICH_TEXT_H
|
||||
|
||||
class RichText
|
||||
{
|
||||
public:
|
||||
RichText();
|
||||
};
|
||||
|
||||
#endif // RICH_TEXT_H
|
@ -1,211 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* volume.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "volume.h"
|
||||
|
||||
#if 0
|
||||
void Volume::_set(const String& p_name, const Variant& p_value) {
|
||||
|
||||
|
||||
if (p_name.begins_with("shapes/")) {
|
||||
|
||||
int idx=p_name.get_slice("/",1).to_int()-1;
|
||||
ERR_FAIL_COND( idx != get_shape_count() );
|
||||
|
||||
Dictionary shape = p_value;
|
||||
ERR_FAIL_COND( !shape.has("type") || !shape.has("data"));
|
||||
String type = shape["type"];
|
||||
Variant data=shape["data"];
|
||||
Transform transform;
|
||||
if (shape.has("transform"))
|
||||
transform=shape["transform"];
|
||||
|
||||
if (type=="plane")
|
||||
add_shape(SHAPE_PLANE,data,transform);
|
||||
else if (type=="sphere")
|
||||
add_shape(SHAPE_SPHERE,data,transform);
|
||||
else if (type=="box")
|
||||
add_shape(SHAPE_BOX,data,transform);
|
||||
else if (type=="cylinder")
|
||||
add_shape(SHAPE_CYLINDER,data,transform);
|
||||
else if (type=="capsule")
|
||||
add_shape(SHAPE_CAPSULE,data,transform);
|
||||
else if (type=="convex_polygon")
|
||||
add_shape(SHAPE_CONVEX_POLYGON,data,transform);
|
||||
else if (type=="concave_polygon")
|
||||
add_shape(SHAPE_CONCAVE_POLYGON,data,transform);
|
||||
else {
|
||||
ERR_FAIL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Variant Volume::_get(const String& p_name) const {
|
||||
|
||||
if (p_name.begins_with("shapes/")) {
|
||||
|
||||
int idx=p_name.get_slice("/",1).to_int()-1;
|
||||
ERR_FAIL_INDEX_V( idx, get_shape_count(), Variant() );
|
||||
|
||||
Dictionary shape;
|
||||
|
||||
switch( get_shape_type(idx) ) {
|
||||
|
||||
case SHAPE_PLANE: shape["type"]="plane"; break;
|
||||
case SHAPE_SPHERE: shape["type"]="sphere"; break;
|
||||
case SHAPE_BOX: shape["type"]="box"; break;
|
||||
case SHAPE_CYLINDER: shape["type"]="cylinder"; break;
|
||||
case SHAPE_CAPSULE: shape["type"]="capsule"; break;
|
||||
case SHAPE_CONVEX_POLYGON: shape["type"]="convex_polygon"; break;
|
||||
case SHAPE_CONCAVE_POLYGON: shape["type"]="concave_polygon"; break;
|
||||
|
||||
}
|
||||
|
||||
shape["transform"]=get_shape_transform(idx);
|
||||
shape["data"]=get_shape(idx);
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
return Variant();
|
||||
}
|
||||
|
||||
void Volume::_get_property_list( List<PropertyInfo> *p_list) const {
|
||||
|
||||
int count=get_shape_count();
|
||||
for(int i=0;i<count;i++) {
|
||||
|
||||
p_list->push_back( PropertyInfo( Variant::DICTIONARY, "shapes/"+itos(i+1)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Volume::add_shape(ShapeType p_shape_type, const Variant& p_data, const Transform& p_transform) {
|
||||
|
||||
PhysicsServer::get_singleton()->volume_add_shape(volume,(PhysicsServer::ShapeType)p_shape_type,p_data,p_transform);
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
|
||||
void Volume::add_plane_shape(const Plane& p_plane,const Transform& p_transform) {
|
||||
|
||||
add_shape(SHAPE_PLANE, p_plane, p_transform );
|
||||
}
|
||||
|
||||
void Volume::add_sphere_shape(float p_radius,const Transform& p_transform) {
|
||||
|
||||
add_shape(SHAPE_SPHERE, p_radius, p_transform );
|
||||
}
|
||||
|
||||
void Volume::add_box_shape(const Vector3& p_half_extents,const Transform& p_transform) {
|
||||
|
||||
add_shape(SHAPE_BOX, p_half_extents, p_transform );
|
||||
}
|
||||
void Volume::add_cylinder_shape(float p_radius, float p_height,const Transform& p_transform) {
|
||||
|
||||
Dictionary d;
|
||||
d["radius"]=p_radius;
|
||||
d["height"]=p_height;
|
||||
|
||||
add_shape(SHAPE_CYLINDER,d,p_transform);
|
||||
}
|
||||
void Volume::add_capsule_shape(float p_radius, float p_height,const Transform& p_transform) {
|
||||
|
||||
Dictionary d;
|
||||
d["radius"]=p_radius;
|
||||
d["height"]=p_height;
|
||||
|
||||
add_shape(SHAPE_CAPSULE,d,p_transform);
|
||||
}
|
||||
|
||||
|
||||
int Volume::get_shape_count() const {
|
||||
|
||||
return PhysicsServer::get_singleton()->volume_get_shape_count(volume);
|
||||
}
|
||||
|
||||
Volume::ShapeType Volume::get_shape_type(int p_shape) const {
|
||||
|
||||
return (ShapeType)PhysicsServer::get_singleton()->volume_get_shape_type(volume,p_shape);
|
||||
}
|
||||
|
||||
Transform Volume::get_shape_transform(int p_shape) const {
|
||||
|
||||
return PhysicsServer::get_singleton()->volume_get_shape_transform(volume,p_shape);
|
||||
}
|
||||
|
||||
Variant Volume::get_shape(int p_shape) const {
|
||||
|
||||
return PhysicsServer::get_singleton()->volume_get_shape(volume,p_shape);
|
||||
}
|
||||
|
||||
void Volume::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_shape","type","data","transform"),&Volume::add_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("add_plane_shape","plane","transform"),&Volume::add_plane_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("add_sphere_shape"),&Volume::add_sphere_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("add_box_shape","radius","transform"),&Volume::add_box_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("add_cylinder_shape","radius","height","transform"),&Volume::add_cylinder_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("add_capsule_shape","radius","height","transform"),&Volume::add_capsule_shape,DEFVAL( Transform() ));
|
||||
ObjectTypeDB::bind_method(_MD("get_shape_count"),&Volume::get_shape_count);
|
||||
ObjectTypeDB::bind_method(_MD("get_shape_type","shape_idx"),&Volume::get_shape_type);
|
||||
ObjectTypeDB::bind_method(_MD("get_shape_transform","shape_idx"),&Volume::get_shape_transform);
|
||||
ObjectTypeDB::bind_method(_MD("get_shape","shape_idx"),&Volume::get_shape);
|
||||
|
||||
BIND_CONSTANT( SHAPE_PLANE );
|
||||
BIND_CONSTANT( SHAPE_SPHERE );
|
||||
BIND_CONSTANT( SHAPE_BOX );
|
||||
BIND_CONSTANT( SHAPE_CYLINDER );
|
||||
BIND_CONSTANT( SHAPE_CAPSULE );
|
||||
BIND_CONSTANT( SHAPE_CONVEX_POLYGON );
|
||||
BIND_CONSTANT( SHAPE_CONCAVE_POLYGON );
|
||||
|
||||
}
|
||||
|
||||
RID Volume::get_rid() {
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
Volume::Volume() {
|
||||
|
||||
volume= PhysicsServer::get_singleton()->volume_create();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Volume::~Volume() {
|
||||
|
||||
PhysicsServer::get_singleton()->free(volume);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,86 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* volume.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef VOLUME_H
|
||||
#define VOLUME_H
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#if 0
|
||||
#include "servers/physics_server.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
class Volume : public Resource {
|
||||
|
||||
OBJ_TYPE( Volume, Resource );
|
||||
RID volume;
|
||||
|
||||
protected:
|
||||
|
||||
bool _set(const StringName& p_name, const Variant& p_value);
|
||||
bool _get(const StringName& p_name,Variant &r_ret) const;
|
||||
void _get_property_list( List<PropertyInfo> *p_list) const;
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
enum ShapeType {
|
||||
SHAPE_PLANE = PhysicsServer::SHAPE_PLANE, ///< plane:"plane"
|
||||
SHAPE_SPHERE = PhysicsServer::SHAPE_SPHERE, ///< float:"radius"
|
||||
SHAPE_BOX = PhysicsServer::SHAPE_BOX, ///< vec3:"extents"
|
||||
SHAPE_CYLINDER = PhysicsServer::SHAPE_CYLINDER, ///< dict(float:"radius", float:"height"):cylinder
|
||||
SHAPE_CAPSULE = PhysicsServer::SHAPE_CAPSULE, ///< dict(float:"radius", float:"height"):capsule
|
||||
SHAPE_CONVEX_POLYGON = PhysicsServer::SHAPE_CONVEX_POLYGON, ///< array of planes:"planes"
|
||||
SHAPE_CONCAVE_POLYGON = PhysicsServer::SHAPE_CONCAVE_POLYGON, ///< vector3 array:"triangles"
|
||||
};
|
||||
|
||||
void add_shape(ShapeType p_shape_type, const Variant& p_data, const Transform& p_transform=Transform ());
|
||||
|
||||
void add_plane_shape(const Plane& p_plane,const Transform& p_transform);
|
||||
void add_sphere_shape(float p_radius,const Transform& p_transform);
|
||||
void add_box_shape(const Vector3& p_half_extents,const Transform& p_transform);
|
||||
void add_cylinder_shape(float p_radius, float p_height,const Transform& p_transform);
|
||||
void add_capsule_shape(float p_radius, float p_height,const Transform& p_transform);
|
||||
|
||||
int get_shape_count() const;
|
||||
ShapeType get_shape_type(int p_shape) const;
|
||||
Transform get_shape_transform(int p_shape) const;
|
||||
Variant get_shape(int p_shape) const;
|
||||
|
||||
virtual RID get_rid();
|
||||
|
||||
Volume();
|
||||
~Volume();
|
||||
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST( Volume::ShapeType );
|
||||
|
||||
#endif
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* reverb_buffers_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "reverb_buffers_sw.h"
|
||||
|
||||
ReverbBuffersSW::ReverbBuffersSW()
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* reverb_buffers_sw.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef REVERB_BUFFERS_SW_H
|
||||
#define REVERB_BUFFERS_SW_H
|
||||
|
||||
class ReverbBuffersSW
|
||||
{
|
||||
public:
|
||||
ReverbBuffersSW();
|
||||
};
|
||||
|
||||
#endif // REVERB_BUFFERS_SW_H
|
@ -1,34 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* voice_rb_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "voice_rb_sw.h"
|
||||
/*
|
||||
VoiceRBSW::VoiceRBSW()
|
||||
{
|
||||
}
|
||||
*/
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* constraint_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "constraint_sw.h"
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* jacobian_entry_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
Adapted to Godot from the Bullet library.
|
||||
See corresponding header file for licensing info.
|
||||
*/
|
||||
|
||||
#include "jacobian_entry_sw.h"
|
@ -1,450 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* joints_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "joints_sw.h"
|
||||
#include "space_sw.h"
|
||||
|
||||
#if 0
|
||||
|
||||
//based on chipmunk joint constraints
|
||||
|
||||
/* Copyright (c) 2007 Scott Lembcke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
static inline real_t k_scalar(Body2DSW *a,Body2DSW *b,const Vector2& rA, const Vector2& rB, const Vector2& n) {
|
||||
|
||||
|
||||
real_t value=0;
|
||||
|
||||
|
||||
{
|
||||
value+=a->get_inv_mass();
|
||||
real_t rcn = rA.cross(n);
|
||||
value+=a->get_inv_inertia() * rcn * rcn;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
|
||||
value+=b->get_inv_mass();
|
||||
real_t rcn = rB.cross(n);
|
||||
value+=b->get_inv_inertia() * rcn * rcn;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool PinJoint2DSW::setup(float p_step) {
|
||||
|
||||
Space2DSW *space = A->get_space();
|
||||
ERR_FAIL_COND_V(!space,false;)
|
||||
rA = A->get_transform().xform(anchor_A);
|
||||
rB = B?B->get_transform().xform(anchor_B):anchor_B;
|
||||
|
||||
Vector2 delta = rB - rA;
|
||||
|
||||
rA-= A->get_transform().get_origin();
|
||||
if (B)
|
||||
rB-=B->get_transform().get_origin();
|
||||
|
||||
|
||||
real_t jdist = delta.length();
|
||||
correct=false;
|
||||
if (jdist==0)
|
||||
return false; // do not correct
|
||||
|
||||
correct=true;
|
||||
|
||||
n = delta / jdist;
|
||||
|
||||
// calculate mass normal
|
||||
mass_normal = 1.0f/k_scalar(A, B, rA, rB, n);
|
||||
|
||||
// calculate bias velocity
|
||||
//real_t maxBias = joint->constraint.maxBias;
|
||||
bias = -(get_bias()==0?space->get_constraint_bias():get_bias())*(1.0/p_step)*(jdist-dist);
|
||||
bias = CLAMP(bias, -get_max_bias(), +get_max_bias());
|
||||
|
||||
// compute max impulse
|
||||
jn_max = get_max_force() * p_step;
|
||||
|
||||
// apply accumulated impulse
|
||||
Vector2 j = n * jn_acc;
|
||||
A->apply_impulse(rA,-j);
|
||||
if (B)
|
||||
B->apply_impulse(rB,j);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static inline Vector2
|
||||
relative_velocity(Body2DSW *a, Body2DSW *b, Vector2 rA, Vector2 rB){
|
||||
Vector2 sum = a->get_linear_velocity() -rA.tangent() * a->get_angular_velocity();
|
||||
if (b)
|
||||
return (b->get_linear_velocity() -rB.tangent() * b->get_angular_velocity()) - sum;
|
||||
else
|
||||
return -sum;
|
||||
}
|
||||
|
||||
static inline real_t
|
||||
normal_relative_velocity(Body2DSW *a, Body2DSW *b, Vector2 rA, Vector2 rB, Vector2 n){
|
||||
return relative_velocity(a, b, rA, rB).dot(n);
|
||||
}
|
||||
|
||||
|
||||
void PinJoint2DSW::solve(float p_step){
|
||||
|
||||
if (!correct)
|
||||
return;
|
||||
|
||||
Vector2 ln = n;
|
||||
|
||||
// compute relative velocity
|
||||
real_t vrn = normal_relative_velocity(A,B, rA, rB, ln);
|
||||
|
||||
// compute normal impulse
|
||||
real_t jn = (bias - vrn)*mass_normal;
|
||||
real_t jnOld = jn_acc;
|
||||
jn_acc = CLAMP(jnOld + jn,-jn_max,jn_max); //cpfclamp(jnOld + jn, -joint->jnMax, joint->jnMax);
|
||||
jn = jn_acc - jnOld;
|
||||
|
||||
Vector2 j = jn*ln;
|
||||
|
||||
A->apply_impulse(rA,-j);
|
||||
if (B)
|
||||
B->apply_impulse(rB,j);
|
||||
|
||||
}
|
||||
|
||||
|
||||
PinJoint2DSW::PinJoint2DSW(const Vector2& p_pos,Body2DSW* p_body_a,Body2DSW* p_body_b) : Joint2DSW(_arr,p_body_b?2:1) {
|
||||
|
||||
A=p_body_a;
|
||||
B=p_body_b;
|
||||
anchor_A = p_body_a->get_inv_transform().xform(p_pos);
|
||||
anchor_B = p_body_b?p_body_b->get_inv_transform().xform(p_pos):p_pos;
|
||||
|
||||
jn_acc=0;
|
||||
dist=0;
|
||||
|
||||
p_body_a->add_constraint(this,0);
|
||||
if (p_body_b)
|
||||
p_body_b->add_constraint(this,1);
|
||||
|
||||
}
|
||||
|
||||
PinJoint2DSW::~PinJoint2DSW() {
|
||||
|
||||
if (A)
|
||||
A->remove_constraint(this);
|
||||
if (B)
|
||||
B->remove_constraint(this);
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
static inline void
|
||||
k_tensor(Body2DSW *a, Body2DSW *b, Vector2 r1, Vector2 r2, Vector2 *k1, Vector2 *k2)
|
||||
{
|
||||
// calculate mass matrix
|
||||
// If I wasn't lazy and wrote a proper matrix class, this wouldn't be so gross...
|
||||
real_t k11, k12, k21, k22;
|
||||
real_t m_sum = a->get_inv_mass() + b->get_inv_mass();
|
||||
|
||||
// start with I*m_sum
|
||||
k11 = m_sum; k12 = 0.0f;
|
||||
k21 = 0.0f; k22 = m_sum;
|
||||
|
||||
// add the influence from r1
|
||||
real_t a_i_inv = a->get_inv_inertia();
|
||||
real_t r1xsq = r1.x * r1.x * a_i_inv;
|
||||
real_t r1ysq = r1.y * r1.y * a_i_inv;
|
||||
real_t r1nxy = -r1.x * r1.y * a_i_inv;
|
||||
k11 += r1ysq; k12 += r1nxy;
|
||||
k21 += r1nxy; k22 += r1xsq;
|
||||
|
||||
// add the influnce from r2
|
||||
real_t b_i_inv = b->get_inv_inertia();
|
||||
real_t r2xsq = r2.x * r2.x * b_i_inv;
|
||||
real_t r2ysq = r2.y * r2.y * b_i_inv;
|
||||
real_t r2nxy = -r2.x * r2.y * b_i_inv;
|
||||
k11 += r2ysq; k12 += r2nxy;
|
||||
k21 += r2nxy; k22 += r2xsq;
|
||||
|
||||
// invert
|
||||
real_t determinant = k11*k22 - k12*k21;
|
||||
ERR_FAIL_COND(determinant== 0.0);
|
||||
|
||||
real_t det_inv = 1.0f/determinant;
|
||||
*k1 = Vector2( k22*det_inv, -k12*det_inv);
|
||||
*k2 = Vector2(-k21*det_inv, k11*det_inv);
|
||||
}
|
||||
|
||||
static _FORCE_INLINE_ Vector2
|
||||
mult_k(const Vector2& vr, const Vector2 &k1, const Vector2 &k2)
|
||||
{
|
||||
return Vector2(vr.dot(k1), vr.dot(k2));
|
||||
}
|
||||
|
||||
bool GrooveJoint2DSW::setup(float p_step) {
|
||||
|
||||
|
||||
// calculate endpoints in worldspace
|
||||
Vector2 ta = A->get_transform().xform(A_groove_1);
|
||||
Vector2 tb = A->get_transform().xform(A_groove_2);
|
||||
Space2DSW *space=A->get_space();
|
||||
|
||||
// calculate axis
|
||||
Vector2 n = -(tb - ta).tangent().normalized();
|
||||
real_t d = ta.dot(n);
|
||||
|
||||
xf_normal = n;
|
||||
rB = B->get_transform().basis_xform(B_anchor);
|
||||
|
||||
// calculate tangential distance along the axis of rB
|
||||
real_t td = (B->get_transform().get_origin() + rB).cross(n);
|
||||
// calculate clamping factor and rB
|
||||
if(td <= ta.cross(n)){
|
||||
clamp = 1.0f;
|
||||
rA = ta - A->get_transform().get_origin();
|
||||
} else if(td >= tb.cross(n)){
|
||||
clamp = -1.0f;
|
||||
rA = tb - A->get_transform().get_origin();
|
||||
} else {
|
||||
clamp = 0.0f;
|
||||
//joint->r1 = cpvsub(cpvadd(cpvmult(cpvperp(n), -td), cpvmult(n, d)), a->p);
|
||||
rA = ((-n.tangent() * -td) + n*d) - A->get_transform().get_origin();
|
||||
}
|
||||
|
||||
// Calculate mass tensor
|
||||
k_tensor(A, B, rA, rB, &k1, &k2);
|
||||
|
||||
// compute max impulse
|
||||
jn_max = get_max_force() * p_step;
|
||||
|
||||
// calculate bias velocity
|
||||
// cpVect delta = cpvsub(cpvadd(b->p, joint->r2), cpvadd(a->p, joint->r1));
|
||||
// joint->bias = cpvclamp(cpvmult(delta, -joint->constraint.biasCoef*dt_inv), joint->constraint.maxBias);
|
||||
|
||||
|
||||
Vector2 delta = (B->get_transform().get_origin() +rB) - (A->get_transform().get_origin() + rA);
|
||||
gbias=(delta*-(get_bias()==0?space->get_constraint_bias():get_bias())*(1.0/p_step)).clamped(get_max_bias());
|
||||
|
||||
// apply accumulated impulse
|
||||
A->apply_impulse(rA,-jn_acc);
|
||||
B->apply_impulse(rB,jn_acc);
|
||||
|
||||
correct=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrooveJoint2DSW::solve(float p_step){
|
||||
|
||||
|
||||
// compute impulse
|
||||
Vector2 vr = relative_velocity(A, B, rA,rB);
|
||||
|
||||
Vector2 j = mult_k(gbias-vr, k1, k2);
|
||||
Vector2 jOld = jn_acc;
|
||||
j+=jOld;
|
||||
|
||||
jn_acc = (((clamp * j.cross(xf_normal)) > 0) ? j : xf_normal.project(j)).clamped(jn_max);
|
||||
|
||||
j = jn_acc - jOld;
|
||||
|
||||
A->apply_impulse(rA,-j);
|
||||
B->apply_impulse(rB,j);
|
||||
}
|
||||
|
||||
|
||||
GrooveJoint2DSW::GrooveJoint2DSW(const Vector2& p_a_groove1,const Vector2& p_a_groove2, const Vector2& p_b_anchor, Body2DSW* p_body_a,Body2DSW* p_body_b) : Joint2DSW(_arr,2) {
|
||||
|
||||
A=p_body_a;
|
||||
B=p_body_b;
|
||||
|
||||
A_groove_1 = A->get_inv_transform().xform(p_a_groove1);
|
||||
A_groove_2 = A->get_inv_transform().xform(p_a_groove2);
|
||||
B_anchor=B->get_inv_transform().xform(p_b_anchor);
|
||||
A_groove_normal = -(A_groove_2 - A_groove_1).normalized().tangent();
|
||||
|
||||
A->add_constraint(this,0);
|
||||
B->add_constraint(this,1);
|
||||
|
||||
}
|
||||
|
||||
GrooveJoint2DSW::~GrooveJoint2DSW() {
|
||||
|
||||
A->remove_constraint(this);
|
||||
B->remove_constraint(this);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
bool DampedSpringJoint2DSW::setup(float p_step) {
|
||||
|
||||
rA = A->get_transform().basis_xform(anchor_A);
|
||||
rB = B->get_transform().basis_xform(anchor_B);
|
||||
|
||||
Vector2 delta = (B->get_transform().get_origin() + rB) - (A->get_transform().get_origin() + rA) ;
|
||||
real_t dist = delta.length();
|
||||
|
||||
if (dist)
|
||||
n=delta/dist;
|
||||
else
|
||||
n=Vector2();
|
||||
|
||||
real_t k = k_scalar(A, B, rA, rB, n);
|
||||
n_mass = 1.0f/k;
|
||||
|
||||
target_vrn = 0.0f;
|
||||
v_coef = 1.0f - Math::exp(-damping*(p_step)*k);
|
||||
|
||||
// apply spring force
|
||||
real_t f_spring = (rest_length - dist) * stiffness;
|
||||
Vector2 j = n * f_spring*(p_step);
|
||||
|
||||
A->apply_impulse(rA,-j);
|
||||
B->apply_impulse(rB,j);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DampedSpringJoint2DSW::solve(float p_step) {
|
||||
|
||||
// compute relative velocity
|
||||
real_t vrn = normal_relative_velocity(A, B, rA, rB, n) - target_vrn;
|
||||
|
||||
// compute velocity loss from drag
|
||||
// not 100% certain this is derived correctly, though it makes sense
|
||||
real_t v_damp = -vrn*v_coef;
|
||||
target_vrn = vrn + v_damp;
|
||||
Vector2 j=n*v_damp*n_mass;
|
||||
|
||||
A->apply_impulse(rA,-j);
|
||||
B->apply_impulse(rB,j);
|
||||
|
||||
}
|
||||
|
||||
void DampedSpringJoint2DSW::set_param(Physics2DServer::DampedStringParam p_param, real_t p_value) {
|
||||
|
||||
switch(p_param) {
|
||||
|
||||
case Physics2DServer::DAMPED_STRING_REST_LENGTH: {
|
||||
|
||||
rest_length=p_value;
|
||||
} break;
|
||||
case Physics2DServer::DAMPED_STRING_DAMPING: {
|
||||
|
||||
damping=p_value;
|
||||
} break;
|
||||
case Physics2DServer::DAMPED_STRING_STIFFNESS: {
|
||||
|
||||
stiffness=p_value;
|
||||
} break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
real_t DampedSpringJoint2DSW::get_param(Physics2DServer::DampedStringParam p_param) const{
|
||||
|
||||
switch(p_param) {
|
||||
|
||||
case Physics2DServer::DAMPED_STRING_REST_LENGTH: {
|
||||
|
||||
return rest_length;
|
||||
} break;
|
||||
case Physics2DServer::DAMPED_STRING_DAMPING: {
|
||||
|
||||
return damping;
|
||||
} break;
|
||||
case Physics2DServer::DAMPED_STRING_STIFFNESS: {
|
||||
|
||||
return stiffness;
|
||||
} break;
|
||||
}
|
||||
|
||||
ERR_FAIL_V(0);
|
||||
}
|
||||
|
||||
|
||||
DampedSpringJoint2DSW::DampedSpringJoint2DSW(const Vector2& p_anchor_a,const Vector2& p_anchor_b, Body2DSW* p_body_a,Body2DSW* p_body_b) : Joint2DSW(_arr,2) {
|
||||
|
||||
|
||||
A=p_body_a;
|
||||
B=p_body_b;
|
||||
anchor_A = A->get_inv_transform().xform(p_anchor_a);
|
||||
anchor_B = B->get_inv_transform().xform(p_anchor_b);
|
||||
|
||||
rest_length=p_anchor_a.distance_to(p_anchor_b);
|
||||
stiffness=20;
|
||||
damping=1.5;
|
||||
|
||||
|
||||
A->add_constraint(this,0);
|
||||
B->add_constraint(this,1);
|
||||
|
||||
}
|
||||
|
||||
DampedSpringJoint2DSW::~DampedSpringJoint2DSW() {
|
||||
|
||||
A->remove_constraint(this);
|
||||
B->remove_constraint(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -33,7 +33,6 @@
|
||||
#include "body_sw.h"
|
||||
|
||||
|
||||
|
||||
class JointSW : public ConstraintSW {
|
||||
|
||||
|
||||
@ -45,122 +44,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
class PinJointSW : public JointSW {
|
||||
|
||||
union {
|
||||
struct {
|
||||
BodySW *A;
|
||||
BodySW *B;
|
||||
};
|
||||
|
||||
BodySW *_arr[2];
|
||||
};
|
||||
|
||||
Vector2 anchor_A;
|
||||
Vector2 anchor_B;
|
||||
real_t dist;
|
||||
real_t jn_acc;
|
||||
real_t jn_max;
|
||||
real_t max_distance;
|
||||
real_t mass_normal;
|
||||
real_t bias;
|
||||
|
||||
Vector2 rA,rB;
|
||||
Vector2 n; //normal
|
||||
bool correct;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_PIN; }
|
||||
|
||||
virtual bool setup(float p_step);
|
||||
virtual void solve(float p_step);
|
||||
|
||||
|
||||
PinJointSW(const Vector2& p_pos,BodySW* p_body_a,BodySW* p_body_b=NULL);
|
||||
~PinJointSW();
|
||||
};
|
||||
|
||||
|
||||
class GrooveJointSW : public JointSW {
|
||||
|
||||
union {
|
||||
struct {
|
||||
BodySW *A;
|
||||
BodySW *B;
|
||||
};
|
||||
|
||||
BodySW *_arr[2];
|
||||
};
|
||||
|
||||
Vector2 A_groove_1;
|
||||
Vector2 A_groove_2;
|
||||
Vector2 A_groove_normal;
|
||||
Vector2 B_anchor;
|
||||
Vector2 jn_acc;
|
||||
Vector2 gbias;
|
||||
real_t jn_max;
|
||||
real_t clamp;
|
||||
Vector2 xf_normal;
|
||||
Vector2 rA,rB;
|
||||
Vector2 k1,k2;
|
||||
|
||||
|
||||
bool correct;
|
||||
|
||||
public:
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_GROOVE; }
|
||||
|
||||
virtual bool setup(float p_step);
|
||||
virtual void solve(float p_step);
|
||||
|
||||
|
||||
GrooveJointSW(const Vector2& p_a_groove1,const Vector2& p_a_groove2, const Vector2& p_b_anchor, BodySW* p_body_a,BodySW* p_body_b);
|
||||
~GrooveJointSW();
|
||||
};
|
||||
|
||||
|
||||
class DampedSpringJointSW : public JointSW {
|
||||
|
||||
union {
|
||||
struct {
|
||||
BodySW *A;
|
||||
BodySW *B;
|
||||
};
|
||||
|
||||
BodySW *_arr[2];
|
||||
};
|
||||
|
||||
|
||||
Vector2 anchor_A;
|
||||
Vector2 anchor_B;
|
||||
|
||||
real_t rest_length;
|
||||
real_t damping;
|
||||
real_t stiffness;
|
||||
|
||||
Vector2 rA,rB;
|
||||
Vector2 n;
|
||||
real_t n_mass;
|
||||
real_t target_vrn;
|
||||
real_t v_coef;
|
||||
|
||||
public:
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_DAMPED_SPRING; }
|
||||
|
||||
virtual bool setup(float p_step);
|
||||
virtual void solve(float p_step);
|
||||
|
||||
void set_param(PhysicsServer::DampedStringParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::DampedStringParam p_param) const;
|
||||
|
||||
DampedSpringJointSW(const Vector2& p_anchor_a,const Vector2& p_anchor_b, BodySW* p_body_a,BodySW* p_body_b);
|
||||
~DampedSpringJointSW();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // JOINTS__SW_H
|
||||
#endif // JOINTS_SW_H
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* constraint_2d_sw.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "constraint_2d_sw.h"
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* shader_compiler.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "shader_compiler.h"
|
||||
|
@ -1,142 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* shader_compiler.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef SHADER_COMPILER_H
|
||||
#define SHADER_COMPILER_H
|
||||
|
||||
#include "map.h"
|
||||
#include "list.h"
|
||||
#include "vector.h"
|
||||
#if 0
|
||||
class ShaderSyntax {
|
||||
public:
|
||||
|
||||
|
||||
enum DataType {
|
||||
TYPE_BOOL,
|
||||
TYPE_FLOAT,
|
||||
TYPE_VEC3,
|
||||
TYPE_TRANSFORM,
|
||||
TYPE_TEXTURE
|
||||
};
|
||||
|
||||
enum Operator {
|
||||
OP_ASSIGN,
|
||||
OP_ADD,
|
||||
OP_SUB,
|
||||
OP_MUL,
|
||||
OP_DIV,
|
||||
OP_NEG,
|
||||
OP_CMP_EQ,
|
||||
OP_CMP_NEQ,
|
||||
OP_CMP_LEQ,
|
||||
OP_CMP_GEQ,
|
||||
OP_CMP_OR,
|
||||
OP_CMP_AND,
|
||||
OP_CALL
|
||||
};
|
||||
|
||||
struct Node {
|
||||
|
||||
enum Type {
|
||||
TYPE_PROGRAM,
|
||||
TYPE_FUNCTION,
|
||||
TYPE_BLOCK,
|
||||
TYPE_VARIABLE,
|
||||
TYPE_OPERATOR,
|
||||
TYPE_IF,
|
||||
};
|
||||
|
||||
Node * parent;
|
||||
Type type;
|
||||
|
||||
virtual ~Node() {}
|
||||
};
|
||||
|
||||
|
||||
struct OperatorNode : public Node {
|
||||
|
||||
Operator op;
|
||||
Vector<Node*> arguments;
|
||||
OperatorNode() { type=TYPE_OPERATOR; }
|
||||
};
|
||||
|
||||
struct VariableNode : public Node {
|
||||
|
||||
StringName variable;
|
||||
VariableNode() { type=TYPE_VARIABLE; }
|
||||
};
|
||||
|
||||
struct BlockNode : public Node {
|
||||
|
||||
Map<StringName,DataType> variables;
|
||||
List<Node*> subnodes;
|
||||
BlockNode() { type=TYPE_BLOCK; }
|
||||
};
|
||||
|
||||
struct ConditionalNode : public Node {
|
||||
|
||||
Node *test;
|
||||
Node *do_if;
|
||||
Node *do_else;
|
||||
ConditionalNode() { type=TYPE_CONDITIONAL; }
|
||||
};
|
||||
|
||||
|
||||
struct FunctionNode : public Node {
|
||||
|
||||
struct Argument {
|
||||
|
||||
StringName name;
|
||||
DataType type;
|
||||
};
|
||||
|
||||
Vector<Argument> arguments;
|
||||
Node *body;
|
||||
|
||||
FunctionNode() { type=TYPE_FUNCTION; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct ProgramNode : public Node {
|
||||
|
||||
Vector<FunctionNode*> functions;
|
||||
Node *body;
|
||||
|
||||
ProgramNode() { type=TYPE_PROGRAM; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
ShaderCompiler();
|
||||
};
|
||||
|
||||
#endif // SHADER_COMPILER_H
|
||||
#endif
|
@ -1,455 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* shader_graph.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "shader_graph.h"
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
struct _ConnectionKey {
|
||||
|
||||
int node;
|
||||
int slot;
|
||||
|
||||
_FORCE_INLINE_ _ConnectionKey(int p_node=0,int p_slot=0) { node=p_node; slot=p_slot; }
|
||||
|
||||
_FORCE_INLINE_ bool operator<(const _ConnectionKey& p_other) const {
|
||||
|
||||
if (node<p_other.node)
|
||||
return true;
|
||||
else if (node>p_other.node)
|
||||
return false;
|
||||
else
|
||||
return slot<p_other.slot;
|
||||
}
|
||||
};
|
||||
|
||||
Error ShaderGraph::generate(ShaderCodeGenerator * p_generator) const {
|
||||
|
||||
Map<int,Node>::Element *E = node_map.front();
|
||||
int i=0;
|
||||
while(E) {
|
||||
|
||||
E->get().order=i++;
|
||||
E->get().out_valid=false;
|
||||
E->get().in_valid=false;
|
||||
E=E->next();
|
||||
}
|
||||
|
||||
int worst_case=connections.size() * connections.size(); // worst bubble case
|
||||
int iterations=0;
|
||||
int swaps;
|
||||
|
||||
do {
|
||||
swaps=0;
|
||||
const List<Connection>::Element *E=connections.front();
|
||||
|
||||
while(E) {
|
||||
|
||||
const Connection &c = E->get();
|
||||
|
||||
const Node *src = &node_map[c.src_id];
|
||||
const Node *dst = &node_map[c.dst_id];
|
||||
|
||||
if (src->order > dst->order) {
|
||||
|
||||
SWAP(src->order, dst->order);
|
||||
swaps++;
|
||||
}
|
||||
|
||||
E=E->next();
|
||||
}
|
||||
|
||||
|
||||
iterations++;
|
||||
|
||||
} while (iterations<=worst_case && swaps>0);
|
||||
|
||||
ERR_FAIL_COND_V( swaps != 0 , ERR_CYCLIC_LINK );
|
||||
|
||||
//node array
|
||||
Vector<const Node*> nodes;
|
||||
nodes.resize(node_map.size());
|
||||
|
||||
E = node_map.front();
|
||||
while(E) {
|
||||
|
||||
ERR_FAIL_INDEX_V( E->get().order, nodes.size(), ERR_BUG);
|
||||
nodes[E->get().order]=&E->get();
|
||||
E=E->next();
|
||||
}
|
||||
|
||||
//connection set
|
||||
|
||||
Map<_ConnectionKey,int> in_connection_map;
|
||||
Map<_ConnectionKey,List<int> > out_connection_map;
|
||||
Map<_ConnectionKey,int> in_node_map;
|
||||
Map<_ConnectionKey,List<int> > out_node_map;
|
||||
|
||||
const List<Connection>::Element *CE=connections.front();
|
||||
i=0;
|
||||
while(CE) {
|
||||
const Connection &c = CE->get();
|
||||
|
||||
_ConnectionKey in_k;
|
||||
in_k.node=node_map[c.dst_id].order;
|
||||
in_k.slot=c.dst_slot;
|
||||
in_connection_map[in_k]=i;
|
||||
in_node_map[in_k]=node_map[c.src_id].order;
|
||||
|
||||
_ConnectionKey out_k;
|
||||
out_k.node=node_map[c.src_id].order;
|
||||
out_k.slot=c.src_slot;
|
||||
if (!out_connection_map.has(out_k))
|
||||
out_connection_map[out_k]=List<int>();
|
||||
out_connection_map[out_k].push_back(i);
|
||||
if(!out_node_map.has(out_k))
|
||||
out_node_map[out_k]=List<int>();
|
||||
out_node_map[out_k].push_back(node_map[c.dst_id].order);
|
||||
|
||||
i++;
|
||||
CE=CE->next();
|
||||
}
|
||||
|
||||
// validate nodes if they are connected to an output
|
||||
|
||||
for(int i=nodes.size()-1;i>=0;i--) {
|
||||
|
||||
if (VisualServer::shader_get_output_count(nodes[i]->type)==0) {
|
||||
// an actual graph output
|
||||
|
||||
_ConnectionKey in_k;
|
||||
in_k.node=nodes[i]->order;
|
||||
in_k.slot=0;
|
||||
|
||||
if (in_node_map.has(in_k)) {
|
||||
nodes[i]->out_valid=true;
|
||||
}
|
||||
} else {
|
||||
// regular node
|
||||
|
||||
bool valid=false;
|
||||
for(int j=0;j<VS::shader_get_output_count(nodes[i]->type);j++) {
|
||||
|
||||
_ConnectionKey key(nodes[i]->order,j);
|
||||
|
||||
if (out_node_map.has(key)) {
|
||||
for(List<int>::Element *CE=out_node_map[key].front();CE;CE=CE->next()) {
|
||||
|
||||
int to_node=CE->get();
|
||||
ERR_CONTINUE(to_node<0 || to_node >=nodes.size());
|
||||
if (nodes[to_node]->out_valid) {
|
||||
valid=true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (valid)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
nodes[i]->out_valid=valid;
|
||||
}
|
||||
}
|
||||
|
||||
// validate nodes if they are connected to an input
|
||||
|
||||
for(int i=0;i<nodes.size();i++) {
|
||||
|
||||
if (VisualServer::shader_get_input_count(nodes[i]->type)==0) {
|
||||
// an actual graph input
|
||||
|
||||
int out_count=VisualServer::shader_get_output_count(nodes[i]->type);
|
||||
|
||||
|
||||
for(int j=0;j<out_count;j++) {
|
||||
|
||||
_ConnectionKey out_k;
|
||||
out_k.node=nodes[i]->order;
|
||||
out_k.slot=j;
|
||||
if (out_node_map.has(out_k)) {
|
||||
nodes[i]->in_valid=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// regular node
|
||||
// this is very important.. for a node to be valid, all its inputs need to be valid
|
||||
bool valid=true;
|
||||
for(int j=0;j<VS::shader_get_input_count(nodes[i]->type);j++) {
|
||||
|
||||
|
||||
bool in_valid=false;
|
||||
_ConnectionKey key(nodes[i]->order,j);
|
||||
if (in_node_map.has(key)) {
|
||||
|
||||
int from_node=in_node_map[key];
|
||||
ERR_CONTINUE(from_node<0 || from_node>=nodes.size());
|
||||
if (nodes[from_node]->in_valid)
|
||||
in_valid=true;
|
||||
|
||||
}
|
||||
|
||||
if (!in_valid) {
|
||||
valid=false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nodes[i]->in_valid=valid;
|
||||
}
|
||||
}
|
||||
|
||||
// write code
|
||||
|
||||
p_generator->begin();
|
||||
|
||||
for(int i=0;i<nodes.size();i++) {
|
||||
|
||||
|
||||
if (!nodes[i]->out_valid || !nodes[i]->in_valid) // valid in both ways
|
||||
continue; // skip node
|
||||
|
||||
Vector<int> in_indices;
|
||||
in_indices.resize(VS::shader_get_input_count(nodes[i]->type));
|
||||
Vector<int> out_indices;
|
||||
Vector<int> out_slot_indices;
|
||||
|
||||
for(int j=0;j<in_indices.size();j++) {
|
||||
|
||||
_ConnectionKey key(nodes[i]->order,j);
|
||||
if (in_connection_map.has(key))
|
||||
in_indices[j]=in_connection_map[key];
|
||||
else
|
||||
in_indices[j]=-1;
|
||||
}
|
||||
|
||||
for(int j=0;j<VS::shader_get_output_count(nodes[i]->type);j++) {
|
||||
|
||||
_ConnectionKey key(nodes[i]->order,j);
|
||||
if (out_connection_map.has(key)) {
|
||||
for(List<int>::Element *CE=out_connection_map[key].front();CE;CE=CE->next()) {
|
||||
|
||||
out_indices.push_back(CE->get());
|
||||
out_slot_indices.push_back(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Error err = p_generator->add_node(nodes[i]->type,i,nodes[i]->id,nodes[i]->param,in_indices,out_indices,out_slot_indices);
|
||||
ERR_FAIL_COND_V( err, err );
|
||||
}
|
||||
|
||||
p_generator->end();
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void ShaderGraph::node_add(VS::ShaderNodeType p_type,int p_id) {
|
||||
|
||||
|
||||
ERR_FAIL_COND( node_map.has(p_id ) );
|
||||
ERR_FAIL_INDEX( p_type, VS::NODE_TYPE_MAX );
|
||||
Node node;
|
||||
|
||||
node.type=p_type;
|
||||
node.id=p_id;
|
||||
node.x=0;
|
||||
node.y=0;
|
||||
|
||||
node_map[p_id]=node;
|
||||
|
||||
}
|
||||
|
||||
void ShaderGraph::node_set_pos(int p_id, int p_x,int p_y) {
|
||||
|
||||
ERR_FAIL_COND(!node_map.has(p_id));
|
||||
node_map[p_id].x=p_x;
|
||||
node_map[p_id].y=p_y;
|
||||
}
|
||||
int ShaderGraph::node_get_pos_x(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!node_map.has(p_id),-1);
|
||||
return node_map[p_id].x;
|
||||
}
|
||||
int ShaderGraph::node_get_pos_y(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!node_map.has(p_id),-1);
|
||||
return node_map[p_id].y;
|
||||
}
|
||||
|
||||
void ShaderGraph::node_remove(int p_id) {
|
||||
|
||||
ERR_FAIL_COND(!node_map.has(p_id));
|
||||
|
||||
//erase connections associated with node
|
||||
List<Connection>::Element *N,*E=connections.front();
|
||||
while(E) {
|
||||
N=E->next();
|
||||
const Connection &c = E->get();
|
||||
if (c.src_id==p_id || c.dst_id==p_id) {
|
||||
|
||||
connections.erase(E);
|
||||
}
|
||||
E=N;
|
||||
}
|
||||
|
||||
node_map.erase(p_id);
|
||||
}
|
||||
|
||||
void ShaderGraph::node_change_type(int p_id, VS::ShaderNodeType p_type) {
|
||||
|
||||
ERR_FAIL_COND(!node_map.has(p_id));
|
||||
node_map[p_id].type=p_type;
|
||||
node_map[p_id].param=Variant();
|
||||
|
||||
}
|
||||
|
||||
void ShaderGraph::node_set_param(int p_id, const Variant& p_value) {
|
||||
|
||||
ERR_FAIL_COND(!node_map.has(p_id));
|
||||
node_map[p_id].param=p_value;
|
||||
}
|
||||
|
||||
void ShaderGraph::get_node_list(List<int> *p_node_list) const {
|
||||
|
||||
Map<int,Node>::Element *E = node_map.front();
|
||||
|
||||
while(E) {
|
||||
|
||||
p_node_list->push_back(E->key());
|
||||
E=E->next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VS::ShaderNodeType ShaderGraph::node_get_type(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!node_map.has(p_id),VS::NODE_TYPE_MAX);
|
||||
return node_map[p_id].type;
|
||||
}
|
||||
|
||||
Variant ShaderGraph::node_get_param(int p_id) const {
|
||||
|
||||
ERR_FAIL_COND_V(!node_map.has(p_id),Variant());
|
||||
return node_map[p_id].param;
|
||||
}
|
||||
|
||||
|
||||
Error ShaderGraph::connect(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) {
|
||||
|
||||
ERR_FAIL_COND_V(p_src_id==p_dst_id, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V(!node_map.has(p_src_id), ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V(!node_map.has(p_dst_id), ERR_INVALID_PARAMETER);
|
||||
VisualServer::ShaderNodeType type_src=node_map[p_src_id].type;
|
||||
VisualServer::ShaderNodeType type_dst=node_map[p_dst_id].type;
|
||||
ERR_FAIL_INDEX_V( p_src_slot, VisualServer::shader_get_output_count(type_src), ERR_INVALID_PARAMETER );
|
||||
ERR_FAIL_INDEX_V( p_dst_slot, VisualServer::shader_get_input_count(type_dst), ERR_INVALID_PARAMETER );
|
||||
ERR_FAIL_COND_V(VisualServer::shader_is_output_vector(type_src,p_src_slot) != VisualServer::shader_is_input_vector(type_dst,p_dst_slot), ERR_INVALID_PARAMETER );
|
||||
|
||||
|
||||
List<Connection>::Element *E=connections.front();
|
||||
while(E) {
|
||||
const Connection &c = E->get();
|
||||
ERR_FAIL_COND_V(c.dst_slot==p_dst_slot && c.dst_id == p_dst_id, ERR_ALREADY_EXISTS);
|
||||
|
||||
E=E->next();
|
||||
}
|
||||
|
||||
Connection c;
|
||||
c.src_slot=p_src_slot;
|
||||
c.src_id=p_src_id;
|
||||
c.dst_slot=p_dst_slot;
|
||||
c.dst_id=p_dst_id;
|
||||
|
||||
connections.push_back(c);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool ShaderGraph::is_connected(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const {
|
||||
|
||||
const List<Connection>::Element *E=connections.front();
|
||||
while(E) {
|
||||
const Connection &c = E->get();
|
||||
if (c.dst_slot==p_dst_slot && c.dst_id == p_dst_id && c.src_slot==p_src_slot && c.src_id == p_src_id)
|
||||
return true;
|
||||
|
||||
E=E->next();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShaderGraph::disconnect(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) {
|
||||
|
||||
List<Connection>::Element *N,*E=connections.front();
|
||||
while(E) {
|
||||
N=E->next();
|
||||
const Connection &c = E->get();
|
||||
if (c.src_slot==p_src_slot && c.src_id==p_src_id && c.dst_slot==p_dst_slot && c.dst_id == p_dst_id) {
|
||||
|
||||
connections.erase(E);
|
||||
}
|
||||
E=N;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ShaderGraph::clear() {
|
||||
|
||||
connections.clear();
|
||||
node_map.clear();
|
||||
}
|
||||
|
||||
List<ShaderGraph::Connection> ShaderGraph::get_connection_list() const {
|
||||
|
||||
return connections;
|
||||
|
||||
}
|
||||
|
||||
ShaderGraph::ShaderGraph() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ShaderGraph::~ShaderGraph() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* shader_graph.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#if 0
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "servers/visual_server.h"
|
||||
#include "map.h"
|
||||
|
||||
|
||||
class ShaderCodeGenerator {
|
||||
public:
|
||||
|
||||
virtual void begin()=0;
|
||||
virtual Error add_node(VS::ShaderNodeType p_type,int p_node_pos,int p_id,const Variant& p_param,const Vector<int>& p_in_connections,const Vector<int>& p_out_connections,const Vector<int>& p_out_connection_outputs)=0;
|
||||
virtual void end()=0;
|
||||
|
||||
virtual ~ShaderCodeGenerator() {}
|
||||
};
|
||||
|
||||
class ShaderGraph {
|
||||
public:
|
||||
|
||||
|
||||
struct Connection {
|
||||
|
||||
int src_id;
|
||||
int src_slot;
|
||||
int dst_id;
|
||||
int dst_slot;
|
||||
};
|
||||
|
||||
private:
|
||||
struct Node {
|
||||
|
||||
int16_t x,y;
|
||||
VS::ShaderNodeType type;
|
||||
Variant param;
|
||||
int id;
|
||||
mutable int order; // used for sorting
|
||||
mutable bool out_valid;
|
||||
mutable bool in_valid;
|
||||
};
|
||||
|
||||
Map<int,Node> node_map;
|
||||
|
||||
List<Connection> connections;
|
||||
|
||||
public:
|
||||
|
||||
Error generate(ShaderCodeGenerator * p_generator) const;
|
||||
|
||||
void node_add(VS::ShaderNodeType p_type,int p_id);
|
||||
void node_remove(int p_id);
|
||||
void node_change_type(int p_id, VS::ShaderNodeType p_type);
|
||||
void node_set_param(int p_id, const Variant& p_value);
|
||||
|
||||
void node_set_pos(int p_id, int p_x,int p_y);
|
||||
int node_get_pos_x(int p_id) const;
|
||||
int node_get_pos_y(int p_id) const;
|
||||
|
||||
void get_node_list(List<int> *p_node_list) const;
|
||||
void get_sorted_node_list(List<int> *p_node_list) const;
|
||||
VS::ShaderNodeType node_get_type(int p_id) const;
|
||||
Variant node_get_param(int p_id) const;
|
||||
|
||||
Error connect(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
bool is_connected(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const;
|
||||
void disconnect(int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot);
|
||||
|
||||
void clear();
|
||||
|
||||
List<Connection> get_connection_list() const;
|
||||
|
||||
|
||||
ShaderGraph();
|
||||
~ShaderGraph();
|
||||
|
||||
};
|
||||
#endif
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "balloon_allocator.h"
|
||||
#include "allocators.h"
|
||||
#include "octree.h"
|
||||
|
||||
/**
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* default_saver.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
@ -1,35 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* default_saver.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef DEFAULT_SAVER_H
|
||||
#define DEFAULT_SAVER_H
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // DEFAULT_SAVER_H
|
@ -34,7 +34,6 @@
|
||||
#include "list.h"
|
||||
#include "undo_redo.h"
|
||||
#include "pair.h"
|
||||
#include "default_saver.h"
|
||||
|
||||
class EditorHistory {
|
||||
|
||||
|
@ -5224,7 +5224,6 @@ EditorNode::EditorNode() {
|
||||
ObjectTypeDB::set_type_enabled("CollisionShape",true);
|
||||
ObjectTypeDB::set_type_enabled("CollisionShape2D",true);
|
||||
ObjectTypeDB::set_type_enabled("CollisionPolygon2D",true);
|
||||
//ObjectTypeDB::set_type_enabled("BodyVolumeConvexPolygon",true);
|
||||
|
||||
Control *theme_base = memnew( Control );
|
||||
add_child(theme_base);
|
||||
|
@ -65,7 +65,6 @@
|
||||
#include "tools/editor/editor_log.h"
|
||||
#include "tools/editor/scene_tree_dock.h"
|
||||
#include "tools/editor/resources_dock.h"
|
||||
#include "tools/editor/optimized_save_dialog.h"
|
||||
#include "tools/editor/editor_run_script.h"
|
||||
|
||||
#include "tools/editor/editor_run_native.h"
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "property_editor.h"
|
||||
#include "optimized_save_dialog.h"
|
||||
#include "undo_redo.h"
|
||||
#include "editor_data.h"
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_selection.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "editor_selection.h"
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_selection.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef EDITOR_SELECTION_H
|
||||
#define EDITOR_SELECTION_H
|
||||
|
||||
#endif // EDITOR_SELECTION_H
|
@ -1,30 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_vu.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "editor_vu.h"
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_vu.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef EDITOR_VU_H
|
||||
#define EDITOR_VU_H
|
||||
|
||||
#endif // EDITOR_VU_H
|
@ -1,28 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* optimized_save_dialog.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
@ -1,34 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* optimized_save_dialog.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef OPTIMIZED_SAVE_DIALOG_H
|
||||
#define OPTIMIZED_SAVE_DIALOG_H
|
||||
|
||||
|
||||
|
||||
#endif // OPTIMIZED_SAVE_DIALOG_H
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* animation_data_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "animation_data_editor_plugin.h"
|
||||
|
||||
AnimationDataEditorPlugin::AnimationDataEditorPlugin()
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* animation_data_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef ANIMATION_DATA_EDITOR_PLUGIN_H
|
||||
#define ANIMATION_DATA_EDITOR_PLUGIN_H
|
||||
|
||||
class AnimationDataEditorPlugin
|
||||
{
|
||||
public:
|
||||
AnimationDataEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // ANIMATION_DATA_EDITOR_PLUGIN_H
|
@ -1,825 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* control_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#if 0
|
||||
#include "control_editor_plugin.h"
|
||||
#include "print_string.h"
|
||||
#include "editor_node.h"
|
||||
#include "os/keyboard.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
void ControlEditor::_add_control(Control *p_control,const EditInfo& p_info) {
|
||||
|
||||
if (controls.has(p_control))
|
||||
return;
|
||||
|
||||
controls.insert(p_control,p_info);
|
||||
p_control->call_deferred("connect","visibility_changed",this,"_visibility_changed",varray(p_control->get_instance_ID()));
|
||||
}
|
||||
|
||||
void ControlEditor::_remove_control(Control *p_control) {
|
||||
|
||||
p_control->call_deferred("disconnect","visibility_changed",this,"_visibility_changed");
|
||||
controls.erase(p_control);
|
||||
}
|
||||
void ControlEditor::_clear_controls(){
|
||||
|
||||
while(controls.size())
|
||||
_remove_control(controls.front()->key());
|
||||
}
|
||||
|
||||
void ControlEditor::_visibility_changed(ObjectID p_control) {
|
||||
|
||||
Object *c = ObjectDB::get_instance(p_control);
|
||||
if (!c)
|
||||
return;
|
||||
Control *ct = c->cast_to<Control>();
|
||||
if (!ct)
|
||||
return;
|
||||
|
||||
_remove_control(ct);
|
||||
}
|
||||
|
||||
|
||||
void ControlEditor::_node_removed(Node *p_node) {
|
||||
|
||||
Control *control = (Control*)p_node; //not a good cast, but safe
|
||||
if (controls.has(control))
|
||||
_remove_control(control);
|
||||
|
||||
if (current_window==p_node) {
|
||||
_clear_controls();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
// slow as hell
|
||||
Control* ControlEditor::_select_control_at_pos(const Point2& p_pos,Node* p_node) {
|
||||
|
||||
for (int i=p_node->get_child_count()-1;i>=0;i--) {
|
||||
|
||||
Control *r=_select_control_at_pos(p_pos,p_node->get_child(i));
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
Control *c=p_node->cast_to<Control>();
|
||||
|
||||
if (c) {
|
||||
Rect2 rect = c->get_window_rect();
|
||||
if (c->get_window()==current_window) {
|
||||
rect.pos=transform.xform(rect.pos).floor();
|
||||
}
|
||||
if (rect.has_point(p_pos))
|
||||
return c;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void ControlEditor::_key_move(const Vector2& p_dir, bool p_snap) {
|
||||
|
||||
if (drag!=DRAG_NONE)
|
||||
return;
|
||||
|
||||
Vector2 motion=p_dir;
|
||||
if (p_snap)
|
||||
motion*=snap_val->get_text().to_double();
|
||||
|
||||
undo_redo->create_action("Edit Control");
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
Control *control = E->key();
|
||||
undo_redo->add_do_method(control,"set_pos",control->get_pos()+motion);
|
||||
undo_redo->add_undo_method(control,"set_pos",control->get_pos());
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
|
||||
void ControlEditor::_input_event(InputEvent p_event) {
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_BUTTON) {
|
||||
|
||||
const InputEventMouseButton &b=p_event.mouse_button;
|
||||
|
||||
if (b.button_index==BUTTON_RIGHT) {
|
||||
|
||||
if (controls.size() && drag!=DRAG_NONE) {
|
||||
//cancel drag
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
Control *control = E->key();
|
||||
control->set_pos(E->get().drag_pos);
|
||||
control->set_size(E->get().drag_size);
|
||||
}
|
||||
|
||||
} else if (b.pressed) {
|
||||
popup->set_pos(Point2(b.x,b.y));
|
||||
popup->popup();
|
||||
}
|
||||
return;
|
||||
}
|
||||
//if (!controls.size())
|
||||
// return;
|
||||
|
||||
if (b.button_index!=BUTTON_LEFT)
|
||||
return;
|
||||
|
||||
if (!b.pressed) {
|
||||
|
||||
if (drag!=DRAG_NONE) {
|
||||
|
||||
if (undo_redo) {
|
||||
|
||||
undo_redo->create_action("Edit Control");
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
Control *control = E->key();
|
||||
undo_redo->add_do_method(control,"set_pos",control->get_pos());
|
||||
undo_redo->add_do_method(control,"set_size",control->get_size());
|
||||
undo_redo->add_undo_method(control,"set_pos",E->get().drag_pos);
|
||||
undo_redo->add_undo_method(control,"set_size",E->get().drag_size);
|
||||
}
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
drag=DRAG_NONE;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (controls.size()==1) {
|
||||
//try single control edit
|
||||
Control *control = controls.front()->key();
|
||||
ERR_FAIL_COND(!current_window);
|
||||
|
||||
Rect2 rect=control->get_window_rect();
|
||||
Point2 ofs=Point2();//get_global_pos();
|
||||
Rect2 draw_rect=Rect2(rect.pos-ofs,rect.size);
|
||||
Point2 click=Point2(b.x,b.y);
|
||||
click = transform.affine_inverse().xform(click);
|
||||
Size2 handle_size=Size2(handle_len,handle_len);
|
||||
|
||||
drag = DRAG_NONE;
|
||||
|
||||
if (Rect2(draw_rect.pos-handle_size,handle_size).has_point(click))
|
||||
drag=DRAG_TOP_LEFT;
|
||||
else if (Rect2(draw_rect.pos+draw_rect.size,handle_size).has_point(click))
|
||||
drag=DRAG_BOTTOM_RIGHT;
|
||||
else if(Rect2(draw_rect.pos+Point2(draw_rect.size.width,-handle_size.y),handle_size).has_point(click))
|
||||
drag=DRAG_TOP_RIGHT;
|
||||
else if (Rect2(draw_rect.pos+Point2(-handle_size.x,draw_rect.size.height),handle_size).has_point(click))
|
||||
drag=DRAG_BOTTOM_LEFT;
|
||||
else if (Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),-handle_size.height),handle_size).has_point(click))
|
||||
drag=DRAG_TOP;
|
||||
else if( Rect2(draw_rect.pos+Point2(-handle_size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size).has_point(click))
|
||||
drag=DRAG_LEFT;
|
||||
else if ( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),draw_rect.size.height),handle_size).has_point(click))
|
||||
drag=DRAG_BOTTOM;
|
||||
else if( Rect2(draw_rect.pos+Point2(draw_rect.size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size).has_point(click))
|
||||
drag=DRAG_RIGHT;
|
||||
|
||||
if (drag!=DRAG_NONE) {
|
||||
drag_from=click;
|
||||
controls[control].drag_pos=control->get_pos();
|
||||
controls[control].drag_size=control->get_size();
|
||||
controls[control].drag_limit=drag_from+controls[control].drag_size-control->get_minimum_size();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//multi control edit
|
||||
|
||||
Point2 click=Point2(b.x,b.y);
|
||||
Node* scene = get_scene()->get_root_node()->cast_to<EditorNode>()->get_edited_scene();
|
||||
if (!scene)
|
||||
return;
|
||||
/*
|
||||
if (current_window) {
|
||||
//no window.... ?
|
||||
click-=current_window->get_scroll();
|
||||
}*/
|
||||
Control *c=_select_control_at_pos(click, scene);
|
||||
|
||||
Node* n = c;
|
||||
while ((n && n != scene && n->get_owner() != scene) || (n && !n->is_type("Control"))) {
|
||||
n = n->get_parent();
|
||||
};
|
||||
c = n->cast_to<Control>();
|
||||
|
||||
|
||||
if (b.mod.control) { //additive selection
|
||||
|
||||
if (!c)
|
||||
return; //nothing to add
|
||||
|
||||
if (current_window && controls.size() && c->get_window()!=current_window)
|
||||
return; //cant multiple select from multiple windows
|
||||
|
||||
if (!controls.size())
|
||||
current_window=c->get_window();
|
||||
|
||||
if (controls.has(c)) {
|
||||
//already in here, erase it
|
||||
_remove_control(c);
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
//check parents!
|
||||
Control *parent = c->get_parent()->cast_to<Control>();
|
||||
|
||||
while(parent) {
|
||||
|
||||
if (controls.has(parent))
|
||||
return; //a parent is already selected, so this is pointless
|
||||
parent=parent->get_parent()->cast_to<Control>();
|
||||
}
|
||||
|
||||
//check childrens of everything!
|
||||
List<Control*> to_erase;
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
parent = E->key()->get_parent()->cast_to<Control>();
|
||||
while(parent) {
|
||||
if (parent==c) {
|
||||
to_erase.push_back(E->key());
|
||||
break;
|
||||
}
|
||||
parent=parent->get_parent()->cast_to<Control>();
|
||||
}
|
||||
}
|
||||
|
||||
while(to_erase.size()) {
|
||||
_remove_control(to_erase.front()->get());
|
||||
to_erase.pop_front();
|
||||
}
|
||||
|
||||
_add_control(c,EditInfo());
|
||||
update();
|
||||
} else {
|
||||
//regular selection
|
||||
if (!c) {
|
||||
_clear_controls();
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!controls.has(c)) {
|
||||
_clear_controls();
|
||||
current_window=c->get_window();
|
||||
_add_control(c,EditInfo());
|
||||
//reselect
|
||||
if (get_scene()->is_editor_hint()) {
|
||||
get_scene()->get_root_node()->call("edit_node",c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
EditInfo &ei=E->get();
|
||||
Control *control=E->key();
|
||||
ei.drag_pos=control->get_pos();
|
||||
ei.drag_size=control->get_size();
|
||||
ei.drag_limit=drag_from+ei.drag_size-control->get_minimum_size();
|
||||
}
|
||||
|
||||
drag=DRAG_ALL;
|
||||
drag_from=click;
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION) {
|
||||
|
||||
const InputEventMouseMotion &m=p_event.mouse_motion;
|
||||
|
||||
if (drag==DRAG_NONE || !current_window)
|
||||
return;
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
Control *control = E->key();
|
||||
Point2 control_drag_pos=E->get().drag_pos;
|
||||
Point2 control_drag_size=E->get().drag_size;
|
||||
Point2 control_drag_limit=E->get().drag_limit;
|
||||
|
||||
Point2 pos=Point2(m.x,m.y);
|
||||
pos = transform.affine_inverse().xform(pos);
|
||||
|
||||
switch(drag) {
|
||||
case DRAG_ALL: {
|
||||
|
||||
control->set_pos( snapify(control_drag_pos+(pos-drag_from)) );
|
||||
} break;
|
||||
case DRAG_RIGHT: {
|
||||
|
||||
control->set_size( snapify(Size2(control_drag_size.width+(pos-drag_from).x,control_drag_size.height)) );
|
||||
} break;
|
||||
case DRAG_BOTTOM: {
|
||||
|
||||
control->set_size( snapify(Size2(control_drag_size.width,control_drag_size.height+(pos-drag_from).y)) );
|
||||
} break;
|
||||
case DRAG_BOTTOM_RIGHT: {
|
||||
|
||||
control->set_size( snapify(control_drag_size+(pos-drag_from)) );
|
||||
} break;
|
||||
case DRAG_TOP_LEFT: {
|
||||
|
||||
if(pos.x>control_drag_limit.x)
|
||||
pos.x=control_drag_limit.x;
|
||||
if(pos.y>control_drag_limit.y)
|
||||
pos.y=control_drag_limit.y;
|
||||
|
||||
Point2 old_size = control->get_size();
|
||||
Point2 new_pos = snapify(control_drag_pos+(pos-drag_from));
|
||||
Point2 new_size = old_size + (control->get_pos() - new_pos);
|
||||
|
||||
control->set_pos( new_pos );
|
||||
control->set_size( new_size );
|
||||
} break;
|
||||
case DRAG_TOP: {
|
||||
|
||||
if(pos.y>control_drag_limit.y)
|
||||
pos.y=control_drag_limit.y;
|
||||
|
||||
Point2 old_size = control->get_size();
|
||||
Point2 new_pos = snapify(control_drag_pos+Point2(0,pos.y-drag_from.y));
|
||||
Point2 new_size = old_size + (control->get_pos() - new_pos);
|
||||
|
||||
control->set_pos( new_pos );
|
||||
control->set_size( new_size );
|
||||
} break;
|
||||
case DRAG_LEFT: {
|
||||
|
||||
if(pos.x>control_drag_limit.x)
|
||||
pos.x=control_drag_limit.x;
|
||||
|
||||
Point2 old_size = control->get_size();
|
||||
Point2 new_pos = snapify(control_drag_pos+Point2(pos.x-drag_from.x,0));
|
||||
Point2 new_size = old_size + (control->get_pos() - new_pos);
|
||||
|
||||
control->set_pos( new_pos );
|
||||
control->set_size( new_size );
|
||||
|
||||
} break;
|
||||
case DRAG_TOP_RIGHT: {
|
||||
|
||||
if(pos.y>control_drag_limit.y)
|
||||
pos.y=control_drag_limit.y;
|
||||
|
||||
Point2 old_size = control->get_size();
|
||||
Point2 new_pos = snapify(control_drag_pos+Point2(0,pos.y-drag_from.y));
|
||||
|
||||
float new_size_y = Point2( old_size + (control->get_pos() - new_pos)).y;
|
||||
float new_size_x = snapify(control_drag_size+Point2(pos.x-drag_from.x,0)).x;
|
||||
|
||||
control->set_pos( new_pos );
|
||||
control->set_size( Point2(new_size_x, new_size_y) );
|
||||
} break;
|
||||
case DRAG_BOTTOM_LEFT: {
|
||||
|
||||
if(pos.x>control_drag_limit.x)
|
||||
pos.x=control_drag_limit.x;
|
||||
|
||||
Point2 old_size = control->get_size();
|
||||
Point2 new_pos = snapify(control_drag_pos+Point2(pos.x-drag_from.x,0));
|
||||
|
||||
float new_size_y = snapify(control_drag_size+Point2(0,pos.y-drag_from.y)).y;
|
||||
float new_size_x = Point2( old_size + (control->get_pos() - new_pos)).x;
|
||||
|
||||
control->set_pos( new_pos );
|
||||
control->set_size( Point2(new_size_x, new_size_y) );
|
||||
|
||||
|
||||
} break;
|
||||
|
||||
default:{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_event.type==InputEvent::KEY) {
|
||||
|
||||
const InputEventKey &k=p_event.key;
|
||||
|
||||
if (k.pressed) {
|
||||
|
||||
if (k.scancode==KEY_UP)
|
||||
_key_move(Vector2(0,-1),k.mod.shift);
|
||||
else if (k.scancode==KEY_DOWN)
|
||||
_key_move(Vector2(0,1),k.mod.shift);
|
||||
else if (k.scancode==KEY_LEFT)
|
||||
_key_move(Vector2(-1,0),k.mod.shift);
|
||||
else if (k.scancode==KEY_RIGHT)
|
||||
_key_move(Vector2(1,0),k.mod.shift);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool ControlEditor::get_remove_list(List<Node*> *p_list) {
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
p_list->push_back(E->key());
|
||||
}
|
||||
|
||||
return !p_list->empty();
|
||||
}
|
||||
|
||||
void ControlEditor::_update_scroll(float) {
|
||||
|
||||
if (updating_scroll)
|
||||
return;
|
||||
|
||||
if (!current_window)
|
||||
return;
|
||||
|
||||
Point2 ofs;
|
||||
ofs.x=h_scroll->get_val();
|
||||
ofs.y=v_scroll->get_val();
|
||||
|
||||
// current_window->set_scroll(-ofs);
|
||||
|
||||
transform=Matrix32();
|
||||
|
||||
transform.scale_basis(Size2(zoom,zoom));
|
||||
transform.elements[2]=-ofs*zoom;
|
||||
|
||||
|
||||
RID viewport = editor->get_scene_root()->get_viewport();
|
||||
|
||||
VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport,transform);
|
||||
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void ControlEditor::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_PROCESS) {
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
Control *control = E->key();
|
||||
Rect2 r=control->get_window_rect();
|
||||
if (r != E->get().last_rect ) {
|
||||
update();
|
||||
E->get().last_rect=r;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (p_what==NOTIFICATION_CHILDREN_CONFIGURED) {
|
||||
|
||||
get_scene()->connect("node_removed",this,"_node_removed");
|
||||
}
|
||||
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
|
||||
// TODO fetch the viewport?
|
||||
/*
|
||||
if (!control) {
|
||||
h_scroll->hide();
|
||||
v_scroll->hide();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
_update_scrollbars();
|
||||
|
||||
if (!current_window)
|
||||
return;
|
||||
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
Control *control = E->key();
|
||||
|
||||
Rect2 rect=control->get_window_rect();
|
||||
RID ci=get_canvas_item();
|
||||
VisualServer::get_singleton()->canvas_item_set_clip(ci,true);
|
||||
Point2 ofs=Point2();//get_global_pos();
|
||||
Rect2 draw_rect=Rect2(rect.pos-ofs,rect.size);
|
||||
draw_rect.pos = transform.xform(draw_rect.pos);
|
||||
Color light_edit_color=Color(1.0,0.8,0.8);
|
||||
Color dark_edit_color=Color(0.4,0.1,0.1);
|
||||
Size2 handle_size=Size2(handle_len,handle_len);
|
||||
|
||||
#define DRAW_RECT( m_rect, m_color )\
|
||||
VisualServer::get_singleton()->canvas_item_add_rect(ci,m_rect,m_color);
|
||||
|
||||
#define DRAW_EMPTY_RECT( m_rect, m_color )\
|
||||
DRAW_RECT( Rect2(m_rect.pos,Size2(m_rect.size.width,1)), m_color );\
|
||||
DRAW_RECT(Rect2(Point2(m_rect.pos.x,m_rect.pos.y+m_rect.size.height-1),Size2(m_rect.size.width,1)), m_color);\
|
||||
DRAW_RECT(Rect2(m_rect.pos,Size2(1,m_rect.size.height)), m_color);\
|
||||
DRAW_RECT(Rect2(Point2(m_rect.pos.x+m_rect.size.width-1,m_rect.pos.y),Size2(1,m_rect.size.height)), m_color);
|
||||
|
||||
#define DRAW_BORDER_RECT( m_rect, m_border_color,m_color )\
|
||||
DRAW_RECT( m_rect, m_color );\
|
||||
DRAW_EMPTY_RECT( m_rect, m_border_color );
|
||||
|
||||
DRAW_EMPTY_RECT( draw_rect.grow(2), light_edit_color );
|
||||
DRAW_EMPTY_RECT( draw_rect.grow(1), dark_edit_color );
|
||||
|
||||
if (controls.size()==1) {
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos-handle_size,handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+draw_rect.size,handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(draw_rect.size.width,-handle_size.y),handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(-handle_size.x,draw_rect.size.height),handle_size), light_edit_color,dark_edit_color );
|
||||
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),-handle_size.height),handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(-handle_size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),draw_rect.size.height),handle_size), light_edit_color,dark_edit_color );
|
||||
DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(draw_rect.size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size), light_edit_color,dark_edit_color );
|
||||
}
|
||||
|
||||
//DRAW_EMPTY_RECT( Rect2( current_window->get_scroll()-Point2(1,1), get_size()+Size2(2,2)), Color(0.8,0.8,1.0,0.8) );
|
||||
E->get().last_rect = rect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ControlEditor::edit(Control *p_control) {
|
||||
|
||||
drag=DRAG_NONE;
|
||||
|
||||
_clear_controls();
|
||||
_add_control(p_control,EditInfo());
|
||||
current_window=p_control->get_window();
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ControlEditor::_find_controls_span(Node *p_node, Rect2& r_rect) {
|
||||
|
||||
if (!editor->get_scene())
|
||||
return;
|
||||
|
||||
if (p_node!=editor->get_edited_scene() && p_node->get_owner()!=editor->get_edited_scene())
|
||||
return;
|
||||
|
||||
if (p_node->cast_to<Control>()) {
|
||||
Control *c = p_node->cast_to<Control>();
|
||||
if (c->get_viewport() != editor->get_viewport()->get_viewport())
|
||||
return; //bye, it's in another viewport
|
||||
|
||||
if (!c->get_parent_control()) {
|
||||
|
||||
Rect2 span = c->get_subtree_span_rect();
|
||||
r_rect.merge(span);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<p_node->get_child_count();i++) {
|
||||
|
||||
_find_controls_span(p_node->get_child(i),r_rect);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlEditor::_update_scrollbars() {
|
||||
|
||||
|
||||
if (!editor->get_scene()) {
|
||||
h_scroll->hide();
|
||||
v_scroll->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
updating_scroll=true;
|
||||
|
||||
|
||||
Size2 size = get_size();
|
||||
Size2 hmin = h_scroll->get_minimum_size();
|
||||
Size2 vmin = v_scroll->get_minimum_size();
|
||||
|
||||
v_scroll->set_begin( Point2(size.width - vmin.width, 0) );
|
||||
v_scroll->set_end( Point2(size.width, size.height) );
|
||||
|
||||
h_scroll->set_begin( Point2( 0, size.height - hmin.height) );
|
||||
h_scroll->set_end( Point2(size.width-vmin.width, size.height) );
|
||||
|
||||
|
||||
Rect2 local_rect = Rect2(Point2(),get_size()-Size2(vmin.width,hmin.height));
|
||||
|
||||
Rect2 control_rect=local_rect;
|
||||
if (editor->get_edited_scene())
|
||||
_find_controls_span(editor->get_edited_scene(),control_rect);
|
||||
control_rect.pos*=zoom;
|
||||
control_rect.size*=zoom;
|
||||
|
||||
/*
|
||||
for(ControlMap::Element *E=controls.front();E;E=E->next()) {
|
||||
|
||||
Control *control = E->key();
|
||||
Rect2 r = control->get_window()->get_subtree_span_rect();
|
||||
if (E==controls.front()) {
|
||||
control_rect = r.merge(local_rect);
|
||||
} else {
|
||||
control_rect = control_rect.merge(r);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
Point2 ofs;
|
||||
|
||||
|
||||
if (control_rect.size.height <= local_rect.size.height) {
|
||||
|
||||
v_scroll->hide();
|
||||
ofs.y=0;
|
||||
} else {
|
||||
|
||||
v_scroll->show();
|
||||
v_scroll->set_min(control_rect.pos.y);
|
||||
v_scroll->set_max(control_rect.pos.y+control_rect.size.y);
|
||||
v_scroll->set_page(local_rect.size.y);
|
||||
ofs.y=-v_scroll->get_val();
|
||||
}
|
||||
|
||||
if (control_rect.size.width <= local_rect.size.width) {
|
||||
|
||||
h_scroll->hide();
|
||||
ofs.x=0;
|
||||
} else {
|
||||
|
||||
h_scroll->show();
|
||||
h_scroll->set_min(control_rect.pos.x);
|
||||
h_scroll->set_max(control_rect.pos.x+control_rect.size.x);
|
||||
h_scroll->set_page(local_rect.size.x);
|
||||
ofs.x=-h_scroll->get_val();
|
||||
}
|
||||
|
||||
// transform=Matrix32();
|
||||
transform.elements[2]=ofs*zoom;
|
||||
RID viewport = editor->get_scene_root()->get_viewport();
|
||||
VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport,transform);
|
||||
|
||||
// transform.scale_basis(Vector2(zoom,zoom));
|
||||
updating_scroll=false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Point2i ControlEditor::snapify(const Point2i& p_pos) const {
|
||||
|
||||
bool active=popup->is_item_checked(0);
|
||||
int snap = snap_val->get_text().to_int();
|
||||
|
||||
if (!active || snap<1)
|
||||
return p_pos;
|
||||
|
||||
Point2i pos=p_pos;
|
||||
pos.x-=pos.x%snap;
|
||||
pos.y-=pos.y%snap;
|
||||
return pos;
|
||||
|
||||
|
||||
}
|
||||
void ControlEditor::_popup_callback(int p_op) {
|
||||
|
||||
switch(p_op) {
|
||||
|
||||
case SNAP_USE: {
|
||||
|
||||
popup->set_item_checked(0,!popup->is_item_checked(0));
|
||||
} break;
|
||||
case SNAP_CONFIGURE: {
|
||||
snap_dialog->popup_centered(Size2(200,85));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void ControlEditor::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("_input_event",&ControlEditor::_input_event);
|
||||
ObjectTypeDB::bind_method("_node_removed",&ControlEditor::_node_removed);
|
||||
ObjectTypeDB::bind_method("_update_scroll",&ControlEditor::_update_scroll);
|
||||
ObjectTypeDB::bind_method("_popup_callback",&ControlEditor::_popup_callback);
|
||||
ObjectTypeDB::bind_method("_visibility_changed",&ControlEditor::_visibility_changed);
|
||||
}
|
||||
|
||||
ControlEditor::ControlEditor(EditorNode *p_editor) {
|
||||
|
||||
editor=p_editor;
|
||||
h_scroll = memnew( HScrollBar );
|
||||
v_scroll = memnew( VScrollBar );
|
||||
|
||||
add_child(h_scroll);
|
||||
add_child(v_scroll);
|
||||
h_scroll->connect("value_changed", this,"_update_scroll",Vector<Variant>(),true);
|
||||
v_scroll->connect("value_changed", this,"_update_scroll",Vector<Variant>(),true);
|
||||
|
||||
|
||||
updating_scroll=false;
|
||||
set_focus_mode(FOCUS_ALL);
|
||||
handle_len=10;
|
||||
|
||||
popup=memnew( PopupMenu );
|
||||
popup->add_check_item("Use Snap");
|
||||
popup->add_item("Configure Snap..");
|
||||
add_child(popup);
|
||||
|
||||
snap_dialog = memnew( ConfirmationDialog );
|
||||
snap_dialog->get_ok()->hide();
|
||||
snap_dialog->get_cancel()->set_text("Close");
|
||||
add_child(snap_dialog);
|
||||
|
||||
Label *l = memnew(Label);
|
||||
l->set_text("Snap:");
|
||||
l->set_pos(Point2(5,5));
|
||||
snap_dialog->add_child(l);
|
||||
|
||||
snap_val=memnew(LineEdit);
|
||||
snap_val->set_text("5");
|
||||
snap_val->set_anchor(MARGIN_RIGHT,ANCHOR_END);
|
||||
snap_val->set_begin(Point2(15,25));
|
||||
snap_val->set_end(Point2(10,25));
|
||||
snap_dialog->add_child(snap_val);
|
||||
|
||||
popup->connect("item_pressed", this,"_popup_callback");
|
||||
current_window=NULL;
|
||||
|
||||
zoom=0.5;
|
||||
}
|
||||
|
||||
|
||||
void ControlEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
control_editor->set_undo_redo(&get_undo_redo());
|
||||
control_editor->edit(p_object->cast_to<Control>());
|
||||
}
|
||||
|
||||
bool ControlEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_type("Control");
|
||||
}
|
||||
|
||||
void ControlEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
control_editor->show();
|
||||
control_editor->set_process(true);
|
||||
} else {
|
||||
|
||||
control_editor->hide();
|
||||
control_editor->set_process(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ControlEditorPlugin::ControlEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor=p_node;
|
||||
control_editor = memnew( ControlEditor(editor) );
|
||||
editor->get_viewport()->add_child(control_editor);
|
||||
control_editor->set_area_as_parent_rect();
|
||||
control_editor->hide();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ControlEditorPlugin::~ControlEditorPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,141 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* control_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef CONTROL_EDITOR_PLUGIN_H
|
||||
#define CONTROL_EDITOR_PLUGIN_H
|
||||
|
||||
#include "tools/editor/editor_plugin.h"
|
||||
#include "tools/editor/editor_node.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#if 0
|
||||
class ControlEditor : public Control {
|
||||
|
||||
OBJ_TYPE(ControlEditor, Control );
|
||||
|
||||
EditorNode *editor;
|
||||
|
||||
enum {
|
||||
SNAP_USE,
|
||||
SNAP_CONFIGURE
|
||||
};
|
||||
|
||||
enum DragType {
|
||||
DRAG_NONE,
|
||||
DRAG_LEFT,
|
||||
DRAG_TOP_LEFT,
|
||||
DRAG_TOP,
|
||||
DRAG_TOP_RIGHT,
|
||||
DRAG_RIGHT,
|
||||
DRAG_BOTTOM_RIGHT,
|
||||
DRAG_BOTTOM,
|
||||
DRAG_BOTTOM_LEFT,
|
||||
DRAG_ALL
|
||||
};
|
||||
|
||||
HScrollBar *h_scroll;
|
||||
VScrollBar *v_scroll;
|
||||
|
||||
Matrix32 transform;
|
||||
float zoom;
|
||||
|
||||
Control *current_window;
|
||||
PopupMenu *popup;
|
||||
DragType drag;
|
||||
Point2 drag_from;
|
||||
|
||||
struct EditInfo {
|
||||
|
||||
Point2 drag_pos;
|
||||
Point2 drag_size;
|
||||
Point2 drag_limit;
|
||||
Rect2 last_rect;
|
||||
};
|
||||
|
||||
typedef Map<Control*,EditInfo> ControlMap;
|
||||
ControlMap controls;
|
||||
int handle_len;
|
||||
Control* _select_control_at_pos(const Point2& p_pos,Node* p_node);
|
||||
|
||||
ConfirmationDialog *snap_dialog;
|
||||
LineEdit *snap_val;
|
||||
|
||||
void _add_control(Control *p_control,const EditInfo& p_info);
|
||||
void _remove_control(Control *p_control);
|
||||
void _clear_controls();
|
||||
void _visibility_changed(ObjectID p_control);
|
||||
void _key_move(const Vector2& p_dir, bool p_snap);
|
||||
|
||||
|
||||
Point2i snapify(const Point2i& p_pos) const;
|
||||
void _popup_callback(int p_op);
|
||||
bool updating_scroll;
|
||||
void _update_scroll(float);
|
||||
void _update_scrollbars();
|
||||
UndoRedo *undo_redo;
|
||||
|
||||
void _find_controls_span(Node *p_node, Rect2& r_rect);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
void _input_event(InputEvent p_event);
|
||||
void _node_removed(Node *p_node);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
bool get_remove_list(List<Node*> *p_list);
|
||||
void set_undo_redo(UndoRedo *p_undo_redo) {undo_redo=p_undo_redo; }
|
||||
void edit(Control *p_control);
|
||||
ControlEditor(EditorNode *p_editor);
|
||||
};
|
||||
|
||||
class ControlEditorPlugin : public EditorPlugin {
|
||||
|
||||
OBJ_TYPE( ControlEditorPlugin, EditorPlugin );
|
||||
|
||||
ControlEditor *control_editor;
|
||||
EditorNode *editor;
|
||||
|
||||
public:
|
||||
|
||||
virtual String get_name() const { return "GUI"; }
|
||||
bool has_main_screen() const { return true; }
|
||||
virtual void edit(Object *p_object);
|
||||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
virtual bool get_remove_list(List<Node*> *p_list) { return control_editor->get_remove_list(p_list); }
|
||||
|
||||
|
||||
ControlEditorPlugin(EditorNode *p_node);
|
||||
~ControlEditorPlugin();
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif
|
@ -33,7 +33,6 @@
|
||||
#include "tools/editor/editor_plugin.h"
|
||||
#include "tools/editor/editor_node.h"
|
||||
#include "scene/resources/shader.h"
|
||||
#include "servers/visual/shader_graph.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/graph_edit.h"
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "io/resource_saver.h"
|
||||
#include "os/os.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "default_saver.h"
|
||||
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/scroll_container.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "property_editor.h"
|
||||
#include "optimized_save_dialog.h"
|
||||
#include "undo_redo.h"
|
||||
#include "editor_data.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* scenes.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "scenes.h"
|
||||
|
||||
Scenes::Scenes()
|
||||
{
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* scenes.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2016 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 */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef SCENES_H
|
||||
#define SCENES_H
|
||||
|
||||
class Scenes{
|
||||
public:
|
||||
Scenes();
|
||||
};
|
||||
|
||||
#endif // SCENES_H
|
Loading…
x
Reference in New Issue
Block a user