Hi,
I am using this code for inserting texture in a simple model.
Public Sub SetTexture(iEntity As IEntity_DG)
iEntity = mModel.GetEntityAt(0)
Debug.WriteLine("Entity: " & iEntity.GetName())
Dim iTex As ITexture_DG = iEntity
If iTex Is Nothing Then
MessageBox.Show("The model is not suitable for Texture sample")
Return
End If
Dim props As IDictionary_DG = iEntity.GetExtendedProperties()
Dim iSurfaces As IArray_DG = props.GetInterface("TextureArray")
Debug.WriteLine("1-Surfaces=" & iSurfaces.GetCount().ToString)
Dim TextureFile As String = "C:\Users\wood.jpg"
iTex.Load(TextureFile)
iTex.SetEnabled(True)
If iTex.IsLoaded() Then Debug.WriteLine("Was loaded " & iTex.GetFileName())
props = iEntity.GetExtendedProperties()
iSurfaces = props.GetInterface("TextureArray")
Debug.WriteLine("2-Surfaces=" & iSurfaces.GetCount().ToString)
iTex.SetBlend(True)
End Sub
Don´t manage to see the texture. I get iSurfaces.GetCount()=0. What is missing or erroneous?
Thank you,
Marcos
Entity Texture
-
- Posts: 40
- Joined: Mon Jul 15, 2024 5:20 am
Re: Entity Texture
Hello Marcos
Textures are little tricky. DGK also needs some work in this regard. I think you are the first person asking about this feature. So, it is a bit behind. We have plans to revisit this area asap.
Textures have to be oriented and positioned in some way on the surface. This means it heavily depends on the type of geometry of the object. Normally, there is also some input from the application is needed to define the mapping.
Currently textures work well for 3DS geometry. This is what the textures sample demonstrates. It also works well for Mesh type of geometry, but I believe defining it for mesh currently works only via importing the relevant vrml structures. The textual VRML file can be generated on the run by the application.
Regards
Textures are little tricky. DGK also needs some work in this regard. I think you are the first person asking about this feature. So, it is a bit behind. We have plans to revisit this area asap.
Textures have to be oriented and positioned in some way on the surface. This means it heavily depends on the type of geometry of the object. Normally, there is also some input from the application is needed to define the mapping.
Currently textures work well for 3DS geometry. This is what the textures sample demonstrates. It also works well for Mesh type of geometry, but I believe defining it for mesh currently works only via importing the relevant vrml structures. The textual VRML file can be generated on the run by the application.
Regards