Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-04-11, 14:46


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Siemka, ot?? u?ywam dxDrawCircle, kt?ry jest tworzony t? funkcj? i shaderem.
Jednak?e jest mocno rozpixelowany, jest jaki? inny spos?b ?eby zrobi? ko?o, w kt?rym nie wida? pixeli?

c.lua

function dxDrawCirclexywidthheightcolorangleStartangleSweepborderWidth ) 
    height height or width 
    color color or tocolor(255,255,255) 
    borderWidth borderWidth or 1e9 
    angleStart angleStart or 0 
    angleSweep angleSweep or 360 angleStart 
    if ( angleSweep 360 then 
        angleEnd math.fmodangleStart angleSweep360 ) + 0 
    else 
        angleStart 0 
        angleEnd 360 
    end 
    x width 2 
    y height 2 
    if not circleShader then 
        circleShader dxCreateShader "files/circle.fx" ) 
    end 
    dxSetShaderValue circleShader"sCircleWidthInPixel"width ); 
    dxSetShaderValue circleShader"sCircleHeightInPixel"height ); 
    dxSetShaderValue circleShader"sBorderWidthInPixel"borderWidth ); 
    dxSetShaderValue circleShader"sAngleStart"math.radangleStart ) - math.pi ); 
    dxSetShaderValue circleShader"sAngleEnd"math.radangleEnd ) - math.pi ); 
    dxDrawImagexywidthheightcircleShader000color end 


shader.fx

// 
// Example shader - circle.fx 
// 
  
// 
// Based on code from: 
// http://www.geeks3d.com/20...nbsp;lslhacker/ 
// 
  
float sCircleHeightInPixel 100float sCircleWidthInPixel 100float sBorderWidthInPixel 10float sAngleStart = -3.14float sAngleEnd 3.14; 
  
//------------------------------------------------------------------------------------------ 
// PixelShaderFunction 
//  1. Read from PS structure 
//  2. Process 
//  3. Return pixel color 
//------------------------------------------------------------------------------------------ 
float4 PixelShaderFunction(float4 Diffuse COLOR0float2 TexCoord TEXCOORD0) : COLOR0 
{ 
    float2 uv float2TexCoord.xTexCoord.) - float20.50.5 ); 
  
    // Clip unwanted pixels from partial pie 
    float angle atan2( -uv.xuv.);  // -PI to +PI 
    if ( sAngleStart sAngleEnd ) 
    { 
        if ( angle sAngleStart && angle sAngleEnd ) 
            return 0; 
    } 
    else 
    { 
        if ( angle sAngleStart || angle sAngleEnd ) 
            return 0; 
    } 
  
    // Calc border width to use 
    float2 vec normalizeuv ); 
    float CircleRadiusInPixel lerpsCircleWidthInPixelsCircleHeightInPixelvec.vec.); 
    float borderWidth sBorderWidthInPixel CircleRadiusInPixel; 
  
    // Check if pixel is inside circle 
    float dist =  sqrtdotuvuv ) ); 
    if ( ( dist 0.5 ) || ( dist 0.5 borderWidth ) ) 
        return 0; 
    else  
        return Diffuse; 
} 
  
//------------------------------------------------------------------------------------------ 
// Techniques 
//------------------------------------------------------------------------------------------ 
technique tec0 
{ 
    pass P0 
    { 
        PixelShader compile ps_2_0 PixelShaderFunction(); 
    } 
} 
  


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-04-11, 14:58


_jvneczek







Wiek: 22
Na forum: 4325 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

nak?adasz na ko?o grafik?, kt?ra zas?ania te piksele

Tu masz ss'a jak ja to zrobi?em, jest to w oparciu o dxDrawCircle + na to nak?adam grafike

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2021-04-11, 15:31


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Dzi?ki bardzo, nie pomy?la?em o tym.
Do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: pixele
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku