Wednesday, 13 October 2010

XNA 4.0 - Binary Model Loader

So i was trying to avoid the standard xna pipeline classes to start porting some features of my "graphic engine" to XNA. The first thing i wanted was to render a model with my custom file format, the C# and the XNA API stood well to the task, allowing me to read a buffers of bytes from filestream and copying it to vertex and index buffer.
 public class CustomModel  
 {  
      int m_Vertices;  
      int m_Triangles;  
   
      byte[] m_VerticeData;  
      byte[] m_TrianglesData;  
   
      GraphicsDevice m_GraphicsDevice;  
      VertexBuffer m_VertexBuffer;  
      IndexBuffer m_IndexBuffer;  
   
      public CustomModel()  
      {  
           m_Vertices = 0;  
           m_Triangles = 0;  
      }  
   
      public void Render()  
      {  
           m_GraphicsDevice.SetVertexBuffer(m_VertexBuffer);  
           m_GraphicsDevice.Indices = m_IndexBuffer;  
           m_GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, m_Vertices, 0, m_Triangles);  
   
           m_GraphicsDevice.SetVertexBuffer(null);  
           m_GraphicsDevice.Indices = null;  
      }  
   
      public void Load(GraphicsDevice graphics, ContentManager manager, string filename)  
      {  
           m_GraphicsDevice = graphics;  
   
           String StageIndexPath = manager.RootDirectory + "\\" + filename;  
   
           StreamReader st = new StreamReader(StageIndexPath);  
           BinaryReader bin = new BinaryReader(st.BaseStream);  
   
           m_Vertices = bin.ReadInt32();  
           m_Triangles = bin.ReadInt32();  
   
           m_VerticeData = new byte[m_Vertices * 32];  
           m_TrianglesData = new byte[m_Triangles * 12];  
   
           bin.Read(m_VerticeData, 0, m_Vertices * 32);  
           bin.Read(m_TrianglesData, 0, m_Triangles * 12);  
   
           bin.Close();  
           st.Close();  
   
           VertexDeclaration vdx = new VertexDeclaration(  
                new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),  
                new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),  
                new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0)  
           );  
   
           m_VertexBuffer = new VertexBuffer(m_GraphicsDevice, vdx, m_Vertices, BufferUsage.None);  
           m_IndexBuffer = new IndexBuffer(m_GraphicsDevice, IndexElementSize.ThirtyTwoBits, 3 * m_Triangles, BufferUsage.None);  
   
           m_VertexBuffer.SetData<byte>(m_VerticeData);  
           m_IndexBuffer.SetData<byte>(m_TrianglesData);  
      }  
 }  

Sunday, 10 October 2010

Event Report - Euskal 2010

Awesome place to sleep, if you still like concrete floor.

Yet again after one year of abstention the portuguese crew was back to Bilbao and Euskal, as usual our driver was Evil and is mighty mitsubishi, but this time we used a GPS to get there, although the roads in the frontier messed the GPS a bit :), we arrived at 23pm local hours after leaving Porto at 10:30am.

As usual the place was full gamers and scene spirit kept being replaced by stupid videos on youtube at the big screen, which was the biggest mistake, if I wanted to see video on youtube I could stayed in home and didn't needed to waste 300€ on trips and food :(

This year we learned how to waste less money on food, we bought microwave food on the local supermarket and we heated it at the local party microwaves, 2.5€ per meal, a great deal!

The sleeping space was ... the same, the showers were ... the same. But the big issue was the first night, I tried to slept under the hall lights and it didn't work very well since I didn't even had a tent.

During the party i bought an external hard drive with esata port with a good price tag, but the first impressions weren't the best, since the hard drive blew up in my face, which was interesting :), but the guys at the shop gave me a new kit and everything was fine. It's a 1-Tera Byte HD were i store my projects that I need a faster access, since the USB drives are awfully slow.

The demoparty was meh, no demoshow during the event, the competitions didn't went well to evil and me, only xernobyl managed win something and still he had to share the price with someone, because in Euskal it's pretty common the entry's classification being tied(like the ASD and XPSV demos, seriously wtf ?)

My 3D art entry didn't got any prize, I admit it still needed some improvements, but I didn't agree with the second and third place, oh well ...

The party is becoming less and less interesting for sceners, although the prizes are interesting, it can't be the unique reason to attend to the party, for me it's was the final Euskal, if the opportunity appears in the near future, I will go to Main DemoParty.

At least it was good to see the spanish sceners, Ham, Stage7 and the guys markan and pope with their awesome laser demo, props for putting napalmcore in the greetings :)

In the last day me and jae went out to take photos in Bilbau, the city is amazing place, saldy we didn't had time to visit the Guggenheim.

Event Report - Portugal Tecnológico 2009

In 15 October of 2009, I participated in the national technology event with my driving simulator, which was the fourth time in public events. It's always good to see how the people react to the game and it's a good chance to find new bugs and get more feedback. The only problem was the driving wheel, which didn't resist the fair.


The fair was also a excellent opportunity to see top tech from public and private companies, awesome fair indeed.

Event Report - FIBDA 2009

