Changeset 7399


Ignore:
Timestamp:
2016-06-16 22:57:10 (7 years ago)
Author:
sieerinn
Message:
 
Location:
2016/24/SimoR/Tasohyppelypeli/Tasohyppelypeli
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2016/24/SimoR/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli.cs

    r7398 r7399  
    88using Microsoft.Xna.Framework.Graphics; 
    99using Microsoft.Xna.Framework; 
     10using System.Reflection; 
    1011 
    1112public class Tasohyppelypeli : PhysicsGame 
     
    123124 
    124125    float aspectRatio; 
     126    GraphicsDeviceManager graphics; 
    125127 
    126128    Model norsuModel; 
     
    141143    bool light = false; 
    142144 
     145 
     146    protected override void Initialize() 
     147    { 
     148        base.Initialize(); 
     149 
     150        var parameters = new PresentationParameters() 
     151        { 
     152            MultiSampleCount = 4 
     153        }; 
     154 
     155        //graphics = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, parameters); 
     156    } 
     157 
    143158    protected override void LoadContent() 
    144159    { 
     
    146161        aspectRatio = GraphicsDevice.Viewport.AspectRatio; 
    147162 
    148         norsuModel = Content.Load<Model>("norsu2"); 
     163        // Haetaan reflektiolla Jypelin sisältä GraphicsDeviceManager. 
     164        var props = typeof(Tasohyppelypeli).GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Static); 
     165        foreach (PropertyInfo property in props) 
     166        { 
     167            if (property.Name == "GraphicsDeviceManager") 
     168                graphics = property.GetValue(null, null) as GraphicsDeviceManager; 
     169        } 
     170 
     171        // Yritetään säätää multisampling päälle. 
     172        if (graphics != null) 
     173        { 
     174            graphics.PreferMultiSampling = true; 
     175            graphics.ApplyChanges(); 
     176        } 
     177 
     178        // Ladataan mallit ja tekstuurit. 
     179        norsuModel = Content.Load<Model>("norsu3"); 
    149180        tasoModel = Content.Load<Model>("taso"); 
    150181        tahtiModel = Content.Load<Model>("tahti2"); 
    151         norsuTexture = Content.Load<Texture2D>("norsu"); 
     182        norsuTexture = Content.Load<Texture2D>("norsumusta"); 
    152183        vihreaTexture = Content.Load<Texture2D>("vihrea"); 
    153184        tahtiTexture = Content.Load<Texture2D>("tahti"); 
     
    166197    protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime) 
    167198    { 
    168         base.Draw(gameTime); // Piirretään se mitä Jypeli jutut ensin. 
     199        base.Draw(gameTime); // Piirretään Jypeli jutut ensin. 
    169200 
    170201        // Sulava muunnos projektiomatriisien välille. 
     
    175206        // Kameran pyörittely. 
    176207        cameraPos = Vector3.Transform(cameraStartPos, Matrix.CreateRotationY(cameraRotation)); 
    177          
     208 
    178209        // Piirretään 3D-mallit päälle. 
    179210        DrawModel(norsuModel, norsuTexture, pelaaja1.Position); 
     
    211242                effect.DirectionalLight2.Enabled = false; 
    212243 
    213                 if (light) effect.EnableDefaultLighting(); 
     244                if (light) 
     245                { 
     246                    effect.EnableDefaultLighting(); 
     247                    effect.DiffuseColor = new Vector3(1f, 1f, 1f); 
     248                    //effect.DirectionalLight0. 
     249                } 
    214250 
    215251                effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(0f) * Matrix.CreateTranslation(modelPosition); 
  • 2016/24/SimoR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/TasohyppelypeliContent.contentproj

    r7398 r7399  
    9595    </Compile> 
    9696  </ItemGroup> 
     97  <ItemGroup> 
     98    <Compile Include="norsu3.fbx"> 
     99      <Name>norsu3</Name> 
     100      <Importer>FbxImporter</Importer> 
     101      <Processor>ModelProcessor</Processor> 
     102    </Compile> 
     103  </ItemGroup> 
     104  <ItemGroup> 
     105    <Compile Include="norsumusta.png"> 
     106      <Name>norsumusta</Name> 
     107      <Importer>TextureImporter</Importer> 
     108      <Processor>TextureProcessor</Processor> 
     109    </Compile> 
     110  </ItemGroup> 
    97111  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    98112  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/24/SimoR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/tahti2.fbx

    r7398 r7399  
    1212                Month: 06 
    1313                Day: 16 
    14                 Hour: 20 
    15                 Minute: 48 
    16                 Second: 43 
     14                Hour: 22 
     15                Minute: 51 
     16                Second: 11 
    1717                Millisecond: 0 
    1818        } 
     
    2222        } 
    2323} 
    24 CreationTime: "2016-06-16 20:48:43:000" 
     24CreationTime: "2016-06-16 22:51:11:000" 
    2525Creator: "Blender version 2.77 (sub 0)" 
    2626 
     
    290290                        MappingInformationType: "ByPolygonVertex" 
    291291                        ReferenceInformationType: "IndexToDirect" 
    292                         UV: 0.511539,0.982282,0.496063,0.982282,0.500000,0.512425,0.986590,0.641071,0.637467,0.662789,0.723628,0.389671, 
    293                             0.987827,0.607327,0.500000,0.241374,0.800117,0.000000,0.837350,0.027699,0.480587,0.982282,0.262592,0.371953, 
    294                             0.015556,0.628167,0.013965,0.584795,0.246758,-0.009375,0.209525,0.018324,0.375033,0.642476 
    295                         UVIndex: 2,4,1,0,1,4,2,5,4,3,4,5,6,2,7,5,8,5,7,9,5,8,2,1,16,10,16,1,2,16,11,12,13,11,16,2,11,7,14,7,11,15,14,11,1,4,2,4,1,0,4,5,2,6,5,4,3,5,7,2,7,5,8,8, 
    296                                  5,9,16,1,2,1,16,10,11,16,2,16,11,13,12,7,11,2,11,7,14,11,14,15,0,4,4,0,4,3,3,4,3,6,6,3,6,5,5,6,5,9,9,5,9,8,8,9,8,7,7,8,1,0,0,1,16,10,10,16,12,16,16,12, 
    297                                  13,12,12,13,11,13,13,11,15,11,11,15,14,15,15,14,7,14,14,7,10,1,1,10 
     292                        UV: 0.485729,0.937141,0.375033,0.642476,0.480587,0.982282,0.262592,0.371953,0.045320,0.628167,0.043728,0.584795, 
     293                            0.225676,0.019149,0.493021,0.960558,0.496055,0.955796,0.497305,0.958479,0.209525,0.030725,0.478603,0.955635, 
     294                            0.487737,0.938571,0.488261,0.938138,0.486475,0.936315,0.511539,0.982282,0.496063,0.982282,0.500000,0.512425, 
     295                            0.986590,0.641071,0.637467,0.662789,0.723628,0.389671,0.637467,0.640466,0.987827,0.607327,0.500000,0.241374, 
     296                            0.800117,0.000000,0.482477,0.955589,0.479652,0.957518,0.482268,0.954359,0.487343,0.958703,0.501406,0.937883, 
     297                            0.498097,0.938097,0.500787,0.936498,0.493477,0.935429,0.493398,0.932769,0.492737,0.960523,0.492772,0.962624, 
     298                            0.488774,0.955898,0.492447,0.960481,0.492388,0.962624,0.482373,0.945826,0.286155,0.368233,0.837350,0.027699, 
     299                            0.493226,0.962598,0.501717,0.955483,0.504759,0.956812,0.502174,0.954439,0.505311,0.955097,0.498113,0.948486, 
     300                            0.501816,0.947669,0.498140,0.939048,0.486005,0.947303 
     301                        UVIndex: 17,19,16,15,16,19,17,20,19,18,21,20,22,17,23,20,24,20,23,41,20,24,17,16,1,2,1,16,17,1,3,4,5,3,1,17,3,23,6,23,40,10,6,40,16,19,17,19,16,15,19,20,17,22,20,21,18,20,23,17,23,20,24,24, 
     302                                 20,41,1,16,17,16,1,2,3,1,17,1,3,5,4,23,3,17,40,23,6,40,6,10,7,8,9,42,8,43,44,9,43,45,46,44,45,47,48,46,47,49,29,48,49,30,31,29,30,32,33,31,34,7,42,35,36,37,38,28,25,36,28,26, 
     303                                 27,25,26,11,50,27,11,39,12,50,39,0,13,12,0,14,32,13,14,33,37,34,35,38 
    298304                } 
    299305                LayerElementTexture: 0 { 
Note: See TracChangeset for help on using the changeset viewer.