Просмотр исходного кода

Fixed near and far variables not working in Windows cause MSVC treats them as constants, added latest files to IDE MSVC project

Ivan Safrin 12 лет назад
Родитель
Сommit
264d34cc94

+ 1 - 1
Core/Contents/Source/PolyFontGlyphSheet.cpp

@@ -231,7 +231,7 @@ void FontGlyphSheet::buildGlyphs(std::set<wchar_t> characters) {
 							int v = (gd.data[scan_y * gd.pitch + scan_x] >> 7) & 1;
 							if (v != value) {
 								int dx2 = dx*dx;
-								Number d(sqrt(dx2+dy2));
+								Number d(sqrt((Number)(dx2+dy2)));
 								if (d < dist) {
 									dist = d;
 								}

+ 6 - 6
Core/Contents/Source/PolyGLRenderer.cpp

@@ -219,13 +219,13 @@ void OpenGLRenderer::setProjectionFromFrustum(Number left, Number right, Number
 
 }
 
-void OpenGLRenderer::setProjectionFromFoV(Number fov, Number near, Number far) {
+void OpenGLRenderer::setProjectionFromFoV(Number fov, Number _near, Number _far) {
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
 	Number fW, fH;
-	fH = tan( fov / 360.0 * PI ) * near;
+	fH = tan( fov / 360.0 * PI ) * _near;
 	fW = fH * ((GLfloat)viewportWidth/(GLfloat)viewportHeight);
-	glFrustum(-fW + (viewportShift.x*fW*2.0), fW + (viewportShift.x*fW*2.0), -fH + (viewportShift.y*fH*2.0), fH + (viewportShift.y*fH*2.0), near, far);
+	glFrustum(-fW + (viewportShift.x*fW*2.0), fW + (viewportShift.x*fW*2.0), -fH + (viewportShift.y*fH*2.0), fH + (viewportShift.y*fH*2.0), _near, _far);
 	glMatrixMode(GL_MODELVIEW);
 	polycodeGLGetNumberv(GL_PROJECTION_MATRIX, sceneProjectionMatrix);
 }
@@ -551,14 +551,14 @@ void OpenGLRenderer::setFogProperties(int fogMode, Color color, Number density,
 	glFogf(GL_FOG_END, endDepth);
 }
 
-void OpenGLRenderer::setProjectionOrtho(Number xSize, Number ySize, Number near, Number far, bool centered) {
+void OpenGLRenderer::setProjectionOrtho(Number xSize, Number ySize, Number _near, Number _far, bool centered) {
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
 		
 	if(centered) {
-		glOrtho(-xSize*0.5,xSize*0.5,-ySize*0.5,ySize*0.5,near,far);
+		glOrtho(-xSize*0.5, xSize*0.5, -ySize*0.5, ySize*0.5, _near, _far);
 	} else {
-		glOrtho(0.0f,xSize,0,ySize,near,far);
+		glOrtho(0.0f, xSize, 0, ySize, _near, _far);
 	}
 	polycodeGLGetNumberv( GL_PROJECTION_MATRIX, sceneProjectionMatrixOrtho);
 

+ 4 - 0
IDE/Build/Windows/Polycode.vcxproj

@@ -13,6 +13,8 @@
   <ItemGroup>
     <ClCompile Include="..\..\Contents\Source\EditorGrid.cpp" />
     <ClCompile Include="..\..\Contents\Source\EntityEditorPropertyView.cpp" />
+    <ClCompile Include="..\..\Contents\Source\EntityEditorSettingsView.cpp" />
+    <ClCompile Include="..\..\Contents\Source\EntityEditorTreeView.cpp" />
     <ClCompile Include="..\..\Contents\Source\ExampleBrowserWindow.cpp" />
     <ClCompile Include="..\..\Contents\Source\ExportProjectWindow.cpp" />
     <ClCompile Include="..\..\Contents\Source\NewFileWindow.cpp" />
@@ -47,6 +49,8 @@
   <ItemGroup>
     <ClInclude Include="..\..\Contents\Include\EditorGrid.h" />
     <ClInclude Include="..\..\Contents\Include\EntityEditorPropertyView.h" />
+    <ClInclude Include="..\..\Contents\Include\EntityEditorSettingsView.h" />
+    <ClInclude Include="..\..\Contents\Include\EntityEditorTreeView.h" />
     <ClInclude Include="..\..\Contents\Include\ExampleBrowserWindow.h" />
     <ClInclude Include="..\..\Contents\Include\ExportProjectWindow.h" />
     <ClInclude Include="..\..\Contents\Include\NewFileWindow.h" />

+ 12 - 0
IDE/Build/Windows/Polycode.vcxproj.filters

@@ -105,6 +105,12 @@
     <ClCompile Include="..\..\Contents\Source\PolycodeEntityEditor.cpp">
       <Filter>Source</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\EntityEditorSettingsView.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\EntityEditorTreeView.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\Contents\Include\ExampleBrowserWindow.h">
@@ -204,6 +210,12 @@
     <ClInclude Include="..\..\Contents\Include\TransformGizmo.h">
       <Filter>Include</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\EntityEditorSettingsView.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\EntityEditorTreeView.h">
+      <Filter>Include</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Polycode.rc" />