TAILIEUCHUNG - Beginning XNA 2.0 Game Programming From Novice to Professional phần 9

và có được những máy ảnh tích cực của nó, và bạn có thể đọc các biến đổi địa hình từ thuộc tính chuyển đổi của chuyển đổi loại:Bạn cập nhật vũ khí của người chơi bằng cách gọi phương pháp của vũ khí Cập nhật và đi qua xương bàn tay phải của người chơi như xương cha mẹ của vũ khí. | 334 CHAPTER 11 SKELETAL ANIMATION float4 finalColor materialcolor diffuseColor1 diffuseColor2 diffuseColor ambientLightColor specularColor1 specularColor2 specularColor The code for the phongShading function is shown in Chapter 10 and the final pixel shader code follows float4 animatedModelPS v2f IN COLOR0 Normalize all input vectors float3 normal normalize float3 eyeVec normalize float3 lightVec1 normalize float3 lightVec2 normalize float3 halfwayVec1 normalize lightVec1 eyeVec float3 halfwayVec2 normalize lightVec2 eyeVec Calculate diffuse and specular color for each light float3 diffuseColor1 diffuseColor2 float3 specularColor1 specularColor2 phongShading normal lightVec1 halfwayVec1 light1Color diffuseColor1 specularColor1 phongShading normal lightVec2 halfwayVec2 light2Color diffuseColor2 specularColor2 Read texture diffuse color float4 materialColor tex2D diffuse1Sampler Phong lighting result float4 finalColor materialColor diffuseColor1 diffuseColor2 diffuseColor ambientLightColor specularColor1 specularColor2 specularColor return finalColor Following is the code for the technique using the vertex and pixel shader created in the previous sections CHAPTER 11 SKELETAL ANIMATION 335 technique AnimatedModel pass p0 VertexShader compile vs_2_0 animatedModelVS PixelShader compile ps_2_a animatedModelPS Converting the Mesh Effect You need to use the effect that you created in the preceding section to render the model. XNA s model processor has the ConvertMaterial method which is called whenever a material of a model s mesh is found. The ConvertMaterial method receives as a parameter a MaterialContent object that stores the material content used by the mesh. When a model is exported without an effect it only has some basic material configuration such as the color and texture. In this case the received MaterialContent is actually an instance of the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.