Fix more warnings in MSVC

This commit is contained in:
2019-01-14 21:07:32 -08:00
parent cdbbd329cb
commit 5096b391de
9 changed files with 121 additions and 116 deletions

View File

@@ -1,7 +1,12 @@
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
else(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "64 bits compiler detected" ) MESSAGE( "64 bits compiler detected" )

View File

@@ -433,7 +433,7 @@ float KRAudioSource::getAudioTime()
void KRAudioSource::setAudioTime(float new_position) void KRAudioSource::setAudioTime(float new_position)
{ {
// Sets the audio playback position with units of floating point seconds. // Sets the audio playback position with units of floating point seconds.
setAudioFrame(new_position * 44100.0f); setAudioFrame((__int64_t)(new_position * 44100.0f));
} }
void KRAudioSource::sample(int frame_count, int channel, float *buffer, float gain) void KRAudioSource::sample(int frame_count, int channel, float *buffer, float gain)

View File

@@ -191,7 +191,7 @@ void KRLight::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_light
float particle_range = 600.0f; float particle_range = 600.0f;
int particle_count = m_dust_particle_density * pow(particle_range, 3); int particle_count = (int)(m_dust_particle_density * pow(particle_range, 3));
if(particle_count > KRMeshManager::KRENGINE_MAX_RANDOM_PARTICLES) particle_count = KRMeshManager::KRENGINE_MAX_RANDOM_PARTICLES; if(particle_count > KRMeshManager::KRENGINE_MAX_RANDOM_PARTICLES) particle_count = KRMeshManager::KRENGINE_MAX_RANDOM_PARTICLES;
// Enable z-buffer test // Enable z-buffer test
@@ -421,12 +421,12 @@ void KRLight::renderShadowBuffers(KRCamera *pCamera)
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow])); GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow]));
GLDEBUG(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowDepthTexture[iShadow], 0)); GLDEBUG(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowDepthTexture[iShadow], 0));
GLDEBUG(glViewport(0, 0, m_shadowViewports[iShadow].getSize().x, m_shadowViewports[iShadow].getSize().y)); GLDEBUG(glViewport(0, 0, (GLsizei)m_shadowViewports[iShadow].getSize().x, (GLsizei)m_shadowViewports[iShadow].getSize().y));
GLDEBUG(glClearDepthf(0.0f)); GLDEBUG(glClearDepthf(0.0f));
GLDEBUG(glClear(GL_DEPTH_BUFFER_BIT)); GLDEBUG(glClear(GL_DEPTH_BUFFER_BIT));
GLDEBUG(glViewport(1, 1, m_shadowViewports[iShadow].getSize().x - 2, m_shadowViewports[iShadow].getSize().y - 2)); GLDEBUG(glViewport(1, 1, (GLsizei)m_shadowViewports[iShadow].getSize().x - 2, (GLsizei)m_shadowViewports[iShadow].getSize().y - 2));
GLDEBUG(glClearDepthf(1.0f)); GLDEBUG(glClearDepthf(1.0f));

View File

@@ -1053,15 +1053,15 @@ void KRMesh::updateAttributeOffsets()
{ {
pack_header *header = getHeader(); pack_header *header = getHeader();
int mask = 0; int mask = 0;
for(int i=0; i < KRENGINE_NUM_ATTRIBUTES; i++) { for(size_t i=0; i < KRENGINE_NUM_ATTRIBUTES; i++) {
if(has_vertex_attribute((vertex_attrib_t)i)) { if(has_vertex_attribute((vertex_attrib_t)i)) {
m_vertex_attribute_offset[i] = VertexSizeForAttributes(header->vertex_attrib_flags & mask); m_vertex_attribute_offset[i] = (int)VertexSizeForAttributes(header->vertex_attrib_flags & mask);
} else { } else {
m_vertex_attribute_offset[i] = -1; m_vertex_attribute_offset[i] = -1;
} }
mask = (mask << 1) | 1; mask = (mask << 1) | 1;
} }
m_vertex_size = VertexSizeForAttributes(header->vertex_attrib_flags); m_vertex_size = (int)VertexSizeForAttributes(header->vertex_attrib_flags);
} }
size_t KRMesh::AttributeOffset(__int32_t vertex_attrib, __int32_t vertex_attrib_flags) size_t KRMesh::AttributeOffset(__int32_t vertex_attrib, __int32_t vertex_attrib_flags)

View File

