Permalink
Browse files

Merge branch 'next'

2 parents 5485fcf + fa9c37e commit 4de92c4c6f8047db5dcb7f0dee8541c7e7ea5a80 @seanpaultaylor seanpaultaylor committed Mar 23, 2016
Showing 318 changed files with 14,835 additions and 12,645 deletions.
View
@@ -0,0 +1,23 @@
+language: cpp
+before_script:
+ - ./install.sh
+ - mkdir build
+ - cd build
+ - cmake ..
+script: make
+compiler:
+ - gcc
+addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libglu1-mesa-dev
+ - libogg-dev
+ - libopenal-dev
+ - lib32z1-dev
+ - libgtk2.0-dev
+notifications:
+ email: false
+sudo: required
+dist: trusty
View
@@ -1,4 +1,3 @@
-
## v3.0.0
- Adds support for Visual Studio 2015.
@@ -16,16 +15,20 @@
- Adds support for cubemap textures.
- Adds support for font kerning.
- Adds support for Android x86.
+- Adds support for CMake on MacOSX.
- Adds support for gamepads on Android.
- Adds supoprt for Android extensions through custom native activity.
- Adds water sample to browser.
- Adds audio player sample to browser.
- Adds GamePlay-deps repository for cross-platform Cmake dependency builds.
+- Adds map/unmap buffer for Mesh and MeshPart.
- Fixes to Scene Graph for merging Drawables on Node.
- Fixes from setUserPointer to setUserObject(Ref*)
- Fixes for virtual gamepad scaling.
- Fixes Image to support grayscale PNGs.
- Fixes Android to build with arm instead of thumb.
+- Fixes Android crash when gamepads disconnected.
+- Fixes for lua script bindings.
## v2.0.0
View
@@ -17,9 +17,6 @@ GamePlay is an open-source, cross-platform, C++ game framework/engine for creati
- [iOS](https://github.com/gameplay3d/GamePlay/wiki/Xcode-Setup)
- [Android](https://github.com/gameplay3d/GamePlay/wiki/Android-NDK-Setup)
-## Roadmap for 'next' branch
-- [backlog](https://github.com/gameplay3d/GamePlay/issues?q=is%3Aopen+is%3Aissue+no%3Amilestone)
-
## License
Open-source under [Apache 2.0 license](http://www.tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29).
@@ -1,3 +1,11 @@
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(GAMEPLAY_PLATFORM_SRC
+ src/PlatformMacOSX.mm
+ src/gameplay-main-macosx.mm
+ )
+else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(GAMEPLAY_PLATFORM_SRC )
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(GAMEPLAY_SRC
src/AbsoluteLayout.cpp
@@ -165,6 +173,7 @@ set(GAMEPLAY_SRC
src/PlatformAndroid.cpp
src/PlatformLinux.cpp
src/PlatformWindows.cpp
+ ${GAMEPLAY_PLATFORM_SRC}
src/Properties.cpp
src/Properties.h
src/Quaternion.cpp
@@ -555,8 +564,13 @@ add_definitions(${GTK2_CFLAGS_OTHER})
add_definitions(-D__linux__)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-add_definitions(-std=c++11)
-add_definitions(-lstdc++)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ # using Clang
+ add_definitions(-std=c++11 -stdlib=libc++)
+else()
+ add_definitions(-std=c++11)
+ add_definitions(-lstdc++)
+endif()
add_library(gameplay STATIC
${GAMEPLAY_SRC}
View
@@ -9,8 +9,7 @@ TEMPLATE = lib
CONFIG += staticlib
CONFIG += c++11
CONFIG -= qt
-
-#DEFINES += GP_NO_PLATFORM
+CONFIG(debug, debug|release): DEFINES += _DEBUG
SOURCES += src/AbsoluteLayout.cpp \
src/AIAgent.cpp \
@@ -548,18 +547,19 @@ linux: INCLUDEPATH += /usr/include/harfbuzz
macx: OBJECTIVE_SOURCES += src/PlatformMacOSX.mm
macx: OBJECTIVE_SOURCES += src/gameplay-main-macosx.mm
-macx: QMAKE_CXXFLAGS += -x c++ -stdlib=libc++ -w -arch x86_64
-macx: QMAKE_OBJECTIVE_CFLAGS += -x objective-c++ -stdlib=libc++ -w -arch x86_64
+macx: QMAKE_CXXFLAGS += -x c++ -x objective-c++ -stdlib=libc++ -w -arch x86_64
macx: LIBS += -F/System/Library/Frameworks -framework GameKit
macx: LIBS += -F/System/Library/Frameworks -framework IOKit
macx: LIBS += -F/System/Library/Frameworks -framework QuartzCore
macx: LIBS += -F/System/Library/Frameworks -framework OpenAL
macx: LIBS += -F/System/Library/Frameworks -framework OpenGL
macx: LIBS += -F/System/Library/Frameworks -framework Cocoa
+macx: LIBS += -F/System/Library/Frameworks -framework Foundation
win32: SOURCES += src/PlatformWindows.cpp
win32: SOURCES += src/gameplay-main-windows.cpp
win32: DEFINES += WIN32 _UNICODE UNICODE
-win32: INCLUDEPATH += $$(DXSDK_DIR)Include
+win32: INCLUDEPATH += $$(DXSDK_DIR)/Include
win32: QMAKE_CXXFLAGS_WARN_ON -= -w34100
win32: QMAKE_CXXFLAGS_WARN_ON -= -w34189
+win32: QMAKE_CXXFLAGS_WARN_ON -= -w4302
View
@@ -22,6 +22,7 @@
#include <set>
#include <stack>
#include <map>
+#include <unordered_map>
#include <queue>
#include <algorithm>
#include <limits>
@@ -116,7 +117,7 @@ extern int strcmpnocase(const char* s1, const char* s2);
#pragma warning( disable : 4244 )
#pragma warning( disable : 4267 )
#pragma warning( disable : 4311 )
- #pragma warning( disable : 4316 )
+ #pragma warning( disable : 4316 )
#pragma warning( disable : 4390 )
#pragma warning( disable : 4800 )
#pragma warning( disable : 4996 )
@@ -217,6 +218,9 @@ using std::va_list;
extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
extern PFNGLISVERTEXARRAYOESPROC glIsVertexArray;
+ extern PFNGLMAPBUFFEROESPROC glMapBuffer;
+ extern PFNGLUNMAPBUFFEROESPROC glUnmapBuffer;
+ #define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define glClearDepth glClearDepthf
#define OPENGL_ES
@@ -239,6 +243,9 @@ using std::va_list;
#define glDeleteVertexArrays glDeleteVertexArraysOES
#define glGenVertexArrays glGenVertexArraysOES
#define glIsVertexArray glIsVertexArrayOES
+ #define glMapBuffer glMapBufferOES
+ #define glUnmapBuffer glUnmapBufferOES
+ #define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define glClearDepth glClearDepthf
#define OPENGL_ES
@@ -20,8 +20,10 @@ extern void printMemoryLeaks();
#endif
void* operator new (std::size_t size, const char* file, int line);
void* operator new[] (std::size_t size, const char* file, int line);
+#ifdef WIN32
void* operator new (std::size_t size) throw(std::bad_alloc);
void* operator new[] (std::size_t size) throw(std::bad_alloc);
+#endif
void* operator new (std::size_t size, const std::nothrow_t&) throw();
void* operator new[] (std::size_t size, const std::nothrow_t&) throw();
void operator delete (void* p) throw();
@@ -35,6 +35,11 @@ Node::Type Joint::getType() const
return Node::JOINT;
}
+const char* Joint::getTypeName() const
+{
+ return "Joint";
+}
+
Scene* Joint::getScene() const
{
// Overrides Node::getScene() to search the node our skins.
@@ -35,6 +35,14 @@ class Joint : public Node
Scene* getScene() const;
/**
+ * Extends ScriptTarget::getTypeName() to return the type name of this class.
+ *
+ * @return The type name of this class: "Joint"
+ * @see ScriptTarget::getTypeName()
+ */
+ const char* getTypeName() const;
+
+ /**
* Returns the inverse bind pose matrix for this joint.
*
* @return Inverse bind pose matrix.
@@ -65,7 +65,7 @@ void Logger::log(Level level, const char* message, ...)
else if (state.logFunctionLua)
{
// Pass call to registered Lua log function
- Game::getInstance()->getScriptController()->executeFunction<void>(state.logFunctionLua, "[Logger::Level]s", level, str);
+ Game::getInstance()->getScriptController()->executeFunction<void>(state.logFunctionLua, "[Logger::Level]s", NULL, level, str);
}
else
{
View
@@ -251,7 +251,6 @@ bool Mesh::isDynamic() const
return _dynamic;
}
-
Mesh::PrimitiveType Mesh::getPrimitiveType() const
{
return _primitiveType;
@@ -262,7 +261,19 @@ void Mesh::setPrimitiveType(PrimitiveType type)
_primitiveType = type;
}
-void Mesh::setVertexData(const float* vertexData, unsigned int vertexStart, unsigned int vertexCount)
+void* Mesh::mapVertexBuffer()
+{
+ GL_ASSERT( glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer) );
+
+ return (void*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
+}
+
+bool Mesh::unmapVertexBuffer()
+{
+ return glUnmapBuffer(GL_ARRAY_BUFFER);
+}
+
+void Mesh::setVertexData(const void* vertexData, unsigned int vertexStart, unsigned int vertexCount)
{
GL_ASSERT( glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer) );
View
@@ -201,13 +201,45 @@ class Mesh : public Ref
void setPrimitiveType(Mesh::PrimitiveType type);
/**
+ * Maps the vertex buffer for the specified access.
+ *
+ * Mapping vertex data causes a synchronizing issue. To avoid gpu idle
+ * If GPU is still working with the buffer object, mapVertexBuffer will not
+ * return until GPU finishes its job with the corresponding buffer object.
+ *
+ * To avoid waiting (idle), you can call first setVertexBuffer with NULL pointer,
+ * then call mapVertexBuffer(). In this case, the previous data will be discarded
+ * and mapVertexBuffer() returns a new allocated pointer immediately even if GPU is
+ * still working with the previous data.
+ *
+ * However, this method is valid only if you want to update entire data set because
+ * you discard the previous data. If you want to change only portion of data or to
+ * read data, you better not release the previous data.
+ *
+ * After modifying the data of VBO, it must be unmapped the buffer object from the client's
+ * memory. unmapVertexBuffer returns true if success. When it returns false, the contents of
+ * vertex buffer become corrupted while the buffer was mapped. The corruption results from screen
+ * resolution change or window system specific events. In this case, the data must be resubmitted.
+ *
+ * @return The mapped vertex buffer
+ */
+ void* mapVertexBuffer();
+
+ /**
+ * Unmaps the vertex buffer.
+ *
+ * @return false if unmapping buffer was unsuccessful
+ */
+ bool unmapVertexBuffer();
+
+ /**
* Sets the specified vertex data into the mapped vertex buffer.
*
* @param vertexData The vertex data to be set.
* @param vertexStart The index of the starting vertex (0 by default).
* @param vertexCount The number of vertices to be set (default is 0, for all vertices).
*/
- void setVertexData(const float* vertexData, unsigned int vertexStart = 0, unsigned int vertexCount = 0);
+ void setVertexData(const void* vertexData, unsigned int vertexStart = 0, unsigned int vertexCount = 0);
/**
* Creates and adds a new part of primitive data defining how the vertices are connected.
@@ -82,9 +82,16 @@ IndexBufferHandle MeshPart::getIndexBuffer() const
return _indexBuffer;
}
-bool MeshPart::isDynamic() const
+void* MeshPart::mapIndexBuffer()
{
- return _dynamic;
+ GL_ASSERT( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer) );
+
+ return (void*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
+}
+
+bool MeshPart::unmapIndexBuffer()
+{
+ return glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
}
void MeshPart::setIndexData(const void* indexData, unsigned int indexStart, unsigned int indexCount)
@@ -123,4 +130,9 @@ void MeshPart::setIndexData(const void* indexData, unsigned int indexStart, unsi
}
}
+bool MeshPart::isDynamic() const
+{
+ return _dynamic;
+}
+
}
@@ -58,11 +58,36 @@ class MeshPart
IndexBufferHandle getIndexBuffer() const;
/**
- * Determines if the indices are dynamic.
+ * Maps the index buffer for the specified access.
*
- * @return true if the part is dynamic; false otherwise.
+ * Mapping index data causes a synchronizing issue. To avoid gpu idle
+ * If GPU is still working with the buffer object, mapIndexBuffer will not
+ * return until GPU finishes its job with the corresponding buffer object.
+ *
+ * To avoid waiting (idle), you can call first setIndexData with NULL pointer,
+ * then call mapIndexBuffer(). In this case, the previous data will be discarded
+ * and mapIndexData() returns a new allocated pointer immediately even if GPU is
+ * still working with the previous data.
+ *
+ * However, this method is valid only if you want to update entire data set because
+ * you discard the previous data. If you want to change only portion of data or to
+ * read data, you better not release the previous data.
+ *
+ * After modifying the data of VBO, it must be unmapped the buffer object from the client's
+ * memory. unmapIndexBuffer returns true if success. When it returns false, the contents of
+ * index buffer become corrupted while the buffer was mapped. The corruption results from screen
+ * resolution change or window system specific events. In this case, the data must be resubmitted.
+ *
+ * @return The mapped index buffer
*/
- bool isDynamic() const;
+ void* mapIndexBuffer();
+
+ /**
+ * Unmaps the index buffer.
+ *
+ * @return false if unmapping buffer was unsuccessful
+ */
+ bool unmapIndexBuffer();
/**
* Sets the specified index data into the mapped index buffer.
@@ -74,6 +99,13 @@ class MeshPart
*/
void setIndexData(const void* indexData, unsigned int indexStart, unsigned int indexCount);
+ /**
+ * Determines if the indices are dynamic.
+ *
+ * @return true if the part is dynamic; false otherwise.
+ */
+ bool isDynamic() const;
+
private:
/**
Oops, something went wrong.

0 comments on commit 4de92c4

Please sign in to comment.