Changeset 2414


Ignore:
Timestamp:
Feb 15, 2013, 6:44:18 PM (7 years ago)
Author:
touky
Message:

MeshViewer : Added shitty texture to bulletproof easymesh UV, and therefore correct wrongly set ones.

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/vs2010/Lol.sln

    r2406 r2414  
    128128EndProject
    129129Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MeshViewer", "..\..\test\MeshViewer.vcxproj", "{7CE9FE12-E4AB-4A22-90D4-2C15F0C30D4E}"
     130EndProject
     131Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tactics", "..\..\people\touky\private\Tactics\Tactics.vcxproj", "{25493FC8-75AC-4703-AD57-AB0C2A0FB79C}"
    130132EndProject
    131133Global
     
    649651                {58922993-9830-4A40-B462-0326342F69ED}.Release|Xbox 360.ActiveCfg = Release|Any CPU
    650652                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360
    651                 {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
    652                 {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
    653                 {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.Deploy.0 = Debug|Xbox 360
     653                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
     654                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.Build.0 = Debug|Win32
     655                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32
    654656                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|PS3.ActiveCfg = Debug|PS3
    655657                {834852DB-EDB6-4FD0-BCF9-45CD01126962}.Debug|PS3.Build.0 = Debug|PS3
     
    710712                {7CE9FE12-E4AB-4A22-90D4-2C15F0C30D4E}.Release|x64.Build.0 = Release|x64
    711713                {7CE9FE12-E4AB-4A22-90D4-2C15F0C30D4E}.Release|Xbox 360.ActiveCfg = Release|x64
     714                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Any CPU.ActiveCfg = Debug|x64
     715                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
     716                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
     717                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|PS3.ActiveCfg = Debug|x64
     718                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Win32.ActiveCfg = Debug|Win32
     719                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Win32.Build.0 = Debug|Win32
     720                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|x64.ActiveCfg = Debug|x64
     721                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|x64.Build.0 = Debug|x64
     722                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Debug|Xbox 360.ActiveCfg = Debug|x64
     723                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Any CPU.ActiveCfg = Release|x64
     724                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Mixed Platforms.ActiveCfg = Release|x64
     725                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Mixed Platforms.Build.0 = Release|x64
     726                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|PS3.ActiveCfg = Release|x64
     727                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Win32.ActiveCfg = Release|Win32
     728                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Win32.Build.0 = Release|Win32
     729                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|x64.ActiveCfg = Release|x64
     730                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|x64.Build.0 = Release|x64
     731                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C}.Release|Xbox 360.ActiveCfg = Release|x64
    712732        EndGlobalSection
    713733        GlobalSection(SolutionProperties) = preSolution
     
    746766                {587FCCE9-1D8D-4398-B8B6-E8F4E9A92233} = {B357514A-7881-422D-8358-161B689E7620}
    747767                {EE203B88-44CF-4859-9D42-7A5F43FECB52} = {9EA99B18-D352-47F6-BC04-A0B49CAA2772}
     768                {25493FC8-75AC-4703-AD57-AB0C2A0FB79C} = {9EA99B18-D352-47F6-BC04-A0B49CAA2772}
    748769                {A69411B3-6DE8-404E-8E70-0D3375A7492A} = {0A1651FC-322B-4B04-82CB-28E9046D9383}
    749770                {5A77DCDD-2CBA-43E9-8B45-00C281443F77} = {0A1651FC-322B-4B04-82CB-28E9046D9383}
  • trunk/src/easymesh/easymesh.cpp

    r2410 r2414  
    11511151        SetTexCoordData(vec2(.0f, .5f), vec2(.5f, .5f));
    11521152        SetCurColor(m_color);
    1153         AppendDisc(nsides, r1);
     1153        AppendDisc(nsides, d1);
    11541154        Translate(vec3(.0f, h, .0f));
    11551155        RotateX(180.0f);
     
    11571157        SetTexCoordData(vec2(.5f, .5f), vec2(.5f, .5f));
    11581158        SetCurColor(m_color2);
    1159         AppendDisc(nsides, r2);
     1159        AppendDisc(nsides, d2);
    11601160        Translate(vec3(.0f, h * .5f, .0f));
    11611161        CloseBrace();
     
    12941294                        int rid[] = { id[k + l], id[(k + 1) % 3 + l], id[(k + 2) % 3 + l] };
    12951295                        AddVertex(p[rid[0]]);
     1296                        vec2 new_uv;
    12961297                        if (uv[rid[0]].x < .0f)
    1297                             SetCurVertTexCoord(vec2((uv[rid[1]].x + uv[rid[2]].x) * .5f,
    1298                                                     uv[rid[0]].y));
     1298                            new_uv = vec2((uv[rid[1]].x + uv[rid[2]].x) * .5f, uv[rid[0]].y);
    12991299                        else
    1300                             SetCurVertTexCoord(uv[rid[0]]);
     1300                            new_uv = uv[rid[0]];
     1301                        SetCurVertTexCoord(vec2(0.f, 1.f) - new_uv);
    13011302                    }
    13021303                    AppendTriangle(0, 2, 1, m_vert.Count() - 3);
     
    14321433    //Bottom vertices
    14331434    AddVertex(vec3(-d.x, -d.y - chamf, +d.z));
    1434     SetCurVertTexCoord(vec2(0.f, 1.f));
     1435    SetCurVertTexCoord(vec2(.5f, 1.f));
    14351436    AddVertex(vec3(-d.x, -d.y - chamf, -d.z));
    1436     SetCurVertTexCoord(vec2(0.f, .5f));
     1437    SetCurVertTexCoord(vec2(.5f, .5f));
    14371438    AddVertex(vec3(+d.x, -d.y - chamf, -d.z));
    1438     SetCurVertTexCoord(vec2(.5f, .5f));
     1439    SetCurVertTexCoord(vec2(.0f, .5f));
    14391440    AddVertex(vec3(+d.x, -d.y - chamf, +d.z));
    1440     SetCurVertTexCoord(vec2(.5f, 1.f));
     1441    SetCurVertTexCoord(vec2(.0f, 1.f));
    14411442
    14421443    //Top vertices
    14431444    AddVertex(vec3(-d.x, +d.y + chamf, -d.z));
    1444     SetCurVertTexCoord(vec2(0.f, 1.f));
     1445    SetCurVertTexCoord(vec2(1.f, 1.f));
    14451446    AddVertex(vec3(-d.x, +d.y + chamf, +d.z));
    1446     SetCurVertTexCoord(vec2(0.f, .5f));
     1447    SetCurVertTexCoord(vec2(1.f, .5f));
    14471448    AddVertex(vec3(+d.x, +d.y + chamf, +d.z));
    14481449    SetCurVertTexCoord(vec2(.5f, .5f));
     
    16221623    AddVertex(p); SetCurVertTexCoord(vec2(.5f, 0.133975f));
    16231624    p = m * p;
     1625    AddVertex(p); SetCurVertTexCoord(vec2(0.f, 1.f));
     1626    if (fade)
     1627        SetCurVertColor(m_color2);
     1628    p = m * p;
    16241629    AddVertex(p); SetCurVertTexCoord(vec2(1.f, 1.f));
    16251630    if (fade)
    16261631        SetCurVertColor(m_color2);
    1627     p = m * p;
    1628     AddVertex(p); SetCurVertTexCoord(vec2(0.f, 1.f));
    1629     if (fade)
    1630         SetCurVertColor(m_color2);
    16311632
    16321633    AppendTriangle(0, 1, 2, m_vert.Count() - 3);
     
    16421643void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, int fade)
    16431644{
    1644     AddVertex(vec3(p2.x, z, -p1.y)); SetCurVertTexCoord(vec2(0.f, 1.f));
     1645    AddVertex(vec3(p2.x, z, -p1.y)); SetCurVertTexCoord(vec2(1.f, 0.f));
    16451646    AddVertex(vec3(p2.x, z, -p2.y)); SetCurVertTexCoord(vec2(0.f, 0.f));
    1646     AddVertex(vec3(p1.x, z, -p2.y)); SetCurVertTexCoord(vec2(1.f, 0.f));
    1647     if (fade)
    1648         SetCurVertColor(m_color2);
     1647    AddVertex(vec3(p1.x, z, -p2.y)); SetCurVertTexCoord(vec2(0.f, 1.f));
     1648    if (fade) SetCurVertColor(m_color2);
    16491649    AddVertex(vec3(p1.x, z, -p1.y)); SetCurVertTexCoord(vec2(1.f, 1.f));
    1650     if (fade)
    1651         SetCurVertColor(m_color2);
     1650    if (fade) SetCurVertColor(m_color2);
    16521651
    16531652    AppendQuad(0, 1, 2, 3, m_vert.Count() - 4);
  • trunk/src/easymesh/easymesh.h

    r2410 r2414  
    2020#define VU_VANILLA 0
    2121
    22 #define VERTEX_USEAGE VU_VANILLA
     22#define VERTEX_USEAGE VU_TEX_UV
    2323
    2424#if !defined __EASYMESH_EASYMESH_H__
  • trunk/src/tileset.cpp

    r2312 r2414  
    175175}
    176176
     177ShaderTexture TileSet::GetTexture() const
     178{
     179    return data->m_texture->GetTexture();
     180}
     181
    177182void TileSet::Bind()
    178183{
  • trunk/src/tileset.h

    r2216 r2414  
    4444    ivec2 GetCount() const;
    4545    ivec2 GetSize(int tileid) const;
     46    ShaderTexture GetTexture() const;
    4647    void Bind();
    4748    void Unbind();
  • trunk/test/MeshViewer.cpp

    r2404 r2414  
    2222using namespace lol;
    2323
     24static int const TEXTURE_WIDTH = 256;
     25
    2426LOLFX_RESOURCE_DECLARE(shinyfur);
     27LOLFX_RESOURCE_DECLARE(shinyMVTexture);
    2528
    2629#define    IPT_CAM_RESET          "Cam_Center"
     
    9699
    97100        m_angle = 0;
     101        DefaultTexture = NULL;
    98102
    99103        //Camera Setup
     
    326330        }
    327331
     332        if (!DefaultTexture)
     333        {
     334            m_texture_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinyMVTexture));
     335            m_texture_uni = m_texture_shader->GetUniformLocation("u_Texture");
     336            //m_image = new Image("data/MeshViewerTestTexture.png");
     337            DefaultTexture = Tiler::Register("data/MeshViewerTestTexture.png", ivec2(0), ivec2(0,1));
     338
     339            //ivec2 size = m_image->GetSize();
     340            //// m_image->GetFormat()
     341            //m_texture = new Texture(m_image->GetSize(), PixelFormat::ABGR_8);
     342            //m_texture->SetData(m_image->GetData());
     343            // PixelFormat::ABGR_8
     344        }
     345        else if (m_texture && DefaultTexture)
     346            m_texture_shader->SetUniform(m_texture_uni, DefaultTexture->GetTexture(), 0);
     347
    328348        for (int i = 0; i < m_meshes.Count(); i++)
    329349        {
     
    334354                m_meshes[i].m1.MeshConvert(Shader::Create(LOLFX_RESOURCE_NAME(shinyfur)));
    335355#else
    336                 m_meshes[i].m1.MeshConvert();
     356                m_meshes[i].m1.MeshConvert(m_texture_shader);
     357                //m_meshes[i].m1.MeshConvert();
    337358#endif
    338359                m_meshes[i].m2 = true;
     
    402423    Array<Light *>  m_lights;
    403424    Camera *        m_camera;
     425    Shader *        m_texture_shader;
     426    TileSet *       DefaultTexture;
     427    Texture *       m_texture;
     428    ShaderUniform   m_texture_uni;
     429    Image *         m_image;
    404430    float           m_fov;
    405431    float           m_fov_damp;
  • trunk/test/MeshViewer.vcxproj

    r2389 r2414  
    5353  <ItemGroup>
    5454    <LolFxCompile Include="shinyfur.lolfx" />
     55    <LolFxCompile Include="shinyMVTexture.lolfx" />
    5556  </ItemGroup>
    5657  <PropertyGroup Label="Globals">
  • trunk/test/MeshViewerBuffer.txt

    r2410 r2414  
    1 [sc#88f ab 4 4 4 smth 3 1 1 ]//twy 45 0 bdxy 90 0 splt 5 tz 2
     1[sc#fff scb#fff ato 20 8 12 rx0]
     2[sc#fff scb#fff acg 8 2 5 1 6 8 4 2 .1 1]
     3
     4//[sc#fff ab 4 4 4 smth 0 1 1 ]//twy 45 0 bdxy 90 0 splt 5 tz 2
    25//[sc#88f ab 4 4 4 tx 4 ab 4 4 4 tx -2 tax .4 .4 0]
    36//[sc#88f ab .25 1 1 tx .25 ab .25 1 1 tx .25 ab .25 1 1 tx .25 ab .25 1 1 tx .125 stx 10 0 0]
    4 //[sc#ff2 scb#2ff acg 13 2 1 1 8 8 4 4 0 1 tax -2 0 0 0]
     7 // tax -2 0 0 0
    58//[sc#88f ab 4 4 4 tx 4 ab 4 4 4 tx -2 shz 1 0 0 0]
    6 //[sc#ff2 asph 4 4 shx 0 0 0 0]
     9//[sc#fff asph 4 4]
    710//[sc#ff2 asph 4 4 tax .4 .4 0]
    811//[sc#ff2 asph 2 4]
    9 //[sc#ff2 acap 1 4 4]
    10 //[sc#ff2 scb#ff2 ac 10 4 4 4 0 0 1]
     12//[sc#fff acap 1 4 4]
     13//[sc#fff scb#fff ac 10 4 4 4 0 0 1]
    1114//[sc#ff2 scb#ff2 ad 10 4 0]
    12 //[sc#ff2 scb#ff2 ato 40 1 4]
    13 //[sc#ff2 scb#2ff at 4 1]
    14 //[sc#ff2 scb#2ff aq 4 0]
    15 //[sc#ff2 scb#2ff aes 5 3 6 2]
    16 //[sc#ff2 scb#2ff as 4 2 4 0 0]
    17 //[sc#ff2 scb#2ff acg 2 10 .1 .1 .4 .4 .1 .1 0 1]
     15//[sc#fff scb#fff at 4 1]
     16//[sc#fff scb#000 aq 4 1]
     17//[sc#fff scb#2ff aes 5 3 6 2]
     18//[sc#fff scb#2ff as 4 2 4 0 0]
     19//[sc#fff scb#fff acg 2 10 .1 .1 .4 .4 .1 .1 0 1]
    1820
    1921//[sc#ff2 asph 2 10 10 10]
Note: See TracChangeset for help on using the changeset viewer.