@@ -401,32 +401,32 @@ KRDataBlock &KRMeshManager::getVolumetricLightingVertexes()
for(int iPlane=0; iPlane < KRENGINE_MAX_VOLUMETRIC_PLANES; iPlane++) { for(int iPlane=0; iPlane < KRENGINE_MAX_VOLUMETRIC_PLANES; iPlane++) {
vertex_data[iVertex].vertex.x = -1.0f; vertex_data[iVertex].vertex.x = -1.0f;
vertex_data[iVertex].vertex.y = -1.0f; vertex_data[iVertex].vertex.y = -1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
vertex_data[iVertex].vertex.x = 1.0f; vertex_data[iVertex].vertex.x = 1.0f;
vertex_data[iVertex].vertex.y = -1.0f; vertex_data[iVertex].vertex.y = -1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
vertex_data[iVertex].vertex.x = -1.0f; vertex_data[iVertex].vertex.x = -1.0f;
vertex_data[iVertex].vertex.y = 1.0f; vertex_data[iVertex].vertex.y = 1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
vertex_data[iVertex].vertex.x = -1.0f; vertex_data[iVertex].vertex.x = -1.0f;
vertex_data[iVertex].vertex.y = 1.0f; vertex_data[iVertex].vertex.y = 1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
vertex_data[iVertex].vertex.x = 1.0f; vertex_data[iVertex].vertex.x = 1.0f;
vertex_data[iVertex].vertex.y = -1.0f; vertex_data[iVertex].vertex.y = -1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
vertex_data[iVertex].vertex.x = 1.0f; vertex_data[iVertex].vertex.x = 1.0f;
vertex_data[iVertex].vertex.y = 1.0f; vertex_data[iVertex].vertex.y = 1.0f;
vertex_data[iVertex].vertex.z = iPlane; vertex_data[iVertex].vertex.z = (GLfloat)iPlane;
iVertex++; iVertex++;
} }
@@ -481,7 +481,7 @@ long KRMeshManager::getMemoryTransferedThisFrame()
} }
int KRMeshManager::getActiveVBOCount() size_t KRMeshManager::getActiveVBOCount()
{ {
return m_vbosActive.size(); return m_vbosActive.size();
} }

View File

