aplly same material to all objects...
Blitz3D Forums/Blitz3D Beginners Area/aplly same material to all objects...
| ||
i want to try to remove all textures, colors and materials from the scene in the game... there is a way to write a function, to aplly to all entitys in the scene, the same material or texture?.. using the entitys ID or something?.. in some cases, i don't have the name of all entitys... i can't write each one in the function... i thinking in something like for each entity in the scene .... entitycolor entity,125,125,125 textureentity entity,NONE texture :p next is it possible? regards... |
| ||
Store each entity in a type collection when it's loaded/created.Type entity field entity_handle ; the variable holding the handle upon loading, or copying field texture[8] End type You would need to strip each entity as it was loaded and find out which textures it's using though. To remove a texture, i believe you must overtexture, so to speak. Create a black (Or whatever other colour you want) texture 16x16 or something small, and texture every entity with it. |
| ||
Nifty command that'll aid you: http://www.blitzbasic.com/b3ddocs/command.php?name=ClearWorld There isn't a way to access all the entities without having to go through a loop or list of some sort. What you can do that will save you some function calls is to prepare a Brush with the characteristics you want to apply to all meshes (BrushColor, Shininess, Alpha, Texture, Blend, FX). Once you go through the "entity painting loop", simply use PaintMesh or PaintEntity (the latter is prefered) and paint them all with the same single brush you just created. |
| ||
If you create a global parent pivot, and then attach everything to this pivot on creation/loading, you can use GetChild to access all entities in the scene. |
| ||
:) thanks for the three optiones... i don't know how the brush function works.. i need to learn about that... i think now, the name for the function i wan't is "disable texture" some games in the 90's had that options... |
| ||
Then just go with "ClearWorld False,False,True". If I'm not mistaken, that'll immediately strip all the textures from all the objects, leaving them with only their basic flat colors. If you want all the textures back after freeing them, you'd have to reload and re-apply all of them to their respective owners. |
| ||
One further thing: as far as I know it's not possible to disable a texture from a certain entity/surface (unless you want to remove all textures from all entities, as Kryzon said with Clearworld), if a surface once has a texture applied, you can only apply an other one. You may use a 1*1 Pixel white texture to achieve the same effect. |
| ||
i try with clearworld(0,0,1) but the program crash... i go to try to make something like this.. for obj = all objects in the scene if object = entity, sprite, or something... then clear the textures or aplly a small gray texture aplly new color 125,125,125 reset shinnines, alpha, etc.. end if next this is somethime for uses in debug mode o programed mode, to test the time take a video car for calculate the vertex, surfaces, etc... |