Quellcode durchsuchen

Renderer and OSX template tweaks

Ivan Safrin vor 10 Jahren
Ursprung
Commit
136ab1d880

+ 0 - 4
build/osx/PolycodeCore/PolycodeCore.xcodeproj/project.pbxproj

@@ -12,7 +12,6 @@
 		8A8652351B72865C009F94DD /* PolyCamera.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EA1B72865C009F94DD /* PolyCamera.h */; };
 		8A8652361B72865C009F94DD /* PolyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EB1B72865C009F94DD /* PolyClient.h */; };
 		8A8652371B72865C009F94DD /* PolyCocoaCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EC1B72865C009F94DD /* PolyCocoaCore.h */; };
-		8A8652381B72865C009F94DD /* Polycode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651ED1B72865C009F94DD /* Polycode.h */; };
 		8A8652391B72865C009F94DD /* PolyColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EE1B72865C009F94DD /* PolyColor.h */; };
 		8A86523A1B72865C009F94DD /* PolyConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EF1B72865C009F94DD /* PolyConfig.h */; };
 		8A86523B1B72865C009F94DD /* PolyCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F01B72865C009F94DD /* PolyCore.h */; };
@@ -170,7 +169,6 @@
 		8A8651EA1B72865C009F94DD /* PolyCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCamera.h; path = ../../../include/polycode/core/PolyCamera.h; sourceTree = "<group>"; };
 		8A8651EB1B72865C009F94DD /* PolyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyClient.h; path = ../../../include/polycode/core/PolyClient.h; sourceTree = "<group>"; };
 		8A8651EC1B72865C009F94DD /* PolyCocoaCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCocoaCore.h; path = ../../../include/polycode/core/PolyCocoaCore.h; sourceTree = "<group>"; };
-		8A8651ED1B72865C009F94DD /* Polycode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Polycode.h; path = ../../../include/polycode/core/Polycode.h; sourceTree = "<group>"; };
 		8A8651EE1B72865C009F94DD /* PolyColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyColor.h; path = ../../../include/polycode/core/PolyColor.h; sourceTree = "<group>"; };
 		8A8651EF1B72865C009F94DD /* PolyConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyConfig.h; path = ../../../include/polycode/core/PolyConfig.h; sourceTree = "<group>"; };
 		8A8651F01B72865C009F94DD /* PolyCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCore.h; path = ../../../include/polycode/core/PolyCore.h; sourceTree = "<group>"; };
@@ -436,7 +434,6 @@
 				8A8651EA1B72865C009F94DD /* PolyCamera.h */,
 				8A8651EB1B72865C009F94DD /* PolyClient.h */,
 				8A8651EC1B72865C009F94DD /* PolyCocoaCore.h */,
-				8A8651ED1B72865C009F94DD /* Polycode.h */,
 				8A8651EE1B72865C009F94DD /* PolyColor.h */,
 				8A8651EF1B72865C009F94DD /* PolyConfig.h */,
 				8A8651F01B72865C009F94DD /* PolyCore.h */,
@@ -576,7 +573,6 @@
 				8A86526E1B72865C009F94DD /* PolyShader.h in Headers */,
 				8A8652551B72865C009F94DD /* PolyPeer.h in Headers */,
 				8A86524A1B72865C009F94DD /* PolyInputEvent.h in Headers */,
-				8A8652381B72865C009F94DD /* Polycode.h in Headers */,
 				8A8652391B72865C009F94DD /* PolyColor.h in Headers */,
 				8A8652601B72865C009F94DD /* PolySceneEntityInstance.h in Headers */,
 				8A86526C1B72865C009F94DD /* PolyServer.h in Headers */,

+ 1 - 0
build/osx/TemplateApp/TemplateApp/PolycodeTemplateApp.h

@@ -2,6 +2,7 @@
 // Polycode template. Write your code here.
 //
 
+#import "polycode/view/osx/PolycodeView.h"
 #include "Polycode.h"
 
 using namespace Polycode;

+ 1 - 1
include/Polycode.h

@@ -93,7 +93,7 @@
 #endif
 
 #if defined(__APPLE__) && defined(__MACH__)
-        #include "polycode/core/PolyCocoaCore.h"
+//    #import "polycode/view/osx/PolycodeView.h"
 #else
     #if defined(_WINDOWS) && !defined(_MINGW)
         #include "polycode/core/PolyWinCore.h"

