material lua binding added + rev
This commit is contained in:
@@ -357,6 +357,11 @@ Decal is a texture sticker placeable onto any surface. It is a Transform and a C
|
||||
- SetFadeStart(float start)
|
||||
- GetFadeStart() : float result
|
||||
|
||||
#### Material
|
||||
- [constructor]Material(opt string name="")
|
||||
- GetName() : string name
|
||||
- SetName(string value)
|
||||
|
||||
### MainComponent
|
||||
The main component which holds information and manages the running of the current program.
|
||||
- [outer]main : MainComponent
|
||||
|
||||
@@ -15,7 +15,7 @@ float4 main( PixelInputType PSIn) : SV_TARGET
|
||||
float4 baseColor = diffuseColor;
|
||||
|
||||
[branch]if(hasTex){
|
||||
baseColor = xTextureTex.Sample(texSampler, PSIn.tex+movingTex);
|
||||
baseColor *= xTextureTex.Sample(texSampler, PSIn.tex+movingTex);
|
||||
//baseColor*=baseColor.a;
|
||||
}
|
||||
baseColor.rgb *= PSIn.instanceColor;
|
||||
|
||||
@@ -677,7 +677,6 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
currentMat->hasSpecularMap=true;
|
||||
break;
|
||||
case 'a':
|
||||
currentMat->transparent=true;
|
||||
file>>currentMat->alpha;
|
||||
break;
|
||||
case 'h':
|
||||
@@ -888,7 +887,7 @@ void LoadWiObjects(const string& directory, const string& name, const string& id
|
||||
if(wiRenderer::HAIRPARTICLEENABLED){
|
||||
stringstream identified_materialName("");
|
||||
identified_materialName<<mat<<identifier;
|
||||
objects.back()->hwiParticleSystems.push_back(new wiHairParticle(name,len,count,identified_materialName.str(),objects.back(),densityG,lenG) );
|
||||
objects.back()->hParticleSystems.push_back(new wiHairParticle(name,len,count,identified_materialName.str(),objects.back(),densityG,lenG) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -938,11 +937,11 @@ void LoadWiObjects(const string& directory, const string& name, const string& id
|
||||
|
||||
//if(objects[i]->mesh->renderable)
|
||||
for(Material* mat : objects[i]->mesh->materials){
|
||||
if(!mat->water && !mat->isSky && !mat->transparent)
|
||||
if(!mat->water && !mat->isSky && !mat->IsTransparent())
|
||||
default_mesh=true;
|
||||
if(mat->water && !mat->isSky)
|
||||
water_mesh=true;
|
||||
if(!mat->water && !mat->isSky && mat->transparent)
|
||||
if(!mat->water && !mat->isSky && mat->IsTransparent())
|
||||
transparent_mesh=true;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,6 @@ struct Material
|
||||
|
||||
bool subsurface_scattering;
|
||||
bool toonshading;
|
||||
bool transparent;
|
||||
bool water,shadeless;
|
||||
float alpha;
|
||||
float refraction_index;
|
||||
@@ -142,7 +141,7 @@ struct Material
|
||||
Material(){}
|
||||
Material(string newName){
|
||||
name=newName;
|
||||
diffuseColor = XMFLOAT3(0,0,0);
|
||||
diffuseColor = XMFLOAT3(1,1,1);
|
||||
|
||||
hasRefMap=false;
|
||||
refMapName="";
|
||||
@@ -167,7 +166,7 @@ struct Material
|
||||
specularMapName="";
|
||||
specularMap=0;
|
||||
|
||||
subsurface_scattering=toonshading=transparent=water=false;
|
||||
subsurface_scattering=toonshading=water=false;
|
||||
alpha=1.0f;
|
||||
refraction_index=0.0f;
|
||||
enviroReflection=0.0f;
|
||||
@@ -182,6 +181,8 @@ struct Material
|
||||
cast_shadow=true;
|
||||
}
|
||||
void CleanUp();
|
||||
|
||||
bool IsTransparent() { return alpha < 1.0f; }
|
||||
};
|
||||
struct RibbonVertex
|
||||
{
|
||||
@@ -495,7 +496,7 @@ struct Object : public Streamable, public Transform
|
||||
};
|
||||
wiParticleEmitter particleEmitter;
|
||||
vector< wiEmittedParticle* > eParticleSystems;
|
||||
vector< wiHairParticle* > hwiParticleSystems;
|
||||
vector< wiHairParticle* > hParticleSystems;
|
||||
|
||||
float transparency;
|
||||
|
||||
@@ -530,7 +531,7 @@ struct Object : public Streamable, public Transform
|
||||
trailBuff=NULL;
|
||||
particleEmitter = NO_EMITTER;
|
||||
eParticleSystems.resize(0);
|
||||
hwiParticleSystems.resize(0);
|
||||
hParticleSystems.resize(0);
|
||||
mesh=nullptr;
|
||||
rigidBody=kinematic=false;
|
||||
collisionShape="";
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace wiLoader_BindLua
|
||||
AABB_BindLua::Bind();
|
||||
EmittedParticle_BindLua::Bind();
|
||||
Decal_BindLua::Bind();
|
||||
Material_BindLua::Bind();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1508,4 +1509,123 @@ void EmittedParticle_BindLua::Bind()
|
||||
initialized = true;
|
||||
Luna<EmittedParticle_BindLua>::Register(wiLua::GetGlobal()->GetLuaState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char Material_BindLua::className[] = "Emitter";
|
||||
|
||||
Luna<Material_BindLua>::FunctionType Material_BindLua::methods[] = {
|
||||
lunamethod(Material_BindLua, GetName),
|
||||
lunamethod(Material_BindLua, SetName),
|
||||
lunamethod(Material_BindLua, GetColor),
|
||||
lunamethod(Material_BindLua, SetColor),
|
||||
lunamethod(Material_BindLua, GetAlpha),
|
||||
lunamethod(Material_BindLua, SetAlpha),
|
||||
lunamethod(Material_BindLua, GetRefractionIndex),
|
||||
lunamethod(Material_BindLua, SetRefractionIndex),
|
||||
{ NULL, NULL }
|
||||
};
|
||||
Luna<Material_BindLua>::PropertyType Material_BindLua::properties[] = {
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
Material_BindLua::Material_BindLua(Material* material) :material(material)
|
||||
{
|
||||
}
|
||||
Material_BindLua::Material_BindLua(lua_State *L)
|
||||
{
|
||||
material = new Material();
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
material->name = wiLua::SGetString(L, 1);
|
||||
}
|
||||
}
|
||||
Material_BindLua::~Material_BindLua()
|
||||
{
|
||||
}
|
||||
|
||||
int Material_BindLua::GetName(lua_State* L)
|
||||
{
|
||||
wiLua::SSetString(L, material->name);
|
||||
return 1;
|
||||
}
|
||||
int Material_BindLua::SetName(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
material->name = wiLua::SGetString(L, 1);
|
||||
}
|
||||
else
|
||||
wiLua::SError(L, "SetName(string name) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Material_BindLua::GetColor(lua_State* L)
|
||||
{
|
||||
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&material->diffuseColor)));
|
||||
return 1;
|
||||
}
|
||||
int Material_BindLua::SetColor(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
Vector_BindLua* vec = Luna<Vector_BindLua>::lightcheck(L, 1);
|
||||
if (vec != nullptr)
|
||||
{
|
||||
XMStoreFloat3(&material->diffuseColor, vec->vector);
|
||||
}
|
||||
else
|
||||
{
|
||||
wiLua::SError(L, "SetColor(Vector color) argument is not a Vector!");
|
||||
}
|
||||
}
|
||||
else
|
||||
wiLua::SError(L, "SetColor(Vector color) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Material_BindLua::GetAlpha(lua_State* L)
|
||||
{
|
||||
wiLua::SSetFloat(L, material->alpha);
|
||||
return 1;
|
||||
}
|
||||
int Material_BindLua::SetAlpha(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
material->alpha = wiLua::SGetFloat(L, 1);
|
||||
}
|
||||
else
|
||||
wiLua::SError(L, "SetTransparency(float alpha) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Material_BindLua::GetRefractionIndex(lua_State* L)
|
||||
{
|
||||
wiLua::SSetFloat(L, material->refraction_index);
|
||||
return 1;
|
||||
}
|
||||
int Material_BindLua::SetRefractionIndex(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
material->refraction_index = wiLua::SGetFloat(L, 1);
|
||||
}
|
||||
else
|
||||
wiLua::SError(L, "SetRefractionIndex(float alpha) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Material_BindLua::Bind()
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
Luna<Material_BindLua>::Register(wiLua::GetGlobal()->GetLuaState());
|
||||
}
|
||||
}
|
||||
@@ -223,3 +223,28 @@ public:
|
||||
static void Bind();
|
||||
};
|
||||
|
||||
class Material_BindLua
|
||||
{
|
||||
public:
|
||||
Material* material;
|
||||
|
||||
static const char className[];
|
||||
static Luna<Material_BindLua>::FunctionType methods[];
|
||||
static Luna<Material_BindLua>::PropertyType properties[];
|
||||
|
||||
Material_BindLua(Material* material);
|
||||
Material_BindLua(lua_State* L);
|
||||
~Material_BindLua();
|
||||
|
||||
int GetName(lua_State* L);
|
||||
int SetName(lua_State* L);
|
||||
int GetColor(lua_State* L);
|
||||
int SetColor(lua_State* L);
|
||||
int GetAlpha(lua_State* L);
|
||||
int SetAlpha(lua_State* L);
|
||||
int GetRefractionIndex(lua_State* L);
|
||||
int SetRefractionIndex(lua_State* L);
|
||||
|
||||
static void Bind();
|
||||
};
|
||||
|
||||
|
||||
+39
-39
@@ -632,9 +632,9 @@ void wiRenderer::CleanUpStaticTemp(){
|
||||
objects[i]->eParticleSystems[j]->CleanUp();
|
||||
objects[i]->eParticleSystems.clear();
|
||||
|
||||
for(unsigned int j=0;j<objects[i]->hwiParticleSystems.size();++j)
|
||||
objects[i]->hwiParticleSystems[j]->CleanUp();
|
||||
objects[i]->hwiParticleSystems.clear();
|
||||
for(unsigned int j=0;j<objects[i]->hParticleSystems.size();++j)
|
||||
objects[i]->hParticleSystems[j]->CleanUp();
|
||||
objects[i]->hParticleSystems.clear();
|
||||
}
|
||||
objects.clear();
|
||||
|
||||
@@ -644,9 +644,9 @@ void wiRenderer::CleanUpStaticTemp(){
|
||||
objects_trans[i]->eParticleSystems[j]->CleanUp();
|
||||
objects_trans[i]->eParticleSystems.clear();
|
||||
|
||||
for (unsigned int j = 0; j<objects_trans[i]->hwiParticleSystems.size(); ++j)
|
||||
objects_trans[i]->hwiParticleSystems[j]->CleanUp();
|
||||
objects_trans[i]->hwiParticleSystems.clear();
|
||||
for (unsigned int j = 0; j<objects_trans[i]->hParticleSystems.size(); ++j)
|
||||
objects_trans[i]->hParticleSystems[j]->CleanUp();
|
||||
objects_trans[i]->hParticleSystems.clear();
|
||||
}
|
||||
objects_trans.clear();
|
||||
|
||||
@@ -656,9 +656,9 @@ void wiRenderer::CleanUpStaticTemp(){
|
||||
objects_water[i]->eParticleSystems[j]->CleanUp();
|
||||
objects_water[i]->eParticleSystems.clear();
|
||||
|
||||
for (unsigned int j = 0; j<objects_water[i]->hwiParticleSystems.size(); ++j)
|
||||
objects_water[i]->hwiParticleSystems[j]->CleanUp();
|
||||
objects_water[i]->hwiParticleSystems.clear();
|
||||
for (unsigned int j = 0; j<objects_water[i]->hParticleSystems.size(); ++j)
|
||||
objects_water[i]->hParticleSystems[j]->CleanUp();
|
||||
objects_water[i]->hParticleSystems.clear();
|
||||
}
|
||||
objects_water.clear();
|
||||
everyObject.clear();
|
||||
@@ -775,7 +775,7 @@ void iterateSPTree(wiSPTree::Node* n, vector<Cube>& cubes, const XMFLOAT4A& col)
|
||||
for(Cullable* object:n->objects){
|
||||
cubes.push_back(Cube(object->bounds.getCenter(),object->bounds.getHalfWidth(),XMFLOAT4A(1,0,0,1)));
|
||||
//Object* o = (Object*)object;
|
||||
//for(wiHairParticle& hps : o->hwiParticleSystems)
|
||||
//for(wiHairParticle& hps : o->hParticleSystems)
|
||||
// iterateSPTree2(hps.spTree->root,cubes,XMFLOAT4A(0,1,0,1));
|
||||
}
|
||||
}
|
||||
@@ -2954,7 +2954,7 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
CulledList culledObjects;
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
|
||||
l->shadowMaps_dirLight[index].Activate(context);
|
||||
|
||||
@@ -2972,10 +2972,10 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
if (!culledObjects.empty()) {
|
||||
|
||||
for (Cullable* object : culledObjects) {
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
}
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3060,7 +3060,7 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
l->shadowMap_index = i;
|
||||
|
||||
CulledList culledObjects;
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
|
||||
Light::shadowMaps_spotLight[i].Set(context);
|
||||
static thread_local Frustum frustum = Frustum();
|
||||
@@ -3077,10 +3077,10 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
if (!culledObjects.empty()) {
|
||||
|
||||
for (Cullable* object : culledObjects) {
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
}
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3186,15 +3186,15 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
UpdateBuffer(cubeShCb, &cb, context);
|
||||
|
||||
CulledList culledObjects;
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
|
||||
if (spTree)
|
||||
wiSPTree::getVisible(spTree->root, l->bounds, culledObjects);
|
||||
|
||||
for (Cullable* object : culledObjects)
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3269,7 +3269,7 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
// {
|
||||
// //l->shadowMap[index].Set(context);
|
||||
|
||||
// CulledCollection culledwiRenderer;
|
||||
// CulledCollection culledRenderer;
|
||||
// CulledList culledObjects;
|
||||
|
||||
// if (l->type == Light::DIRECTIONAL){
|
||||
@@ -3297,10 +3297,10 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
// if (!culledObjects.empty()){
|
||||
|
||||
// for (Cullable* object : culledObjects){
|
||||
// culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
// culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
// }
|
||||
|
||||
// for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
// for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
// Mesh* mesh = iter->first;
|
||||
// CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3418,16 +3418,16 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
|
||||
// UpdateBuffer(cubeShCb, &cb, context);
|
||||
|
||||
// CulledCollection culledwiRenderer;
|
||||
// CulledCollection culledRenderer;
|
||||
// CulledList culledObjects;
|
||||
|
||||
// if (spTree)
|
||||
// wiSPTree::getVisible(spTree->root, l->bounds, culledObjects);
|
||||
|
||||
// for (Cullable* object : culledObjects)
|
||||
// culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
// culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
|
||||
// for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
// for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
// Mesh* mesh = iter->first;
|
||||
// CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3548,7 +3548,7 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11Device
|
||||
if(objects.empty())
|
||||
return;
|
||||
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
CulledList culledObjects;
|
||||
if(spTree)
|
||||
wiSPTree::getVisible(spTree->root, camera->frustum,culledObjects);
|
||||
@@ -3558,9 +3558,9 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11Device
|
||||
{
|
||||
|
||||
for(Cullable* object : culledObjects){
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
if(grass){
|
||||
for(wiHairParticle* hair : ((Object*)object)->hwiParticleSystems){
|
||||
for(wiHairParticle* hair : ((Object*)object)->hParticleSystems){
|
||||
hair->Draw(camera,context);
|
||||
}
|
||||
}
|
||||
@@ -3628,7 +3628,7 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11Device
|
||||
}
|
||||
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3673,7 +3673,7 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11Device
|
||||
int m=0;
|
||||
for(Material* iMat : mesh->materials){
|
||||
|
||||
if(!iMat->transparent && !iMat->isSky && !iMat->water){
|
||||
if(!iMat->IsTransparent() && !iMat->isSky && !iMat->water){
|
||||
|
||||
if(iMat->shadeless)
|
||||
BindDepthStencilState(depthStencilState,STENCILREF_SHADELESS,context);
|
||||
@@ -3719,7 +3719,7 @@ void wiRenderer::DrawWorldWater(Camera* camera, ID3D11ShaderResourceView* refrac
|
||||
return;
|
||||
|
||||
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
CulledList culledObjects;
|
||||
if(spTree_water)
|
||||
wiSPTree::getVisible(spTree_water->root, camera->frustum,culledObjects);
|
||||
@@ -3727,7 +3727,7 @@ void wiRenderer::DrawWorldWater(Camera* camera, ID3D11ShaderResourceView* refrac
|
||||
if(!culledObjects.empty())
|
||||
{
|
||||
for(Cullable* object : culledObjects)
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
|
||||
|
||||
BindPrimitiveTopology(TRIANGLELIST,context);
|
||||
@@ -3759,7 +3759,7 @@ void wiRenderer::DrawWorldWater(Camera* camera, ID3D11ShaderResourceView* refrac
|
||||
|
||||
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3818,7 +3818,7 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView*
|
||||
return;
|
||||
|
||||
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
CulledList culledObjects;
|
||||
if(spTree_trans)
|
||||
wiSPTree::getVisible(spTree_trans->root, camera->frustum,culledObjects);
|
||||
@@ -3826,7 +3826,7 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView*
|
||||
if(!culledObjects.empty())
|
||||
{
|
||||
for(Cullable* object : culledObjects)
|
||||
culledwiRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
culledRenderer[((Object*)object)->mesh].insert((Object*)object);
|
||||
|
||||
BindPrimitiveTopology(TRIANGLELIST,context);
|
||||
BindVertexLayout(vertexLayout,context);
|
||||
@@ -3854,7 +3854,7 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView*
|
||||
BindRasterizerState(wireRender?wireRS:rasterizerState,context);
|
||||
|
||||
|
||||
for (CulledCollection::iterator iter = culledwiRenderer.begin(); iter != culledwiRenderer.end(); ++iter) {
|
||||
for (CulledCollection::iterator iter = culledRenderer.begin(); iter != culledRenderer.end(); ++iter) {
|
||||
Mesh* mesh = iter->first;
|
||||
CulledObjectList& visibleInstances = iter->second;
|
||||
|
||||
@@ -3893,7 +3893,7 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView*
|
||||
int m=0;
|
||||
for(Material* iMat : mesh->materials){
|
||||
|
||||
if(iMat->transparent && iMat->alpha>0 && !iMat->water && !iMat->isSky){
|
||||
if(iMat->IsTransparent() && iMat->alpha>0 && !iMat->water && !iMat->isSky){
|
||||
|
||||
|
||||
static thread_local MaterialCB* mcb = new MaterialCB;
|
||||
@@ -4249,7 +4249,7 @@ void wiRenderer::UpdateLights()
|
||||
wiRenderer::Picked wiRenderer::Pick(RAY& ray, PICKTYPE pickType, const string& layer,
|
||||
const string& layerDisable)
|
||||
{
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
CulledList culledObjects;
|
||||
wiSPTree* searchTree = nullptr;
|
||||
switch (pickType)
|
||||
@@ -4384,7 +4384,7 @@ void wiRenderer::CalculateVertexAO(Object* object)
|
||||
|
||||
XMMATRIX& objectMat = object->getTransform();
|
||||
|
||||
CulledCollection culledwiRenderer;
|
||||
CulledCollection culledRenderer;
|
||||
CulledList culledObjects;
|
||||
wiSPTree* searchTree = spTree;
|
||||
|
||||
|
||||
@@ -191,6 +191,21 @@ namespace wiRenderer_BindLua
|
||||
wiLua::SSetString(L, ss.str());
|
||||
return 1;
|
||||
}
|
||||
int GetMaterial(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
string name = wiLua::SGetString(L, 1);
|
||||
Material* mat = wiRenderer::getMaterialByName(name);
|
||||
if (mat != nullptr)
|
||||
{
|
||||
Luna<Material_BindLua>::push(L, new Material_BindLua(mat));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int GetGameSpeed(lua_State* L)
|
||||
{
|
||||
wiLua::SSetFloat(L, wiRenderer::GetGameSpeed());
|
||||
@@ -559,6 +574,7 @@ namespace wiRenderer_BindLua
|
||||
wiLua::GetGlobal()->RegisterFunc("GetMeshes", GetMeshes);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetLights", GetLights);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetMaterials", GetMaterials);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetMaterial", GetMaterial);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetGameSpeed", GetGameSpeed);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetScreenWidth", GetScreenWidth);
|
||||
wiLua::GetGlobal()->RegisterFunc("GetScreenHeight", GetScreenHeight);
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace wiVersion
|
||||
// minor features, major bug fixes
|
||||
const int minor = 4;
|
||||
// minor bug fixes, alterations
|
||||
const int revision = 0;
|
||||
const int revision = 1;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user