@@ -150,7 +150,7 @@ public:
long getMemoryTransferedThisFrame(); long getMemoryTransferedThisFrame();
int getActiveVBOCount(); size_t getActiveVBOCount();
struct draw_call_info { struct draw_call_info {
KRNode::RenderPass pass; KRNode::RenderPass pass;

View File

@@ -125,13 +125,13 @@ tinyxml2::XMLElement *KRNode::saveXML(tinyxml2::XMLNode *parent) {
e->SetAttribute("name", m_name.c_str()); e->SetAttribute("name", m_name.c_str());
kraken::setXMLAttribute("translate", e, m_localTranslation, Vector3::Zero()); kraken::setXMLAttribute("translate", e, m_localTranslation, Vector3::Zero());
kraken::setXMLAttribute("scale", e, m_localScale, Vector3::One()); kraken::setXMLAttribute("scale", e, m_localScale, Vector3::One());
kraken::setXMLAttribute("rotate", e, (m_localRotation * (180.0f / M_PI)), Vector3::Zero()); kraken::setXMLAttribute("rotate", e, (m_localRotation * (180.0f / (float)M_PI)), Vector3::Zero());
kraken::setXMLAttribute("rotate_offset", e, m_rotationOffset, Vector3::Zero()); kraken::setXMLAttribute("rotate_offset", e, m_rotationOffset, Vector3::Zero());
kraken::setXMLAttribute("scale_offset", e, m_scalingOffset, Vector3::Zero()); kraken::setXMLAttribute("scale_offset", e, m_scalingOffset, Vector3::Zero());
kraken::setXMLAttribute("rotate_pivot", e, m_rotationPivot, Vector3::Zero()); kraken::setXMLAttribute("rotate_pivot", e, m_rotationPivot, Vector3::Zero());
kraken::setXMLAttribute("scale_pivot", e, m_scalingPivot, Vector3::Zero()); kraken::setXMLAttribute("scale_pivot", e, m_scalingPivot, Vector3::Zero());
kraken::setXMLAttribute("pre_rotate", e, (m_preRotation * (180.0f / M_PI)), Vector3::Zero()); kraken::setXMLAttribute("pre_rotate", e, (m_preRotation * (180.0f / (float)M_PI)), Vector3::Zero());
kraken::setXMLAttribute("post_rotate", e, (m_postRotation * (180.0f / M_PI)), Vector3::Zero()); kraken::setXMLAttribute("post_rotate", e, (m_postRotation * (180.0f / (float)M_PI)), Vector3::Zero());
for(std::set<KRNode *>::iterator itr=m_childNodes.begin(); itr != m_childNodes.end(); ++itr) { for(std::set<KRNode *>::iterator itr=m_childNodes.begin(); itr != m_childNodes.end(); ++itr) {
KRNode *child = (*itr); KRNode *child = (*itr);
@@ -145,11 +145,11 @@ void KRNode::loadXML(tinyxml2::XMLElement *e) {
m_localTranslation = kraken::getXMLAttribute("translate", e, Vector3::Zero()); m_localTranslation = kraken::getXMLAttribute("translate", e, Vector3::Zero());
m_localScale = kraken::getXMLAttribute("scale", e, Vector3::One()); m_localScale = kraken::getXMLAttribute("scale", e, Vector3::One());
m_localRotation = kraken::getXMLAttribute("rotate", e, Vector3::Zero()); m_localRotation = kraken::getXMLAttribute("rotate", e, Vector3::Zero());
m_localRotation *= M_PI / 180.0f; // Convert degrees to radians m_localRotation *= (float)M_PI / 180.0f; // Convert degrees to radians
m_preRotation = kraken::getXMLAttribute("pre_rotate", e, Vector3::Zero()); m_preRotation = kraken::getXMLAttribute("pre_rotate", e, Vector3::Zero());
m_preRotation *= M_PI / 180.0f; // Convert degrees to radians m_preRotation *= (float)M_PI / 180.0f; // Convert degrees to radians
m_postRotation = kraken::getXMLAttribute("post_rotate", e, Vector3::Zero()); m_postRotation = kraken::getXMLAttribute("post_rotate", e, Vector3::Zero());
m_postRotation *= M_PI / 180.0f; // Convert degrees to radians m_postRotation *= (float)M_PI / 180.0f; // Convert degrees to radians
m_rotationOffset = kraken::getXMLAttribute("rotate_offset", e, Vector3::Zero()); m_rotationOffset = kraken::getXMLAttribute("rotate_offset", e, Vector3::Zero());
m_scalingOffset = kraken::getXMLAttribute("scale_offset", e, Vector3::Zero()); m_scalingOffset = kraken::getXMLAttribute("scale_offset", e, Vector3::Zero());
@@ -763,7 +763,7 @@ void KRNode::SetAttribute(node_attribute_type attrib, float v)
{ {
if(m_animation_mask[attrib]) return; if(m_animation_mask[attrib]) return;
const float DEGREES_TO_RAD = M_PI / 180.0f; const float DEGREES_TO_RAD = (float)M_PI / 180.0f;
//printf("%s - ", m_name.c_str()); //printf("%s - ", m_name.c_str());
switch(attrib) { switch(attrib) {

View File

@@ -57,9 +57,9 @@ KRShader *KRShaderManager::getShader(const std::string &shader_name, KRCamera *p
int light_point_count = 0; int light_point_count = 0;
int light_spot_count = 0; int light_spot_count = 0;
if(renderPass != KRNode::RENDER_PASS_DEFERRED_LIGHTS && renderPass != KRNode::RENDER_PASS_DEFERRED_GBUFFER && renderPass != KRNode::RENDER_PASS_DEFERRED_OPAQUE && renderPass != KRNode::RENDER_PASS_GENERATE_SHADOWMAPS) { if(renderPass != KRNode::RENDER_PASS_DEFERRED_LIGHTS && renderPass != KRNode::RENDER_PASS_DEFERRED_GBUFFER && renderPass != KRNode::RENDER_PASS_DEFERRED_OPAQUE && renderPass != KRNode::RENDER_PASS_GENERATE_SHADOWMAPS) {
light_directional_count = directional_lights.size(); light_directional_count = (int)directional_lights.size();
light_point_count = point_lights.size(); light_point_count = (int)point_lights.size();
light_spot_count = spot_lights.size(); light_spot_count = (int)spot_lights.size();
for(std::vector<KRDirectionalLight *>::const_iterator light_itr=directional_lights.begin(); light_itr != directional_lights.end(); light_itr++) { for(std::vector<KRDirectionalLight *>::const_iterator light_itr=directional_lights.begin(); light_itr != directional_lights.end(); light_itr++) {
KRDirectionalLight *directional_light =(*light_itr); KRDirectionalLight *directional_light =(*light_itr);
iShadowQuality = directional_light->getShadowBufferCount(); iShadowQuality = directional_light->getShadowBufferCount();
@@ -109,13 +109,13 @@ KRShader *KRShaderManager::getShader(const std::string &shader_name, KRCamera *p
key.second.push_back(pCamera->settings.dof_quality); key.second.push_back(pCamera->settings.dof_quality);
key.second.push_back(pCamera->settings.bEnableFlash); key.second.push_back(pCamera->settings.bEnableFlash);
key.second.push_back(pCamera->settings.bEnableVignette); key.second.push_back(pCamera->settings.bEnableVignette);
key.second.push_back(pCamera->settings.dof_depth * 1000.0f); key.second.push_back((int)(pCamera->settings.dof_depth * 1000.0f));
key.second.push_back(pCamera->settings.dof_falloff * 1000.0f); key.second.push_back((int)(pCamera->settings.dof_falloff * 1000.0f));
key.second.push_back(pCamera->settings.flash_depth * 1000.0f); key.second.push_back((int)(pCamera->settings.flash_depth * 1000.0f));
key.second.push_back(pCamera->settings.flash_falloff * 1000.0f); key.second.push_back((int)(pCamera->settings.flash_falloff * 1000.0f));
key.second.push_back(pCamera->settings.flash_intensity * 1000.0f); key.second.push_back((int)(pCamera->settings.flash_intensity * 1000.0f));
key.second.push_back(pCamera->settings.vignette_radius * 1000.0f); key.second.push_back((int)(pCamera->settings.vignette_radius * 1000.0f));
key.second.push_back(pCamera->settings.vignette_falloff * 1000.0f); key.second.push_back((int)(pCamera->settings.vignette_falloff * 1000.0f));
key.second.push_back(bRimColor); key.second.push_back(bRimColor);
key.second.push_back(bFadeColorEnabled); key.second.push_back(bFadeColorEnabled);
@@ -278,6 +278,6 @@ const std::string &KRShaderManager::getVertShaderSource(const std::string &name)
return m_vertShaderSource[name]; return m_vertShaderSource[name];
} }
long KRShaderManager::getShaderHandlesUsed() { size_t KRShaderManager::getShaderHandlesUsed() {
return m_shaders.size(); return m_shaders.size();
} }

View File

@@ -1,79 +1,79 @@
// //
// KRShaderManager.h // KRShaderManager.h
// KREngine // KREngine
// //
// Copyright 2012 Kearwood Gilbert. All rights reserved. // Copyright 2012 Kearwood Gilbert. All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without modification, are // Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met: // permitted provided that the following conditions are met:
// //
// 1. Redistributions of source code must retain the above copyright notice, this list of // 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer. // conditions and the following disclaimer.
// //
// 2. Redistributions in binary form must reproduce the above copyright notice, this list // 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials // of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution. // provided with the distribution.
// //
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED // THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// The views and conclusions contained in the software and documentation are those of the // The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed // authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert. // or implied, of Kearwood Gilbert.
// //
#include "KREngine-common.h" #include "KREngine-common.h"
#include "KRCamera.h" #include "KRCamera.h"
#include "KRDataBlock.h" #include "KRDataBlock.h"
#include "KRNode.h" #include "KRNode.h"
using std::map; using std::map;
using std::vector; using std::vector;
#include "KRShader.h" #include "KRShader.h"
#ifndef KRSHADERMANAGER_H #ifndef KRSHADERMANAGER_H
#define KRSHADERMANAGER_H #define KRSHADERMANAGER_H
class KRShader; class KRShader;
class KRCamera; class KRCamera;
class KRShaderManager : public KRContextObject { class KRShaderManager : public KRContextObject {
public: public:
KRShaderManager(KRContext &context); KRShaderManager(KRContext &context);
virtual ~KRShaderManager(); virtual ~KRShaderManager();
void loadFragmentShader(const std::string &name, KRDataBlock *data); void loadFragmentShader(const std::string &name, KRDataBlock *data);
void loadVertexShader(const std::string &name, KRDataBlock *data); void loadVertexShader(const std::string &name, KRDataBlock *data);
const std::string &getFragShaderSource(const std::string &name); const std::string &getFragShaderSource(const std::string &name);
const std::string &getVertShaderSource(const std::string &name); const std::string &getVertShaderSource(const std::string &name);
KRShader *getShader(const std::string &shader_name, KRCamera *pCamera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, bool bRimColor = false); KRShader *getShader(const std::string &shader_name, KRCamera *pCamera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, bool bRimColor = false);
bool selectShader(KRCamera &camera, KRShader *pShader, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color); bool selectShader(KRCamera &camera, KRShader *pShader, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
bool selectShader(const std::string &shader_name, KRCamera &camera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRViewport &viewport, const Matrix4 &matModel, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color); bool selectShader(const std::string &shader_name, KRCamera &camera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRViewport &viewport, const Matrix4 &matModel, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
long getShaderHandlesUsed(); size_t getShaderHandlesUsed();
KRShader *m_active_shader; KRShader *m_active_shader;
private: private:
//unordered_map<std::string, KRShader *> m_shaders; //unordered_map<std::string, KRShader *> m_shaders;
std::map<std::pair<std::string, std::vector<int> >, KRShader *> m_shaders; std::map<std::pair<std::string, std::vector<int> >, KRShader *> m_shaders;
unordered_map<std::string, std::string> m_fragShaderSource; unordered_map<std::string, std::string> m_fragShaderSource;
unordered_map<std::string, std::string> m_vertShaderSource; unordered_map<std::string, std::string> m_vertShaderSource;
}; };
#endif #endif