Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpaultaylor committed Mar 23, 2016
2 parents 5485fcf + fa9c37e commit 4de92c4
Show file tree
Hide file tree
Showing 318 changed files with 14,835 additions and 12,645 deletions.
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## v3.0.0

- Adds support for Visual Studio 2015.
Expand All @@ -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

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
18 changes: 16 additions & 2 deletions gameplay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
10 changes: 5 additions & 5 deletions gameplay/gameplay.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
9 changes: 8 additions & 1 deletion gameplay/src/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gameplay/src/DebugNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions gameplay/src/Joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions gameplay/src/Joint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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.
*
Expand Down
2 changes: 1 addition & 1 deletion gameplay/src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
15 changes: 13 additions & 2 deletions gameplay/src/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ bool Mesh::isDynamic() const
return _dynamic;
}


Mesh::PrimitiveType Mesh::getPrimitiveType() const
{
return _primitiveType;
Expand All @@ -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) );

Expand Down
34 changes: 33 additions & 1 deletion gameplay/src/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,46 @@ 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.
Expand Down
16 changes: 14 additions & 2 deletions gameplay/src/MeshPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -123,4 +130,9 @@ void MeshPart::setIndexData(const void* indexData, unsigned int indexStart, unsi
}
}

bool MeshPart::isDynamic() const
{
return _dynamic;
}

}
38 changes: 35 additions & 3 deletions gameplay/src/MeshPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:

/**
Expand Down
Loading

0 comments on commit 4de92c4

Please sign in to comment.