commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
93
include/engine/core/material.cpp
Normal file
93
include/engine/core/material.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "core/material.h"
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace GS::Core;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Material::TextureStage *Material::GetChannelStage(MaterialChannel channel) const
|
||||
{
|
||||
for (int n = 0; n < max_texture_stage; ++n)
|
||||
if (texstage[n].channel == channel)
|
||||
return &texstage[n];
|
||||
return NULL;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Material::TextureStage *Material::NewStage(MaterialChannel channel, const char *uri, UVMode uv_mode, uchar uv_index)
|
||||
{
|
||||
TextureStage *s = GetChannelStage(channel);
|
||||
if (s)
|
||||
return s;
|
||||
|
||||
// Find a free stage.
|
||||
for (int n = 0; n < max_texture_stage; ++n)
|
||||
if (texstage[n].channel == Channel_None)
|
||||
{
|
||||
s = &texstage[n];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!s)
|
||||
__ERR__(__LOG_W__ << "No more free texture stage, cannot create new stage.\n", NULL)
|
||||
|
||||
// Initialize stage.
|
||||
s->channel = channel;
|
||||
s->t = uri;
|
||||
s->uv_mode = uv_mode;
|
||||
s->uv_index = uv_index;
|
||||
return s;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Material::Reset()
|
||||
{
|
||||
renderword = Render_None;
|
||||
blendop = Blend_None;
|
||||
|
||||
diffuse.Set(1, 1, 1);
|
||||
specular.Set(1, 1, 1);
|
||||
self.Set(0, 0, 0);
|
||||
ambient.Set(1, 1, 1);
|
||||
|
||||
glossiness = 0.4f;
|
||||
opacity = 1;
|
||||
reflection = 0;
|
||||
irefraction = 1;
|
||||
athreshold = 0.1f;
|
||||
depth_bias = 0;
|
||||
|
||||
shader.Clear();
|
||||
|
||||
for (int n = 0; n < max_texture_stage; n++)
|
||||
texstage[n].Reset();
|
||||
texstage_count = 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Material::TextureStage::Reset()
|
||||
{
|
||||
channel = Channel_None;
|
||||
op = Operator_Default;
|
||||
t.Clear();
|
||||
|
||||
uv_mode = UV_UV;
|
||||
uv_matrix = Matrix4::IdentityMatrix();
|
||||
uv_index = 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Material::Material()
|
||||
{
|
||||
texstage.Allocate(max_texture_stage);
|
||||
Reset();
|
||||
}
|
||||
Reference in New Issue
Block a user