Browse Source

Fixed new project template for Visual Studio.
Fixes duplicate line in TemplateGame.cpp
Fixes colored.frag shader.
Adds game.config on desktop systems which support it.

setaylor 13 years ago
parent
commit
ce3aa05b26

+ 4 - 0
gameplay-newproject.bat

@@ -243,6 +243,10 @@ copy gameplay-template\res\* %projPath%\res\
 REM Copy icon
 REM Copy icon
 copy gameplay-template\icon.png %projPath%\icon.png
 copy gameplay-template\icon.png %projPath%\icon.png
 
 
+REM Copy config
+copy gameplay-template\game.config %projPath%\game.config
+call:replace %projPath%\game.config TEMPLATE_TITLE "%projName%"
+
 REM Open new project folder
 REM Open new project folder
 start %projPath%
 start %projPath%
 
 

+ 7 - 0
gameplay-template/game.config

@@ -0,0 +1,7 @@
+window
+{
+    title = TEMPLATE_TITLE
+    width = 1280
+    height = 720
+    fullscreen = false
+}

+ 2 - 1
gameplay-template/gameplay-template.vcxproj

@@ -165,7 +165,8 @@
     <None Include="bar-descriptor.xml" >
     <None Include="bar-descriptor.xml" >
         <SubType>Designer</SubType>
         <SubType>Designer</SubType>
     </None>
     </None>
-    <None Include="icon.png" />
+    <None Include="game.config" />
+	<None Include="icon.png" />
     <None Include="res\box.dae" />
     <None Include="res\box.dae" />
     <None Include="res\box.gpb" />
     <None Include="res\box.gpb" />
     <None Include="res\box.material" />
     <None Include="res\box.material" />

+ 1 - 0
gameplay-template/gameplay-template.vcxproj.filters

@@ -7,6 +7,7 @@
     </Filter>
     </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
+	<None Include="game.config" />
     <None Include="icon.png" />
     <None Include="icon.png" />
     <None Include="bar-descriptor.xml" />
     <None Include="bar-descriptor.xml" />
     <None Include="res\box.dae">
     <None Include="res\box.dae">

+ 1 - 1
gameplay-template/res/colored.frag

@@ -25,7 +25,7 @@ void main()
 
 
     // Diffuse
     // Diffuse
 	float attenuation = 1.0;
 	float attenuation = 1.0;
-    float ddot = dot(normalVector, lightDirection);
+    float ddot = dot(normalVector, -lightDirection);
     float intensity =  max(0.0, attenuation * ddot);
     float intensity =  max(0.0, attenuation * ddot);
     vec3 diffuseColor = u_lightColor * baseColor.rgb * intensity;
     vec3 diffuseColor = u_lightColor * baseColor.rgb * intensity;
 
 

+ 1 - 2
gameplay-template/src/TemplateGame.cpp

@@ -26,8 +26,7 @@ void TemplateGame::initialize()
     Node* boxNode = _scene->findNode("box");
     Node* boxNode = _scene->findNode("box");
     Model* boxModel = boxNode->getModel();
     Model* boxModel = boxNode->getModel();
     Material* boxMaterial = boxModel->setMaterial("res/box.material");
     Material* boxMaterial = boxModel->setMaterial("res/box.material");
-	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
-	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
+    boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
     boxMaterial->getParameter("u_lightColor")->setValue(light->getColor());
     boxMaterial->getParameter("u_lightColor")->setValue(light->getColor());
     boxMaterial->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
     boxMaterial->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
 }
 }