diff --git a/include/openspace/engine/settingsengine.h b/include/openspace/engine/settingsengine.h index 623d262d96..c7098725f0 100644 --- a/include/openspace/engine/settingsengine.h +++ b/include/openspace/engine/settingsengine.h @@ -26,8 +26,10 @@ #define __SETTINGSENGINE_H__ #include -#include + #include +#include +#include #include diff --git a/include/openspace/interaction/interactionhandler.h b/include/openspace/interaction/interactionhandler.h index 88a8cc688e..0dba068b19 100644 --- a/include/openspace/interaction/interactionhandler.h +++ b/include/openspace/interaction/interactionhandler.h @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include diff --git a/include/openspace/properties/matrix/dmat2property.h b/include/openspace/properties/matrix/dmat2property.h new file mode 100644 index 0000000000..068262e95e --- /dev/null +++ b/include/openspace/properties/matrix/dmat2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT2PROPERTY_H__ +#define __DMAT2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat2Property, glm::dmat2x2); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat2x3property.h b/include/openspace/properties/matrix/dmat2x3property.h new file mode 100644 index 0000000000..93b788a467 --- /dev/null +++ b/include/openspace/properties/matrix/dmat2x3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT2x3PROPERTY_H__ +#define __DMAT2x3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat2x3Property, glm::dmat2x3); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT2x3PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat2x4property.h b/include/openspace/properties/matrix/dmat2x4property.h new file mode 100644 index 0000000000..6eadff129a --- /dev/null +++ b/include/openspace/properties/matrix/dmat2x4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT2x4PROPERTY_H__ +#define __DMAT2x4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat2x4Property, glm::dmat2x4); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT2x4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat3property.h b/include/openspace/properties/matrix/dmat3property.h new file mode 100644 index 0000000000..1ddb7c33e4 --- /dev/null +++ b/include/openspace/properties/matrix/dmat3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT3PROPERTY_H__ +#define __DMAT3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat3Property, glm::dmat3x3); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT3PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat3x2property.h b/include/openspace/properties/matrix/dmat3x2property.h new file mode 100644 index 0000000000..df77be19bd --- /dev/null +++ b/include/openspace/properties/matrix/dmat3x2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT3x2PROPERTY_H__ +#define __DMAT3x2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat3x2Property, glm::dmat3x2); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT3x2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat3x4property.h b/include/openspace/properties/matrix/dmat3x4property.h new file mode 100644 index 0000000000..2bd147a1e2 --- /dev/null +++ b/include/openspace/properties/matrix/dmat3x4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT3x4PROPERTY_H__ +#define __DMAT3x4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat3x4Property, glm::dmat3x4); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT3x4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat4property.h b/include/openspace/properties/matrix/dmat4property.h new file mode 100644 index 0000000000..d94a034d59 --- /dev/null +++ b/include/openspace/properties/matrix/dmat4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT4PROPERTY_H__ +#define __DMAT4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat4Property, glm::dmat4x4); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat4x2property.h b/include/openspace/properties/matrix/dmat4x2property.h new file mode 100644 index 0000000000..c494207d06 --- /dev/null +++ b/include/openspace/properties/matrix/dmat4x2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT4x2PROPERTY_H__ +#define __DMAT4x2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat4x2Property, glm::dmat4x2); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT4x2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/dmat4x3property.h b/include/openspace/properties/matrix/dmat4x3property.h new file mode 100644 index 0000000000..2445c505a6 --- /dev/null +++ b/include/openspace/properties/matrix/dmat4x3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DMAT4x3PROPERTY_H__ +#define __DMAT4x3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DMat4x3Property, glm::dmat4x3); + +} // namespace properties +} // namespace openspace + +#endif // __DMAT4x3PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat2property.h b/include/openspace/properties/matrix/mat2property.h new file mode 100644 index 0000000000..9f33108218 --- /dev/null +++ b/include/openspace/properties/matrix/mat2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT2PROPERTY_H__ +#define __MAT2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat2Property, glm::mat2x2); + +} // namespace properties +} // namespace openspace + +#endif // __MAT2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat2x3property.h b/include/openspace/properties/matrix/mat2x3property.h new file mode 100644 index 0000000000..4e7058b19c --- /dev/null +++ b/include/openspace/properties/matrix/mat2x3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT2x3PROPERTY_H__ +#define __MAT2x3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat2x3Property, glm::mat2x3); + +} // namespace properties +} // namespace openspace + +#endif // __MAT2x3PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat2x4property.h b/include/openspace/properties/matrix/mat2x4property.h new file mode 100644 index 0000000000..2c6472ec39 --- /dev/null +++ b/include/openspace/properties/matrix/mat2x4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT2x4PROPERTY_H__ +#define __MAT2x4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat2x4Property, glm::mat2x4); + +} // namespace properties +} // namespace openspace + +#endif // __MAT2x4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat3property.h b/include/openspace/properties/matrix/mat3property.h new file mode 100644 index 0000000000..d722340c78 --- /dev/null +++ b/include/openspace/properties/matrix/mat3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT3PROPERTY_H__ +#define __MAT3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat3Property, glm::mat3x3); + +} // namespace properties +} // namespace openspace + +#endif // __MAT3PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat3x2property.h b/include/openspace/properties/matrix/mat3x2property.h new file mode 100644 index 0000000000..880998f3c1 --- /dev/null +++ b/include/openspace/properties/matrix/mat3x2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT3x2PROPERTY_H__ +#define __MAT3x2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat3x2Property, glm::mat3x2); + +} // namespace properties +} // namespace openspace + +#endif // __MAT3x2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat3x4property.h b/include/openspace/properties/matrix/mat3x4property.h new file mode 100644 index 0000000000..f204e8a612 --- /dev/null +++ b/include/openspace/properties/matrix/mat3x4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT3x4PROPERTY_H__ +#define __MAT3x4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat3x4Property, glm::mat3x4); + +} // namespace properties +} // namespace openspace + +#endif // __MAT3x4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat4property.h b/include/openspace/properties/matrix/mat4property.h new file mode 100644 index 0000000000..174e653f6e --- /dev/null +++ b/include/openspace/properties/matrix/mat4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT4PROPERTY_H__ +#define __MAT4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat4Property, glm::mat4x4); + +} // namespace properties +} // namespace openspace + +#endif // __MAT4PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat4x2property.h b/include/openspace/properties/matrix/mat4x2property.h new file mode 100644 index 0000000000..1ba992b3c1 --- /dev/null +++ b/include/openspace/properties/matrix/mat4x2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT4x2PROPERTY_H__ +#define __MAT4x2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat4x2Property, glm::mat4x2); + +} // namespace properties +} // namespace openspace + +#endif // __MAT4x2PROPERTY_H__ diff --git a/include/openspace/properties/matrix/mat4x3property.h b/include/openspace/properties/matrix/mat4x3property.h new file mode 100644 index 0000000000..5c98761f22 --- /dev/null +++ b/include/openspace/properties/matrix/mat4x3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __MAT4x3PROPERTY_H__ +#define __MAT4x3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Mat4x3Property, glm::mat4x3); + +} // namespace properties +} // namespace openspace + +#endif // __MAT4x3PROPERTY_H__ diff --git a/include/openspace/properties/matrixproperty.h b/include/openspace/properties/matrixproperty.h index 572d840933..fdce58f3be 100644 --- a/include/openspace/properties/matrixproperty.h +++ b/include/openspace/properties/matrixproperty.h @@ -27,31 +27,24 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace openspace { -namespace properties { - -REGISTER_NUMERICALPROPERTY_HEADER(Mat2Property, glm::mat2x2); -REGISTER_NUMERICALPROPERTY_HEADER(Mat2x3Property, glm::mat2x3); -REGISTER_NUMERICALPROPERTY_HEADER(Mat2x4Property, glm::mat2x4); -REGISTER_NUMERICALPROPERTY_HEADER(Mat3x2Property, glm::mat3x2); -REGISTER_NUMERICALPROPERTY_HEADER(Mat3Property, glm::mat3x3); -REGISTER_NUMERICALPROPERTY_HEADER(Mat3x4Property, glm::mat3x4); -REGISTER_NUMERICALPROPERTY_HEADER(Mat4x2Property, glm::mat4x2); -REGISTER_NUMERICALPROPERTY_HEADER(Mat4x3Property, glm::mat4x3); -REGISTER_NUMERICALPROPERTY_HEADER(Mat4Property, glm::mat4x4); -REGISTER_NUMERICALPROPERTY_HEADER(DMat2Property, glm::dmat2x2); -REGISTER_NUMERICALPROPERTY_HEADER(DMat2x3Property, glm::dmat2x3); -REGISTER_NUMERICALPROPERTY_HEADER(DMat2x4Property, glm::dmat2x4); -REGISTER_NUMERICALPROPERTY_HEADER(DMat3x2Property, glm::dmat3x2); -REGISTER_NUMERICALPROPERTY_HEADER(DMat3Property, glm::dmat3x3); -REGISTER_NUMERICALPROPERTY_HEADER(DMat3x4Property, glm::dmat3x4); -REGISTER_NUMERICALPROPERTY_HEADER(DMat4x2Property, glm::dmat4x2); -REGISTER_NUMERICALPROPERTY_HEADER(DMat4x3Property, glm::dmat4x3); -REGISTER_NUMERICALPROPERTY_HEADER(DMat4Property, glm::dmat4x4); - -} // namespace properties -} // namespace openspace +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif // __MATRIXPROPERTY_H__ diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index 2a1ae50d4d..78c0630c37 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -25,7 +25,7 @@ #ifndef __OPTIONPROPERTY_H__ #define __OPTIONPROPERTY_H__ -#include +#include #include diff --git a/include/openspace/properties/scalar/boolproperty.h b/include/openspace/properties/scalar/boolproperty.h new file mode 100644 index 0000000000..e3766ccce0 --- /dev/null +++ b/include/openspace/properties/scalar/boolproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __BOOLPROPERTY_H__ +#define __BOOLPROPERTY_H__ + + /** + * \file boolproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class BoolProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type bool. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_TEMPLATEPROPERTY_HEADER(BoolProperty, bool); + +} // namespace properties +} // namespace openspace + +#endif // __BOOLPROPERTY_H__ diff --git a/include/openspace/properties/scalar/charproperty.h b/include/openspace/properties/scalar/charproperty.h new file mode 100644 index 0000000000..bf8c4037c6 --- /dev/null +++ b/include/openspace/properties/scalar/charproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __CHARPROPERTY_H__ +#define __CHARPROPERTY_H__ + + /** + * \file charproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class CharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type char. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(CharProperty, char); + +} // namespace properties +} // namespace openspace + +#endif // __CHARPROPERTY_H__ diff --git a/include/openspace/properties/scalar/doubleproperty.h b/include/openspace/properties/scalar/doubleproperty.h new file mode 100644 index 0000000000..244612cc38 --- /dev/null +++ b/include/openspace/properties/scalar/doubleproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DOUBLEPROPERTY_H__ +#define __DOUBLEPROPERTY_H__ + + /** + * \file doubleproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class DoubleProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type double. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DoubleProperty, double); + +} // namespace properties +} // namespace openspace + +#endif // __DOUBLEPROPERTY_H__ diff --git a/include/openspace/properties/scalar/floatproperty.h b/include/openspace/properties/scalar/floatproperty.h new file mode 100644 index 0000000000..5a72f238eb --- /dev/null +++ b/include/openspace/properties/scalar/floatproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __FLOATPROPERTY_H__ +#define __FLOATPROPERTY_H__ + + /** + * \file floatproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class FloatProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type float. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(FloatProperty, float); + +} // namespace properties +} // namespace openspace + +#endif // __FLOATPROPERTY_H__ diff --git a/include/openspace/properties/scalar/intproperty.h b/include/openspace/properties/scalar/intproperty.h new file mode 100644 index 0000000000..83317d89d4 --- /dev/null +++ b/include/openspace/properties/scalar/intproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __INTPROPERTY_H__ +#define __INTPROPERTY_H__ + + /** + * \file intproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class IntProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type int. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(IntProperty, int); + +} // namespace properties +} // namespace openspace + +#endif // __INTPROPERTY_H__ diff --git a/include/openspace/properties/scalar/longdoubleproperty.h b/include/openspace/properties/scalar/longdoubleproperty.h new file mode 100644 index 0000000000..74c154caa3 --- /dev/null +++ b/include/openspace/properties/scalar/longdoubleproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __LONGDOUBLEPROPERTY_H__ +#define __LONGDOUBLEPROPERTY_H__ + + /** + * \file longdoubleproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class LongDoubleProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type long double. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(LongDoubleProperty, long double); + +} // namespace properties +} // namespace openspace + +#endif // __LONGDOUBLEPROPERTY_H__ diff --git a/include/openspace/properties/scalar/longlongproperty.h b/include/openspace/properties/scalar/longlongproperty.h new file mode 100644 index 0000000000..f9544ee2b3 --- /dev/null +++ b/include/openspace/properties/scalar/longlongproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __LONGLONGPROPERTY_H__ +#define __LONGLONGPROPERTY_H__ + + /** + * \file longlongproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class LongLongProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type long long. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(LongLongProperty, long long); + +} // namespace properties +} // namespace openspace + +#endif // __LONGLONGPROPERTY_H__ diff --git a/include/openspace/properties/scalar/longproperty.h b/include/openspace/properties/scalar/longproperty.h new file mode 100644 index 0000000000..5a8b8a273c --- /dev/null +++ b/include/openspace/properties/scalar/longproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __LONGPROPERTY_H__ +#define __LONGPROPERTY_H__ + + /** + * \file longproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class LongProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type long. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(LongProperty, long); + +} // namespace properties +} // namespace openspace + +#endif // __LONGPROPERTY_H__ diff --git a/include/openspace/properties/scalar/shortproperty.h b/include/openspace/properties/scalar/shortproperty.h new file mode 100644 index 0000000000..8f862e9f13 --- /dev/null +++ b/include/openspace/properties/scalar/shortproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __SHORTPROPERTY_H__ +#define __SHORTPROPERTY_H__ + + /** + * \file shortproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class ShortProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type short. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(ShortProperty, short); + +} // namespace properties +} // namespace openspace + +#endif // __SHORTPROPERTY_H__ diff --git a/include/openspace/properties/scalar/signedcharproperty.h b/include/openspace/properties/scalar/signedcharproperty.h new file mode 100644 index 0000000000..c3aacd600f --- /dev/null +++ b/include/openspace/properties/scalar/signedcharproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __SIGNEDCHARPROPERTY_H__ +#define __SIGNEDCHARPROPERTY_H__ + + /** + * \file signedcharproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class SignedCharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type signed char. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(SignedCharProperty, signed char); + +} // namespace properties +} // namespace openspace + +#endif // __SIGNEDCHARPROPERTY_H__ diff --git a/include/openspace/properties/scalar/ucharproperty.h b/include/openspace/properties/scalar/ucharproperty.h new file mode 100644 index 0000000000..c22e4abeec --- /dev/null +++ b/include/openspace/properties/scalar/ucharproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UCHARPROPERTY_H__ +#define __UCHARPROPERTY_H__ + + /** + * \file ucharproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class UCharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned char. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char); + +} // namespace properties +} // namespace openspace + +#endif // __UCHARPROPERTY_H__ diff --git a/include/openspace/properties/scalar/uintproperty.h b/include/openspace/properties/scalar/uintproperty.h new file mode 100644 index 0000000000..4aa70035d0 --- /dev/null +++ b/include/openspace/properties/scalar/uintproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UINTPROPERTY_H__ +#define __UINTPROPERTY_H__ + + /** + * \file uintproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class UIntProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned int. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UIntProperty, unsigned int); + +} // namespace properties +} // namespace openspace + +#endif // __UINTPROPERTY_H__ diff --git a/include/openspace/properties/scalar/ulonglongproperty.h b/include/openspace/properties/scalar/ulonglongproperty.h new file mode 100644 index 0000000000..7fd7c7f980 --- /dev/null +++ b/include/openspace/properties/scalar/ulonglongproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __ULONGLONGPROPERTY_H__ +#define __ULONGLONGPROPERTY_H__ + + /** + * \file ulonglongproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class ULongLongProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned long long. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(ULongLongProperty, unsigned long long); + +} // namespace properties +} // namespace openspace + +#endif // __ULONGLONGPROPERTY_H__ diff --git a/include/openspace/properties/scalar/ulongproperty.h b/include/openspace/properties/scalar/ulongproperty.h new file mode 100644 index 0000000000..a346551618 --- /dev/null +++ b/include/openspace/properties/scalar/ulongproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __ULONGPROPERTY_H__ +#define __ULONGPROPERTY_H__ + + /** + * \file ulongproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class ULongProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned long. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(ULongProperty, unsigned long); + +} // namespace properties +} // namespace openspace + +#endif // __ULONGPROPERTY_H__ diff --git a/include/openspace/properties/scalar/ushortproperty.h b/include/openspace/properties/scalar/ushortproperty.h new file mode 100644 index 0000000000..8e9b7ea882 --- /dev/null +++ b/include/openspace/properties/scalar/ushortproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __USHORTPROPERTY_H__ +#define __USHORTPROPERTY_H__ + + /** + * \file ushortproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class UShortProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned short. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UShortProperty, unsigned short); + +} // namespace properties +} // namespace openspace + +#endif // __USHORTPROPERTY_H__ diff --git a/include/openspace/properties/scalar/wcharproperty.h b/include/openspace/properties/scalar/wcharproperty.h new file mode 100644 index 0000000000..f6b91d4766 --- /dev/null +++ b/include/openspace/properties/scalar/wcharproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __WCHARPROPERTY_H__ +#define __WCHARPROPERTY_H__ + + /** + * \file wcharproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class WCharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type wchar_t. + + * @} @} + */ + +#include + +namespace openspace { +namespace properties { + +//REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t); + +} // namespace properties +} // namespace openspace + +#endif // __WCHARPROPERTY_H__ diff --git a/include/openspace/properties/scalarproperty.h b/include/openspace/properties/scalarproperty.h index 7576edd37d..8127b83077 100644 --- a/include/openspace/properties/scalarproperty.h +++ b/include/openspace/properties/scalarproperty.h @@ -25,100 +25,23 @@ #ifndef __SCALARPROPERTY_H__ #define __SCALARPROPERTY_H__ - /** - * \file scalarproperty.h - * - * \addtogroup openspace - * @{ - * \addtogroup properties - * @{ - - * \class BoolProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type bool. +#include - * \class CharProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type char. - - * \class SignedCharProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type signed char. - - * \class UCharProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type unsigned char. - - * \class ShortProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type short. - - * \class UShortProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type unsigned short. - - * \class IntProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type int. - - * \class UIntProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type unsigned int. - - * \class LongProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type long. - - * \class ULongProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type unsigned long. - - * \class LongLongProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type long long. - - * \class ULongLongProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type unsigned long long. - - * \class FloatProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type float. - - * \class DoubleProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type double. - - * \class LongDoubleProperty - * This class is a concrete implementation of openspace::properties::TemplateProperty with - * the type long double. - - * @} @} - */ - -#include "openspace/properties/numericalproperty.h" - -namespace openspace { -namespace properties { - -REGISTER_TEMPLATEPROPERTY_HEADER(BoolProperty, bool); -REGISTER_NUMERICALPROPERTY_HEADER(CharProperty, char); -//REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t); -REGISTER_NUMERICALPROPERTY_HEADER(SignedCharProperty, signed char); -REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char); -REGISTER_NUMERICALPROPERTY_HEADER(ShortProperty, short); -REGISTER_NUMERICALPROPERTY_HEADER(UShortProperty, unsigned short); -REGISTER_NUMERICALPROPERTY_HEADER(IntProperty, int); -REGISTER_NUMERICALPROPERTY_HEADER(UIntProperty, unsigned int); -REGISTER_NUMERICALPROPERTY_HEADER(LongProperty, long); -REGISTER_NUMERICALPROPERTY_HEADER(ULongProperty, unsigned long); -REGISTER_NUMERICALPROPERTY_HEADER(LongLongProperty, long long); -REGISTER_NUMERICALPROPERTY_HEADER(ULongLongProperty, unsigned long long); -REGISTER_NUMERICALPROPERTY_HEADER(FloatProperty, float); -REGISTER_NUMERICALPROPERTY_HEADER(DoubleProperty, double); -REGISTER_NUMERICALPROPERTY_HEADER(LongDoubleProperty, long double); - -} // namespace properties -} // namespace openspace +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif // __SCALARPROPERTY_H__ diff --git a/include/openspace/properties/selectionproperty.h b/include/openspace/properties/selectionproperty.h index ad2cafc4f4..3eefe59b31 100644 --- a/include/openspace/properties/selectionproperty.h +++ b/include/openspace/properties/selectionproperty.h @@ -25,7 +25,7 @@ #ifndef __SELECTIONPROPERTY_H__ #define __SELECTIONPROPERTY_H__ -#include +#include #include diff --git a/include/openspace/properties/ucharproperty.h b/include/openspace/properties/ucharproperty.h new file mode 100644 index 0000000000..f0d7de59ef --- /dev/null +++ b/include/openspace/properties/ucharproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UCHARPROPERTY_H__ +#define __UCHARPROPERTY_H__ + + /** + * \file ucharproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class UCharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned char. + + * @} @} + */ + +#include "openspace/properties/numericalproperty.h" + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char); + +} // namespace properties +} // namespace openspace + +#endif // __UCHARPROPERTY_H__ diff --git a/include/openspace/properties/uintproperty.h b/include/openspace/properties/uintproperty.h new file mode 100644 index 0000000000..2e4b50b103 --- /dev/null +++ b/include/openspace/properties/uintproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UINTPROPERTY_H__ +#define __UINTPROPERTY_H__ + + /** + * \file uintproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class UIntProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type unsigned int. + + * @} @} + */ + +#include "openspace/properties/numericalproperty.h" + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UIntProperty, unsigned int); + +} // namespace properties +} // namespace openspace + +#endif // __UINTPROPERTY_H__ diff --git a/include/openspace/properties/vector/bvec2property.h b/include/openspace/properties/vector/bvec2property.h new file mode 100644 index 0000000000..ba2c6f607e --- /dev/null +++ b/include/openspace/properties/vector/bvec2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __BVEC2PROPERTY_H__ +#define __BVEC2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_TEMPLATEPROPERTY_HEADER(BVec2Property, glm::bvec2); + +} // namespace properties +} // namespace openspace + +#endif // __BVEC2PROPERTY_H__ diff --git a/include/openspace/properties/vector/bvec3property.h b/include/openspace/properties/vector/bvec3property.h new file mode 100644 index 0000000000..482b573871 --- /dev/null +++ b/include/openspace/properties/vector/bvec3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __BVEC3PROPERTY_H__ +#define __BVEC3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_TEMPLATEPROPERTY_HEADER(BVec3Property, glm::bvec3); + +} // namespace properties +} // namespace openspace + +#endif // __BVEC3PROPERTY_H__ diff --git a/include/openspace/properties/vector/bvec4property.h b/include/openspace/properties/vector/bvec4property.h new file mode 100644 index 0000000000..971e323d95 --- /dev/null +++ b/include/openspace/properties/vector/bvec4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __BVEC4PROPERTY_H__ +#define __BVEC4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_TEMPLATEPROPERTY_HEADER(BVec4Property, glm::bvec4); + +} // namespace properties +} // namespace openspace + +#endif // __BVEC4PROPERTY_H__ diff --git a/include/openspace/properties/vector/dvec2property.h b/include/openspace/properties/vector/dvec2property.h new file mode 100644 index 0000000000..eb42825526 --- /dev/null +++ b/include/openspace/properties/vector/dvec2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DVEC2PROPERTY_H__ +#define __DVEC2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DVec2Property, glm::dvec2); + +} // namespace properties +} // namespace openspace + +#endif // __DVEC2PROPERTY_H__ diff --git a/include/openspace/properties/vector/dvec3property.h b/include/openspace/properties/vector/dvec3property.h new file mode 100644 index 0000000000..01d9c1a51a --- /dev/null +++ b/include/openspace/properties/vector/dvec3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DVEC3PROPERTY_H__ +#define __DVEC3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DVec3Property, glm::dvec3); + +} // namespace properties +} // namespace openspace + +#endif // __DVEC3PROPERTY_H__ diff --git a/include/openspace/properties/vector/dvec4property.h b/include/openspace/properties/vector/dvec4property.h new file mode 100644 index 0000000000..21ec5ef4bc --- /dev/null +++ b/include/openspace/properties/vector/dvec4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __DVEC4PROPERTY_H__ +#define __DVEC4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(DVec4Property, glm::dvec4); + +} // namespace properties +} // namespace openspace + +#endif // __DVEC4PROPERTY_H__ diff --git a/include/openspace/properties/vector/ivec2property.h b/include/openspace/properties/vector/ivec2property.h new file mode 100644 index 0000000000..b0b1864127 --- /dev/null +++ b/include/openspace/properties/vector/ivec2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __IVEC2PROPERTY_H__ +#define __IVEC2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(IVec2Property, glm::ivec2); + +} // namespace properties +} // namespace openspace + +#endif // __IVEC2PROPERTY_H__ diff --git a/include/openspace/properties/vector/ivec3property.h b/include/openspace/properties/vector/ivec3property.h new file mode 100644 index 0000000000..423c807de9 --- /dev/null +++ b/include/openspace/properties/vector/ivec3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __IVEC3PROPERTY_H__ +#define __IVEC3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(IVec3Property, glm::ivec3); + +} // namespace properties +} // namespace openspace + +#endif // __IVEC3PROPERTY_H__ diff --git a/include/openspace/properties/vector/ivec4property.h b/include/openspace/properties/vector/ivec4property.h new file mode 100644 index 0000000000..8d23b78d56 --- /dev/null +++ b/include/openspace/properties/vector/ivec4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __IVEC4PROPERTY_H__ +#define __IVEC4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(IVec4Property, glm::ivec4); + +} // namespace properties +} // namespace openspace + +#endif // __IVEC4PROPERTY_H__ diff --git a/include/openspace/properties/vector/uvec2property.h b/include/openspace/properties/vector/uvec2property.h new file mode 100644 index 0000000000..1d3ea09f92 --- /dev/null +++ b/include/openspace/properties/vector/uvec2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UVEC2PROPERTY_H__ +#define __UVEC2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UVec2Property, glm::uvec2); + +} // namespace properties +} // namespace openspace + +#endif // __UVEC2PROPERTY_H__ diff --git a/include/openspace/properties/vector/uvec3property.h b/include/openspace/properties/vector/uvec3property.h new file mode 100644 index 0000000000..c189e7e2b6 --- /dev/null +++ b/include/openspace/properties/vector/uvec3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UVEC3PROPERTY_H__ +#define __UVEC3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UVec3Property, glm::uvec3); + +} // namespace properties +} // namespace openspace + +#endif // __UVEC3PROPERTY_H__ diff --git a/include/openspace/properties/vector/uvec4property.h b/include/openspace/properties/vector/uvec4property.h new file mode 100644 index 0000000000..24a77157c1 --- /dev/null +++ b/include/openspace/properties/vector/uvec4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __UVEC4PROPERTY_H__ +#define __UVEC4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(UVec4Property, glm::uvec4); + +} // namespace properties +} // namespace openspace + +#endif // __UVEC4PROPERTY_H__ diff --git a/include/openspace/properties/vector/vec2property.h b/include/openspace/properties/vector/vec2property.h new file mode 100644 index 0000000000..40a112abfa --- /dev/null +++ b/include/openspace/properties/vector/vec2property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __VEC2PROPERTY_H__ +#define __VEC2PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Vec2Property, glm::vec2); + +} // namespace properties +} // namespace openspace + +#endif // __VEC2PROPERTY_H__ diff --git a/include/openspace/properties/vector/vec3property.h b/include/openspace/properties/vector/vec3property.h new file mode 100644 index 0000000000..11416f467b --- /dev/null +++ b/include/openspace/properties/vector/vec3property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __VEC3PROPERTY_H__ +#define __VEC3PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Vec3Property, glm::vec3); + +} // namespace properties +} // namespace openspace + +#endif // __VEC3PROPERTY_H__ diff --git a/include/openspace/properties/vector/vec4property.h b/include/openspace/properties/vector/vec4property.h new file mode 100644 index 0000000000..0ee753b33b --- /dev/null +++ b/include/openspace/properties/vector/vec4property.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __VEC4PROPERTY_H__ +#define __VEC4PROPERTY_H__ + +#include + +#include + +namespace openspace { +namespace properties { + +REGISTER_NUMERICALPROPERTY_HEADER(Vec4Property, glm::vec4); + +} // namespace properties +} // namespace openspace + +#endif // __VEC4PROPERTY_H__ diff --git a/include/openspace/properties/vectorproperty.h b/include/openspace/properties/vectorproperty.h index a1307037ba..6c13d195d5 100644 --- a/include/openspace/properties/vectorproperty.h +++ b/include/openspace/properties/vectorproperty.h @@ -25,31 +25,26 @@ #ifndef __VECTORPROPERTY_H__ #define __VECTORPROPERTY_H__ -#include "openspace/properties/numericalproperty.h" +#include -#include +#include +#include +#include -namespace openspace { -namespace properties { +#include +#include +#include -REGISTER_TEMPLATEPROPERTY_HEADER(BVec2Property, glm::bvec2); -REGISTER_TEMPLATEPROPERTY_HEADER(BVec3Property, glm::bvec3); -REGISTER_TEMPLATEPROPERTY_HEADER(BVec4Property, glm::bvec4); +#include +#include +#include -REGISTER_NUMERICALPROPERTY_HEADER(Vec2Property, glm::vec2); -REGISTER_NUMERICALPROPERTY_HEADER(Vec3Property, glm::vec3); -REGISTER_NUMERICALPROPERTY_HEADER(Vec4Property, glm::vec4); -REGISTER_NUMERICALPROPERTY_HEADER(DVec2Property, glm::dvec2); -REGISTER_NUMERICALPROPERTY_HEADER(DVec3Property, glm::dvec3); -REGISTER_NUMERICALPROPERTY_HEADER(DVec4Property, glm::dvec4); -REGISTER_NUMERICALPROPERTY_HEADER(IVec2Property, glm::ivec2); -REGISTER_NUMERICALPROPERTY_HEADER(IVec3Property, glm::ivec3); -REGISTER_NUMERICALPROPERTY_HEADER(IVec4Property, glm::ivec4); -REGISTER_NUMERICALPROPERTY_HEADER(UVec2Property, glm::uvec2); -REGISTER_NUMERICALPROPERTY_HEADER(UVec3Property, glm::uvec3); -REGISTER_NUMERICALPROPERTY_HEADER(UVec4Property, glm::uvec4); +#include +#include +#include -} // namespace properties -} // namespace openspace +#include +#include +#include #endif // __INTPROPERTY_H__ diff --git a/include/openspace/properties/wcharproperty.h b/include/openspace/properties/wcharproperty.h new file mode 100644 index 0000000000..38d12030ce --- /dev/null +++ b/include/openspace/properties/wcharproperty.h @@ -0,0 +1,53 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 __WCHARPROPERTY_H__ +#define __WCHARPROPERTY_H__ + + /** + * \file wcharproperty.h + * + * \addtogroup openspace + * @{ + * \addtogroup properties + * @{ + + * \class WCharProperty + * This class is a concrete implementation of openspace::properties::TemplateProperty with + * the type wchar_t. + + * @} @} + */ + +#include "openspace/properties/numericalproperty.h" + +namespace openspace { +namespace properties { + +//REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t); + +} // namespace properties +} // namespace openspace + +#endif // __WCHARPROPERTY_H__ diff --git a/include/openspace/rendering/renderable.h b/include/openspace/rendering/renderable.h index de1934821d..4ecd81f97a 100644 --- a/include/openspace/rendering/renderable.h +++ b/include/openspace/rendering/renderable.h @@ -26,7 +26,8 @@ #define __RENDERABLE_H__ #include -#include + +#include #include #include diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 2120554775..6ec9765c4b 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include diff --git a/include/openspace/rendering/screenspacerenderable.h b/include/openspace/rendering/screenspacerenderable.h index 46cea14e32..adc6633787 100644 --- a/include/openspace/rendering/screenspacerenderable.h +++ b/include/openspace/rendering/screenspacerenderable.h @@ -27,9 +27,10 @@ #include -#include #include -#include +#include +#include +#include #include #include diff --git a/include/openspace/util/powerscaledsphere.h b/include/openspace/util/powerscaledsphere.h index 26d36eb2ce..c7e6bd8576 100644 --- a/include/openspace/util/powerscaledsphere.h +++ b/include/openspace/util/powerscaledsphere.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace openspace { diff --git a/modules/base/rendering/modelgeometry.h b/modules/base/rendering/modelgeometry.h index edfbada197..f01989799a 100644 --- a/modules/base/rendering/modelgeometry.h +++ b/modules/base/rendering/modelgeometry.h @@ -28,7 +28,6 @@ #include #include -#include #include #include diff --git a/modules/base/rendering/renderableconstellationbounds.cpp b/modules/base/rendering/renderableconstellationbounds.cpp index 66c279f4d3..b75c5fdbc7 100644 --- a/modules/base/rendering/renderableconstellationbounds.cpp +++ b/modules/base/rendering/renderableconstellationbounds.cpp @@ -61,7 +61,7 @@ namespace { namespace openspace { RenderableConstellationBounds::RenderableConstellationBounds( - const ghoul::Dictionary& dictionary) + const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _vertexFilename("") , _constellationFilename("") @@ -91,9 +91,6 @@ RenderableConstellationBounds::RenderableConstellationBounds( ); } -RenderableConstellationBounds::~RenderableConstellationBounds() { -} - bool RenderableConstellationBounds::initialize() { RenderEngine& renderEngine = OsEng.renderEngine(); _program = renderEngine.buildRenderProgram("ConstellationBounds", diff --git a/modules/base/rendering/renderableconstellationbounds.h b/modules/base/rendering/renderableconstellationbounds.h index b4b7774c0f..2a6ab74a04 100644 --- a/modules/base/rendering/renderableconstellationbounds.h +++ b/modules/base/rendering/renderableconstellationbounds.h @@ -26,6 +26,7 @@ #define __RENDERABLECONSTELLATIONBOUNDS_H__ #include + #include #include #include @@ -53,7 +54,6 @@ namespace openspace { class RenderableConstellationBounds : public Renderable { public: RenderableConstellationBounds(const ghoul::Dictionary& dictionary); - ~RenderableConstellationBounds(); bool initialize() override; bool deinitialize() override; diff --git a/modules/base/rendering/renderablemodel.h b/modules/base/rendering/renderablemodel.h index 5f842336ca..a476562be9 100644 --- a/modules/base/rendering/renderablemodel.h +++ b/modules/base/rendering/renderablemodel.h @@ -28,7 +28,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/modules/base/rendering/renderablepath.cpp b/modules/base/rendering/renderablepath.cpp index b94d02f178..f0e3623950 100644 --- a/modules/base/rendering/renderablepath.cpp +++ b/modules/base/rendering/renderablepath.cpp @@ -52,7 +52,6 @@ namespace { const char* keyPointSteps = "PointSteps"; const char* keyDrawLine = "DrawLine"; const char* keRenderDistanceInterval = "RenderDistanceInterval"; - } namespace openspace { diff --git a/modules/base/rendering/renderablepath.h b/modules/base/rendering/renderablepath.h index 4e8cdeefb7..5627363162 100644 --- a/modules/base/rendering/renderablepath.h +++ b/modules/base/rendering/renderablepath.h @@ -26,8 +26,8 @@ #define __RENDERABLEPATH_H__ #include -#include -#include +#include +#include #include diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h index fc4e8f795c..8057895d52 100644 --- a/modules/base/rendering/renderableplane.h +++ b/modules/base/rendering/renderableplane.h @@ -28,7 +28,8 @@ #include #include -#include +#include +#include #include namespace ghoul { diff --git a/modules/base/rendering/renderableplanet.h b/modules/base/rendering/renderableplanet.h index 9080b60fd4..47f26ea491 100644 --- a/modules/base/rendering/renderableplanet.h +++ b/modules/base/rendering/renderableplanet.h @@ -29,6 +29,9 @@ #include #include +#include +#include +#include #include #include diff --git a/modules/base/rendering/renderablerings.h b/modules/base/rendering/renderablerings.h index 75aa28a8c8..f6319ceece 100644 --- a/modules/base/rendering/renderablerings.h +++ b/modules/base/rendering/renderablerings.h @@ -29,7 +29,8 @@ #include #include -#include +#include +#include #include namespace ghoul { diff --git a/modules/base/rendering/renderablesphere.h b/modules/base/rendering/renderablesphere.h index 2a2d49c1b0..8b82e0f8b0 100644 --- a/modules/base/rendering/renderablesphere.h +++ b/modules/base/rendering/renderablesphere.h @@ -30,7 +30,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/modules/base/rendering/renderablestars.h b/modules/base/rendering/renderablestars.h index a40a732d3a..b1c309d3c4 100644 --- a/modules/base/rendering/renderablestars.h +++ b/modules/base/rendering/renderablestars.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include namespace ghoul { namespace filesystem { diff --git a/modules/base/rendering/renderabletrail.h b/modules/base/rendering/renderabletrail.h index a43dc7974f..fac2259f49 100644 --- a/modules/base/rendering/renderabletrail.h +++ b/modules/base/rendering/renderabletrail.h @@ -29,9 +29,11 @@ #include #include -#include +#include +#include +#include #include -#include +#include #include diff --git a/modules/base/rendering/renderabletrailorbit.h b/modules/base/rendering/renderabletrailorbit.h index 68ec1ca7f1..2b8f5a4712 100644 --- a/modules/base/rendering/renderabletrailorbit.h +++ b/modules/base/rendering/renderabletrailorbit.h @@ -28,7 +28,8 @@ #include #include -#include +#include +#include namespace openspace { diff --git a/modules/base/rendering/renderabletrailtrajectory.h b/modules/base/rendering/renderabletrailtrajectory.h index b913d40118..bba77cfa68 100644 --- a/modules/base/rendering/renderabletrailtrajectory.h +++ b/modules/base/rendering/renderabletrailtrajectory.h @@ -28,7 +28,9 @@ #include #include -#include +#include +#include +#include #include namespace openspace { diff --git a/modules/base/rendering/screenspaceframebuffer.h b/modules/base/rendering/screenspaceframebuffer.h index e9f6586bb1..6bce0a9ab5 100644 --- a/modules/base/rendering/screenspaceframebuffer.h +++ b/modules/base/rendering/screenspaceframebuffer.h @@ -21,10 +21,13 @@ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ + #ifndef __SCREENSPACEFRAMEBUFFER_H__ #define __SCREENSPACEFRAMEBUFFER_H__ #include + +#include #include #include diff --git a/modules/base/rendering/simplespheregeometry.h b/modules/base/rendering/simplespheregeometry.h index 1b752a2b48..0d7fa3de9a 100644 --- a/modules/base/rendering/simplespheregeometry.h +++ b/modules/base/rendering/simplespheregeometry.h @@ -26,8 +26,9 @@ #define __SIMPLESPHEREGEOMETRY_H__ #include -#include -#include + +#include +#include namespace openspace { diff --git a/modules/base/rotation/staticrotation.h b/modules/base/rotation/staticrotation.h index 8df5c8637e..95490dd186 100644 --- a/modules/base/rotation/staticrotation.h +++ b/modules/base/rotation/staticrotation.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace openspace { diff --git a/modules/base/scale/staticscale.h b/modules/base/scale/staticscale.h index e99e07fd60..29db57acd3 100644 --- a/modules/base/scale/staticscale.h +++ b/modules/base/scale/staticscale.h @@ -28,6 +28,7 @@ #include #include +#include namespace openspace { diff --git a/modules/base/translation/statictranslation.h b/modules/base/translation/statictranslation.h index 3a71266c28..f753e92202 100644 --- a/modules/base/translation/statictranslation.h +++ b/modules/base/translation/statictranslation.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace openspace { diff --git a/modules/debugging/rendering/renderabledebugplane.h b/modules/debugging/rendering/renderabledebugplane.h index 40b2621aba..2afeadab05 100644 --- a/modules/debugging/rendering/renderabledebugplane.h +++ b/modules/debugging/rendering/renderabledebugplane.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include namespace ghoul { diff --git a/modules/globebrowsing/globes/renderableglobe.h b/modules/globebrowsing/globes/renderableglobe.h index f854a94156..78ac016114 100644 --- a/modules/globebrowsing/globes/renderableglobe.h +++ b/modules/globebrowsing/globes/renderableglobe.h @@ -34,6 +34,9 @@ #include #include +#include +#include + #include #include diff --git a/modules/newhorizons/rendering/renderablefov.h b/modules/newhorizons/rendering/renderablefov.h index c752f49d9d..eb8750ac88 100644 --- a/modules/newhorizons/rendering/renderablefov.h +++ b/modules/newhorizons/rendering/renderablefov.h @@ -27,6 +27,8 @@ #include +#include +#include #include #include diff --git a/modules/newhorizons/rendering/renderablemodelprojection.h b/modules/newhorizons/rendering/renderablemodelprojection.h index 60349f5033..317b486781 100644 --- a/modules/newhorizons/rendering/renderablemodelprojection.h +++ b/modules/newhorizons/rendering/renderablemodelprojection.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/modules/newhorizons/rendering/renderableplaneprojection.h b/modules/newhorizons/rendering/renderableplaneprojection.h index 7c2ee5b6ac..8981bdc5c0 100644 --- a/modules/newhorizons/rendering/renderableplaneprojection.h +++ b/modules/newhorizons/rendering/renderableplaneprojection.h @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/modules/newhorizons/rendering/renderableshadowcylinder.h b/modules/newhorizons/rendering/renderableshadowcylinder.h index bd05fda49a..09f1b9d188 100644 --- a/modules/newhorizons/rendering/renderableshadowcylinder.h +++ b/modules/newhorizons/rendering/renderableshadowcylinder.h @@ -28,7 +28,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/modules/newhorizons/util/projectioncomponent.h b/modules/newhorizons/util/projectioncomponent.h index ef6b57cd4e..3e027cb7f4 100644 --- a/modules/newhorizons/util/projectioncomponent.h +++ b/modules/newhorizons/util/projectioncomponent.h @@ -28,9 +28,11 @@ #include #include -#include #include -#include +#include +#include +#include +#include #include #include diff --git a/modules/onscreengui/include/guicomponent.h b/modules/onscreengui/include/guicomponent.h index dd4baeba70..585870ba4d 100644 --- a/modules/onscreengui/include/guicomponent.h +++ b/modules/onscreengui/include/guicomponent.h @@ -26,7 +26,7 @@ #define __GUICOMPONENT_H__ #include -#include +#include namespace openspace { namespace gui { diff --git a/modules/onscreengui/include/guiperformancecomponent.h b/modules/onscreengui/include/guiperformancecomponent.h index 20e06f137c..33a7ac5667 100644 --- a/modules/onscreengui/include/guiperformancecomponent.h +++ b/modules/onscreengui/include/guiperformancecomponent.h @@ -27,6 +27,9 @@ #include +#include +#include + #include #include diff --git a/modules/toyvolume/rendering/renderabletoyvolume.h b/modules/toyvolume/rendering/renderabletoyvolume.h index 9c08f1af14..59f4dacf65 100644 --- a/modules/toyvolume/rendering/renderabletoyvolume.h +++ b/modules/toyvolume/rendering/renderabletoyvolume.h @@ -25,15 +25,18 @@ #ifndef __RENDERABLETOYVOLUME_H__ #define __RENDERABLETOYVOLUME_H__ -#include +#include + +#include +#include +#include +#include #include #include -#include -#include - namespace openspace { +class ToyVolumeRaycaster; struct RenderData; class RenderableToyVolume : public Renderable { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d65f2e49f..2a6220dd90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,15 +65,61 @@ set(OPENSPACE_SOURCE ${OPENSPACE_BASE_DIR}/src/performance/performancemeasurement.cpp ${OPENSPACE_BASE_DIR}/src/performance/performancelayout.cpp ${OPENSPACE_BASE_DIR}/src/performance/performancemanager.cpp - ${OPENSPACE_BASE_DIR}/src/properties/matrixproperty.cpp ${OPENSPACE_BASE_DIR}/src/properties/optionproperty.cpp ${OPENSPACE_BASE_DIR}/src/properties/property.cpp ${OPENSPACE_BASE_DIR}/src/properties/propertyowner.cpp - ${OPENSPACE_BASE_DIR}/src/properties/scalarproperty.cpp ${OPENSPACE_BASE_DIR}/src/properties/selectionproperty.cpp ${OPENSPACE_BASE_DIR}/src/properties/stringproperty.cpp ${OPENSPACE_BASE_DIR}/src/properties/triggerproperty.cpp - ${OPENSPACE_BASE_DIR}/src/properties/vectorproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2x3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat2x4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat3x2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat3x4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat4x2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat4x3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/dmat4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat2x3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat2x4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat3x2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat3x4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat4x2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat4x3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/matrix/mat4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/boolproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/charproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/doubleproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/floatproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/intproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/longdoubleproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/longlongproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/longproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/shortproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/signedcharproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/ucharproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/uintproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/ulonglongproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/ulongproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/ushortproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/scalar/wcharproperty.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/bvec2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/bvec3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/bvec4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/dvec2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/dvec3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/dvec4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/ivec2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/ivec3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/ivec4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/uvec2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/uvec3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/uvec4property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/vec2property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/vec3property.cpp + ${OPENSPACE_BASE_DIR}/src/properties/vector/vec4property.cpp ${OPENSPACE_BASE_DIR}/src/query/query.cpp ${OPENSPACE_BASE_DIR}/src/rendering/abufferrenderer.cpp ${OPENSPACE_BASE_DIR}/src/rendering/framebufferrenderer.cpp @@ -172,6 +218,55 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/properties/templateproperty.inl ${OPENSPACE_BASE_DIR}/include/openspace/properties/triggerproperty.h ${OPENSPACE_BASE_DIR}/include/openspace/properties/vectorproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2x3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat2x4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat3x2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat3x4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat4x2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat4x3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/dmat4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat2x3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat2x4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat3x2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat3x4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat4x2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat4x3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/matrix/mat4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/boolproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/charproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/doubleproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/floatproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/intproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/longdoubleproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/longlongproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/longproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/shortproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/signedcharproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/ucharproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/uintproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/ulonglongproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/ulongproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/ushortproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/scalar/wcharproperty.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/bvec2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/bvec3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/bvec4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/dvec2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/dvec3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/dvec4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/ivec2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/ivec3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/ivec4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/uvec2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/uvec3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/uvec4property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/vec2property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/vec3property.h + ${OPENSPACE_BASE_DIR}/include/openspace/properties/vector/vec4property.h ${OPENSPACE_BASE_DIR}/include/openspace/query/query.h ${OPENSPACE_BASE_DIR}/include/openspace/rendering/abufferrenderer.h ${OPENSPACE_BASE_DIR}/include/openspace/rendering/framebufferrenderer.h diff --git a/src/properties/matrix/dmat2property.cpp b/src/properties/matrix/dmat2property.cpp new file mode 100644 index 0000000000..5803a22efa --- /dev/null +++ b/src/properties/matrix/dmat2property.cpp @@ -0,0 +1,140 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat2Property, glm::dmat2x2, glm::dmat2x2(0), + glm::dmat2x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat2x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat2x2( + 0.01, 0.01, + 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x2), + DEFAULT_TO_LUA_LAMBDA(glm::dmat2x2), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x2), + DEFAULT_TO_STRING_LAMBDA(glm::dmat2x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat2x3property.cpp b/src/properties/matrix/dmat2x3property.cpp new file mode 100644 index 0000000000..d19e4c2ab5 --- /dev/null +++ b/src/properties/matrix/dmat2x3property.cpp @@ -0,0 +1,144 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x3Property, glm::dmat2x3, glm::dmat2x3(0), + glm::dmat2x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat2x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat2x3( + 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x3), + DEFAULT_TO_LUA_LAMBDA(glm::dmat2x3), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x3), + DEFAULT_TO_STRING_LAMBDA(glm::dmat2x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat2x4property.cpp b/src/properties/matrix/dmat2x4property.cpp new file mode 100644 index 0000000000..c98c3c6457 --- /dev/null +++ b/src/properties/matrix/dmat2x4property.cpp @@ -0,0 +1,148 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x4Property, glm::dmat2x4, glm::dmat2x4(0), + glm::dmat2x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat2x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat2x4( + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x4), + DEFAULT_TO_LUA_LAMBDA(glm::dmat2x4), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x4), + DEFAULT_TO_STRING_LAMBDA(glm::dmat2x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat3property.cpp b/src/properties/matrix/dmat3property.cpp new file mode 100644 index 0000000000..5b5bed6e59 --- /dev/null +++ b/src/properties/matrix/dmat3property.cpp @@ -0,0 +1,151 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat3Property, glm::dmat3x3, glm::dmat3x3(0), + glm::dmat3x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat3x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat3x3( + 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x3), + DEFAULT_TO_LUA_LAMBDA(glm::dmat3x3), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x3), + DEFAULT_TO_STRING_LAMBDA(glm::dmat3x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat3x2property.cpp b/src/properties/matrix/dmat3x2property.cpp new file mode 100644 index 0000000000..1bd04eb146 --- /dev/null +++ b/src/properties/matrix/dmat3x2property.cpp @@ -0,0 +1,144 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x2Property, glm::dmat3x2, glm::dmat3x2(0), + glm::dmat3x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat3x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat3x2( + 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x2), + DEFAULT_TO_LUA_LAMBDA(glm::dmat3x2), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x2), + DEFAULT_TO_STRING_LAMBDA(glm::dmat3x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat3x4property.cpp b/src/properties/matrix/dmat3x4property.cpp new file mode 100644 index 0000000000..99dfe5283a --- /dev/null +++ b/src/properties/matrix/dmat3x4property.cpp @@ -0,0 +1,157 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x4Property, glm::dmat3x4, glm::dmat3x4(0), + glm::dmat3x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat3x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat3x4( + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x4), + DEFAULT_TO_LUA_LAMBDA(glm::dmat3x4), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x4), + DEFAULT_TO_STRING_LAMBDA(glm::dmat3x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat4property.cpp b/src/properties/matrix/dmat4property.cpp new file mode 100644 index 0000000000..2d9c24003c --- /dev/null +++ b/src/properties/matrix/dmat4property.cpp @@ -0,0 +1,166 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat4Property, glm::dmat4x4, glm::dmat4x4(0), + glm::dmat4x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat4x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat4x4( + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x4), + DEFAULT_TO_LUA_LAMBDA(glm::dmat4x4), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x4), + DEFAULT_TO_STRING_LAMBDA(glm::dmat4x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat4x2property.cpp b/src/properties/matrix/dmat4x2property.cpp new file mode 100644 index 0000000000..b4b132d47b --- /dev/null +++ b/src/properties/matrix/dmat4x2property.cpp @@ -0,0 +1,148 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x2Property, glm::dmat4x2, glm::dmat4x2(0), + glm::dmat4x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat4x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat4x2( + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x2), + DEFAULT_TO_LUA_LAMBDA(glm::dmat4x2), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x2), + DEFAULT_TO_STRING_LAMBDA(glm::dmat4x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/dmat4x3property.cpp b/src/properties/matrix/dmat4x3property.cpp new file mode 100644 index 0000000000..306e259976 --- /dev/null +++ b/src/properties/matrix/dmat4x3property.cpp @@ -0,0 +1,157 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x3Property, glm::dmat4x3, glm::dmat4x3(0), + glm::dmat4x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::dmat4x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::dmat4x3( + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01, + 0.01, 0.01, 0.01, 0.01 + ), + DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x3), + DEFAULT_TO_LUA_LAMBDA(glm::dmat4x3), + DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x3), + DEFAULT_TO_STRING_LAMBDA(glm::dmat4x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat2property.cpp b/src/properties/matrix/mat2property.cpp new file mode 100644 index 0000000000..f2736c6a9e --- /dev/null +++ b/src/properties/matrix/mat2property.cpp @@ -0,0 +1,140 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat2Property, glm::mat2x2, glm::mat2x2(0), + glm::mat2x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat2x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat2x2( + 0.01f, 0.01f, + 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat2x2), + DEFAULT_TO_LUA_LAMBDA(glm::mat2x2), + DEFAULT_FROM_STRING_LAMBDA(glm::mat2x2), + DEFAULT_TO_STRING_LAMBDA(glm::mat2x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat2x3property.cpp b/src/properties/matrix/mat2x3property.cpp new file mode 100644 index 0000000000..cf42b7261a --- /dev/null +++ b/src/properties/matrix/mat2x3property.cpp @@ -0,0 +1,144 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x3Property, glm::mat2x3, glm::mat2x3(0), + glm::mat2x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat2x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat2x3( + 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat2x3), + DEFAULT_TO_LUA_LAMBDA(glm::mat2x3), + DEFAULT_FROM_STRING_LAMBDA(glm::mat2x3), + DEFAULT_TO_STRING_LAMBDA(glm::mat2x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat2x4property.cpp b/src/properties/matrix/mat2x4property.cpp new file mode 100644 index 0000000000..fac1405f6a --- /dev/null +++ b/src/properties/matrix/mat2x4property.cpp @@ -0,0 +1,148 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x4Property, glm::mat2x4, glm::mat2x4(0), + glm::mat2x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat2x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat2x4( + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat2x4), + DEFAULT_TO_LUA_LAMBDA(glm::mat2x4), + DEFAULT_FROM_STRING_LAMBDA(glm::mat2x4), + DEFAULT_TO_STRING_LAMBDA(glm::mat2x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat3property.cpp b/src/properties/matrix/mat3property.cpp new file mode 100644 index 0000000000..fb8f473434 --- /dev/null +++ b/src/properties/matrix/mat3property.cpp @@ -0,0 +1,151 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat3Property, glm::mat3x3, glm::mat3x3(0), + glm::mat3x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat3x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat3x3( + 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat3x3), + DEFAULT_TO_LUA_LAMBDA(glm::mat3x3), + DEFAULT_FROM_STRING_LAMBDA(glm::mat3x3), + DEFAULT_TO_STRING_LAMBDA(glm::mat3x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat3x2property.cpp b/src/properties/matrix/mat3x2property.cpp new file mode 100644 index 0000000000..e230b7904d --- /dev/null +++ b/src/properties/matrix/mat3x2property.cpp @@ -0,0 +1,144 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x2Property, glm::mat3x2, glm::mat3x2(0), + glm::mat3x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat3x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat3x2( + 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat3x2), + DEFAULT_TO_LUA_LAMBDA(glm::mat3x2), + DEFAULT_FROM_STRING_LAMBDA(glm::mat3x2), + DEFAULT_TO_STRING_LAMBDA(glm::mat3x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat3x4property.cpp b/src/properties/matrix/mat3x4property.cpp new file mode 100644 index 0000000000..f17c44d825 --- /dev/null +++ b/src/properties/matrix/mat3x4property.cpp @@ -0,0 +1,157 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x4Property, glm::mat3x4, glm::mat3x4(0), + glm::mat3x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat3x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat3x4( + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat3x4), + DEFAULT_TO_LUA_LAMBDA(glm::mat3x4), + DEFAULT_FROM_STRING_LAMBDA(glm::mat3x4), + DEFAULT_TO_STRING_LAMBDA(glm::mat3x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat4property.cpp b/src/properties/matrix/mat4property.cpp new file mode 100644 index 0000000000..1d7ff0b614 --- /dev/null +++ b/src/properties/matrix/mat4property.cpp @@ -0,0 +1,166 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat4Property, glm::mat4x4, glm::mat4x4(0), + glm::mat4x4( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat4x4( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat4x4( + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat4x4), + DEFAULT_TO_LUA_LAMBDA(glm::mat4x4), + DEFAULT_FROM_STRING_LAMBDA(glm::mat4x4), + DEFAULT_TO_STRING_LAMBDA(glm::mat4x4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat4x2property.cpp b/src/properties/matrix/mat4x2property.cpp new file mode 100644 index 0000000000..ca90cf41f6 --- /dev/null +++ b/src/properties/matrix/mat4x2property.cpp @@ -0,0 +1,148 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x2Property, glm::mat4x2, glm::mat4x2(0), + glm::mat4x2( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat4x2( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat4x2( + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat4x2), + DEFAULT_TO_LUA_LAMBDA(glm::mat4x2), + DEFAULT_FROM_STRING_LAMBDA(glm::mat4x2), + DEFAULT_TO_STRING_LAMBDA(glm::mat4x2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrix/mat4x3property.cpp b/src/properties/matrix/mat4x3property.cpp new file mode 100644 index 0000000000..bdc1fecb21 --- /dev/null +++ b/src/properties/matrix/mat4x3property.cpp @@ -0,0 +1,157 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_getfield(state, -1, std::to_string(number).c_str()); \ + if (lua_isnumber(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i][j] \ + = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ + lua_pop(state, 1); \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State* state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + lua_pushnumber(state, static_cast(value[i][j])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != \ + (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ + { \ + success = false; \ + return result; \ + } \ + int number = 0; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + std::stringstream s(tokens[number]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else { \ + result[i][j] = v; \ + ++number; \ + } \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = ""; \ + for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ + for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ + outValue += std::to_string(inValue[i][j]) + ","; \ + } \ + outValue.pop_back(); \ + } \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x3Property, glm::mat4x3, glm::mat4x3(0), + glm::mat4x3( + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest(), + numeric_limits::lowest() + ), + glm::mat4x3( + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max() + ), + glm::mat4x3( + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f, + 0.01f, 0.01f, 0.01f, 0.01f + ), + DEFAULT_FROM_LUA_LAMBDA(glm::mat4x3), + DEFAULT_TO_LUA_LAMBDA(glm::mat4x3), + DEFAULT_FROM_STRING_LAMBDA(glm::mat4x3), + DEFAULT_TO_STRING_LAMBDA(glm::mat4x3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/matrixproperty.cpp b/src/properties/matrixproperty.cpp deleted file mode 100644 index ca33757247..0000000000 --- a/src/properties/matrixproperty.cpp +++ /dev/null @@ -1,721 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2016 * - * * - * 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 - -#include - -#include -#include -#include - -using std::numeric_limits; - -namespace openspace { -namespace properties { - -#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__) \ - [](lua_State* state, bool& success) -> __TYPE__ { \ - __TYPE__ result; \ - int number = 1; \ - for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ - for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ - lua_getfield(state, -1, std::to_string(number).c_str()); \ - if (lua_isnumber(state, -1) != 1) { \ - success = false; \ - return __TYPE__(0); \ - } else { \ - result[i][j] \ - = static_cast<__TYPE__::value_type>(lua_tonumber(state, -1)); \ - lua_pop(state, 1); \ - ++number; \ - } \ - } \ - } \ - success = true; \ - return result; \ - } - -#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ - [](lua_State* state, __TYPE__ value) -> bool { \ - lua_newtable(state); \ - int number = 1; \ - for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ - for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ - lua_pushnumber(state, static_cast(value[i][j])); \ - lua_setfield(state, -2, std::to_string(number).c_str()); \ - ++number; \ - } \ - } \ - return true; \ - } - -#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ - [](std::string value, bool& success) -> __TYPE__ { \ - __TYPE__ result; \ - std::vector tokens = ghoul::tokenizeString(value, ','); \ - if (tokens.size() != \ - (ghoul::glm_rows<__TYPE__>::value * ghoul::glm_cols<__TYPE__>::value)) \ - { \ - success = false; \ - return result; \ - } \ - int number = 0; \ - for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ - for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ - std::stringstream s(tokens[number]); \ - __TYPE__::value_type v; \ - s >> v; \ - if (s.fail()) { \ - success = false; \ - return result; \ - } \ - else { \ - result[i][j] = v; \ - ++number; \ - } \ - } \ - } \ - success = true; \ - return result; \ - } - -#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ - [](std::string& outValue, __TYPE__ inValue) -> bool { \ - outValue = ""; \ - for (glm::length_t i = 0; i < ghoul::glm_cols<__TYPE__>::value; ++i) { \ - for (glm::length_t j = 0; j < ghoul::glm_rows<__TYPE__>::value; ++j) { \ - outValue += std::to_string(inValue[i][j]) + ","; \ - } \ - outValue.pop_back(); \ - } \ - return true; \ - } - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat2Property, glm::mat2x2, glm::mat2x2(0), - glm::mat2x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat2x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat2x2( - 0.01f, 0.01f, - 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat2x2), - DEFAULT_TO_LUA_LAMBDA(glm::mat2x2), - DEFAULT_FROM_STRING_LAMBDA(glm::mat2x2), - DEFAULT_TO_STRING_LAMBDA(glm::mat2x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x3Property, glm::mat2x3, glm::mat2x3(0), - glm::mat2x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat2x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat2x3( - 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat2x3), - DEFAULT_TO_LUA_LAMBDA(glm::mat2x3), - DEFAULT_FROM_STRING_LAMBDA(glm::mat2x3), - DEFAULT_TO_STRING_LAMBDA(glm::mat2x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x4Property, glm::mat2x4, glm::mat2x4(0), - glm::mat2x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat2x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat2x4( - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat2x4), - DEFAULT_TO_LUA_LAMBDA(glm::mat2x4), - DEFAULT_FROM_STRING_LAMBDA(glm::mat2x4), - DEFAULT_TO_STRING_LAMBDA(glm::mat2x4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x2Property, glm::mat3x2, glm::mat3x2(0), - glm::mat3x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat3x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat3x2( - 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat3x2), - DEFAULT_TO_LUA_LAMBDA(glm::mat3x2), - DEFAULT_FROM_STRING_LAMBDA(glm::mat3x2), - DEFAULT_TO_STRING_LAMBDA(glm::mat3x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat3Property, glm::mat3x3, glm::mat3x3(0), - glm::mat3x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat3x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat3x3( - 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat3x3), - DEFAULT_TO_LUA_LAMBDA(glm::mat3x3), - DEFAULT_FROM_STRING_LAMBDA(glm::mat3x3), - DEFAULT_TO_STRING_LAMBDA(glm::mat3x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x4Property, glm::mat3x4, glm::mat3x4(0), - glm::mat3x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat3x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat3x4( - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat3x4), - DEFAULT_TO_LUA_LAMBDA(glm::mat3x4), - DEFAULT_FROM_STRING_LAMBDA(glm::mat3x4), - DEFAULT_TO_STRING_LAMBDA(glm::mat3x4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x2Property, glm::mat4x2, glm::mat4x2(0), - glm::mat4x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat4x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat4x2( - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat4x2), - DEFAULT_TO_LUA_LAMBDA(glm::mat4x2), - DEFAULT_FROM_STRING_LAMBDA(glm::mat4x2), - DEFAULT_TO_STRING_LAMBDA(glm::mat4x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x3Property, glm::mat4x3, glm::mat4x3(0), - glm::mat4x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat4x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat4x3( - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat4x3), - DEFAULT_TO_LUA_LAMBDA(glm::mat4x3), - DEFAULT_FROM_STRING_LAMBDA(glm::mat4x3), - DEFAULT_TO_STRING_LAMBDA(glm::mat4x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Mat4Property, glm::mat4x4, glm::mat4x4(0), - glm::mat4x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::mat4x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::mat4x4( - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f, - 0.01f, 0.01f, 0.01f, 0.01f - ), - DEFAULT_FROM_LUA_LAMBDA(glm::mat4x4), - DEFAULT_TO_LUA_LAMBDA(glm::mat4x4), - DEFAULT_FROM_STRING_LAMBDA(glm::mat4x4), - DEFAULT_TO_STRING_LAMBDA(glm::mat4x4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat2Property, glm::dmat2x2, glm::dmat2x2(0), - glm::dmat2x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat2x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat2x2( - 0.01, 0.01, - 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x2), - DEFAULT_TO_LUA_LAMBDA(glm::dmat2x2), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x2), - DEFAULT_TO_STRING_LAMBDA(glm::dmat2x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x3Property, glm::dmat2x3, glm::dmat2x3(0), - glm::dmat2x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat2x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat2x3( - 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x3), - DEFAULT_TO_LUA_LAMBDA(glm::dmat2x3), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x3), - DEFAULT_TO_STRING_LAMBDA(glm::dmat2x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x4Property, glm::dmat2x4, glm::dmat2x4(0), - glm::dmat2x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat2x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat2x4( - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat2x4), - DEFAULT_TO_LUA_LAMBDA(glm::dmat2x4), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x4), - DEFAULT_TO_STRING_LAMBDA(glm::dmat2x4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x2Property, glm::dmat3x2, glm::dmat3x2(0), - glm::dmat3x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat3x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat3x2( - 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x2), - DEFAULT_TO_LUA_LAMBDA(glm::dmat3x2), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x2), - DEFAULT_TO_STRING_LAMBDA(glm::dmat3x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat3Property, glm::dmat3x3, glm::dmat3x3(0), - glm::dmat3x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat3x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat3x3( - 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x3), - DEFAULT_TO_LUA_LAMBDA(glm::dmat3x3), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x3), - DEFAULT_TO_STRING_LAMBDA(glm::dmat3x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x4Property, glm::dmat3x4, glm::dmat3x4(0), - glm::dmat3x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat3x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat3x4( - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat3x4), - DEFAULT_TO_LUA_LAMBDA(glm::dmat3x4), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x4), - DEFAULT_TO_STRING_LAMBDA(glm::dmat3x4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x2Property, glm::dmat4x2, glm::dmat4x2(0), - glm::dmat4x2( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat4x2( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat4x2( - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x2), - DEFAULT_TO_LUA_LAMBDA(glm::dmat4x2), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x2), - DEFAULT_TO_STRING_LAMBDA(glm::dmat4x2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x3Property, glm::dmat4x3, glm::dmat4x3(0), - glm::dmat4x3( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat4x3( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat4x3( - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x3), - DEFAULT_TO_LUA_LAMBDA(glm::dmat4x3), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x3), - DEFAULT_TO_STRING_LAMBDA(glm::dmat4x3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DMat4Property, glm::dmat4x4, glm::dmat4x4(0), - glm::dmat4x4( - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest(), - numeric_limits::lowest() - ), - glm::dmat4x4( - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max() - ), - glm::dmat4x4( - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01, - 0.01, 0.01, 0.01, 0.01 - ), - DEFAULT_FROM_LUA_LAMBDA(glm::dmat4x4), - DEFAULT_TO_LUA_LAMBDA(glm::dmat4x4), - DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x4), - DEFAULT_TO_STRING_LAMBDA(glm::dmat4x4), - LUA_TTABLE); - -} // namespace properties -} // namespace openspace diff --git a/src/properties/scalar/boolproperty.cpp b/src/properties/scalar/boolproperty.cpp new file mode 100644 index 0000000000..c150cf276b --- /dev/null +++ b/src/properties/scalar/boolproperty.cpp @@ -0,0 +1,67 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +namespace openspace { +namespace properties { + +REGISTER_TEMPLATEPROPERTY_SOURCE(BoolProperty, bool, false, + [](lua_State* state, bool& success) -> bool { + success = (lua_isboolean(state, -1) == 1); + if (success) { + return lua_toboolean(state, -1) == 1; + } + else { + return false; + } + }, + [](lua_State* state, bool value) -> bool { + lua_pushboolean(state, value); + return true; + }, + [](std::string value, bool& success) -> bool { + std::stringstream s(value); + bool v; + s >> v; + success = !s.fail(); + if (success) { + return v; + } + }, + [](std::string& outValue, bool inValue) -> bool { + outValue = inValue ? "true" : "false"; + return true; + }, + LUA_TBOOLEAN +); + + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/charproperty.cpp b/src/properties/scalar/charproperty.cpp new file mode 100644 index 0000000000..57e3b78ff0 --- /dev/null +++ b/src/properties/scalar/charproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(CharProperty, char, char(0), + numeric_limits::lowest(), + numeric_limits::max(), char(1), + DEFAULT_FROM_LUA_LAMBDA(char, char(0)), + DEFAULT_TO_LUA_LAMBDA(char), + DEFAULT_FROM_STRING_LAMBDA(char, char(0)), + DEFAULT_TO_STRING_LAMBDA(char), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/doubleproperty.cpp b/src/properties/scalar/doubleproperty.cpp new file mode 100644 index 0000000000..0e6d97eb5b --- /dev/null +++ b/src/properties/scalar/doubleproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DoubleProperty, double, 0.0, + numeric_limits::lowest(), + numeric_limits::max(), 0.01, + DEFAULT_FROM_LUA_LAMBDA(double, double(0)), + DEFAULT_TO_LUA_LAMBDA(double), + DEFAULT_FROM_STRING_LAMBDA(double, double(0)), + DEFAULT_TO_STRING_LAMBDA(double), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/floatproperty.cpp b/src/properties/scalar/floatproperty.cpp new file mode 100644 index 0000000000..c42df70e76 --- /dev/null +++ b/src/properties/scalar/floatproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(FloatProperty, float, 0.f, + numeric_limits::lowest(), + numeric_limits::max(), 0.01f, + DEFAULT_FROM_LUA_LAMBDA(float, float(0)), + DEFAULT_TO_LUA_LAMBDA(float), + DEFAULT_FROM_STRING_LAMBDA(float, float(0)), + DEFAULT_TO_STRING_LAMBDA(float), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/intproperty.cpp b/src/properties/scalar/intproperty.cpp new file mode 100644 index 0000000000..43ac9a85f2 --- /dev/null +++ b/src/properties/scalar/intproperty.cpp @@ -0,0 +1,80 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(IntProperty, int, int(0), numeric_limits::lowest(), + numeric_limits::max(), int(1), + DEFAULT_FROM_LUA_LAMBDA(int, int(0)), + DEFAULT_TO_LUA_LAMBDA(int), + DEFAULT_FROM_STRING_LAMBDA(int, int(0)), + DEFAULT_TO_STRING_LAMBDA(int), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/longdoubleproperty.cpp b/src/properties/scalar/longdoubleproperty.cpp new file mode 100644 index 0000000000..2917978abd --- /dev/null +++ b/src/properties/scalar/longdoubleproperty.cpp @@ -0,0 +1,82 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(LongDoubleProperty, long double, (long double)0, + numeric_limits::lowest(), + numeric_limits::max(), (long double)0.01f, + DEFAULT_FROM_LUA_LAMBDA(long double, (long double)(0)), + DEFAULT_TO_LUA_LAMBDA(long double), + DEFAULT_FROM_STRING_LAMBDA(long double, + (long double)(0)), + DEFAULT_TO_STRING_LAMBDA(long double), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/longlongproperty.cpp b/src/properties/scalar/longlongproperty.cpp new file mode 100644 index 0000000000..706ed6cba2 --- /dev/null +++ b/src/properties/scalar/longlongproperty.cpp @@ -0,0 +1,82 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(LongLongProperty, long long, (long long)0, + numeric_limits::lowest(), + numeric_limits::max(), (long long)1, + DEFAULT_FROM_LUA_LAMBDA(long long, (long long)(0)), + DEFAULT_TO_LUA_LAMBDA(long long), + DEFAULT_FROM_STRING_LAMBDA(long long, + (long long)(0)), + DEFAULT_TO_STRING_LAMBDA(long long), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/longproperty.cpp b/src/properties/scalar/longproperty.cpp new file mode 100644 index 0000000000..2e3ddf76f9 --- /dev/null +++ b/src/properties/scalar/longproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(LongProperty, long, long(0), + numeric_limits::lowest(), + numeric_limits::max(), long(1), + DEFAULT_FROM_LUA_LAMBDA(long, long(0)), + DEFAULT_TO_LUA_LAMBDA(long), + DEFAULT_FROM_STRING_LAMBDA(long, long(0)), + DEFAULT_TO_STRING_LAMBDA(long), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/shortproperty.cpp b/src/properties/scalar/shortproperty.cpp new file mode 100644 index 0000000000..d95b09bbee --- /dev/null +++ b/src/properties/scalar/shortproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(ShortProperty, short, short(0), + numeric_limits::lowest(), + numeric_limits::max(), short(1), + DEFAULT_FROM_LUA_LAMBDA(short, short(0)), + DEFAULT_TO_LUA_LAMBDA(short), + DEFAULT_FROM_STRING_LAMBDA(short, short(0)), + DEFAULT_TO_STRING_LAMBDA(short), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/signedcharproperty.cpp b/src/properties/scalar/signedcharproperty.cpp new file mode 100644 index 0000000000..3f0e7e068a --- /dev/null +++ b/src/properties/scalar/signedcharproperty.cpp @@ -0,0 +1,81 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(SignedCharProperty, signed char, (signed char)(0), + numeric_limits::lowest(), + numeric_limits::max(), (signed char)0, + DEFAULT_FROM_LUA_LAMBDA(signed char, (signed char)(0)), + DEFAULT_TO_LUA_LAMBDA(signed char), + DEFAULT_FROM_STRING_LAMBDA(signed char, (signed char)(0)), + DEFAULT_TO_STRING_LAMBDA(signed char), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/ucharproperty.cpp b/src/properties/scalar/ucharproperty.cpp new file mode 100644 index 0000000000..17ecca1c52 --- /dev/null +++ b/src/properties/scalar/ucharproperty.cpp @@ -0,0 +1,80 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) \ + return static_cast(lua_tonumber(state, -1)); \ + else \ + return DEFAULT_VALUE; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) \ + return v; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UCharProperty, unsigned char, (unsigned char)0, + numeric_limits::lowest(), + numeric_limits::max(), (unsigned char)1, + DEFAULT_FROM_LUA_LAMBDA(unsigned char, + (unsigned char)(0)), + DEFAULT_TO_LUA_LAMBDA(unsigned char), + DEFAULT_FROM_STRING_LAMBDA(unsigned char, + (unsigned char)(0)), + DEFAULT_TO_STRING_LAMBDA(unsigned char), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/uintproperty.cpp b/src/properties/scalar/uintproperty.cpp new file mode 100644 index 0000000000..f60782cbd8 --- /dev/null +++ b/src/properties/scalar/uintproperty.cpp @@ -0,0 +1,80 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) \ + return static_cast(lua_tonumber(state, -1)); \ + else \ + return DEFAULT_VALUE; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) \ + return v; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UCharProperty, unsigned int, (unsigned int)0, + numeric_limits::lowest(), + numeric_limits::max(), (unsigned int)1, + DEFAULT_FROM_LUA_LAMBDA(unsigned int, + (unsigned int)(0)), + DEFAULT_TO_LUA_LAMBDA(unsigned int), + DEFAULT_FROM_STRING_LAMBDA(unsigned int, + (unsigned int)(0)), + DEFAULT_TO_STRING_LAMBDA(unsigned int), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/ulonglongproperty.cpp b/src/properties/scalar/ulonglongproperty.cpp new file mode 100644 index 0000000000..6dc195639c --- /dev/null +++ b/src/properties/scalar/ulonglongproperty.cpp @@ -0,0 +1,85 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(ULongLongProperty, unsigned long long, + (unsigned long long)1, + numeric_limits::lowest(), + numeric_limits::max(), + (unsigned long long)1, + DEFAULT_FROM_LUA_LAMBDA(unsigned long long, + (unsigned long long)(0)), + DEFAULT_TO_LUA_LAMBDA(unsigned long long), + DEFAULT_FROM_STRING_LAMBDA(unsigned long long, + (unsigned long long)(0)), + DEFAULT_TO_STRING_LAMBDA(unsigned long long), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/ulongproperty.cpp b/src/properties/scalar/ulongproperty.cpp new file mode 100644 index 0000000000..974204164d --- /dev/null +++ b/src/properties/scalar/ulongproperty.cpp @@ -0,0 +1,83 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(ULongProperty, unsigned long, (unsigned long)0, + numeric_limits::lowest(), + numeric_limits::max(), (unsigned long)1, + DEFAULT_FROM_LUA_LAMBDA(unsigned long, + (unsigned long)(0)), + DEFAULT_TO_LUA_LAMBDA(unsigned long), + DEFAULT_FROM_STRING_LAMBDA(unsigned long, + (unsigned long)(0)), + DEFAULT_TO_STRING_LAMBDA(unsigned long), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/ushortproperty.cpp b/src/properties/scalar/ushortproperty.cpp new file mode 100644 index 0000000000..3369f51f44 --- /dev/null +++ b/src/properties/scalar/ushortproperty.cpp @@ -0,0 +1,84 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ + [](std::string& outValue, TYPE inValue) -> bool { \ + outValue = std::to_string(inValue); \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UShortProperty, unsigned short, (unsigned short)(0), + numeric_limits::lowest(), + numeric_limits::max(), + (unsigned short)1, + DEFAULT_FROM_LUA_LAMBDA(unsigned short, + (unsigned short)(0)), + DEFAULT_TO_LUA_LAMBDA(unsigned short), + DEFAULT_FROM_STRING_LAMBDA(unsigned short, + (unsigned short)(0)), + DEFAULT_TO_STRING_LAMBDA(unsigned short), + LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalar/wcharproperty.cpp b/src/properties/scalar/wcharproperty.cpp new file mode 100644 index 0000000000..9a8c60b1a3 --- /dev/null +++ b/src/properties/scalar/wcharproperty.cpp @@ -0,0 +1,75 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include + +#include +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](lua_State* state, bool& success) -> TYPE { \ + success = (lua_isnumber(state, -1) == 1); \ + if (success) { \ + return static_cast(lua_tonumber(state, -1)); \ + } \ + else { \ + return DEFAULT_VALUE; \ + } \ + } + +#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ + [](lua_State* state, TYPE value) -> bool { \ + lua_pushnumber(state, static_cast(value)); \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ + [](std::string value, bool& success) -> TYPE { \ + std::stringstream s(value); \ + TYPE v; \ + s >> v; \ + success = !s.fail(); \ + if (success) { \ + return v; \ + } \ + } + +//REGISTER_NUMERICALPROPERTY_SOURCE(WCharProperty, wchar_t, wchar_t(0), +// numeric_limits::lowest(), +// numeric_limits::max(), wchar_t(1), +// DEFAULT_FROM_LUA_LAMBDA(wchar_t, wchar_t(0)), +// DEFAULT_TO_LUA_LAMBDA(wchar_t), +// DEFAULT_FROM_STRING_LAMBDA(wchar_t, wchar_t(0)), +// DEFAULT_TO_STRING_LAMBDA(wchar_t), +// LUA_TNUMBER); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/scalarproperty.cpp b/src/properties/scalarproperty.cpp deleted file mode 100644 index d21ba5b5b6..0000000000 --- a/src/properties/scalarproperty.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2016 * - * * - * 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 "openspace/properties/scalarproperty.h" - -#include - -#include -#include - -using std::numeric_limits; - -namespace openspace { -namespace properties { - -#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \ - [](lua_State* state, bool& success) -> TYPE { \ - success = (lua_isnumber(state, -1) == 1); \ - if (success) \ - return static_cast(lua_tonumber(state, -1)); \ - else \ - return DEFAULT_VALUE; \ - } - -#define DEFAULT_TO_LUA_LAMBDA(TYPE) \ - [](lua_State* state, TYPE value) -> bool { \ - lua_pushnumber(state, static_cast(value)); \ - return true; \ - } - -#define DEFAULT_FROM_STRING_LAMBDA(TYPE, DEFAULT_VALUE) \ - [](std::string value, bool& success) -> TYPE { \ - std::stringstream s(value); \ - TYPE v; \ - s >> v; \ - success = !s.fail(); \ - if (success) \ - return v; \ - } - -#define DEFAULT_TO_STRING_LAMBDA(TYPE) \ - [](std::string& outValue, TYPE inValue) -> bool { \ - outValue = std::to_string(inValue); \ - return true; \ - } - -// char16_t and char32_t are not supported on Visual Studio 2013 and are defined to -// be equal to unsigned short and unsigned int which causes a compile error - -REGISTER_TEMPLATEPROPERTY_SOURCE(BoolProperty, bool, false, - [](lua_State* state, bool& success) -> bool { - success = (lua_isboolean(state, -1) == 1); - if (success) - return lua_toboolean(state, -1) == 1; - else - return false; - }, - [](lua_State* state, bool value) -> bool { - lua_pushboolean(state, value); - return true; - }, - DEFAULT_FROM_STRING_LAMBDA(bool, false), - [](std::string& outValue, bool inValue) -> bool { - outValue = inValue ? "true" : "false"; - return true; - }, - LUA_TBOOLEAN - ); - -REGISTER_NUMERICALPROPERTY_SOURCE(CharProperty, char, char(0), - numeric_limits::lowest(), - numeric_limits::max(), char(1), - DEFAULT_FROM_LUA_LAMBDA(char, char(0)), - DEFAULT_TO_LUA_LAMBDA(char), - DEFAULT_FROM_STRING_LAMBDA(char, char(0)), - DEFAULT_TO_STRING_LAMBDA(char), - LUA_TNUMBER); - -// REGISTER_NUMERICALPROPERTY_SOURCE(Char16Property, char16_t, char16_t(0), -// numeric_limits::lowest(), numeric_limits::max(), char16_t(1)); - -// REGISTER_NUMERICALPROPERTY_SOURCE(Char32Property, char32_t, char32_t(0), -// numeric_limits::lowest(), numeric_limits::max(), char32_t(1)); - -//REGISTER_NUMERICALPROPERTY_SOURCE(WCharProperty, wchar_t, wchar_t(0), -// numeric_limits::lowest(), -// numeric_limits::max(), wchar_t(1), -// DEFAULT_FROM_LUA_LAMBDA(wchar_t, wchar_t(0)), -// DEFAULT_TO_LUA_LAMBDA(wchar_t), -// DEFAULT_FROM_STRING_LAMBDA(wchar_t, wchar_t(0)), -// DEFAULT_TO_STRING_LAMBDA(wchar_t), -// LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(SignedCharProperty, signed char, (signed char)(0), - numeric_limits::lowest(), - numeric_limits::max(), (signed char)0, - DEFAULT_FROM_LUA_LAMBDA(signed char, (signed char)(0)), - DEFAULT_TO_LUA_LAMBDA(signed char), - DEFAULT_FROM_STRING_LAMBDA(signed char, (signed char)(0)), - DEFAULT_TO_STRING_LAMBDA(signed char), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(UCharProperty, unsigned char, (unsigned char)0, - numeric_limits::lowest(), - numeric_limits::max(), (unsigned char)1, - DEFAULT_FROM_LUA_LAMBDA(unsigned char, - (unsigned char)(0)), - DEFAULT_TO_LUA_LAMBDA(unsigned char), - DEFAULT_FROM_STRING_LAMBDA(unsigned char, - (unsigned char)(0)), - DEFAULT_TO_STRING_LAMBDA(unsigned char), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(ShortProperty, short, short(0), - numeric_limits::lowest(), - numeric_limits::max(), short(1), - DEFAULT_FROM_LUA_LAMBDA(short, short(0)), - DEFAULT_TO_LUA_LAMBDA(short), - DEFAULT_FROM_STRING_LAMBDA(short, short(0)), - DEFAULT_TO_STRING_LAMBDA(short), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(UShortProperty, unsigned short, (unsigned short)(0), - numeric_limits::lowest(), - numeric_limits::max(), - (unsigned short)1, - DEFAULT_FROM_LUA_LAMBDA(unsigned short, - (unsigned short)(0)), - DEFAULT_TO_LUA_LAMBDA(unsigned short), - DEFAULT_FROM_STRING_LAMBDA(unsigned short, - (unsigned short)(0)), - DEFAULT_TO_STRING_LAMBDA(unsigned short), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(IntProperty, int, int(0), numeric_limits::lowest(), - numeric_limits::max(), int(1), - DEFAULT_FROM_LUA_LAMBDA(int, int(0)), - DEFAULT_TO_LUA_LAMBDA(int), - DEFAULT_FROM_STRING_LAMBDA(int, int(0)), - DEFAULT_TO_STRING_LAMBDA(int), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(UIntProperty, unsigned int, (unsigned int)0, - numeric_limits::lowest(), - numeric_limits::max(), (unsigned int)1, - DEFAULT_FROM_LUA_LAMBDA(unsigned int, - (unsigned int)(0)), - DEFAULT_TO_LUA_LAMBDA(unsigned int), - DEFAULT_FROM_STRING_LAMBDA(unsigned int, - (unsigned int)(0)), - DEFAULT_TO_STRING_LAMBDA(unsigned int), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(LongProperty, long, long(0), - numeric_limits::lowest(), - numeric_limits::max(), long(1), - DEFAULT_FROM_LUA_LAMBDA(long, long(0)), - DEFAULT_TO_LUA_LAMBDA(long), - DEFAULT_FROM_STRING_LAMBDA(long, long(0)), - DEFAULT_TO_STRING_LAMBDA(long), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(ULongProperty, unsigned long, (unsigned long)0, - numeric_limits::lowest(), - numeric_limits::max(), (unsigned long)1, - DEFAULT_FROM_LUA_LAMBDA(unsigned long, - (unsigned long)(0)), - DEFAULT_TO_LUA_LAMBDA(unsigned long), - DEFAULT_FROM_STRING_LAMBDA(unsigned long, - (unsigned long)(0)), - DEFAULT_TO_STRING_LAMBDA(unsigned long), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(LongLongProperty, long long, (long long)0, - numeric_limits::lowest(), - numeric_limits::max(), (long long)1, - DEFAULT_FROM_LUA_LAMBDA(long long, (long long)(0)), - DEFAULT_TO_LUA_LAMBDA(long long), - DEFAULT_FROM_STRING_LAMBDA(long long, - (long long)(0)), - DEFAULT_TO_STRING_LAMBDA(long long), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(ULongLongProperty, unsigned long long, - (unsigned long long)1, - numeric_limits::lowest(), - numeric_limits::max(), - (unsigned long long)1, - DEFAULT_FROM_LUA_LAMBDA(unsigned long long, - (unsigned long long)(0)), - DEFAULT_TO_LUA_LAMBDA(unsigned long long), - DEFAULT_FROM_STRING_LAMBDA(unsigned long long, - (unsigned long long)(0)), - DEFAULT_TO_STRING_LAMBDA(unsigned long long), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(FloatProperty, float, 0.f, - numeric_limits::lowest(), - numeric_limits::max(), 0.01f, - DEFAULT_FROM_LUA_LAMBDA(float, float(0)), - DEFAULT_TO_LUA_LAMBDA(float), - DEFAULT_FROM_STRING_LAMBDA(float, float(0)), - DEFAULT_TO_STRING_LAMBDA(float), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(DoubleProperty, double, 0.0, - numeric_limits::lowest(), - numeric_limits::max(), 0.01, - DEFAULT_FROM_LUA_LAMBDA(double, double(0)), - DEFAULT_TO_LUA_LAMBDA(double), - DEFAULT_FROM_STRING_LAMBDA(double, double(0)), - DEFAULT_TO_STRING_LAMBDA(double), - LUA_TNUMBER); - -REGISTER_NUMERICALPROPERTY_SOURCE(LongDoubleProperty, long double, (long double)0, - numeric_limits::lowest(), - numeric_limits::max(), (long double)0.01f, - DEFAULT_FROM_LUA_LAMBDA(long double, (long double)(0)), - DEFAULT_TO_LUA_LAMBDA(long double), - DEFAULT_FROM_STRING_LAMBDA(long double, - (long double)(0)), - DEFAULT_TO_STRING_LAMBDA(long double), - LUA_TNUMBER); - -} // namespace properties -} // namespace openspace diff --git a/src/properties/selectionproperty.cpp b/src/properties/selectionproperty.cpp index 1049d62e77..adeefb3f5b 100644 --- a/src/properties/selectionproperty.cpp +++ b/src/properties/selectionproperty.cpp @@ -24,6 +24,8 @@ #include +#include + namespace { const std::string _loggerCat = "SelectionProperty"; diff --git a/src/properties/vector/bvec2property.cpp b/src/properties/vector/bvec2property.cpp new file mode 100644 index 0000000000..4e48dd1de5 --- /dev/null +++ b/src/properties/vector/bvec2property.cpp @@ -0,0 +1,125 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + + +// Forcing value from int to bool is acceptable here (line 48) +#ifdef WIN32 +#pragma warning(disable : 4800) +#endif + + +REGISTER_TEMPLATEPROPERTY_SOURCE(BVec2Property, glm::bvec2, glm::bvec2(false), + DEFAULT_FROM_LUA_LAMBDA(glm::bvec2, lua_toboolean, + lua_isboolean), + DEFAULT_TO_LUA_LAMBDA(glm::bvec2), + DEFAULT_FROM_STRING_LAMBDA(glm::bvec2), + DEFAULT_TO_STRING_LAMBDA(glm::bvec2), + LUA_TTABLE); + +#ifdef WIN32 +#pragma warning(default : 4800) +#endif + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/bvec3property.cpp b/src/properties/vector/bvec3property.cpp new file mode 100644 index 0000000000..9891b42f2f --- /dev/null +++ b/src/properties/vector/bvec3property.cpp @@ -0,0 +1,124 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + + +// Forcing value from int to bool is acceptable here (line 48) +#ifdef WIN32 +#pragma warning(disable : 4800) +#endif + +REGISTER_TEMPLATEPROPERTY_SOURCE(BVec3Property, glm::bvec3, glm::bvec3(false), + DEFAULT_FROM_LUA_LAMBDA(glm::bvec3, lua_toboolean, + lua_isboolean), + DEFAULT_TO_LUA_LAMBDA(glm::bvec3), + DEFAULT_FROM_STRING_LAMBDA(glm::bvec3), + DEFAULT_TO_STRING_LAMBDA(glm::bvec3), + LUA_TTABLE); + +#ifdef WIN32 +#pragma warning(default : 4800) +#endif + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/bvec4property.cpp b/src/properties/vector/bvec4property.cpp new file mode 100644 index 0000000000..9ec01527e2 --- /dev/null +++ b/src/properties/vector/bvec4property.cpp @@ -0,0 +1,124 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + + +// Forcing value from int to bool is acceptable here (line 48) +#ifdef WIN32 +#pragma warning(disable : 4800) +#endif + +REGISTER_TEMPLATEPROPERTY_SOURCE(BVec4Property, glm::bvec4, glm::bvec4(false), + DEFAULT_FROM_LUA_LAMBDA(glm::bvec4, lua_toboolean, + lua_isboolean), + DEFAULT_TO_LUA_LAMBDA(glm::bvec4), + DEFAULT_FROM_STRING_LAMBDA(glm::bvec4), + DEFAULT_TO_STRING_LAMBDA(glm::bvec4), + LUA_TTABLE); + +#ifdef WIN32 +#pragma warning(default : 4800) +#endif + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/dvec2property.cpp b/src/properties/vector/dvec2property.cpp new file mode 100644 index 0000000000..2c70902f22 --- /dev/null +++ b/src/properties/vector/dvec2property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DVec2Property, glm::dvec2, glm::dvec2(0), + glm::dvec2(numeric_limits::lowest()), + glm::dvec2(numeric_limits::max()), + glm::dvec2(0.01), + DEFAULT_FROM_LUA_LAMBDA(glm::dvec2, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::dvec2), + DEFAULT_FROM_STRING_LAMBDA(glm::dvec2), + DEFAULT_TO_STRING_LAMBDA(glm::dvec2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/dvec3property.cpp b/src/properties/vector/dvec3property.cpp new file mode 100644 index 0000000000..80d9b4db3f --- /dev/null +++ b/src/properties/vector/dvec3property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DVec3Property, glm::dvec3, glm::dvec3(0), + glm::dvec3(numeric_limits::lowest()), + glm::dvec3(numeric_limits::max()), + glm::dvec3(0.01), + DEFAULT_FROM_LUA_LAMBDA(glm::dvec3, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::dvec3), + DEFAULT_FROM_STRING_LAMBDA(glm::dvec3), + DEFAULT_TO_STRING_LAMBDA(glm::dvec3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/dvec4property.cpp b/src/properties/vector/dvec4property.cpp new file mode 100644 index 0000000000..2a8393437b --- /dev/null +++ b/src/properties/vector/dvec4property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(DVec4Property, glm::dvec4, glm::dvec4(0), + glm::dvec4(numeric_limits::lowest()), + glm::dvec4(numeric_limits::max()), + glm::dvec4(0.01), + DEFAULT_FROM_LUA_LAMBDA(glm::dvec4, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::dvec4), + DEFAULT_FROM_STRING_LAMBDA(glm::dvec4), + DEFAULT_TO_STRING_LAMBDA(glm::dvec4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/ivec2property.cpp b/src/properties/vector/ivec2property.cpp new file mode 100644 index 0000000000..3949a09bb1 --- /dev/null +++ b/src/properties/vector/ivec2property.cpp @@ -0,0 +1,116 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(IVec2Property, glm::ivec2, glm::ivec2(0), + glm::ivec2(numeric_limits::lowest()), + glm::ivec2(numeric_limits::max()), glm::ivec2(1), + DEFAULT_FROM_LUA_LAMBDA(glm::ivec2, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::ivec2), + DEFAULT_FROM_STRING_LAMBDA(glm::ivec2), + DEFAULT_TO_STRING_LAMBDA(glm::ivec2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/ivec3property.cpp b/src/properties/vector/ivec3property.cpp new file mode 100644 index 0000000000..f7e4207e87 --- /dev/null +++ b/src/properties/vector/ivec3property.cpp @@ -0,0 +1,116 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(IVec3Property, glm::ivec3, glm::ivec3(0), + glm::ivec3(numeric_limits::lowest()), + glm::ivec3(numeric_limits::max()), glm::ivec3(1), + DEFAULT_FROM_LUA_LAMBDA(glm::ivec3, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::ivec3), + DEFAULT_FROM_STRING_LAMBDA(glm::ivec3), + DEFAULT_TO_STRING_LAMBDA(glm::ivec3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/ivec4property.cpp b/src/properties/vector/ivec4property.cpp new file mode 100644 index 0000000000..2c357001d6 --- /dev/null +++ b/src/properties/vector/ivec4property.cpp @@ -0,0 +1,116 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(IVec4Property, glm::ivec4, glm::ivec4(0), + glm::ivec4(numeric_limits::lowest()), + glm::ivec4(numeric_limits::max()), glm::ivec4(1), + DEFAULT_FROM_LUA_LAMBDA(glm::ivec4, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::ivec4), + DEFAULT_FROM_STRING_LAMBDA(glm::ivec4), + DEFAULT_TO_STRING_LAMBDA(glm::ivec4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/uvec2property.cpp b/src/properties/vector/uvec2property.cpp new file mode 100644 index 0000000000..50bc166cba --- /dev/null +++ b/src/properties/vector/uvec2property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UVec2Property, glm::uvec2, glm::uvec2(0), + glm::uvec2(numeric_limits::lowest()), + glm::uvec2(numeric_limits::max()), + glm::uvec2(1), + DEFAULT_FROM_LUA_LAMBDA(glm::uvec2, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::uvec2), + DEFAULT_FROM_STRING_LAMBDA(glm::uvec2), + DEFAULT_TO_STRING_LAMBDA(glm::uvec2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/uvec3property.cpp b/src/properties/vector/uvec3property.cpp new file mode 100644 index 0000000000..0feb1188e8 --- /dev/null +++ b/src/properties/vector/uvec3property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UVec3Property, glm::uvec3, glm::uvec3(0), + glm::uvec3(numeric_limits::lowest()), + glm::uvec3(numeric_limits::max()), + glm::uvec3(1), + DEFAULT_FROM_LUA_LAMBDA(glm::uvec3, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::uvec3), + DEFAULT_FROM_STRING_LAMBDA(glm::uvec3), + DEFAULT_TO_STRING_LAMBDA(glm::uvec3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/uvec4property.cpp b/src/properties/vector/uvec4property.cpp new file mode 100644 index 0000000000..333907eb7c --- /dev/null +++ b/src/properties/vector/uvec4property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(UVec4Property, glm::uvec4, glm::uvec4(0), + glm::uvec4(numeric_limits::lowest()), + glm::uvec4(numeric_limits::max()), + glm::uvec4(1), + DEFAULT_FROM_LUA_LAMBDA(glm::uvec4, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::uvec4), + DEFAULT_FROM_STRING_LAMBDA(glm::uvec4), + DEFAULT_TO_STRING_LAMBDA(glm::uvec4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/vec2property.cpp b/src/properties/vector/vec2property.cpp new file mode 100644 index 0000000000..4cef6f2c28 --- /dev/null +++ b/src/properties/vector/vec2property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Vec2Property, glm::vec2, glm::vec2(0), + glm::vec2(numeric_limits::lowest()), + glm::vec2(numeric_limits::max()), + glm::vec2(0.01f), + DEFAULT_FROM_LUA_LAMBDA(glm::vec2, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::vec2), + DEFAULT_FROM_STRING_LAMBDA(glm::vec2), + DEFAULT_TO_STRING_LAMBDA(glm::vec2), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/vec3property.cpp b/src/properties/vector/vec3property.cpp new file mode 100644 index 0000000000..3c237bea2a --- /dev/null +++ b/src/properties/vector/vec3property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Vec3Property, glm::vec3, glm::vec3(0), + glm::vec3(numeric_limits::lowest()), + glm::vec3(numeric_limits::max()), + glm::vec3(0.01f), + DEFAULT_FROM_LUA_LAMBDA(glm::vec3, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::vec3), + DEFAULT_FROM_STRING_LAMBDA(glm::vec3), + DEFAULT_TO_STRING_LAMBDA(glm::vec3), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vector/vec4property.cpp b/src/properties/vector/vec4property.cpp new file mode 100644 index 0000000000..196fc28036 --- /dev/null +++ b/src/properties/vector/vec4property.cpp @@ -0,0 +1,117 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 + +#include +#include +#include + +#include + +using std::numeric_limits; + +namespace openspace { +namespace properties { + +#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ + [](lua_State * state, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + lua_pushnil(state); \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + int success = lua_next(state, -2); \ + if (success != 1) { \ + success = false; \ + return __TYPE__(0); \ + } \ + if (__TESTFUNC__(state, -1) != 1) { \ + success = false; \ + return __TYPE__(0); \ + } else { \ + result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ + lua_pop(state, 1); \ + } \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ + [](lua_State * state, __TYPE__ value) -> bool { \ + lua_newtable(state); \ + int number = 1; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + lua_pushnumber(state, static_cast(value[i])); \ + lua_setfield(state, -2, std::to_string(number).c_str()); \ + ++number; \ + } \ + return true; \ + } + +#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ + [](std::string value, bool& success) -> __TYPE__ { \ + __TYPE__ result; \ + std::vector tokens = ghoul::tokenizeString(value, ','); \ + if (tokens.size() != result.length()) { \ + success = false; \ + return result; \ + } \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ + std::stringstream s(tokens[i]); \ + __TYPE__::value_type v; \ + s >> v; \ + if (s.fail()) { \ + success = false; \ + return result; \ + } \ + else \ + result[i] = v; \ + } \ + success = true; \ + return result; \ + } + +#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ + [](std::string& outValue, __TYPE__ inValue) -> bool { \ + outValue = "{"; \ + for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ + outValue += std::to_string(inValue[i]) + ","; \ + outValue.pop_back(); \ + outValue += "}"; \ + return true; \ + } + +REGISTER_NUMERICALPROPERTY_SOURCE(Vec4Property, glm::vec4, glm::vec4(0), + glm::vec4(numeric_limits::lowest()), + glm::vec4(numeric_limits::max()), + glm::vec4(0.01f), + DEFAULT_FROM_LUA_LAMBDA(glm::vec4, lua_tonumber, + lua_isnumber), + DEFAULT_TO_LUA_LAMBDA(glm::vec4), + DEFAULT_FROM_STRING_LAMBDA(glm::vec4), + DEFAULT_TO_STRING_LAMBDA(glm::vec4), + LUA_TTABLE); + +} // namespace properties +} // namespace openspace diff --git a/src/properties/vectorproperty.cpp b/src/properties/vectorproperty.cpp deleted file mode 100644 index 22ce875f6b..0000000000 --- a/src/properties/vectorproperty.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2016 * - * * - * 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 "openspace/properties/vectorproperty.h" - -#include -#include -#include - -#include - -using std::numeric_limits; - -namespace openspace { -namespace properties { - -#define DEFAULT_FROM_LUA_LAMBDA(__TYPE__, __CONVFUNC__, __TESTFUNC__) \ - [](lua_State * state, bool& success) -> __TYPE__ { \ - __TYPE__ result; \ - lua_pushnil(state); \ - for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ - int success = lua_next(state, -2); \ - if (success != 1) { \ - success = false; \ - return __TYPE__(0); \ - } \ - if (__TESTFUNC__(state, -1) != 1) { \ - success = false; \ - return __TYPE__(0); \ - } else { \ - result[i] = static_cast<__TYPE__::value_type>(__CONVFUNC__(state, -1)); \ - lua_pop(state, 1); \ - } \ - } \ - success = true; \ - return result; \ - } - -#define DEFAULT_TO_LUA_LAMBDA(__TYPE__) \ - [](lua_State * state, __TYPE__ value) -> bool { \ - lua_newtable(state); \ - int number = 1; \ - for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ - lua_pushnumber(state, static_cast(value[i])); \ - lua_setfield(state, -2, std::to_string(number).c_str()); \ - ++number; \ - } \ - return true; \ - } - -#define DEFAULT_FROM_STRING_LAMBDA(__TYPE__) \ - [](std::string value, bool& success) -> __TYPE__ { \ - __TYPE__ result; \ - std::vector tokens = ghoul::tokenizeString(value, ','); \ - if (tokens.size() != result.length()) { \ - success = false; \ - return result; \ - } \ - for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \ - std::stringstream s(tokens[i]); \ - __TYPE__::value_type v; \ - s >> v; \ - if (s.fail()) { \ - success = false; \ - return result; \ - } \ - else \ - result[i] = v; \ - } \ - success = true; \ - return result; \ - } - -#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \ - [](std::string& outValue, __TYPE__ inValue) -> bool { \ - outValue = "{"; \ - for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \ - outValue += std::to_string(inValue[i]) + ","; \ - outValue.pop_back(); \ - outValue += "}"; \ - return true; \ - } - - -// Forcing value from int to bool is acceptable here (line 48) -#ifdef WIN32 -#pragma warning(disable : 4800) -#endif - - -REGISTER_TEMPLATEPROPERTY_SOURCE(BVec2Property, glm::bvec2, glm::bvec2(false), - DEFAULT_FROM_LUA_LAMBDA(glm::bvec2, lua_toboolean, - lua_isboolean), - DEFAULT_TO_LUA_LAMBDA(glm::bvec2), - DEFAULT_FROM_STRING_LAMBDA(glm::bvec2), - DEFAULT_TO_STRING_LAMBDA(glm::bvec2), - LUA_TTABLE); - -REGISTER_TEMPLATEPROPERTY_SOURCE(BVec3Property, glm::bvec3, glm::bvec3(false), - DEFAULT_FROM_LUA_LAMBDA(glm::bvec3, lua_toboolean, - lua_isboolean), - DEFAULT_TO_LUA_LAMBDA(glm::bvec3), - DEFAULT_FROM_STRING_LAMBDA(glm::bvec3), - DEFAULT_TO_STRING_LAMBDA(glm::bvec3), - LUA_TTABLE); - -REGISTER_TEMPLATEPROPERTY_SOURCE(BVec4Property, glm::bvec4, glm::bvec4(false), - DEFAULT_FROM_LUA_LAMBDA(glm::bvec4, lua_toboolean, - lua_isboolean), - DEFAULT_TO_LUA_LAMBDA(glm::bvec4), - DEFAULT_FROM_STRING_LAMBDA(glm::bvec4), - DEFAULT_TO_STRING_LAMBDA(glm::bvec4), - LUA_TTABLE); - -#ifdef WIN32 -#pragma warning(default : 4800) -#endif - - -REGISTER_NUMERICALPROPERTY_SOURCE(Vec2Property, glm::vec2, glm::vec2(0), - glm::vec2(numeric_limits::lowest()), - glm::vec2(numeric_limits::max()), - glm::vec2(0.01f), - DEFAULT_FROM_LUA_LAMBDA(glm::vec2, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::vec2), - DEFAULT_FROM_STRING_LAMBDA(glm::vec2), - DEFAULT_TO_STRING_LAMBDA(glm::vec2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Vec3Property, glm::vec3, glm::vec3(0), - glm::vec3(numeric_limits::lowest()), - glm::vec3(numeric_limits::max()), - glm::vec3(0.01f), - DEFAULT_FROM_LUA_LAMBDA(glm::vec3, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::vec3), - DEFAULT_FROM_STRING_LAMBDA(glm::vec3), - DEFAULT_TO_STRING_LAMBDA(glm::vec3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(Vec4Property, glm::vec4, glm::vec4(0), - glm::vec4(numeric_limits::lowest()), - glm::vec4(numeric_limits::max()), - glm::vec4(0.01f), - DEFAULT_FROM_LUA_LAMBDA(glm::vec4, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::vec4), - DEFAULT_FROM_STRING_LAMBDA(glm::vec4), - DEFAULT_TO_STRING_LAMBDA(glm::vec4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DVec2Property, glm::dvec2, glm::dvec2(0), - glm::dvec2(numeric_limits::lowest()), - glm::dvec2(numeric_limits::max()), - glm::dvec2(0.01), - DEFAULT_FROM_LUA_LAMBDA(glm::dvec2, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::dvec2), - DEFAULT_FROM_STRING_LAMBDA(glm::dvec2), - DEFAULT_TO_STRING_LAMBDA(glm::dvec2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DVec3Property, glm::dvec3, glm::dvec3(0), - glm::dvec3(numeric_limits::lowest()), - glm::dvec3(numeric_limits::max()), - glm::dvec3(0.01), - DEFAULT_FROM_LUA_LAMBDA(glm::dvec3, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::dvec3), - DEFAULT_FROM_STRING_LAMBDA(glm::dvec3), - DEFAULT_TO_STRING_LAMBDA(glm::dvec3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(DVec4Property, glm::dvec4, glm::dvec4(0), - glm::dvec4(numeric_limits::lowest()), - glm::dvec4(numeric_limits::max()), - glm::dvec4(0.01), - DEFAULT_FROM_LUA_LAMBDA(glm::dvec4, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::dvec4), - DEFAULT_FROM_STRING_LAMBDA(glm::dvec4), - DEFAULT_TO_STRING_LAMBDA(glm::dvec4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(IVec2Property, glm::ivec2, glm::ivec2(0), - glm::ivec2(numeric_limits::lowest()), - glm::ivec2(numeric_limits::max()), glm::ivec2(1), - DEFAULT_FROM_LUA_LAMBDA(glm::ivec2, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::ivec2), - DEFAULT_FROM_STRING_LAMBDA(glm::ivec2), - DEFAULT_TO_STRING_LAMBDA(glm::ivec2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(IVec3Property, glm::ivec3, glm::ivec3(0), - glm::ivec3(numeric_limits::lowest()), - glm::ivec3(numeric_limits::max()), glm::ivec3(1), - DEFAULT_FROM_LUA_LAMBDA(glm::ivec3, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::ivec3), - DEFAULT_FROM_STRING_LAMBDA(glm::ivec3), - DEFAULT_TO_STRING_LAMBDA(glm::ivec3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(IVec4Property, glm::ivec4, glm::ivec4(0), - glm::ivec4(numeric_limits::lowest()), - glm::ivec4(numeric_limits::max()), glm::ivec4(1), - DEFAULT_FROM_LUA_LAMBDA(glm::ivec4, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::ivec4), - DEFAULT_FROM_STRING_LAMBDA(glm::ivec4), - DEFAULT_TO_STRING_LAMBDA(glm::ivec4), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(UVec2Property, glm::uvec2, glm::uvec2(0), - glm::uvec2(numeric_limits::lowest()), - glm::uvec2(numeric_limits::max()), - glm::uvec2(1), - DEFAULT_FROM_LUA_LAMBDA(glm::uvec2, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::uvec2), - DEFAULT_FROM_STRING_LAMBDA(glm::uvec2), - DEFAULT_TO_STRING_LAMBDA(glm::uvec2), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(UVec3Property, glm::uvec3, glm::uvec3(0), - glm::uvec3(numeric_limits::lowest()), - glm::uvec3(numeric_limits::max()), - glm::uvec3(1), - DEFAULT_FROM_LUA_LAMBDA(glm::uvec3, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::uvec3), - DEFAULT_FROM_STRING_LAMBDA(glm::uvec3), - DEFAULT_TO_STRING_LAMBDA(glm::uvec3), - LUA_TTABLE); - -REGISTER_NUMERICALPROPERTY_SOURCE(UVec4Property, glm::uvec4, glm::uvec4(0), - glm::uvec4(numeric_limits::lowest()), - glm::uvec4(numeric_limits::max()), - glm::uvec4(1), - DEFAULT_FROM_LUA_LAMBDA(glm::uvec4, lua_tonumber, - lua_isnumber), - DEFAULT_TO_LUA_LAMBDA(glm::uvec4), - DEFAULT_FROM_STRING_LAMBDA(glm::uvec4), - DEFAULT_TO_STRING_LAMBDA(glm::uvec4), - LUA_TTABLE); - -} // namespace properties -} // namespace openspace