madjam002
11-09-2010 13:30:32
I'm new to Mogre and I think it's fantastic, but one of the things I find confusing from using other 3d engines is the whole entity system.
I want to draw some lego bricks on the screen, which I can manage fine, however I can't find out how to change the colour, transparency and reflectiveness on the materials.
I have had a look around the Mogre and Ogre forums but I don't understand how all the material files work, and I can't seem to find any tutorials on the material file construction.
Here is the code I am using at the moment:
The code works absolutely fine and draws a brick on the screen. Ignore the fact I haven't done the texture co-ordinates on all of the faces... I know I haven't done that
My textures are transparent PNGs. With the reflectiveness, I have a skybox so would it be possible to reflect the skybox or just draw a shiny skybox merged into the stud texture?
Also, if you think the way I am going about drawing a brick on screen with the manualobject is wrong in some way, just let me know because like I said I am new![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
Thanks for everyones help!
I want to draw some lego bricks on the screen, which I can manage fine, however I can't find out how to change the colour, transparency and reflectiveness on the materials.
I have had a look around the Mogre and Ogre forums but I don't understand how all the material files work, and I can't seem to find any tutorials on the material file construction.
Here is the code I am using at the moment:
' Code in VB.NET
Dim block As ManualObject = mySceneManager.CreateManualObject()
' Times size by 10 to take the stud size into account
Size = New Vector3(Size.x * 10, Size.y * 10, Size.z * 10)
' Front Face
block.Begin("Examples/Rockwall", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position(-(Size.x / 2), (Size.y / 2), -(Size.z / 2))
block.Position((Size.x / 2), (Size.y / 2), -(Size.z / 2))
block.Position(-(Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.Position((Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.End()
' Back Face
block.Begin("Examples/Rockwall", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position(-(Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.Position((Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.Position(-(Size.x / 2), (Size.y / 2), (Size.z / 2))
block.Position((Size.x / 2), (Size.y / 2), (Size.z / 2))
block.End()
' Top Face
block.Begin("Examples/Stud", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position(-(Size.x / 2), (Size.y / 2), (Size.z / 2)) : block.TextureCoord(0, 0)
block.Position((Size.x / 2), (Size.y / 2), (Size.z / 2)) : block.TextureCoord(0, 1)
block.Position(-(Size.x / 2), (Size.y / 2), -(Size.z / 2)) : block.TextureCoord(1, 0)
block.Position((Size.x / 2), (Size.y / 2), -(Size.z / 2)) : block.TextureCoord(1, 1)
block.End()
' Bottom Face
block.Begin("Examples/Rockwall", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position(-(Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.Position((Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.Position(-(Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.Position((Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.End()
' Left Face
block.Begin("Examples/Rockwall", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position(-(Size.x / 2), (Size.y / 2), (Size.z / 2))
block.Position(-(Size.x / 2), (Size.y / 2), -(Size.z / 2))
block.Position(-(Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.Position(-(Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.End()
' Right Face
block.Begin("Examples/Rockwall", RenderOperation.OperationTypes.OT_TRIANGLE_STRIP)
block.Position((Size.x / 2), -(Size.y / 2), (Size.z / 2))
block.Position((Size.x / 2), -(Size.y / 2), -(Size.z / 2))
block.Position((Size.x / 2), (Size.y / 2), (Size.z / 2))
block.Position((Size.x / 2), (Size.y / 2), -(Size.z / 2))
block.End()
block.CastShadows = True
o_Entity = block
o_SceneNode = mySceneManager.RootSceneNode.CreateChildSceneNode()
o_SceneNode.AttachObject(block)
o_SceneNode.Position = New Vector3(0, 0, 0)
The code works absolutely fine and draws a brick on the screen. Ignore the fact I haven't done the texture co-ordinates on all of the faces... I know I haven't done that
![Laughing :lol:]({SMILIES_PATH}/icon_lol.gif)
My textures are transparent PNGs. With the reflectiveness, I have a skybox so would it be possible to reflect the skybox or just draw a shiny skybox merged into the stud texture?
Also, if you think the way I am going about drawing a brick on screen with the manualobject is wrong in some way, just let me know because like I said I am new
![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
Thanks for everyones help!