예제 #1
0
        public void CanCreateSlotFromCustomSlotBlockDescriptor()
        {
            var node = new BlockNode();

            node.Init(s_CustomSlotDescriptor);
            List <MaterialSlot> slots = new List <MaterialSlot>();

            node.GetSlots(slots);

            Assert.IsNotNull(slots);
            Assert.AreEqual(1, slots.Count);
            Assert.AreNotEqual(s_MaterialSlot, slots[0]); //We actually WANT to create a new slot in this case
            Assert.AreEqual(s_MaterialSlot.displayName, slots[0].displayName);
            Assert.AreEqual(s_MaterialSlot.valueType, slots[0].valueType);
            Assert.AreEqual(s_MaterialSlot.value, ((Vector3MaterialSlot)slots[0]).value);
        }
예제 #2
0
        public void CanCreateSlotFromBlockDescriptor()
        {
            var node = new BlockNode();

            node.Init(s_DescriptorA);
            List <MaterialSlot> slots = new List <MaterialSlot>();

            node.GetSlots(slots);

            Assert.IsNotNull(slots);
            Assert.AreEqual(1, slots.Count);

            var vector3Slot = slots[0] as Vector1MaterialSlot;

            Assert.IsNotNull(vector3Slot);
            Assert.AreEqual(0, vector3Slot.id);
            Assert.AreEqual(s_DescriptorA.displayName, vector3Slot.RawDisplayName());
            Assert.AreEqual(s_DescriptorA.name, vector3Slot.shaderOutputName);
            Assert.AreEqual(SlotType.Input, vector3Slot.slotType);
            Assert.AreEqual(((FloatControl)s_DescriptorA.control).value, vector3Slot.value);
            Assert.AreEqual(s_DescriptorA.shaderStage.GetShaderStageCapability(), vector3Slot.stageCapability);
        }