+ 1 - 1
include/polycode/core/PolyCocoaCore.h

@@ -35,13 +35,13 @@
 #include <unistd.h>
 #include "polycode/core/PolyInputEvent.h"
 #include <IOKit/hid/IOHIDLib.h>
-#import <Cocoa/Cocoa.h>
 
 #define POLYCODE_CORE CocoaCore
 
 using std::vector;
 
 @class PolycodeView;
+@class NSOpenGLContext;
 
 namespace Polycode {
 	

+ 0 - 95
include/polycode/core/Polycode.h

@@ -1,95 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- 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.
- */
-
- 
-#pragma once
-
-#include "PolyString.h"
-#include "PolyData.h"
-#include "PolyObject.h"
-#include "PolyLogger.h"
-#include "PolyConfig.h"
-#include "PolyPerlin.h"
-#include "PolyEntity.h"
-#include "PolyEvent.h"
-#include "PolyEventDispatcher.h"
-#include "PolyEventHandler.h"
-#include "PolyTimer.h"
-#include "PolyTween.h"
-#include "PolyTweenManager.h"
-#include "PolyResourceManager.h"
-#include "PolyCore.h"
-#include "PolyCoreInput.h"
-#include "PolyInputKeys.h"
-#include "PolyInputEvent.h"
-#include "PolyVector2.h"
-#include "PolyVector3.h"
-#include "PolyVector4.h"
-#include "PolyBezierCurve.h"
-#include "PolyQuaternionCurve.h"
-#include "PolyRectangle.h"
-#include "PolyRenderer.h"
-#include "PolyRenderDataArray.h"
-#include "PolyCoreServices.h"
-#include "PolyImage.h"
-#include "PolyLabel.h"
-#include "PolyFont.h"
-#include "PolyFontGlyphSheet.h"
-#include "PolyFontManager.h"
-#include "PolyTexture.h"
-#include "PolyMaterial.h"
-#include "PolyMesh.h"
-#include "PolyShader.h"
-#include "PolySceneManager.h"
-#include "PolyCoreServices.h"
-#include "PolyCamera.h"
-#include "PolyScene.h"
-#include "PolyEntity.h"
-#include "PolySceneMesh.h"
-#include "PolySceneLine.h"
-#include "PolySceneLight.h"
-#include "PolySkeleton.h"
-#include "PolyBone.h"
-#include "PolyScenePrimitive.h"
-#include "PolySceneLabel.h"
-#include "PolyParticleEmitter.h"
-#include "PolySceneRenderTexture.h"
-#include "PolyResource.h"
-#include "PolyThreaded.h"
-#include "PolySound.h"
-#include "PolySoundManager.h"
-#include "PolySceneSound.h"
-#include "PolySceneImage.h"
-#include "PolyClient.h"
-#include "PolyPeer.h"
-#include "PolyServer.h"
-#include "PolyServerWorld.h"
-#include "PolySocket.h"
-#include "PolyHTTPFetcher.h"
-#include "PolyRay.h"
-#include "PolySceneSprite.h"
-#include "PolySceneEntityInstance.h"
-#include "PolyGlobals.h"
-
-#ifdef _WINDOWS
-#include "PolyWinCore.h"
-#endif

BIN
lib/osx/libPolycore.a


+ 1 - 0
src/core/PolyCocoaCore.mm

@@ -24,6 +24,7 @@
 #import "polycode/view/osx/PolycodeView.h"
 #include <iostream>
 #include <limits.h>
+#import <Cocoa/Cocoa.h>
 
 #include <ApplicationServices/ApplicationServices.h>
 

+ 4 - 1
src/core/PolyRenderer.cpp

@@ -165,7 +165,10 @@ void RenderThread::processDrawBuffer(GPUDrawBuffer *buffer) {
                                 attributeBinding->attribute = shader->getAttribPointer(attributeBinding->name);
                             }
                             if(attributeBinding->attribute) {
-                                 interface->setAttributeInShader(shader, attributeBinding->attribute, attributeBinding);
+                                
+                                if(attributeBinding->vertexData->data.size() / attributeBinding->vertexData->countPerVertex >= buffer->drawCalls[i].numVertices) {
+                                    interface->setAttributeInShader(shader, attributeBinding->attribute, attributeBinding);
+                                }
                             } else {
                                 attributeBinding->enabled = false;
                             }