Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
... private Vector3 _position; private float _radius; private Device _device; private string _meshFile; private float _scale; private Mesh _mesh = null; private Material[] _meshMaterials; private Texture[] _meshTextures; ... private void LoadMesh ( ) { ExtendedMaterial[] materials = null; Directory.SetCurrentDirectory ( Application.StartupPath + @"\..\..\..\Resources\" ); _mesh = Mesh.FromFile ( _meshFile, MeshFlags.Managed, _device, out materials ); if ( ( materials != null ) && ( materials.Length > 0 ) ) { _meshTextures = new Texture [ materials.Length ]; _meshMaterials = new Material [ materials.Length ]; for ( int i = 0 ; i < materials.Length ; i++ ) { _meshMaterials[i] = materials[i].Material3D; _meshMaterials[i].Ambient = _meshMaterials[i].Ambient; _meshMaterials[i].Diffuse = _meshMaterials[i].Diffuse; if ( materials[i].TextureFilename != null && ( materials[i].TextureFilename != string.Empty ) ) _meshTextures[i] = TextureLoader.FromFile ( _device, materials[i].TextureFilename ); } } } |
Werbeanzeige