In 7 of November 2009, i went to FIBDA (Festival Internacional de Banda desenhada da Amadora) event to see what was new in the comics panorama, national and international (especially the european ones). The shops hadn't a wide selection mangas, just standard shounen stuff, I also saw some Masamune Shirow (Rare!) posters, but I decided it was to much half-nacked girls to put on a wall... There was also the public release of the EVA 1.0 movie in DVD, there was some artwork and a huge Voice-Only Monolith.

That gun from EVA 1.01 movie

EVA 00
Chun-Li

And for last I watched the cosplay competition, it keeps improving year by year !

Saturday, 9 October 2010

Event Report - Inercia 2010

Awesome place to sleep, because you sleep in the hotel.

(Place holder for more content)

Event Report - Euskal 2008

Awesome place to sleep, if you like concrete floor.

Mais um relato da viagem até ao mundo da demonscene estrangeira, desta vez até a cena espanhola a euskal. Essencialmente a Euskal é uma party de gamers e sacanço (mad uplink speed jesus), sendo os demosceners um ínfimo da população, mas com grande qualidade !

A viagem foi feita até Bilbau de carro, no Mitsubishi do Evil, com a participação de : xernobyl, breakneck, coxosclassic, zeroshift(je) e o Evil, com a paragem obrigatória no restaurante português em Chaves, antes de ir para Espanha(comida excelente diga-se de passagem).

 

Partindo as ~13h de Portugal, nas longas horas de carro, nunca ouve tempos mortos, sempre na conversa e a ouvir musica da scene e similares. Só chegamos lá pelas 10~11 (hora espanhola) e o local onde decorre a party é gigante, dava para enfiar a FIL dentro dela, é difícil explicar por palavras mais vale verem as imagens.



(Isto era o lado direito, o esquerdo é igual)

Em termos de condições, é muito melhor que a Breakpoint, existe um pavilhão adicional só para o pessoal dormir, um bar e telepizza para servir o pessoal.

Na scene estrangeira podemos contar com o Navis(ASD), o Iq(RGBA), Ham(Software Failure), Optimus, alguma malta dos XPLSV etc.

O local contava com varias bancas de venda de hardware para pc, por isso podia-se até construir um pc novo e levar para casa, eu comprei um candeiro de leds USB para as minhas noitadas de partycoding, havia tambem uma mostra de consolas old-school, e outras para jogar.

A nivel de compos, eu participei nas de 3d e Demo, o Evil atacou as de Musica e Demos 4k, o coxos atacou a Wild contudo acabou desqualificado devido a musica de uma banda que já nem existe, mas merece o maior premio, porque apesar de o pc dele ter dado o berro e ter se visto grego para o formatar, conseguio no ultimo dia fazer uma animação espectacular no Maya PLE.

Mas o seu esforço não foi em vão e num jogo que participou na secção old-school, acabou por ganhar um joystick de arcada XPTO!



(RULEZ)

A minha compo 3d, não valeu de grande coisa, visto que foi praticamente feita na party e nem usava texturas, mas era HARDCORE(gostava de ter sotaque japona para gritar isto), se bem que fui ultrapassado por umas varandas e umas casas de outros gajos, ainda não me cabe na cabeça o que uma varanda tem espirito de demoscene... se tive-se uns efeitos a LSD em cima ainda se entendia, mas prontos, não é por isso que o gato vai as filhoses.

A criação da demo foi muito estafante, apareceram muitos bugs nos shaders que me tramaram a vida e encravou algumas das minhas ideias, mas no geral tem umas ideias bacanas, uma musica do caraças, só precisa é de ser melhorada, mesmo assim rendeu-nos ~1200€ o que deu para pagar a viagem e voltar a breakpoint para o proximo ano.



Dormir, algo épico na historia da demoscene.

Posso ainda referir que durante as horas de comer era costume encontrar o iq e o navis e meter conversa, ficamos a saber que eles são gajos normais, bacanos, mas fazem as melhores demos do mundo.

A única coisa que tenho a criticar é que os banhos era uma bosta, tinham água por o lado, tudo ensopado, que era tramado mudar de roupa, além da água fria.

A viagem de volta ainda foi melhor que a ida, foi tanta a conversa que nem parecia que tínhamos viajado quase até França e voltado.

Detalhes e pormenores:

O navis trabalha numa empresa de visualização gráfica medica (agora faz sentido de onde veio o modelo do coração da Lifeforce), o Optimus(figura épica da pouet) é um gajo bacano, fomos beber umas cervejas após ver as demos, pena o barulho, não deu para falar como deve ser.

No domínio do sacanço, a internet lá era um estoiro, por isso dava para sacar tudo o que se quizesse, um dos gajos que estava na fila da frente sacou durante 3 dias seguidos ... videos para adultos(dos quais passava o resto do tempo a conferir a qualidade), mas o gajo que estava mesmo a minha frente sacava anime e eu acabei por ir sacar o mesmo anime que ele e rendeu bem, Soul Eater Rulez!

A party também contava com uma grande dose de Otakus e pessoal do cosplay, mas não vi nada porque passei a party inteira a programar :D

E foi isto !

Event Report - Inercia 2008

An awfull place to sleep.

(Place holder for more content)